@trycourier/courier-ui-inbox 1.2.1 → 2.0.0
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.
- package/dist/components/courier-inbox-feed-button.d.ts +28 -0
- package/dist/components/courier-inbox-header.d.ts +28 -11
- package/dist/components/courier-inbox-list-item.d.ts +4 -4
- package/dist/components/courier-inbox-list.d.ts +9 -4
- package/dist/components/courier-inbox-option-menu-item.d.ts +3 -0
- package/dist/components/courier-inbox-option-menu.d.ts +19 -12
- package/dist/components/courier-inbox-popup-menu.d.ts +57 -10
- package/dist/components/courier-inbox-tabs.d.ts +33 -0
- package/dist/components/courier-inbox.d.ts +121 -9
- package/dist/components/courier-unread-count-badge.d.ts +10 -5
- package/dist/datastore/__tests__/inbox-datastore.test.d.ts +1 -0
- package/dist/datastore/datatore-events.d.ts +61 -8
- package/dist/datastore/inbox-dataset.d.ts +110 -0
- package/dist/datastore/inbox-datastore.d.ts +217 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3225 -1501
- package/dist/index.mjs.map +1 -1
- package/dist/types/courier-inbox-theme.d.ts +64 -20
- package/dist/types/factories.d.ts +21 -8
- package/dist/types/inbox-data-set.d.ts +111 -2
- package/dist/types/inbox-defaults.d.ts +39 -0
- package/dist/types/snapshots.d.ts +6 -0
- package/dist/utils/utils.d.ts +7 -0
- package/package.json +3 -3
- package/dist/components/courier-inbox-header-title.d.ts +0 -23
- package/dist/datastore/datastore.d.ts +0 -114
- package/dist/types/feed-type.d.ts +0 -1
- /package/dist/datastore/__tests__/{datastore.test.d.ts → inbox-dataset.test.d.ts} +0 -0
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/utils/utils.ts","../src/components/courier-inbox-list-item-menu.ts","../src/datastore/datastore.ts","../src/components/courier-inbox-list-item.ts","../src/components/courier-inbox-skeleton-list-item.ts","../src/components/courier-inbox-skeleton-list.ts","../src/components/courier-inbox-pagination-list-item.ts","../src/utils/extensions.ts","../src/components/courier-inbox-list.ts","../src/components/courier-inbox-option-menu-item.ts","../src/components/courier-inbox-option-menu.ts","../src/components/courier-unread-count-badge.ts","../src/components/courier-inbox-header-title.ts","../src/components/courier-inbox-header.ts","../src/datastore/datastore-listener.ts","../src/types/courier-inbox-theme.ts","../src/types/courier-inbox-theme-manager.ts","../src/components/courier-inbox.ts","../src/components/courier-inbox-menu-button.ts","../src/components/courier-inbox-popup-menu.ts","../src/datastore/datatore-events.ts","../src/index.ts"],"sourcesContent":["import { InboxMessage, InboxAction } from \"@trycourier/courier-js\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\n\n/**\n * Copy a message\n * @param message - The message to copy\n * @returns A copy of the message\n */\nexport function copyMessage(message: InboxMessage): InboxMessage {\n const copy = {\n ...message,\n };\n\n if (message.actions) {\n copy.actions = message.actions.map(action => copyInboxAction(action));\n }\n\n if (message.data) {\n copy.data = JSON.parse(JSON.stringify(message.data));\n }\n\n if (message.tags) {\n copy.tags = [...message.tags];\n }\n\n if (message.trackingIds) {\n copy.trackingIds = { ...message.trackingIds };\n }\n\n return copy;\n}\n\n/**\n * Copy an inbox action\n * @param action - The inbox action to copy\n * @returns A copy of the inbox action\n */\nexport function copyInboxAction(action: InboxAction): InboxAction {\n const copy = {\n ...action,\n };\n\n if (action.data) {\n copy.data = JSON.parse(JSON.stringify(action.data));\n }\n\n return copy;\n}\n\n/**\n * Copy an inbox data set\n * @param dataSet - The inbox data set to copy\n * @returns A copy of the inbox data set\n */\nexport function copyInboxDataSet(dataSet?: InboxDataSet): InboxDataSet | undefined {\n\n if (!dataSet) {\n return undefined;\n }\n\n return {\n ...dataSet,\n messages: dataSet.messages.map(message => copyMessage(message)),\n };\n\n}\n\nexport function getMessageTime(message: InboxMessage): string {\n if (!message.created) return 'Now';\n\n const now = new Date();\n const messageDate = new Date(message.created);\n const diffInSeconds = Math.floor((now.getTime() - messageDate.getTime()) / 1000);\n\n if (diffInSeconds < 5) return 'Now';\n if (diffInSeconds < 60) return `${diffInSeconds}s`;\n if (diffInSeconds < 3600) return `${Math.floor(diffInSeconds / 60)}m`;\n if (diffInSeconds < 86400) return `${Math.floor(diffInSeconds / 3600)}h`;\n if (diffInSeconds < 604800) return `${Math.floor(diffInSeconds / 86400)}d`;\n if (diffInSeconds < 31536000) return `${Math.floor(diffInSeconds / 604800)}w`;\n return `${Math.floor(diffInSeconds / 31536000)}y`;\n}","import { CourierBaseElement, CourierIconButton, registerElement } from '@trycourier/courier-ui-core';\nimport { CourierInboxIconTheme, CourierInboxTheme } from '../types/courier-inbox-theme';\n\nexport type CourierInboxListItemActionMenuOption = {\n id: string;\n icon: CourierInboxIconTheme;\n onClick: () => void;\n};\n\nexport class CourierInboxListItemMenu extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list-item-menu';\n }\n\n // State\n private _theme: CourierInboxTheme;\n private _options: CourierInboxListItemActionMenuOption[] = [];\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n const menu = document.createElement('ul');\n menu.className = 'menu';\n this.appendChild(menu);\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const menu = theme.inbox?.list?.item?.menu;\n\n return `\n ${CourierInboxListItemMenu.id} {\n display: none;\n position: absolute;\n background: ${menu?.backgroundColor ?? 'red'};\n border: ${menu?.border ?? '1px solid red'};\n border-radius: ${menu?.borderRadius ?? '0px'};\n box-shadow: ${menu?.shadow ?? '0 2px 8px red'};\n user-select: none;\n opacity: 0;\n pointer-events: none;\n transition: opacity 0.15s;\n overflow: hidden;\n }\n\n ${CourierInboxListItemMenu.id}.visible {\n display: block;\n opacity: 1;\n pointer-events: auto;\n }\n\n ${CourierInboxListItemMenu.id} ul.menu {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: row;\n }\n\n ${CourierInboxListItemMenu.id} li.menu-item {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border-bottom: none;\n background: transparent;\n }\n `;\n }\n\n setOptions(options: CourierInboxListItemActionMenuOption[]) {\n this._options = options;\n this.renderMenu();\n }\n\n private renderMenu() {\n // Clear existing menu items\n const menu = this.querySelector('ul.menu');\n if (!menu) return;\n menu.innerHTML = '';\n const menuTheme = this._theme.inbox?.list?.item?.menu;\n\n // Prevent click events from propagating outside of this menu\n const cancelEvent = (e: Event) => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n // Create new menu items\n this._options.forEach((opt) => {\n const icon = new CourierIconButton(opt.icon.svg, opt.icon.color, menuTheme?.backgroundColor, menuTheme?.item?.hoverBackgroundColor, menuTheme?.item?.activeBackgroundColor, menuTheme?.item?.borderRadius);\n\n // Handle both click and touch events\n const handleInteraction = (e: Event) => {\n cancelEvent(e);\n opt.onClick();\n };\n\n // Add click handler for desktop\n icon.addEventListener('click', handleInteraction);\n\n // Add touch handlers for mobile\n icon.addEventListener('touchstart', cancelEvent);\n icon.addEventListener('touchend', handleInteraction);\n\n // Prevent default touch behavior\n icon.addEventListener('touchmove', cancelEvent);\n\n // Prevent mouse events from interfering\n icon.addEventListener('mousedown', cancelEvent);\n icon.addEventListener('mouseup', cancelEvent);\n\n menu.appendChild(icon);\n });\n }\n\n show() {\n this.style.display = 'block';\n this.classList.add('visible');\n }\n\n hide() {\n this.style.display = 'none';\n this.classList.remove('visible');\n }\n}\n\nregisterElement(CourierInboxListItemMenu);","import { Courier, CourierGetInboxMessagesResponse, InboxMessage, InboxMessageEvent, InboxMessageEventEnvelope } from \"@trycourier/courier-js\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxDataStoreListener } from \"./datastore-listener\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { DataSetSnapshot, MessageSnapshot } from \"../types/snapshots\";\nimport { copyInboxDataSet, copyMessage } from \"../utils/utils\";\n\nexport class CourierInboxDatastore {\n private static instance: CourierInboxDatastore;\n private _inboxDataSet?: InboxDataSet;\n private _archiveDataSet?: InboxDataSet;\n private _dataStoreListeners: CourierInboxDataStoreListener[] = [];\n private _unreadCount?: number;\n private _removeMessageEventListener?: () => void;\n private isPaginatingInbox: boolean = false;\n private isPaginatingArchive: boolean = false;\n\n public static get shared(): CourierInboxDatastore {\n if (!CourierInboxDatastore.instance) {\n CourierInboxDatastore.instance = new CourierInboxDatastore();\n }\n return CourierInboxDatastore.instance;\n }\n\n public get unreadCount(): number {\n return this._unreadCount ?? 0;\n }\n\n public get inboxDataSet(): InboxDataSet {\n return this._inboxDataSet ?? { feedType: 'inbox', messages: [], canPaginate: false, paginationCursor: null };\n }\n\n public get archiveDataSet(): InboxDataSet {\n return this._archiveDataSet ?? { feedType: 'archive', messages: [], canPaginate: false, paginationCursor: null };\n }\n\n public addDataStoreListener(listener: CourierInboxDataStoreListener) {\n this._dataStoreListeners.push(listener);\n }\n\n public removeDataStoreListener(listener: CourierInboxDataStoreListener) {\n this._dataStoreListeners = this._dataStoreListeners.filter(l => l !== listener);\n }\n\n private async fetchCachableDataSet(props: { fetch: Promise<CourierGetInboxMessagesResponse>, feedType: CourierInboxFeedType, canUseCache: boolean }): Promise<InboxDataSet> {\n\n // If we can return the cached version, return it.\n // If there is no cache, it will fall through and fetch the latest from the server.\n if (props.canUseCache) {\n if (props.feedType === 'inbox' && this._inboxDataSet) {\n return this._inboxDataSet;\n }\n if (props.feedType === 'archive' && this._archiveDataSet) {\n return this._archiveDataSet;\n }\n }\n\n // Perform the fetch\n const response = await props.fetch;\n\n // Bundle the data properly\n return {\n feedType: props.feedType,\n messages: response.data?.messages?.nodes ?? [],\n canPaginate: response.data?.messages?.pageInfo?.hasNextPage ?? false,\n paginationCursor: response.data?.messages?.pageInfo?.startCursor ?? null,\n };\n\n }\n\n private async fetchUnreadCount(props: { canUseCache: boolean }): Promise<number> {\n\n if (props.canUseCache && this._unreadCount !== undefined) {\n return this._unreadCount;\n }\n\n const unreadCount = await Courier.shared.client?.inbox.getUnreadMessageCount();\n return unreadCount ?? 0;\n }\n\n public async load(props?: { canUseCache: boolean }) {\n\n try {\n\n const client = Courier.shared.client;\n\n // If the user is not signed in, return early\n if (!client?.options.userId) {\n throw new Error('User is not signed in');\n }\n\n // If no props are provided, use the default values\n const properties = props ?? { canUseCache: true };\n\n // Fetch the data. Done in parallel\n const [inboxDataSet, archiveDataSet, unreadCount] = await Promise.all([\n this.fetchCachableDataSet({ fetch: client.inbox.getMessages(), feedType: 'inbox', canUseCache: properties.canUseCache }),\n this.fetchCachableDataSet({ fetch: client.inbox.getArchivedMessages(), feedType: 'archive', canUseCache: properties.canUseCache }),\n this.fetchUnreadCount(properties),\n ]);\n\n // Update the local data\n this._inboxDataSet = inboxDataSet;\n this._archiveDataSet = archiveDataSet;\n this._unreadCount = unreadCount;\n\n // Notify the listeners\n this._dataStoreListeners.forEach(listener => {\n if (this._inboxDataSet) {\n listener.events.onDataSetChange?.(this._inboxDataSet, 'inbox');\n }\n if (this._archiveDataSet) {\n listener.events.onDataSetChange?.(this._archiveDataSet, 'archive');\n }\n listener.events.onUnreadCountChange?.(this._unreadCount ?? 0);\n });\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error loading inbox:', error);\n this._dataStoreListeners.forEach(listener => {\n listener.events.onError?.(error as Error);\n });\n }\n }\n\n // Connect the socket\n public async listenForUpdates() {\n try {\n await this.connectSocket();\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error listening for updates:', error);\n this._dataStoreListeners.forEach(listener => {\n listener.events.onError?.(error as Error);\n });\n }\n }\n\n private async connectSocket() {\n const socket = Courier.shared.client?.inbox.socket;\n\n try {\n // If the socket is not available, return early\n if (!socket) {\n Courier.shared.client?.options.logger?.info('CourierInbox socket not available');\n return;\n }\n\n // Remove any existing listener before adding a new one.\n // This both prevents multiple listeners from being added to the same WebSocket client\n // and makes sure the listener is on the current WebSocket client (rather than maintaining\n // one from a stale client).\n if (this._removeMessageEventListener) {\n this._removeMessageEventListener();\n }\n\n // Handle message events and store the removal function\n this._removeMessageEventListener = socket.addMessageEventListener((event: InboxMessageEventEnvelope) => {\n if (event.event === InboxMessageEvent.NewMessage) {\n const message: InboxMessage = event.data as InboxMessage;\n this.addMessage(message, 0, 'inbox');\n return;\n }\n\n const message = this.getMessage({ messageId: event.messageId });\n\n switch (event.event) {\n case InboxMessageEvent.MarkAllRead:\n this.readAllMessages({ canCallApi: false });\n break;\n case InboxMessageEvent.Read:\n if (message) {\n this.readMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.Unread:\n if (message) {\n this.unreadMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.Opened:\n if (message) {\n this.openMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.Archive:\n if (message) {\n this.archiveMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.ArchiveRead:\n this.archiveReadMessages({ canCallApi: false });\n break;\n case InboxMessageEvent.ArchiveAll:\n this.archiveAllMessages({ canCallApi: false });\n break;\n case InboxMessageEvent.Clicked:\n if (message) {\n this.clickMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.Unarchive:\n if (message) {\n this.unarchiveMessage({ message, canCallApi: false });\n }\n break;\n case InboxMessageEvent.Unopened:\n break;\n }\n });\n\n // If the socket is already connecting or open, return early\n if (socket.isConnecting || socket.isOpen) {\n Courier.shared.client?.options.logger?.info(`Inbox socket already connecting or open for client ID: [${Courier.shared.client?.options.connectionId}]`);\n return;\n }\n\n // Connect to the socket. By default, the socket will subscribe to all events for the user after opening.\n await socket.connect();\n Courier.shared.client?.options.logger?.info(`Inbox socket connected for client ID: [${Courier.shared.client?.options.connectionId}]`);\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to connect socket:', error);\n }\n }\n\n /**\n * Get a message by messageId from the inbox or archive data set\n * @param props - The message ID\n * @returns The message or undefined if it is not found\n */\n private getMessage(props: { messageId?: string }): InboxMessage | undefined {\n if (!props.messageId) {\n return undefined;\n }\n\n return this._inboxDataSet?.messages.find(m => m.messageId === props.messageId) ??\n this._archiveDataSet?.messages.find(m => m.messageId === props.messageId);\n }\n\n /**\n * Fetch the next page of messages\n * @param props - The feed type\n * @returns The next page of messages or null if there is no next page\n */\n async fetchNextPageOfMessages(props: { feedType: CourierInboxFeedType }): Promise<InboxDataSet | null> {\n\n switch (props.feedType) {\n case 'inbox':\n\n if (this.isPaginatingInbox) {\n return null;\n }\n\n if (this._inboxDataSet?.canPaginate && this._inboxDataSet.paginationCursor) {\n try {\n this.isPaginatingInbox = true;\n const response = await Courier.shared.client?.inbox.getMessages({\n paginationLimit: Courier.shared.paginationLimit,\n startCursor: this._inboxDataSet.paginationCursor\n });\n const dataSet: InboxDataSet = {\n feedType: 'inbox',\n messages: response?.data?.messages?.nodes ?? [],\n canPaginate: response?.data?.messages?.pageInfo?.hasNextPage ?? false,\n paginationCursor: response?.data?.messages?.pageInfo?.startCursor ?? null\n };\n this.addPage(dataSet);\n return dataSet;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error fetching next page of inbox messages:', error);\n return null;\n } finally {\n this.isPaginatingInbox = false;\n }\n }\n\n break;\n case 'archive':\n\n if (this.isPaginatingArchive) {\n return null;\n }\n\n if (this._archiveDataSet?.canPaginate && this._archiveDataSet.paginationCursor) {\n try {\n this.isPaginatingArchive = true;\n const response = await Courier.shared.client?.inbox.getArchivedMessages({\n paginationLimit: Courier.shared.paginationLimit,\n startCursor: this._archiveDataSet.paginationCursor\n });\n const dataSet: InboxDataSet = {\n feedType: 'archive',\n messages: response?.data?.messages?.nodes ?? [],\n canPaginate: response?.data?.messages?.pageInfo?.hasNextPage ?? false,\n paginationCursor: response?.data?.messages?.pageInfo?.startCursor ?? null\n };\n this.addPage(dataSet);\n return dataSet;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error fetching next page of archived messages:', error);\n return null;\n } finally {\n this.isPaginatingArchive = false;\n }\n }\n\n break;\n }\n\n return null;\n }\n\n /**\n * Check if the datastore is loaded and ready to perform mutations\n * @returns True if the datastore is loaded and ready to perform mutations, false otherwise\n */\n private canMutate(): boolean {\n return !!(Courier.shared.client && this._inboxDataSet && this._archiveDataSet);\n }\n\n async readMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get the datastore snapshot\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n // Copy original message and index\n const snapshot = this.getMessageSnapshot(message);\n\n // If the message is already read, return\n if (snapshot.message.read) {\n return;\n }\n\n try {\n\n // Read the message\n snapshot.message.read = new Date().toISOString();\n this.applyMessageSnapshot(snapshot);\n\n // Update the unread count\n this._unreadCount = datastoreSnapshot.unreadCount - 1;\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n listener.events.onUnreadCountChange?.(this._unreadCount!);\n });\n\n if (canCallApi) {\n await Courier.shared.client?.inbox.read({ messageId: message.messageId });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error reading message:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async unreadMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get the datastore snapshot\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n // Save original message and index\n const snapshot = this.getMessageSnapshot(message);\n\n // If the message is already unread, return\n if (!snapshot.message.read) {\n return;\n }\n\n try {\n\n // Unread the message\n snapshot.message.read = undefined;\n\n // Apply the message snapshot\n this.applyMessageSnapshot(snapshot);\n\n // Update the unread count\n this._unreadCount = datastoreSnapshot.unreadCount + 1;\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n listener.events.onUnreadCountChange?.(this._unreadCount!);\n });\n\n if (canCallApi) {\n await Courier.shared.client?.inbox.unread({ messageId: message.messageId });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error unreading message:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async openMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n // Mutable copy of the message\n const snapshot = this.getMessageSnapshot(message);\n\n // If the message is not in the inbox or archive, return\n if (snapshot.inboxIndex === undefined && snapshot.archiveIndex === undefined) {\n return;\n }\n\n // If the message is already opened, return\n if (snapshot.message.opened) {\n return;\n }\n\n try {\n snapshot.message.opened = new Date().toISOString();\n this.applyMessageSnapshot(snapshot);\n\n if (canCallApi) {\n await Courier.shared.client?.inbox.open({ messageId: message.messageId });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error opening message:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async clickMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n try {\n if (message.trackingIds?.clickTrackingId && canCallApi) {\n await Courier.shared.client?.inbox.click({\n messageId: message.messageId,\n trackingId: message.trackingIds?.clickTrackingId\n });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error clicking message:', error);\n }\n }\n\n async archiveMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get the message snapshot\n const messageSnapshot = this.getMessageSnapshot(message);\n\n // If the message is not in the inbox, return\n if (messageSnapshot.inboxIndex === undefined) {\n return;\n }\n\n // Get the datastore snapshots\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n try {\n\n // Update the message to be archived\n message.archived = new Date().toISOString();\n\n // Remove message from local state\n this.removeMessage(message, messageSnapshot.inboxIndex, 'inbox');\n\n // Find index to insert archived message and add to archive\n if (this._archiveDataSet?.messages) {\n const insertIndex = this.findInsertIndex(message, this._archiveDataSet);\n this.addMessage(message, insertIndex, 'archive');\n }\n\n // Call API to archive message\n if (canCallApi) {\n await Courier.shared.client?.inbox.archive({ messageId: message.messageId });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error archiving message:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async unarchiveMessage({ message, canCallApi = true }: { message: InboxMessage; canCallApi?: boolean; }): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get the datastore snapshots\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n // Get the message snapshot\n const messageSnapshot = this.getMessageSnapshot(message);\n\n // If the message is not in the archive, return\n if (messageSnapshot.archiveIndex === undefined) {\n return;\n }\n\n try {\n\n // Update the message to be unarchived\n messageSnapshot.message.archived = undefined;\n\n // Remove message from local state\n this.removeMessage(message, messageSnapshot.archiveIndex, 'archive');\n\n // Find index to insert unarchived message and add to inbox\n if (this._inboxDataSet?.messages) {\n const insertIndex = this.findInsertIndex(message, this._inboxDataSet);\n this.addMessage(message, insertIndex, 'inbox');\n }\n\n // Call API to unarchive message\n if (canCallApi) {\n await Courier.shared.client?.inbox.unarchive({ messageId: message.messageId });\n }\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error unarchiving message:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async archiveReadMessages({ canCallApi = true }: { canCallApi?: boolean; } = {}): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get snapshot of the inbox data set\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n try {\n\n const timestamp = new Date().toISOString();\n\n // Archive all read messages\n const messagesToArchive = this._inboxDataSet?.messages.filter(message => message.read) ?? [];\n messagesToArchive.forEach(message => {\n\n // Update the message to be archived\n message.archived = timestamp;\n\n // Remove message from inbox\n const inboxIndex = this._inboxDataSet?.messages.findIndex(m => m.messageId === message.messageId);\n if (inboxIndex !== undefined && inboxIndex !== -1) {\n this._inboxDataSet?.messages.splice(inboxIndex, 1);\n }\n\n // Add message to archive\n if (this._archiveDataSet?.messages) {\n const insertIndex = this.findInsertIndex(message, this._archiveDataSet);\n this._archiveDataSet.messages.splice(insertIndex, 0, message);\n }\n\n });\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n if (this._inboxDataSet) {\n listener.events.onDataSetChange?.(this._inboxDataSet, 'inbox');\n }\n if (this._archiveDataSet) {\n listener.events.onDataSetChange?.(this._archiveDataSet, 'archive');\n }\n });\n\n // Call API to archive read messages\n if (canCallApi) {\n await Courier.shared.client?.inbox.archiveRead();\n }\n\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error archiving read messages:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async archiveAllMessages({ canCallApi = true }: { canCallApi?: boolean; } = {}): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Get snapshot of the inbox data set\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n try {\n\n const timestamp = new Date().toISOString();\n\n // Archive all read messages\n this._inboxDataSet?.messages.forEach(message => {\n message.archived = timestamp;\n\n // Add message to archive\n if (this._archiveDataSet?.messages) {\n const insertIndex = this.findInsertIndex(message, this._archiveDataSet);\n this._archiveDataSet.messages.splice(insertIndex, 0, message);\n }\n\n });\n\n // Clear the inbox data set\n this._inboxDataSet = {\n messages: [],\n canPaginate: false,\n paginationCursor: null,\n feedType: 'inbox',\n };\n\n // Update the unread count\n this._unreadCount = 0;\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n if (this._inboxDataSet) {\n listener.events.onDataSetChange?.(this._inboxDataSet, 'inbox');\n }\n if (this._archiveDataSet) {\n listener.events.onDataSetChange?.(this._archiveDataSet, 'archive');\n }\n listener.events.onUnreadCountChange?.(this._unreadCount!);\n });\n\n // Call API to archive all messages\n if (canCallApi) {\n await Courier.shared.client?.inbox.archiveAll();\n }\n\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error archiving all messages:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n async readAllMessages({ canCallApi = true }: { canCallApi?: boolean; } = {}): Promise<void> {\n if (!this.canMutate()) {\n return;\n }\n\n // Store original state for potential rollback\n const datastoreSnapshot = this.getDatastoreSnapshot(this.unreadCount, this._inboxDataSet, this._archiveDataSet);\n\n try {\n\n const timestamp = new Date().toISOString();\n\n // Read all messages\n this._inboxDataSet?.messages.forEach(message => {\n if (!message.read) {\n message.read = timestamp;\n }\n });\n\n // Read all archived messages\n this._archiveDataSet?.messages.forEach(message => {\n if (!message.read) {\n message.read = timestamp;\n }\n });\n\n // Update unread count\n this._unreadCount = 0;\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n if (this._inboxDataSet) {\n listener.events.onDataSetChange?.(this._inboxDataSet, 'inbox');\n }\n if (this._archiveDataSet) {\n listener.events.onDataSetChange?.(this._archiveDataSet, 'archive');\n }\n listener.events.onUnreadCountChange?.(this._unreadCount!);\n });\n\n if (canCallApi) {\n await Courier.shared.client?.inbox.readAll();\n }\n\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Error reading all messages:', error);\n this.applyDatastoreSnapshot(datastoreSnapshot);\n }\n }\n\n /**\n * Find the insert index for a new message in a data set\n * @param newMessage - The new message to insert\n * @param dataSet - The data set to insert the message into\n * @returns The index to insert the message at\n */\n private findInsertIndex(newMessage: InboxMessage, dataSet: InboxDataSet): number {\n const messages = dataSet.messages;\n\n for (let i = 0; i < messages.length; i++) {\n const message = messages[i];\n if (message.created && newMessage.created && message.created < newMessage.created) {\n return i;\n }\n }\n\n return messages.length;\n }\n\n private addPage(dataSet: InboxDataSet) {\n switch (dataSet.feedType) {\n case 'inbox':\n if (this._inboxDataSet) {\n this._inboxDataSet.canPaginate = dataSet.canPaginate;\n this._inboxDataSet.paginationCursor = dataSet.paginationCursor;\n this._inboxDataSet.messages = [...this._inboxDataSet.messages, ...dataSet.messages];\n }\n break;\n case 'archive':\n if (this._archiveDataSet) {\n this._archiveDataSet.canPaginate = dataSet.canPaginate;\n this._archiveDataSet.paginationCursor = dataSet.paginationCursor;\n this._archiveDataSet.messages = [...this._archiveDataSet.messages, ...dataSet.messages];\n }\n break;\n }\n this._dataStoreListeners.forEach(listener =>\n listener.events.onPageAdded?.(dataSet, dataSet.feedType)\n );\n }\n\n private addMessage(message: InboxMessage, index: number, feedType: CourierInboxFeedType) {\n switch (feedType) {\n case 'inbox':\n if (!message.read && this._unreadCount !== undefined) {\n this._unreadCount = this._unreadCount + 1;\n }\n this._inboxDataSet?.messages.splice(index, 0, message);\n break;\n case 'archive':\n this._archiveDataSet?.messages.splice(index, 0, message);\n break;\n }\n this._dataStoreListeners.forEach(listener => {\n listener.events.onMessageAdd?.(message, index, feedType);\n listener.events.onUnreadCountChange?.(this._unreadCount ?? 0);\n });\n }\n\n private removeMessage(message: InboxMessage, index: number, feedType: CourierInboxFeedType) {\n switch (feedType) {\n case 'inbox':\n if (!message.read && this._unreadCount !== undefined) {\n this._unreadCount = this._unreadCount - 1;\n }\n this._inboxDataSet?.messages.splice(index, 1);\n break;\n case 'archive':\n this._archiveDataSet?.messages.splice(index, 1);\n break;\n }\n this._dataStoreListeners.forEach(listener => {\n listener.events.onMessageRemove?.(message, index, feedType);\n listener.events.onUnreadCountChange?.(this._unreadCount ?? 0);\n });\n }\n\n /**\n * Apply a message snapshot to the data store\n * @param snapshot - The message snapshot to apply\n */\n private applyMessageSnapshot(snapshot: MessageSnapshot) {\n if (snapshot.archiveIndex !== undefined) {\n this.updateMessage(snapshot.message, snapshot.archiveIndex, 'archive');\n }\n if (snapshot.inboxIndex !== undefined) {\n this.updateMessage(snapshot.message, snapshot.inboxIndex, 'inbox');\n }\n }\n\n private applyDatastoreSnapshot(snapshot: DataSetSnapshot) {\n const { unreadCount, inbox, archive } = snapshot;\n\n // Update the data sets\n this._inboxDataSet = inbox;\n this._archiveDataSet = archive;\n\n // Notify listeners\n this._dataStoreListeners.forEach(listener => {\n if (this._inboxDataSet) {\n listener.events.onDataSetChange?.(this._inboxDataSet, 'inbox');\n }\n if (this._archiveDataSet) {\n listener.events.onDataSetChange?.(this._archiveDataSet, 'archive');\n }\n listener.events.onUnreadCountChange?.(unreadCount);\n });\n }\n\n /**\n * Update a message in the data store\n * @param message - The message to update\n * @param index - The index of the message in its respective data set\n * @param feedType - The feed type of the message\n */\n private updateMessage(message: InboxMessage, index: number, feedType: CourierInboxFeedType) {\n switch (feedType) {\n case 'inbox':\n if (this._inboxDataSet) {\n this._inboxDataSet.messages[index] = message;\n }\n break;\n case 'archive':\n if (this._archiveDataSet) {\n this._archiveDataSet.messages[index] = message;\n }\n break;\n }\n this._dataStoreListeners.forEach(listener => {\n listener.events.onMessageUpdate?.(message, index, feedType);\n listener.events.onUnreadCountChange?.(this._unreadCount ?? 0);\n });\n }\n\n /**\n * Copy an inbox data set\n * @param dataSet - The inbox data set to copy\n * @returns A copy of the inbox data set\n */\n private getDatastoreSnapshot(unreadCount: number, inboxDataSet?: InboxDataSet, archiveDataSet?: InboxDataSet): DataSetSnapshot {\n return {\n unreadCount,\n inbox: copyInboxDataSet(inboxDataSet),\n archive: copyInboxDataSet(archiveDataSet),\n };\n }\n\n /**\n * Copy an inbox message with its archive and inbox indices\n * @param message - The inbox message to copy\n * @returns A copy of the inbox message with its archive and inbox indices\n */\n private getMessageSnapshot(message: InboxMessage): MessageSnapshot {\n const archiveIndex = this._archiveDataSet\n ? this._archiveDataSet.messages.findIndex(m => m.messageId === message.messageId)\n : undefined;\n\n const inboxIndex = this._inboxDataSet\n ? this._inboxDataSet.messages.findIndex(m => m.messageId === message.messageId)\n : undefined;\n\n return {\n message: copyMessage(message),\n archiveIndex,\n inboxIndex,\n };\n }\n\n}\n","import { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, CourierButton, CourierIcon, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { getMessageTime } from \"../utils/utils\";\nimport { CourierInboxListItemMenu, CourierInboxListItemActionMenuOption } from \"./courier-inbox-list-item-menu\";\nimport { CourierInboxDatastore } from \"../datastore/datastore\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\n\nexport class CourierInboxListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list-item';\n }\n\n // State\n private _themeManager: CourierInboxThemeManager;\n private _theme: CourierInboxTheme;\n private _message: InboxMessage | null = null;\n private _feedType: CourierInboxFeedType = 'inbox';\n private _isMobile: boolean = false;\n private _canClick: boolean = false;\n // private _canLongPress: boolean = false; // Unused for now. But we can use this in the future if needed.\n\n // Elements\n private _titleElement?: HTMLParagraphElement;\n private _subtitleElement?: HTMLParagraphElement;\n private _timeElement?: HTMLParagraphElement;\n private _menu?: CourierInboxListItemMenu;\n private _unreadIndicator?: HTMLDivElement;\n private _actionsContainer?: HTMLDivElement;\n\n // Touch gestures\n private _longPressTimeout: number | null = null;\n private _isLongPress: boolean = false;\n\n // Intersection Observer\n private _observer?: IntersectionObserver;\n\n // Callbacks\n private onItemClick: ((message: InboxMessage) => void) | null = null;\n private onItemLongPress: ((message: InboxMessage) => void) | null = null;\n private onItemActionClick: ((message: InboxMessage, action: InboxAction) => void) | null = null;\n private onItemVisible: ((message: InboxMessage) => void) | null = null;\n\n constructor(themeManager: CourierInboxThemeManager, canClick: boolean, _canLongPress: boolean) {\n super();\n this._canClick = canClick;\n // this._canLongPress = canLongPress;\n this._themeManager = themeManager;\n this._theme = themeManager.getTheme();\n this._isMobile = 'ontouchstart' in window;\n this.render();\n this._setupIntersectionObserver();\n }\n\n private render() {\n\n const contentContainer = document.createElement('div');\n contentContainer.className = 'content-container';\n\n // Title\n this._titleElement = document.createElement('p');\n this._titleElement.className = 'title';\n\n // Subtitle\n this._subtitleElement = document.createElement('p');\n this._subtitleElement.className = 'subtitle';\n\n // Actions\n this._actionsContainer = document.createElement('div');\n this._actionsContainer.className = 'actions-container';\n\n contentContainer.appendChild(this._titleElement);\n contentContainer.appendChild(this._subtitleElement);\n contentContainer.appendChild(this._actionsContainer);\n\n // Time\n this._timeElement = document.createElement('p');\n this._timeElement.className = 'time';\n\n // Unread indicator\n this._unreadIndicator = document.createElement('div');\n this._unreadIndicator.className = 'unread-indicator';\n\n // Action menu\n this._menu = new CourierInboxListItemMenu(this._theme);\n this._menu.setOptions(this._getMenuOptions());\n\n // Append elements into shadow‑DOM\n this.append(this._unreadIndicator, contentContainer, this._timeElement, this._menu);\n\n const cancelPropagation = (e: Event): void => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n this._menu.addEventListener('mousedown', cancelPropagation);\n this._menu.addEventListener('pointerdown', cancelPropagation);\n this._menu.addEventListener('click', cancelPropagation);\n\n this.addEventListener('click', (e) => {\n if (!this._canClick) return;\n if (this._menu && (this._menu.contains(e.target as Node) || e.composedPath().includes(this._menu))) {\n return;\n }\n if (this._message && this.onItemClick && !(e.target instanceof CourierIcon) && !this._isLongPress) {\n this.onItemClick(this._message);\n }\n });\n\n this._setupHoverBehavior();\n this._setupLongPressBehavior();\n\n // Enable clickable class if canClick\n if (this._canClick) {\n this.classList.add('clickable');\n }\n }\n\n private _setupIntersectionObserver(): void {\n // Only set up if running in browser and IntersectionObserver is available\n if (typeof window === \"undefined\" || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n // Clean up any previous observer\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio === 1 && this.onItemVisible && this._message) {\n this.onItemVisible(this._message);\n }\n });\n }, { threshold: 1.0 });\n\n this._observer.observe(this);\n }\n\n onComponentUnmounted() {\n this._observer?.disconnect();\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const list = theme.inbox?.list;\n\n return `\n ${CourierInboxListItem.id} {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n border-bottom: ${list?.item?.divider ?? '1px solid red'};\n font-family: inherit;\n cursor: default;\n transition: background-color 0.2s ease;\n margin: 0;\n width: 100%;\n box-sizing: border-box;\n padding: 12px 20px;\n position: relative;\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n touch-action: manipulation;\n }\n\n /* Only apply hover/active background if clickable */\n @media (hover: hover) {\n ${CourierInboxListItem.id}.clickable:hover {\n cursor: pointer;\n background-color: ${list?.item?.hoverBackgroundColor ?? 'red'};\n }\n }\n\n ${CourierInboxListItem.id}.clickable:active {\n cursor: pointer;\n background-color: ${list?.item?.activeBackgroundColor ?? 'red'};\n }\n\n /* Menu hover / active */\n @media (hover: hover) {\n ${CourierInboxListItem.id}.clickable:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n }\n }\n\n ${CourierInboxListItem.id}.clickable:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxListItem.id}:last-child {\n border-bottom: none;\n }\n\n ${CourierInboxListItem.id} .unread-indicator {\n position: absolute;\n top: 28px;\n left: 6px;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background-color: ${list?.item?.unreadIndicatorColor ?? 'red'};\n display: none;\n }\n\n ${CourierInboxListItem.id}.unread .unread-indicator {\n display: block;\n }\n\n ${CourierInboxListItem.id} .content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n margin-right: 12px;\n }\n\n ${CourierInboxListItem.id} p {\n margin: 0;\n overflow-wrap: break-word;\n word-break: break-word;\n hyphens: auto;\n line-height: 1.4;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n text-align: left;\n }\n\n ${CourierInboxListItem.id} .title {\n font-family: ${list?.item?.title?.family ?? 'inherit'};\n font-size: ${list?.item?.title?.size ?? '14px'};\n color: ${list?.item?.title?.color ?? 'red'};\n margin-bottom: 4px;\n }\n\n ${CourierInboxListItem.id} .subtitle {\n font-family: ${list?.item?.subtitle?.family ?? 'inherit'};\n font-size: ${list?.item?.subtitle?.size ?? '14px'};\n color: ${list?.item?.subtitle?.color ?? 'red'};\n }\n\n ${CourierInboxListItem.id} .time {\n font-family: ${list?.item?.time?.family ?? 'inherit'};\n font-size: ${list?.item?.time?.size ?? '14px'};\n color: ${list?.item?.time?.color ?? 'red'};\n text-align: right;\n white-space: nowrap;\n }\n\n ${CourierInboxListItem.id} courier-inbox-list-item-menu {\n z-index: 1;\n position: absolute;\n top: 8px;\n right: 8px;\n display: none;\n }\n\n ${CourierInboxListItem.id} .actions-container {\n display: flex;\n margin-top: 10px;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n display: none;\n }\n `;\n\n }\n\n private _setupHoverBehavior(): void {\n // Only show menu on hover for non-mobile devices and if canClick\n if (!this._isMobile) {\n this.addEventListener('mouseenter', () => {\n this._isLongPress = false;\n this._showMenu();\n });\n this.addEventListener('mouseleave', () => this._hideMenu());\n }\n }\n\n private _setupLongPressBehavior(): void {\n const menu = this._theme.inbox?.list?.item?.menu\n\n if (!menu?.enabled) {\n return;\n }\n\n const longPress = menu.longPress;\n\n this.addEventListener(\n 'touchstart',\n () => {\n // Start long press timer\n this._longPressTimeout = window.setTimeout(() => {\n this._isLongPress = true;\n this._showMenu();\n if (this._message && this.onItemLongPress) {\n this.onItemLongPress(this._message);\n // Vibrate device if supported\n if (navigator.vibrate) {\n navigator.vibrate(longPress?.vibrationDuration ?? 50);\n }\n }\n // Keep the menu visible for 2 s, then hide again\n setTimeout(() => {\n this._hideMenu();\n this._isLongPress = false;\n }, longPress?.displayDuration ?? 2000);\n }, 650);\n },\n { passive: true },\n );\n\n this.addEventListener('touchend', () => {\n // Clear long press timeout\n if (this._longPressTimeout) {\n window.clearTimeout(this._longPressTimeout);\n this._longPressTimeout = null;\n }\n });\n }\n\n // Helpers\n private _getMenuOptions(): CourierInboxListItemActionMenuOption[] {\n const menuTheme = this._theme.inbox?.list?.item?.menu?.item;\n let options: CourierInboxListItemActionMenuOption[] = [];\n\n const isArchiveFeed = this._feedType === 'archive';\n\n // Only add read/unread option if not in archive feed\n if (!isArchiveFeed) {\n options.push({\n id: this._message?.read ? 'unread' : 'read',\n icon: {\n svg: this._message?.read ? menuTheme?.unread?.svg : menuTheme?.read?.svg,\n color: this._message?.read ? menuTheme?.unread?.color : menuTheme?.read?.color ?? 'red',\n },\n onClick: () => {\n if (this._message) {\n if (this._message.read) {\n CourierInboxDatastore.shared.unreadMessage({ message: this._message });\n } else {\n CourierInboxDatastore.shared.readMessage({ message: this._message });\n }\n }\n },\n });\n }\n\n options.push({\n id: isArchiveFeed ? 'unarchive' : 'archive',\n icon: {\n svg: isArchiveFeed ? menuTheme?.unarchive?.svg : menuTheme?.archive?.svg,\n color: isArchiveFeed ? menuTheme?.unarchive?.color : menuTheme?.archive?.color ?? 'red',\n },\n onClick: () => {\n if (this._message) {\n if (isArchiveFeed) {\n CourierInboxDatastore.shared.unarchiveMessage({ message: this._message });\n } else {\n CourierInboxDatastore.shared.archiveMessage({ message: this._message });\n }\n }\n },\n });\n\n return options;\n }\n\n // Menu visibility helpers\n private _showMenu(): void {\n const menu = this._theme.inbox?.list?.item?.menu;\n\n if (menu && menu.enabled && this._menu && this._timeElement) {\n this._menu.setOptions(this._getMenuOptions());\n this._menu.style.display = 'block';\n this._menu.show();\n this._timeElement.style.opacity = '0';\n }\n }\n\n private _hideMenu(): void {\n const menu = this._theme.inbox?.list?.item?.menu;\n\n if (menu && menu.enabled && this._menu && this._timeElement) {\n this._menu.hide();\n this._menu.style.display = 'none';\n this._timeElement.style.opacity = '1';\n }\n }\n\n // Public API\n public setMessage(message: InboxMessage, feedType: CourierInboxFeedType): void {\n this._message = message;\n this._feedType = feedType;\n this._updateContent();\n }\n\n public setOnItemClick(cb: (message: InboxMessage) => void): void {\n this.onItemClick = cb;\n }\n\n public setOnItemActionClick(cb: (message: InboxMessage, action: InboxAction) => void): void {\n this.onItemActionClick = cb;\n }\n\n public setOnItemLongPress(cb: (message: InboxMessage) => void): void {\n this.onItemLongPress = cb;\n }\n\n public setOnItemVisible(cb: (message: InboxMessage) => void): void {\n this.onItemVisible = cb;\n }\n\n // Content rendering\n private _updateContent(): void {\n\n if (!this._message) {\n if (this._titleElement) this._titleElement.textContent = '';\n if (this._subtitleElement) this._subtitleElement.textContent = '';\n return;\n }\n\n // Unread marker\n this.classList.toggle('unread', !this._message.read && this._feedType !== 'archive');\n\n if (this._titleElement) {\n this._titleElement.textContent = this._message.title || 'Untitled Message';\n }\n if (this._subtitleElement) {\n this._subtitleElement.textContent = this._message.preview || this._message.body || '';\n }\n if (this._timeElement) {\n this._timeElement.textContent = getMessageTime(this._message);\n }\n\n // Update menu icons (e.g. read/unread)\n if (this._menu) {\n this._menu.setOptions(this._getMenuOptions());\n }\n\n // Update actions container\n const hasActions = this._message.actions && this._message.actions.length > 0;\n if (this._actionsContainer) {\n this._actionsContainer.style.display = hasActions ? 'flex' : 'none';\n }\n\n const actionsTheme = this._theme.inbox?.list?.item?.actions;\n\n // Add the actions to the actions container\n if (this._actionsContainer && this._message.actions) {\n this._actionsContainer.innerHTML = \"\"; // Clear previous actions to avoid duplicates\n this._message.actions.forEach(action => {\n // Create the action element\n const actionButton = new CourierButton({\n mode: this._themeManager.mode,\n text: action.content,\n variant: 'secondary',\n backgroundColor: actionsTheme?.backgroundColor,\n hoverBackgroundColor: actionsTheme?.hoverBackgroundColor,\n activeBackgroundColor: actionsTheme?.activeBackgroundColor,\n border: actionsTheme?.border,\n borderRadius: actionsTheme?.borderRadius,\n shadow: actionsTheme?.shadow,\n fontFamily: actionsTheme?.font?.family,\n fontSize: actionsTheme?.font?.size,\n fontWeight: actionsTheme?.font?.weight,\n textColor: actionsTheme?.font?.color,\n onClick: () => {\n if (this._message && this.onItemActionClick) {\n this.onItemActionClick(this._message, action);\n }\n },\n });\n\n // Add the action element to the actions container\n this._actionsContainer?.appendChild(actionButton);\n });\n }\n }\n}\n\nregisterElement(CourierInboxListItem);","import { CourierBaseElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport class CourierInboxSkeletonListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-skeleton-list-item';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxSkeletonListItem.id, CourierInboxSkeletonListItem.getStyles(this._theme));\n this.render();\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n private render() {\n // Create skeleton items using CourierSkeletonAnimatedRow\n const firstRow = new CourierSkeletonAnimatedRow(this._theme);\n const secondRow = new CourierSkeletonAnimatedRow(this._theme);\n const thirdRow = new CourierSkeletonAnimatedRow(this._theme);\n\n this.appendChild(firstRow);\n this.appendChild(secondRow);\n this.appendChild(thirdRow);\n }\n\n static getStyles(_theme: CourierInboxTheme): string {\n return `\n ${CourierInboxSkeletonListItem.id} {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 12px;\n width: 100%;\n box-sizing: border-box;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:first-child {\n width: 35%;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:nth-child(2) {\n width: 100%;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:nth-child(3) {\n width: 82%;\n }\n `;\n }\n}\n\n// Register the custom element\nregisterElement(CourierInboxSkeletonListItem);\n\nclass CourierSkeletonAnimatedRow extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-skeleton-animated-row';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierSkeletonAnimatedRow.id, CourierSkeletonAnimatedRow.getStyles(this._theme));\n this.render();\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n private render() {\n const skeletonItem = document.createElement('div');\n skeletonItem.className = 'skeleton-item';\n this.appendChild(skeletonItem);\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n const color = theme.inbox?.loading?.animation?.barColor ?? '#000';\n\n // Handle both 3 and 6 character hex colors\n const hexColor = color.length === 4 ?\n `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}` :\n color;\n\n // Convert hex to RGB\n const r = parseInt(hexColor.slice(1, 3), 16);\n const g = parseInt(hexColor.slice(3, 5), 16);\n const b = parseInt(hexColor.slice(5, 7), 16);\n\n const colorWithAlpha80 = `rgba(${r}, ${g}, ${b}, 0.8)`; // 80% opacity\n const colorWithAlpha40 = `rgba(${r}, ${g}, ${b}, 0.4)`; // 40% opacity\n\n return `\n ${CourierSkeletonAnimatedRow.id} {\n display: flex;\n height: 100%;\n width: 100%;\n align-items: flex-start;\n justify-content: flex-start;\n }\n\n ${CourierSkeletonAnimatedRow.id} .skeleton-item {\n height: ${theme.inbox?.loading?.animation?.barHeight ?? '14px'};\n width: 100%;\n background: linear-gradient(\n 90deg,\n ${colorWithAlpha80} 25%,\n ${colorWithAlpha40} 50%,\n ${colorWithAlpha80} 75%\n );\n background-size: 200% 100%;\n animation: ${CourierSkeletonAnimatedRow.id}-shimmer ${theme.inbox?.loading?.animation?.duration ?? '2s'} ease-in-out infinite;\n border-radius: ${theme.inbox?.loading?.animation?.barBorderRadius ?? '14px'};\n }\n\n @keyframes ${CourierSkeletonAnimatedRow.id}-shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n `;\n }\n}\n\nregisterElement(CourierSkeletonAnimatedRow);\n","import { CourierFactoryElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxSkeletonListItem } from \"./courier-inbox-skeleton-list-item\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport class CourierInboxSkeletonList extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-skeleton-list';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxSkeletonList.id, CourierInboxSkeletonList.getStyles(this._theme));\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n defaultElement(): HTMLElement {\n const list = document.createElement('div');\n list.className = 'list';\n\n // Create skeleton items\n for (let i = 0; i < 3; i++) {\n const skeletonItem = new CourierInboxSkeletonListItem(this._theme); // TODO: Make this a prop\n list.appendChild(skeletonItem);\n }\n\n this.appendChild(list);\n return list;\n\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n return `\n ${CourierInboxSkeletonList.id} {\n display: flex;\n height: 100%;\n width: 100%;\n align-items: flex-start;\n justify-content: flex-start;\n overflow: hidden;\n }\n\n ${CourierInboxSkeletonList.id} .list {\n display: flex;\n flex-direction: column;\n width: 100%;\n overflow: hidden;\n }\n\n ${CourierInboxSkeletonList.id} .list > * {\n border-bottom: ${theme.inbox?.loading?.divider ?? '1px solid red'};\n opacity: 100%;\n }\n\n ${CourierInboxSkeletonList.id} .list > *:nth-child(2) {\n border-bottom: ${theme.inbox?.loading?.divider ?? '1px solid red'};\n opacity: 88%;\n }\n\n ${CourierInboxSkeletonList.id} .list > *:nth-child(3) {\n border-bottom: none;\n opacity: 50%;\n }\n `;\n\n }\n}\n\nregisterElement(CourierInboxSkeletonList);\n","import { CourierBaseElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxSkeletonList } from \"./courier-inbox-skeleton-list\";\n\nexport class CourierInboxPaginationListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-pagination-list-item';\n }\n\n // State\n private _theme: CourierInboxTheme;\n\n // Components\n private _style?: HTMLStyleElement;\n private _skeletonLoadingList?: CourierInboxSkeletonList;\n private _observer?: IntersectionObserver;\n private _customItem?: HTMLElement;\n\n // Handlers\n private _onPaginationTrigger: () => void;\n\n constructor(props: { theme: CourierInboxTheme, customItem?: HTMLElement, onPaginationTrigger: () => void }) {\n super();\n this._theme = props.theme;\n this._customItem = props.customItem;\n this._onPaginationTrigger = props.onPaginationTrigger;\n }\n\n onComponentMounted() {\n\n this._style = injectGlobalStyle(CourierInboxPaginationListItem.id, CourierInboxPaginationListItem.getStyles(this._theme));\n\n if (this._customItem) {\n this.appendChild(this._customItem);\n } else {\n const container = document.createElement('div');\n container.className = 'skeleton-container';\n\n this._skeletonLoadingList = new CourierInboxSkeletonList(this._theme);\n this._skeletonLoadingList.build(undefined);\n container.appendChild(this._skeletonLoadingList);\n\n this.appendChild(container);\n }\n\n // Initialize intersection observer\n this._observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n this._onPaginationTrigger();\n }\n });\n });\n\n // Start observing the element\n this._observer.observe(this);\n\n }\n\n onComponentUnmounted() {\n this._observer?.disconnect();\n this._style?.remove();\n }\n\n static getStyles(_theme: CourierInboxTheme): string {\n return `\n ${CourierInboxPaginationListItem.id} {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n }\n\n ${CourierInboxPaginationListItem.id} .skeleton-container {\n height: 150%;\n }\n `;\n }\n\n}\n\nregisterElement(CourierInboxPaginationListItem);\n","import { InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierInboxDatastore } from \"../datastore/datastore\";\n\nexport function markAsRead(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.readMessage({ message });\n}\n\nexport function markAsUnread(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.unreadMessage({ message });\n}\n\nexport function clickMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.clickMessage({ message });\n}\n\nexport function archiveMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.archiveMessage({ message });\n}\n\nexport function openMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.openMessage({ message });\n}\n","import { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, CourierInfoState, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxListItem } from \"./courier-inbox-list-item\";\nimport { CourierInboxPaginationListItem } from \"./courier-inbox-pagination-list-item\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierInboxStateErrorFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateLoadingFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps } from \"../types/factories\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxSkeletonList } from \"./courier-inbox-skeleton-list\";\nimport { CourierInboxListItemMenu } from \"./courier-inbox-list-item-menu\";\nimport { openMessage } from \"../utils/extensions\";\n\nexport class CourierInboxList extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _messages: InboxMessage[] = [];\n private _feedType: CourierInboxFeedType = 'inbox';\n private _isLoading = true;\n private _error: Error | null = null;\n private _canPaginate = false;\n private _canClickListItems = false;\n private _canLongPressListItems = false;\n\n // Callbacks\n private _onMessageClick: ((message: InboxMessage, index: number) => void) | null = null;\n private _onMessageActionClick: ((message: InboxMessage, action: InboxAction, index: number) => void) | null = null;\n private _onMessageLongPress: ((message: InboxMessage, index: number) => void) | null = null;\n private _onRefresh: () => void;\n\n // Factories\n private _onPaginationTrigger?: (feedType: CourierInboxFeedType) => void;\n private _listItemFactory?: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement;\n private _paginationItemFactory?: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement;\n private _loadingStateFactory?: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement;\n private _emptyStateFactory?: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement;\n private _errorStateFactory?: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement;\n\n // Getters\n public get messages(): InboxMessage[] {\n return this._messages;\n }\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n // Components\n private _listStyles?: HTMLStyleElement;\n private _listItemStyles?: HTMLStyleElement;\n private _listItemMenuStyles?: HTMLStyleElement;\n private _errorContainer?: CourierInfoState;\n private _emptyContainer?: CourierInfoState;\n\n constructor(props: {\n themeManager: CourierInboxThemeManager,\n canClickListItems: boolean,\n canLongPressListItems: boolean,\n onRefresh: () => void,\n onPaginationTrigger: (feedType: CourierInboxFeedType) => void,\n onMessageClick: (message: InboxMessage, index: number) => void,\n onMessageActionClick: (message: InboxMessage, action: InboxAction, index: number) => void,\n onMessageLongPress: (message: InboxMessage, index: number) => void\n }) {\n super();\n\n // Initialize the callbacks\n this._onRefresh = props.onRefresh;\n this._onPaginationTrigger = props.onPaginationTrigger;\n this._onMessageClick = props.onMessageClick;\n this._onMessageActionClick = props.onMessageActionClick;\n this._onMessageLongPress = props.onMessageLongPress;\n\n // Initialize the theme subscription\n this._themeSubscription = props.themeManager.subscribe((_: CourierInboxTheme) => {\n this.render();\n });\n\n }\n\n onComponentMounted() {\n\n // Inject styles at head\n // Since list items and menus don't listen to theme changes directly, their styles are created\n // at the parent level, and the parent manages their theming updates.\n this._listStyles = injectGlobalStyle(CourierInboxList.id, CourierInboxList.getStyles(this.theme));\n this._listItemStyles = injectGlobalStyle(CourierInboxListItem.id, CourierInboxListItem.getStyles(this.theme));\n this._listItemMenuStyles = injectGlobalStyle(CourierInboxListItemMenu.id, CourierInboxListItemMenu.getStyles(this.theme));\n\n // Layout the component\n this.render();\n\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._listStyles?.remove();\n this._listItemStyles?.remove();\n this._listItemMenuStyles?.remove();\n }\n\n public setCanClickListItems(canClick: boolean) {\n this._canClickListItems = canClick;\n }\n\n public setCanLongPressListItems(canLongPress: boolean) {\n this._canLongPressListItems = canLongPress;\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const list = theme.inbox?.list;\n\n return `\n ${CourierInboxList.id} {\n flex: 1;\n width: 100%;\n background-color: ${list?.backgroundColor ?? 'red'};\n }\n\n ${CourierInboxList.id} ul {\n list-style: none;\n padding: 0;\n margin: 0;\n height: 100%;\n }\n `;\n\n }\n\n public setDataSet(dataSet: InboxDataSet): void {\n this._messages = [...dataSet.messages];\n this._canPaginate = Boolean(dataSet.canPaginate);\n this._error = null;\n this._isLoading = false;\n this.render();\n }\n\n public addPage(dataSet: InboxDataSet): void {\n this._messages = [...this._messages, ...dataSet.messages];\n this._canPaginate = Boolean(dataSet.canPaginate);\n this._error = null;\n this._isLoading = false;\n this.render();\n }\n\n public addMessage(message: InboxMessage, index = 0): void {\n this._messages.splice(index, 0, message);\n this.render();\n }\n\n public removeMessage(index = 0): void {\n this._messages.splice(index, 1);\n this.render();\n }\n\n public updateMessage(message: InboxMessage, index = 0): void {\n this._messages[index] = message;\n this.render();\n }\n\n public setFeedType(feedType: CourierInboxFeedType): void {\n this._feedType = feedType;\n this._error = null;\n this._isLoading = true;\n this.render();\n }\n\n public setLoading(isLoading: boolean): void {\n this._error = null;\n this._isLoading = isLoading;\n this.render();\n }\n\n public setError(error: Error | null): void {\n this._error = error;\n this._isLoading = false;\n this._messages = [];\n this.render();\n }\n\n public setErrorNoClient(): void {\n this.setError(new Error('No user signed in'));\n }\n\n private handleRetry(): void {\n this._onRefresh();\n }\n\n private handleRefresh(): void {\n this._onRefresh();\n }\n\n public refreshInfoStateThemes() {\n this._emptyContainer?.updateStyles(this.errorProps);\n this._emptyContainer?.updateStyles(this.emptyProps);\n }\n\n get errorProps(): any {\n const error = this.theme.inbox?.error;\n const themeMode = this._themeSubscription.manager.mode;\n return {\n title: {\n text: error?.title?.text ?? this._error?.message,\n textColor: error?.title?.font?.color,\n fontFamily: error?.title?.font?.family,\n fontSize: error?.title?.font?.size,\n fontWeight: error?.title?.font?.weight\n },\n button: {\n mode: themeMode,\n text: error?.button?.text,\n backgroundColor: error?.button?.backgroundColor,\n hoverBackgroundColor: error?.button?.hoverBackgroundColor,\n activeBackgroundColor: error?.button?.activeBackgroundColor,\n textColor: error?.button?.font?.color,\n fontFamily: error?.button?.font?.family,\n fontSize: error?.button?.font?.size,\n fontWeight: error?.button?.font?.weight,\n shadow: error?.button?.shadow,\n border: error?.button?.border,\n borderRadius: error?.button?.borderRadius,\n onClick: () => this.handleRetry()\n }\n };\n }\n\n get emptyProps(): any {\n const empty = this.theme.inbox?.empty;\n const themeMode = this._themeSubscription.manager.mode;\n return {\n title: {\n text: empty?.title?.text ?? `No ${this._feedType} messages yet`,\n textColor: empty?.title?.font?.color,\n fontFamily: empty?.title?.font?.family,\n fontSize: empty?.title?.font?.size,\n fontWeight: empty?.title?.font?.weight\n },\n button: {\n mode: themeMode,\n text: empty?.button?.text,\n backgroundColor: empty?.button?.backgroundColor,\n hoverBackgroundColor: empty?.button?.hoverBackgroundColor,\n activeBackgroundColor: empty?.button?.activeBackgroundColor,\n textColor: empty?.button?.font?.color,\n fontFamily: empty?.button?.font?.family,\n fontSize: empty?.button?.font?.size,\n fontWeight: empty?.button?.font?.weight,\n shadow: empty?.button?.shadow,\n border: empty?.button?.border,\n borderRadius: empty?.button?.borderRadius,\n onClick: () => this.handleRefresh()\n },\n };\n }\n\n private render(): void {\n\n // Remove all existing elements\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n this._errorContainer = undefined;\n this._emptyContainer = undefined;\n }\n\n // Update list styles\n if (this._listStyles) {\n this._listStyles.textContent = CourierInboxList.getStyles(this.theme);\n }\n\n // Update list item styles\n if (this._listItemStyles) {\n this._listItemStyles.textContent = CourierInboxListItem.getStyles(this.theme);\n }\n\n // Update list item menu styles\n if (this._listItemMenuStyles) {\n this._listItemMenuStyles.textContent = CourierInboxListItemMenu.getStyles(this.theme);\n }\n\n // Error state\n if (this._error) {\n this._errorContainer = new CourierInfoState(this.errorProps);\n this._errorContainer.build(this._errorStateFactory?.({ feedType: this._feedType, error: this._error }));\n this.appendChild(this._errorContainer);\n return;\n }\n\n // Loading state\n if (this._isLoading) {\n const loadingElement = new CourierInboxSkeletonList(this.theme);\n loadingElement.build(this._loadingStateFactory?.({ feedType: this._feedType }));\n this.appendChild(loadingElement);\n return;\n }\n\n // Empty state\n if (this._messages.length === 0) {\n this._emptyContainer = new CourierInfoState(this.emptyProps);\n this._emptyContainer.build(this._emptyStateFactory?.({ feedType: this._feedType }));\n this.appendChild(this._emptyContainer);\n return;\n }\n\n // Create list before adding messages\n const list = document.createElement('ul');\n this.appendChild(list);\n\n // Add messages to the list\n this._messages.forEach((message, index) => {\n if (this._listItemFactory) {\n list.appendChild(this._listItemFactory({ message, index }));\n return;\n }\n const listItem = new CourierInboxListItem(this._themeSubscription.manager, this._canClickListItems, this._canLongPressListItems);\n listItem.setMessage(message, this._feedType);\n listItem.setOnItemClick((message) => this._onMessageClick?.(message, index));\n listItem.setOnItemActionClick((message, action) => this._onMessageActionClick?.(message, action, index));\n listItem.setOnItemLongPress((message) => this._onMessageLongPress?.(message, index));\n listItem.setOnItemVisible((message) => this.openVisibleMessage(message))\n list.appendChild(listItem);\n });\n\n // Add pagination item if can paginate\n if (this._canPaginate) {\n const paginationItem = new CourierInboxPaginationListItem({\n theme: this.theme,\n customItem: this._paginationItemFactory?.({ feedType: this._feedType }),\n onPaginationTrigger: () => this._onPaginationTrigger?.(this._feedType),\n });\n list.appendChild(paginationItem);\n }\n }\n\n private async openVisibleMessage(message: InboxMessage) {\n try {\n await openMessage(message);\n } catch (error) {\n // Error ignored. Will get logged in the openMessage function\n }\n }\n\n // Factories\n public setLoadingStateFactory(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement): void {\n this._loadingStateFactory = factory;\n this.render();\n }\n\n public setEmptyStateFactory(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement): void {\n this._emptyStateFactory = factory;\n this.render();\n }\n\n public setErrorStateFactory(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement): void {\n this._errorStateFactory = factory;\n this.render();\n }\n\n public setListItemFactory(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement): void {\n this._listItemFactory = factory;\n this.render();\n }\n\n public setPaginationItemFactory(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement): void {\n this._paginationItemFactory = factory;\n this.render();\n }\n\n}\n\nregisterElement(CourierInboxList);\n","import { CourierBaseElement, CourierIcon, CourierIconSVGs, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxMenuOption } from \"./courier-inbox-option-menu\";\n\nexport class CourierInboxOptionMenuItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-option-menu-item';\n }\n\n // State\n private _option: CourierInboxMenuOption;\n private _isSelectedable: boolean;\n private _isSelected?: boolean;\n\n // Components\n private _content?: HTMLDivElement;\n private _itemIcon?: CourierIcon;\n private _title?: HTMLParagraphElement;\n private _selectionIcon?: CourierIcon;\n\n constructor(props: { option: CourierInboxMenuOption, selectable: boolean, isSelected: boolean, themeManager: CourierInboxThemeManager }) {\n super();\n this._option = props.option;\n this._isSelected = props.isSelected;\n this._isSelectedable = props.selectable;\n }\n\n onComponentMounted() {\n\n this._content = document.createElement('div');\n this._content.className = 'menu-item';\n\n this._itemIcon = new CourierIcon(this._option.icon.svg ?? CourierIconSVGs.inbox);\n this._itemIcon.setAttribute('size', '16');\n\n this._title = document.createElement('p');\n this._title.textContent = this._option.text;\n\n const spacer = document.createElement('div');\n spacer.className = 'spacer';\n\n this._selectionIcon = new CourierIcon(CourierIconSVGs.check);\n\n this._content.appendChild(this._itemIcon);\n this._content.appendChild(this._title);\n this._content.appendChild(spacer);\n\n // Add check icon if selectable\n if (this._isSelectedable) {\n this._content.appendChild(this._selectionIcon);\n }\n\n this.appendChild(this._content);\n\n this._selectionIcon.style.display = this._isSelected ? 'block' : 'none';\n\n this.refreshTheme();\n\n }\n\n public refreshTheme() {\n\n // Set selected icon color\n this._selectionIcon?.updateColor(this._option.selectionIcon?.color ?? 'red');\n this._selectionIcon?.updateSVG(this._option.selectionIcon?.svg ?? CourierIconSVGs.check);\n\n if (this._title) {\n this._title.textContent = this._option.text ?? 'Missing Text';\n }\n\n this._itemIcon?.updateColor(this._option.icon?.color ?? 'red');\n this._itemIcon?.updateSVG(this._option.icon?.svg ?? CourierIconSVGs.inbox);\n\n }\n\n}\n\nregisterElement(CourierInboxOptionMenuItem);\n","import { CourierBaseElement, CourierIconButton, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxOptionMenuItem } from \"./courier-inbox-option-menu-item\";\nimport { CourierInboxHeaderMenuItemId } from \"./courier-inbox-header\";\nimport { CourierInboxIconTheme } from \"../types/courier-inbox-theme\";\n\nexport type CourierInboxMenuOptionType = 'filters' | 'actions';\n\nexport type CourierInboxMenuOption = {\n id: CourierInboxHeaderMenuItemId;\n text: string;\n icon: CourierInboxIconTheme;\n selectionIcon?: CourierInboxIconTheme | null;\n onClick: (option: CourierInboxMenuOption) => void;\n};\n\nexport class CourierInboxOptionMenu extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-option-menu';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _type: CourierInboxMenuOptionType;\n private _selectedIndex: number = 0;\n private _options: CourierInboxMenuOption[];\n private _selectable: boolean;\n private _onMenuOpen: () => void;\n\n // Components\n private _menuButton?: CourierIconButton;\n private _menu?: HTMLDivElement;\n private _style?: HTMLStyleElement;\n\n constructor(themeManager: CourierInboxThemeManager, type: CourierInboxMenuOptionType, selectable: boolean, options: CourierInboxMenuOption[], onMenuOpen: () => void) {\n super();\n\n this._type = type;\n this._selectable = selectable;\n this._options = options;\n this._selectedIndex = 0;\n this._onMenuOpen = onMenuOpen;\n\n // Handle the theme change\n this._themeSubscription = themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n }\n\n onComponentMounted() {\n\n this._style = injectGlobalStyle(CourierInboxOptionMenu.id, this.getStyles());\n\n this._menuButton = new CourierIconButton(this._type === 'filters' ? CourierIconSVGs.filter : CourierIconSVGs.overflow);\n this._menu = document.createElement('div');\n this._menu.className = `menu ${this._type}`;\n\n this.appendChild(this._menuButton);\n this.appendChild(this._menu);\n\n this._menuButton.addEventListener('click', this.toggleMenu.bind(this));\n document.addEventListener('click', this.handleOutsideClick.bind(this));\n\n this.refreshTheme();\n\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private getStyles(): string {\n const theme = this._themeSubscription.manager.getTheme();\n\n return `\n ${CourierInboxOptionMenu.id} {\n position: relative;\n display: inline-block;\n }\n\n ${CourierInboxOptionMenu.id} .menu {\n display: none;\n position: absolute;\n top: 42px;\n right: -6px;\n border-radius: ${theme.inbox?.header?.menus?.popup?.borderRadius ?? '6px'};\n border: ${theme.inbox?.header?.menus?.popup?.border ?? '1px solid red'};\n background: ${theme.inbox?.header?.menus?.popup?.backgroundColor ?? 'red'};\n box-shadow: ${theme.inbox?.header?.menus?.popup?.shadow ?? '0 4px 12px 0 red'};\n z-index: 1000;\n min-width: 200px;\n overflow: hidden;\n padding: 4px 0;\n }\n\n ${CourierInboxOptionMenu.id} courier-inbox-filter-menu-item {\n border-bottom: ${theme.inbox?.header?.menus?.popup?.list?.divider ?? 'none'};\n }\n\n ${CourierInboxOptionMenu.id} courier-inbox-filter-menu-item:last-child {\n border-bottom: none;\n }\n\n ${CourierInboxOptionMenuItem.id} {\n display: flex;\n flex-direction: row;\n padding: 6px 12px;\n cursor: pointer;\n }\n\n ${CourierInboxOptionMenuItem.id}:hover {\n background-color: ${theme.inbox?.header?.menus?.popup?.list?.hoverBackgroundColor ?? 'red'};\n }\n\n ${CourierInboxOptionMenuItem.id}:active {\n background-color: ${theme.inbox?.header?.menus?.popup?.list?.activeBackgroundColor ?? 'red'};\n }\n\n ${CourierInboxOptionMenuItem.id} .menu-item {\n display: flex;\n align-items: center;\n width: 100%;\n gap: 12px;\n }\n\n ${CourierInboxOptionMenuItem.id} .spacer {\n flex: 1;\n }\n\n ${CourierInboxOptionMenuItem.id} p {\n margin: 0;\n font-family: ${theme.inbox?.header?.menus?.popup?.list?.font?.family ?? 'inherit'};\n font-weight: ${theme.inbox?.header?.menus?.popup?.list?.font?.weight ?? 'inherit'};\n font-size: ${theme.inbox?.header?.menus?.popup?.list?.font?.size ?? '14px'};\n color: ${theme.inbox?.header?.menus?.popup?.list?.font?.color ?? 'red'};\n white-space: nowrap;\n }\n\n ${CourierInboxOptionMenuItem.id} .check-icon {\n display: none;\n }\n `;\n }\n\n private refreshTheme() {\n // Update styles\n if (this._style) {\n this._style.textContent = this.getStyles();\n }\n\n // Get theme\n const theme = this._themeSubscription.manager.getTheme();\n\n // Get menu\n const menu = theme.inbox?.header?.menus;\n const isFilter = this._type === 'filters';\n const buttonConfig = isFilter ? menu?.filters?.button : menu?.actions?.button;\n const defaultIcon = isFilter ? CourierIconSVGs.filter : CourierIconSVGs.overflow;\n\n this._menuButton?.updateIconSVG(buttonConfig?.icon?.svg ?? defaultIcon);\n this._menuButton?.updateIconColor(buttonConfig?.icon?.color ?? 'red');\n this._menuButton?.updateBackgroundColor(buttonConfig?.backgroundColor ?? 'transparent');\n this._menuButton?.updateHoverBackgroundColor(buttonConfig?.hoverBackgroundColor ?? 'red');\n this._menuButton?.updateActiveBackgroundColor(buttonConfig?.activeBackgroundColor ?? 'red');\n\n // Reload menu items\n this.refreshMenuItems();\n }\n\n public setOptions(options: CourierInboxMenuOption[]) {\n this._options = options;\n this.refreshMenuItems();\n }\n\n private refreshMenuItems() {\n if (this._menu) {\n this._menu.innerHTML = '';\n }\n\n this._options.forEach((option, index) => {\n const menuItem = new CourierInboxOptionMenuItem({\n option: option,\n selectable: this._selectable,\n isSelected: this._selectedIndex === index,\n themeManager: this._themeSubscription.manager\n });\n\n menuItem.addEventListener('click', () => {\n this._selectedIndex = index;\n option.onClick(option);\n this.refreshMenuItems();\n this.closeMenu();\n });\n\n this._menu?.appendChild(menuItem);\n });\n }\n\n private toggleMenu(event: Event) {\n event.stopPropagation();\n const isOpening = this._menu?.style.display !== 'block';\n if (this._menu) {\n this._menu.style.display = isOpening ? 'block' : 'none';\n }\n\n if (isOpening) {\n this._onMenuOpen();\n }\n }\n\n private handleOutsideClick(event: MouseEvent) {\n if (!this.contains(event.target as Node)) {\n this.closeMenu();\n }\n }\n\n public closeMenu() {\n if (this._menu) {\n this._menu.style.display = 'none';\n }\n }\n\n public selectOption(option: CourierInboxMenuOption) {\n this._selectedIndex = this._options.findIndex(o => o.id === option.id);\n this.refreshMenuItems();\n }\n\n}\n\nregisterElement(CourierInboxOptionMenu);\n","import { CourierBaseElement, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\n\nexport type CourierUnreadCountLocation = 'button' | 'header';\n\nexport class CourierUnreadCountBadge extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-unread-count-badge';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _location: CourierUnreadCountLocation;\n private _count: number = 0;\n\n // Elements\n private _badge?: HTMLElement;\n private _style?: HTMLStyleElement;\n\n get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(props: { themeBus: CourierInboxThemeManager, location: CourierUnreadCountLocation }) {\n super();\n this._location = props.location;\n this._themeSubscription = props.themeBus.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme(this._location);\n });\n }\n\n onComponentMounted() {\n\n // Create badge element\n this._badge = document.createElement('span');\n this._badge.className = `unread-badge ${this._location}`;\n\n this.appendChild(this._badge);\n this.updateBadge();\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n return `\n ${CourierUnreadCountBadge.id} {\n display: inline-block;\n }\n\n ${CourierUnreadCountBadge.id} .unread-badge {\n padding: 3px 8px;\n font-size: 12px;\n text-align: center;\n display: none;\n pointer-events: none;\n }\n\n ${CourierUnreadCountBadge.id} .header {\n background-color: ${theme.inbox?.header?.filters?.unreadIndicator?.backgroundColor};\n color: ${theme.inbox?.header?.filters?.unreadIndicator?.font?.color};\n border-radius: ${theme.inbox?.header?.filters?.unreadIndicator?.borderRadius};\n font-size: ${theme.inbox?.header?.filters?.unreadIndicator?.font?.size};\n padding: ${theme.inbox?.header?.filters?.unreadIndicator?.padding};\n }\n `\n }\n\n public setCount(count: number) {\n this._count = count;\n this.updateBadge();\n }\n\n public refreshTheme(location: CourierUnreadCountLocation) {\n this._location = location;\n this.updateBadge();\n }\n\n private updateBadge() {\n if (this._badge) {\n if (this._count > 0) {\n this._badge.textContent = this._count > 99 ? '99+' : this._count.toString();\n this._badge.style.display = 'block';\n } else {\n this._badge.style.display = 'none';\n }\n }\n }\n}\n\nregisterElement(CourierUnreadCountBadge);\n","import { CourierBaseElement, CourierIcon, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxMenuOption } from \"./courier-inbox-option-menu\";\nimport { CourierUnreadCountBadge } from \"./courier-unread-count-badge\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport class CourierInboxHeaderTitle extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-header-title';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _option: CourierInboxMenuOption;\n private _feedType?: CourierInboxFeedType;\n\n // Components\n private _style?: HTMLStyleElement;\n private _titleElement?: HTMLHeadingElement;\n private _iconElement?: CourierIcon;\n private _unreadBadge?: CourierUnreadCountBadge;\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(themeManager: CourierInboxThemeManager, option: CourierInboxMenuOption) {\n super();\n\n this._option = option;\n\n // Subscribe to the theme bus\n this._themeSubscription = themeManager.subscribe((_) => {\n this.refreshTheme(this._feedType ?? 'inbox');\n });\n\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n return `\n ${CourierInboxHeaderTitle.id} {\n display: flex;\n align-items: center;\n gap: 8px;\n position: relative;\n }\n\n ${CourierInboxHeaderTitle.id} courier-icon {\n display: flex;\n align-items: center;\n }\n\n ${CourierInboxHeaderTitle.id} h2 {\n margin: 0;\n font-family: ${theme.inbox?.header?.filters?.font?.family ?? 'inherit'};\n font-size: ${theme.inbox?.header?.filters?.font?.size ?? '18px'};\n font-weight: ${theme.inbox?.header?.filters?.font?.weight ?? '500'};\n color: ${theme.inbox?.header?.filters?.font?.color ?? 'red'};\n }\n\n ${CourierInboxHeaderTitle.id} courier-unread-count-badge {\n margin-left: 4px;\n }\n `;\n }\n\n onComponentMounted() {\n\n this._style = injectGlobalStyle(CourierInboxHeaderTitle.id, CourierInboxHeaderTitle.getStyles(this.theme));\n\n this._iconElement = new CourierIcon(undefined, this._option.icon.svg);\n this._titleElement = document.createElement('h2');\n this._unreadBadge = new CourierUnreadCountBadge({\n themeBus: this._themeSubscription.manager,\n location: 'header'\n });\n\n this.appendChild(this._iconElement);\n this.appendChild(this._titleElement);\n this.appendChild(this._unreadBadge);\n\n this.refreshTheme(this._feedType ?? 'inbox');\n\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private refreshTheme(feedType: CourierInboxFeedType) {\n this._feedType = feedType;\n if (this._style) {\n this._style.textContent = CourierInboxHeaderTitle.getStyles(this.theme);\n }\n this._unreadBadge?.refreshTheme('header');\n this.updateFilter();\n }\n\n public updateSelectedOption(option: CourierInboxMenuOption, feedType: CourierInboxFeedType, unreadCount: number) {\n this._option = option;\n this._feedType = feedType;\n this._unreadBadge?.setCount(unreadCount);\n this.updateFilter();\n }\n\n private updateFilter() {\n const theme = this._themeSubscription.manager.getTheme();\n switch (this._feedType) {\n case 'inbox':\n if (this._titleElement) {\n this._titleElement.textContent = theme.inbox?.header?.filters?.inbox?.text ?? 'Inbox';\n }\n this._iconElement?.updateSVG(theme.inbox?.header?.filters?.inbox?.icon?.svg ?? CourierIconSVGs.inbox);\n this._iconElement?.updateColor(theme.inbox?.header?.filters?.inbox?.icon?.color ?? 'red');\n break;\n case 'archive':\n if (this._titleElement) {\n this._titleElement.textContent = theme.inbox?.header?.filters?.archive?.text ?? 'Archive';\n }\n this._iconElement?.updateSVG(theme.inbox?.header?.filters?.archive?.icon?.svg ?? CourierIconSVGs.archive);\n this._iconElement?.updateColor(theme.inbox?.header?.filters?.archive?.icon?.color ?? 'red');\n break;\n }\n }\n}\n\nregisterElement(CourierInboxHeaderTitle);","import { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierIconSVGs, CourierFactoryElement, registerElement, CourierColors, injectGlobalStyle } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxOptionMenu, CourierInboxMenuOption } from \"./courier-inbox-option-menu\";\nimport { CourierInboxHeaderTitle } from \"./courier-inbox-header-title\";\nimport { CourierInboxHeaderFactoryProps } from \"../types/factories\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxDatastore } from \"../datastore/datastore\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport type CourierInboxHeaderMenuItemId = CourierInboxFeedType | 'markAllRead' | 'archiveAll' | 'archiveRead';\n\nexport class CourierInboxHeader extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-header';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _feedType: CourierInboxFeedType = 'inbox';\n private _unreadCount: number = 0;\n\n // Components\n private _titleSection?: CourierInboxHeaderTitle;\n private _filterMenu?: CourierInboxOptionMenu;\n private _actionMenu?: CourierInboxOptionMenu;\n private _style?: HTMLStyleElement;\n\n // Callbacks\n private _onFeedTypeChange: (feedType: CourierInboxFeedType) => void;\n\n static get observedAttributes() {\n return ['icon', 'title', 'feed-type'];\n }\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(props: { themeManager: CourierInboxThemeManager, onFeedTypeChange: (feedType: CourierInboxFeedType) => void }) {\n super();\n\n // Subscribe to the theme bus\n this._themeSubscription = props.themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n // Set the on feed type change callback\n this._onFeedTypeChange = props.onFeedTypeChange;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxHeader.id, CourierInboxHeader.getStyles(this.theme));\n }\n\n onComponentUmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private getFilterOptions(): CourierInboxMenuOption[] {\n const theme = this._themeSubscription.manager.getTheme();\n const filterMenu = theme.inbox?.header?.menus?.filters;\n\n return [\n {\n id: 'inbox',\n text: filterMenu?.inbox?.text ?? 'Inbox',\n icon: {\n color: filterMenu?.inbox?.icon?.color ?? 'red',\n svg: filterMenu?.inbox?.icon?.svg ?? CourierIconSVGs.inbox\n },\n selectionIcon: {\n color: theme.inbox?.header?.menus?.popup?.list?.selectionIcon?.color ?? 'red',\n svg: theme.inbox?.header?.menus?.popup?.list?.selectionIcon?.svg ?? CourierIconSVGs.check\n },\n onClick: (option: CourierInboxMenuOption) => {\n this.handleOptionMenuItemClick('inbox', option);\n }\n },\n {\n id: 'archive',\n text: filterMenu?.archive?.text ?? 'Archive',\n icon: {\n color: filterMenu?.archive?.icon?.color ?? 'red',\n svg: filterMenu?.archive?.icon?.svg ?? CourierIconSVGs.archive\n },\n selectionIcon: {\n color: theme.inbox?.header?.menus?.popup?.list?.selectionIcon?.color ?? 'red',\n svg: theme.inbox?.header?.menus?.popup?.list?.selectionIcon?.svg ?? CourierIconSVGs.check\n },\n onClick: (option: CourierInboxMenuOption) => {\n this.handleOptionMenuItemClick('archive', option);\n }\n }\n ];\n }\n\n private getActionOptions(): CourierInboxMenuOption[] {\n const theme = this._themeSubscription.manager.getTheme();\n const actionMenu = theme.inbox?.header?.menus?.actions;\n\n return [\n {\n id: 'markAllRead',\n text: actionMenu?.markAllRead?.text ?? 'Mark All as Read',\n icon: {\n color: actionMenu?.markAllRead?.icon?.color ?? 'red',\n svg: actionMenu?.markAllRead?.icon?.svg ?? CourierIconSVGs.inbox\n },\n selectionIcon: null,\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.readAllMessages({ canCallApi: true });\n }\n },\n {\n id: 'archiveAll',\n text: actionMenu?.archiveAll?.text ?? 'Archive All',\n icon: {\n color: actionMenu?.archiveAll?.icon?.color ?? 'red',\n svg: actionMenu?.archiveAll?.icon?.svg ?? CourierIconSVGs.archive\n },\n selectionIcon: null,\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.archiveAllMessages({ canCallApi: true });\n }\n },\n {\n id: 'archiveRead',\n text: actionMenu?.archiveRead?.text ?? 'Archive Read',\n icon: {\n color: actionMenu?.archiveRead?.icon?.color ?? 'red',\n svg: actionMenu?.archiveRead?.icon?.svg ?? CourierIconSVGs.archive\n },\n selectionIcon: null,\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.archiveReadMessages({ canCallApi: true });\n }\n }\n ];\n }\n\n private refreshTheme() {\n\n if (this._style) {\n this._style.textContent = CourierInboxHeader.getStyles(this.theme);\n }\n\n // Update menus\n this._filterMenu?.setOptions(this.getFilterOptions());\n this._actionMenu?.setOptions(this.getActionOptions());\n }\n\n private handleOptionMenuItemClick(feedType: CourierInboxFeedType, option: CourierInboxMenuOption) {\n this._feedType = feedType;\n if (this._titleSection) {\n this._titleSection.updateSelectedOption(option, this._feedType, this._feedType === 'inbox' ? this._unreadCount : 0);\n }\n this._onFeedTypeChange(feedType);\n }\n\n public render(props: CourierInboxHeaderFactoryProps): void {\n this._feedType = props.feedType;\n this._unreadCount = props.unreadCount;\n const option = this.getFilterOptions().find(opt => ['inbox', 'archive'].includes(opt.id) && opt.id === this._feedType);\n if (option) {\n this._titleSection?.updateSelectedOption(option, this._feedType, this._feedType === 'inbox' ? this._unreadCount : 0);\n this._filterMenu?.selectOption(option);\n }\n }\n\n build(newElement: HTMLElement | undefined | null) {\n super.build(newElement);\n this.refreshTheme();\n }\n\n defaultElement(): HTMLElement {\n const filterOptions = this.getFilterOptions();\n\n this._titleSection = new CourierInboxHeaderTitle(this._themeSubscription.manager, filterOptions[0]);\n this._filterMenu = new CourierInboxOptionMenu(this._themeSubscription.manager, 'filters', true, filterOptions, () => {\n this._actionMenu?.closeMenu();\n });\n this._actionMenu = new CourierInboxOptionMenu(this._themeSubscription.manager, 'actions', false, this.getActionOptions(), () => {\n this._filterMenu?.closeMenu();\n });\n\n // Selected default menu\n this._filterMenu.selectOption(filterOptions[0]);\n\n // Create flexible spacer\n const spacer = document.createElement('div');\n spacer.className = 'spacer';\n\n // Create and setup actions section\n const actions = document.createElement('div');\n actions.className = 'actions';\n actions.appendChild(this._filterMenu);\n actions.appendChild(this._actionMenu);\n\n const headerContent = document.createElement('div');\n headerContent.className = 'header-content';\n headerContent.appendChild(this._titleSection);\n headerContent.appendChild(spacer);\n headerContent.appendChild(actions);\n\n return headerContent;\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n return `\n ${CourierInboxHeader.id} {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n ${CourierInboxHeader.id} .header-content {\n padding: 10px 10px 10px 16px;\n background-color: ${theme.inbox?.header?.backgroundColor ?? CourierColors.white[500]};\n box-shadow: ${theme.inbox?.header?.shadow ?? `0px 1px 0px 0px red`};\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n z-index: 100;\n }\n\n ${CourierInboxHeader.id} .spacer {\n flex: 1;\n }\n\n ${CourierInboxHeader.id} .actions {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n `;\n }\n\n}\n\nregisterElement(CourierInboxHeader);\n","import { CourierInboxDatastore } from \"./datastore\";\nimport { CourierInboxDatastoreEvents } from \"./datatore-events\";\n\nexport class CourierInboxDataStoreListener {\n readonly events: CourierInboxDatastoreEvents;\n\n constructor(events: CourierInboxDatastoreEvents) {\n this.events = events;\n }\n\n remove() {\n CourierInboxDatastore.shared.removeDataStoreListener(this);\n }\n\n}\n","import { CourierColors, CourierIconSVGs, SystemThemeMode, CourierFontTheme, CourierIconTheme, CourierButtonTheme, CourierIconButtonTheme } from \"@trycourier/courier-ui-core\";\n\n// Re-export common types from core for convenience\nexport type CourierInboxFontTheme = CourierFontTheme;\nexport type CourierInboxIconTheme = CourierIconTheme;\nexport type CourierInboxButtonTheme = CourierButtonTheme;\nexport type CourierInboxIconButtonTheme = CourierIconButtonTheme;\n\nexport type CourierInboxFilterItemTheme = {\n icon?: CourierInboxIconTheme;\n text?: string;\n}\n\nexport type CourierInboxUnreadDotIndicatorTheme = {\n backgroundColor?: string;\n borderRadius?: string;\n height?: string;\n width?: string;\n}\n\nexport type CourierInboxUnreadCountIndicatorTheme = {\n font?: CourierInboxFontTheme;\n backgroundColor?: string;\n borderRadius?: string;\n padding?: string;\n}\n\nexport type CourierInboxMenuButtonTheme = CourierInboxIconButtonTheme & {\n unreadDotIndicator?: CourierInboxUnreadDotIndicatorTheme;\n}\n\nexport type CourierInboxPopupTheme = {\n backgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n list?: {\n font?: CourierInboxFontTheme;\n selectionIcon?: CourierInboxIconTheme;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n divider?: string;\n };\n}\n\nexport type CourierInboxListItemTheme = {\n unreadIndicatorColor?: string;\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n title?: CourierInboxFontTheme;\n subtitle?: CourierInboxFontTheme;\n time?: CourierInboxFontTheme;\n archiveIcon?: CourierInboxIconTheme;\n divider?: string;\n actions?: {\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n font?: CourierInboxFontTheme;\n }\n menu?: {\n enabled?: boolean;\n backgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n longPress?: {\n displayDuration?: number;\n vibrationDuration?: number;\n };\n item?: {\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n borderRadius?: string;\n read?: CourierInboxIconTheme;\n unread?: CourierInboxIconTheme;\n archive?: CourierInboxIconTheme;\n unarchive?: CourierInboxIconTheme;\n };\n };\n}\n\nexport type CourierInboxSkeletonLoadingStateTheme = {\n animation?: {\n barColor?: string;\n barHeight?: string;\n barBorderRadius?: string;\n duration?: string;\n },\n divider?: string;\n}\n\nexport type CourierInboxInfoStateTheme = {\n title?: {\n font?: CourierInboxFontTheme;\n text?: string;\n },\n button?: CourierInboxButtonTheme;\n}\n\nexport type CourierMenuItemTheme = {\n icon?: CourierInboxIconTheme;\n text?: string;\n}\n\nexport type CourierFilterMenuTheme = {\n button?: CourierInboxIconButtonTheme;\n inbox?: CourierMenuItemTheme;\n archive?: CourierMenuItemTheme;\n}\n\nexport type CourierActionMenuTheme = {\n button?: CourierInboxIconButtonTheme;\n markAllRead?: CourierMenuItemTheme;\n archiveAll?: CourierMenuItemTheme;\n archiveRead?: CourierMenuItemTheme;\n}\n\nexport type CourierInboxTheme = {\n popup?: {\n button?: CourierInboxMenuButtonTheme;\n window?: {\n backgroundColor?: string;\n borderRadius?: string;\n border?: string;\n shadow?: string;\n };\n }\n inbox?: {\n header?: {\n backgroundColor?: string;\n shadow?: string;\n filters?: {\n font?: CourierInboxFontTheme;\n inbox?: CourierInboxFilterItemTheme;\n archive?: CourierInboxFilterItemTheme;\n unreadIndicator?: CourierInboxUnreadCountIndicatorTheme;\n }\n menus?: {\n popup?: CourierInboxPopupTheme;\n filters?: CourierFilterMenuTheme;\n actions?: CourierActionMenuTheme;\n }\n }\n list?: {\n backgroundColor?: string;\n item?: CourierInboxListItemTheme;\n },\n loading?: CourierInboxSkeletonLoadingStateTheme,\n empty?: CourierInboxInfoStateTheme,\n error?: CourierInboxInfoStateTheme\n }\n};\n\nexport const defaultLightTheme: CourierInboxTheme = {\n popup: {\n button: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.inbox\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.black[500_10],\n activeBackgroundColor: CourierColors.black[500_20],\n unreadDotIndicator: {\n backgroundColor: CourierColors.blue[500],\n borderRadius: '50%',\n height: '8px',\n width: '8px',\n }\n },\n window: {\n backgroundColor: CourierColors.white[500],\n borderRadius: '8px',\n border: `1px solid ${CourierColors.gray[500]}`,\n shadow: `0px 8px 16px -4px ${CourierColors.gray[500]}`\n }\n },\n inbox: {\n header: {\n backgroundColor: CourierColors.white[500],\n shadow: `0px 1px 0px 0px ${CourierColors.gray[500]}`,\n filters: {\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '18px'\n },\n inbox: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.inbox\n },\n text: 'Inbox'\n },\n archive: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n },\n menus: {\n popup: {\n backgroundColor: CourierColors.white[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '4px',\n shadow: `0px 4px 8px -2px ${CourierColors.gray[500]}`,\n list: {\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n divider: `none`,\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n },\n selectionIcon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.check\n }\n }\n },\n filters: {\n button: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.filter\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.black[500_10],\n activeBackgroundColor: CourierColors.black[500_20],\n },\n inbox: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.inbox\n },\n text: 'Inbox'\n },\n archive: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive'\n }\n },\n actions: {\n button: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.overflow\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.black[500_10],\n activeBackgroundColor: CourierColors.black[500_20],\n },\n markAllRead: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.read\n },\n text: 'Read All'\n },\n archiveAll: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive All'\n },\n archiveRead: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.archiveRead\n },\n text: 'Archive Read'\n }\n },\n }\n },\n list: {\n backgroundColor: CourierColors.white[500],\n item: {\n backgroundColor: 'transparent',\n unreadIndicatorColor: CourierColors.blue[500],\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n actions: {\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '4px',\n shadow: '0px 1px 2px 0px rgba(0, 0, 0, 0.06)',\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n }\n },\n title: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n },\n subtitle: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n time: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n divider: `1px solid ${CourierColors.gray[200]}`,\n menu: {\n enabled: true,\n backgroundColor: CourierColors.white[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '4px',\n shadow: `0px 2px 4px -2px ${CourierColors.gray[500]}`,\n longPress: {\n displayDuration: 4000,\n vibrationDuration: 50\n },\n item: {\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n borderRadius: '0px',\n read: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.read\n },\n unread: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.unread\n },\n archive: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.archive\n },\n unarchive: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.unarchive\n }\n }\n }\n }\n },\n loading: {\n animation: {\n barColor: CourierColors.gray[500],\n barHeight: '14px',\n barBorderRadius: '14px',\n duration: '2s'\n },\n divider: `1px solid ${CourierColors.gray[200]}`\n },\n empty: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.black[500],\n }\n },\n button: {\n text: 'Refresh'\n }\n },\n error: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.black[500],\n }\n },\n button: {\n text: 'Retry'\n }\n }\n }\n};\n\nexport const defaultDarkTheme: CourierInboxTheme = {\n popup: {\n button: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.inbox\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n unreadDotIndicator: {\n backgroundColor: CourierColors.blue[500],\n borderRadius: '50%',\n height: '8px',\n width: '8px',\n }\n },\n window: {\n backgroundColor: CourierColors.black[500],\n borderRadius: '8px',\n border: `1px solid ${CourierColors.gray[400]}`,\n shadow: `0px 4px 8px -2px ${CourierColors.white[500_20]}`\n }\n },\n inbox: {\n header: {\n backgroundColor: CourierColors.black[500],\n shadow: `0px 1px 0px 0px ${CourierColors.gray[400]}`,\n filters: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '18px'\n },\n inbox: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.inbox\n },\n text: 'Inbox'\n },\n archive: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n },\n menus: {\n popup: {\n backgroundColor: CourierColors.black[500],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '4px',\n shadow: `0px 4px 8px -2px ${CourierColors.white[500_20]}`,\n list: {\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n divider: `none`,\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n selectionIcon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.check\n }\n }\n },\n filters: {\n button: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.filter\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n },\n inbox: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.inbox\n },\n text: 'Inbox'\n },\n archive: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive'\n }\n },\n actions: {\n button: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.overflow\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n },\n markAllRead: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.read\n },\n text: 'Read All'\n },\n archiveAll: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.archive\n },\n text: 'Archive All'\n },\n archiveRead: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.archiveRead\n },\n text: 'Archive Read'\n }\n },\n }\n },\n list: {\n backgroundColor: CourierColors.black[500],\n item: {\n backgroundColor: 'transparent',\n unreadIndicatorColor: CourierColors.blue[500],\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n actions: {\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '4px',\n shadow: `0px 1px 2px 0px ${CourierColors.white[500_10]}`,\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n }\n },\n title: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n subtitle: {\n color: CourierColors.gray[500],\n family: undefined,\n size: '14px'\n },\n time: {\n color: CourierColors.gray[500],\n family: undefined,\n size: '12px'\n },\n divider: `1px solid ${CourierColors.gray[400]}`,\n menu: {\n enabled: true,\n backgroundColor: CourierColors.black[500],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '4px',\n shadow: `0px 2px 4px -2px ${CourierColors.white[500_20]}`,\n longPress: {\n displayDuration: 4000,\n vibrationDuration: 50\n },\n item: {\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n borderRadius: '0px',\n read: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.read\n },\n unread: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.unread\n },\n archive: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.archive\n },\n unarchive: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.unarchive\n }\n }\n }\n }\n },\n loading: {\n animation: {\n barColor: CourierColors.gray[400],\n barHeight: '14px',\n barBorderRadius: '14px',\n duration: '2s'\n },\n divider: `1px solid ${CourierColors.gray[400]}`\n },\n empty: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.white[500],\n }\n },\n button: {\n text: 'Refresh'\n }\n },\n error: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.white[500],\n }\n },\n button: {\n text: 'Retry'\n }\n }\n }\n};\n\n// Deep merge the themes, only overwriting non-optional properties\nexport const mergeTheme = (mode: SystemThemeMode, theme: CourierInboxTheme): CourierInboxTheme => {\n const defaultTheme = mode === 'light' ? defaultLightTheme : defaultDarkTheme;\n return {\n popup: {\n button: {\n ...defaultTheme.popup?.button,\n ...theme.popup?.button,\n icon: {\n ...defaultTheme.popup?.button?.icon,\n ...theme.popup?.button?.icon\n },\n unreadDotIndicator: {\n ...defaultTheme.popup?.button?.unreadDotIndicator,\n ...theme.popup?.button?.unreadDotIndicator\n }\n },\n window: {\n ...defaultTheme.popup?.window,\n ...theme.popup?.window\n }\n },\n inbox: {\n header: {\n ...defaultTheme.inbox?.header,\n ...theme.inbox?.header,\n filters: {\n ...defaultTheme.inbox?.header?.filters,\n ...theme.inbox?.header?.filters,\n inbox: {\n ...defaultTheme.inbox?.header?.filters?.inbox,\n ...theme.inbox?.header?.filters?.inbox,\n icon: {\n ...defaultTheme.inbox?.header?.filters?.inbox?.icon,\n ...theme.inbox?.header?.filters?.inbox?.icon\n }\n },\n archive: {\n ...defaultTheme.inbox?.header?.filters?.archive,\n ...theme.inbox?.header?.filters?.archive,\n icon: {\n ...defaultTheme.inbox?.header?.filters?.archive?.icon,\n ...theme.inbox?.header?.filters?.archive?.icon\n }\n },\n unreadIndicator: {\n ...defaultTheme.inbox?.header?.filters?.unreadIndicator,\n ...theme.inbox?.header?.filters?.unreadIndicator\n }\n },\n menus: {\n ...defaultTheme.inbox?.header?.menus,\n ...theme.inbox?.header?.menus,\n popup: {\n ...defaultTheme.inbox?.header?.menus?.popup,\n ...theme.inbox?.header?.menus?.popup,\n list: {\n ...defaultTheme.inbox?.header?.menus?.popup?.list,\n ...theme.inbox?.header?.menus?.popup?.list,\n font: {\n ...defaultTheme.inbox?.header?.menus?.popup?.list?.font,\n ...theme.inbox?.header?.menus?.popup?.list?.font\n },\n selectionIcon: {\n ...defaultTheme.inbox?.header?.menus?.popup?.list?.selectionIcon,\n ...theme.inbox?.header?.menus?.popup?.list?.selectionIcon\n }\n }\n },\n filters: {\n ...defaultTheme.inbox?.header?.menus?.filters,\n ...theme.inbox?.header?.menus?.filters,\n inbox: {\n ...defaultTheme.inbox?.header?.menus?.filters?.inbox,\n ...theme.inbox?.header?.menus?.filters?.inbox,\n icon: {\n ...defaultTheme.inbox?.header?.menus?.filters?.inbox?.icon,\n ...theme.inbox?.header?.menus?.filters?.inbox?.icon\n }\n },\n archive: {\n ...defaultTheme.inbox?.header?.menus?.filters?.archive,\n ...theme.inbox?.header?.menus?.filters?.archive,\n icon: {\n ...defaultTheme.inbox?.header?.menus?.filters?.archive?.icon,\n ...theme.inbox?.header?.menus?.filters?.archive?.icon\n }\n }\n },\n actions: {\n ...defaultTheme.inbox?.header?.menus?.actions,\n ...theme.inbox?.header?.menus?.actions,\n markAllRead: {\n ...defaultTheme.inbox?.header?.menus?.actions?.markAllRead,\n ...theme.inbox?.header?.menus?.actions?.markAllRead,\n icon: {\n ...defaultTheme.inbox?.header?.menus?.actions?.markAllRead?.icon,\n ...theme.inbox?.header?.menus?.actions?.markAllRead?.icon\n }\n },\n archiveAll: {\n ...defaultTheme.inbox?.header?.menus?.actions?.archiveAll,\n ...theme.inbox?.header?.menus?.actions?.archiveAll,\n icon: {\n ...defaultTheme.inbox?.header?.menus?.actions?.archiveAll?.icon,\n ...theme.inbox?.header?.menus?.actions?.archiveAll?.icon\n }\n },\n archiveRead: {\n ...defaultTheme.inbox?.header?.menus?.actions?.archiveRead,\n ...theme.inbox?.header?.menus?.actions?.archiveRead,\n icon: {\n ...defaultTheme.inbox?.header?.menus?.actions?.archiveRead?.icon,\n ...theme.inbox?.header?.menus?.actions?.archiveRead?.icon\n }\n }\n }\n }\n },\n list: {\n ...defaultTheme.inbox?.list,\n ...theme.inbox?.list,\n item: {\n ...defaultTheme.inbox?.list?.item,\n ...theme.inbox?.list?.item,\n menu: {\n ...defaultTheme.inbox?.list?.item?.menu,\n ...theme.inbox?.list?.item?.menu,\n item: {\n ...defaultTheme.inbox?.list?.item?.menu?.item,\n ...theme.inbox?.list?.item?.menu?.item,\n read: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.read,\n ...theme.inbox?.list?.item?.menu?.item?.read\n },\n unread: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.unread,\n ...theme.inbox?.list?.item?.menu?.item?.unread\n },\n archive: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.archive,\n ...theme.inbox?.list?.item?.menu?.item?.archive\n },\n unarchive: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.unarchive,\n ...theme.inbox?.list?.item?.menu?.item?.unarchive\n }\n }\n }\n }\n },\n loading: {\n ...defaultTheme.inbox?.loading,\n ...theme.inbox?.loading,\n },\n empty: {\n ...defaultTheme.inbox?.empty,\n ...theme.inbox?.empty\n },\n error: {\n ...defaultTheme.inbox?.error,\n ...theme.inbox?.error\n }\n }\n };\n};\n","import { CourierThemeManager, CourierThemeSubscription, SystemThemeMode } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme, defaultDarkTheme, defaultLightTheme, mergeTheme } from \"./courier-inbox-theme\";\n\nexport interface CourierInboxThemeSubscription extends CourierThemeSubscription<CourierInboxTheme> {\n manager: CourierInboxThemeManager;\n}\n\n/**\n * Inbox-specific theme manager that extends the abstract CourierThemeManager.\n * Provides inbox theme management with light/dark mode support.\n */\nexport class CourierInboxThemeManager extends CourierThemeManager<CourierInboxTheme> {\n\n // Event ID for inbox theme changes\n protected readonly THEME_CHANGE_EVENT: string = 'courier_inbox_theme_change';\n\n constructor(initialTheme: CourierInboxTheme) {\n super(initialTheme);\n }\n\n /**\n * Get the default light theme for inbox\n */\n protected getDefaultLightTheme(): CourierInboxTheme {\n return defaultLightTheme;\n }\n\n /**\n * Get the default dark theme for inbox\n */\n protected getDefaultDarkTheme(): CourierInboxTheme {\n return defaultDarkTheme;\n }\n\n /**\n * Merge the inbox theme with defaults\n */\n protected mergeTheme(mode: SystemThemeMode, theme: CourierInboxTheme): CourierInboxTheme {\n return mergeTheme(mode, theme);\n }\n\n /**\n * Subscribe to inbox theme changes\n * @param callback - Function to run when the theme changes\n * @returns Object with unsubscribe method to stop listening\n */\n public subscribe(callback: (theme: CourierInboxTheme) => void): CourierInboxThemeSubscription {\n const baseSubscription = super.subscribe(callback);\n return {\n ...baseSubscription,\n manager: this\n };\n }\n\n}\n","import { AuthenticationListener, Courier, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierInboxList } from \"./courier-inbox-list\";\nimport { CourierInboxHeader } from \"./courier-inbox-header\";\nimport { CourierBaseElement, CourierComponentThemeMode, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxDataStoreListener } from \"../datastore/datastore-listener\";\nimport { CourierInboxDatastore } from \"../datastore/datastore\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from \"../types/factories\";\nimport { CourierInboxTheme, defaultLightTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierUnreadCountBadge } from \"./courier-unread-count-badge\";\n\nexport class CourierInbox extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox';\n }\n\n // State\n private _currentFeed: CourierInboxFeedType = 'inbox';\n\n /** Returns the current feed type. */\n get currentFeed(): CourierInboxFeedType {\n return this._currentFeed;\n }\n\n // Theming\n // Theme manager instance for handling theming logic\n private _themeManager: CourierInboxThemeManager;\n\n /** Returns the current theme object. */\n get theme() {\n return this._themeManager.getTheme();\n }\n\n /**\n * Set the light theme for the inbox.\n * @param theme The light theme object to set.\n */\n public setLightTheme(theme: CourierInboxTheme) {\n this._themeManager.setLightTheme(theme);\n }\n\n /**\n * Set the dark theme for the inbox.\n * @param theme The dark theme object to set.\n */\n public setDarkTheme(theme: CourierInboxTheme) {\n this._themeManager.setDarkTheme(theme);\n }\n\n /**\n * Set the theme mode (light/dark/system).\n * @param mode The theme mode to set.\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._themeManager.setMode(mode);\n }\n\n // Components\n private _inboxStyle?: HTMLStyleElement;\n private _unreadIndicatorStyle?: HTMLStyleElement;\n private _list?: CourierInboxList;\n private _datastoreListener: CourierInboxDataStoreListener | undefined;\n private _authListener: AuthenticationListener | undefined;\n\n // Header\n private _header?: CourierInboxHeader;\n private _headerFactory: ((props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) | undefined | null = undefined;\n\n // List\n private _onMessageClick?: (props: CourierInboxListItemFactoryProps) => void;\n private _onMessageActionClick?: (props: CourierInboxListItemActionFactoryProps) => void;\n private _onMessageLongPress?: (props: CourierInboxListItemFactoryProps) => void;\n\n // Default props\n private _defaultProps = {\n title: 'Inbox',\n icon: CourierIconSVGs.inbox,\n feedType: this._currentFeed,\n height: 'auto'\n };\n\n static get observedAttributes() {\n return ['height', 'light-theme', 'dark-theme', 'mode', 'message-click', 'message-action-click', 'message-long-press'];\n }\n\n constructor(themeManager?: CourierInboxThemeManager) {\n super();\n this._themeManager = themeManager ?? new CourierInboxThemeManager(defaultLightTheme);\n }\n\n onComponentMounted() {\n\n // Inject style\n this._inboxStyle = injectGlobalStyle(CourierInbox.id, this.getStyles());\n this._unreadIndicatorStyle = injectGlobalStyle(CourierUnreadCountBadge.id, CourierUnreadCountBadge.getStyles(this.theme));\n\n // Header\n this._header = new CourierInboxHeader({\n themeManager: this._themeManager,\n onFeedTypeChange: (feedType: CourierInboxFeedType) => {\n this.setFeedType(feedType);\n }\n });\n this._header.build(undefined);\n this.appendChild(this._header);\n\n // Create list and ensure it's properly initialized\n this._list = new CourierInboxList({\n themeManager: this._themeManager,\n canClickListItems: false,\n canLongPressListItems: false,\n onRefresh: () => {\n this.refresh();\n },\n onPaginationTrigger: async (feedType: CourierInboxFeedType) => {\n try {\n await CourierInboxDatastore.shared.fetchNextPageOfMessages({\n feedType: feedType\n });\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to fetch next page of messages:', error);\n }\n },\n onMessageClick: (message, index) => {\n CourierInboxDatastore.shared.clickMessage({ message });\n\n this.dispatchEvent(new CustomEvent('message-click', {\n detail: { message, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageClick?.({ message, index });\n },\n onMessageActionClick: (message, action, index) => {\n\n // TODO: Track action click?\n\n this.dispatchEvent(new CustomEvent('message-action-click', {\n detail: { message, action, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageActionClick?.({ message, action, index });\n },\n onMessageLongPress: (message, index) => {\n this.dispatchEvent(new CustomEvent('message-long-press', {\n detail: { message, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageLongPress?.({ message, index });\n }\n });\n\n this.refreshTheme();\n\n this.appendChild(this._list);\n\n // Attach the datastore listener\n this._datastoreListener = new CourierInboxDataStoreListener({\n onError: (error: Error) => {\n this._list?.setError(error);\n },\n onDataSetChange: (dataSet: InboxDataSet, feedType: CourierInboxFeedType) => {\n if (this._currentFeed === feedType) {\n this._list?.setDataSet(dataSet);\n this.updateHeader();\n }\n },\n onPageAdded: (dataSet: InboxDataSet, feedType: CourierInboxFeedType) => {\n if (this._currentFeed === feedType) {\n this._list?.addPage(dataSet);\n this.updateHeader();\n }\n },\n onMessageAdd: (message: InboxMessage, index: number, feedType: CourierInboxFeedType) => {\n if (this._currentFeed === feedType) {\n this._list?.addMessage(message, index);\n this.updateHeader();\n }\n },\n onMessageRemove: (_: InboxMessage, index: number, feedType: CourierInboxFeedType) => {\n if (this._currentFeed === feedType) {\n this._list?.removeMessage(index);\n this.updateHeader();\n }\n },\n onMessageUpdate: (message: InboxMessage, index: number, feedType: CourierInboxFeedType) => {\n if (this._currentFeed === feedType) {\n this._list?.updateMessage(message, index);\n this.updateHeader();\n }\n },\n onUnreadCountChange: (_: number) => {\n this.updateHeader();\n }\n });\n\n CourierInboxDatastore.shared.addDataStoreListener(this._datastoreListener);\n\n // Refresh the theme on change\n this._themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n // Listen for authentication state changes\n this._authListener = Courier.shared.addAuthenticationListener(async ({ userId }) => {\n if (userId) {\n await this.refresh();\n }\n });\n\n // Refresh the inbox if the user is already signed in\n if (!Courier.shared.client?.options.userId) {\n Courier.shared.client?.options.logger.error('No user signed in. Please call Courier.shared.signIn(...) to load the inbox.')\n return;\n }\n\n this.refresh();\n\n }\n\n onComponentUnmounted() {\n this._themeManager.cleanup();\n this._datastoreListener?.remove();\n this._authListener?.remove();\n this._inboxStyle?.remove();\n this._unreadIndicatorStyle?.remove();\n }\n\n private refreshTheme() {\n this._list?.refreshInfoStateThemes();\n if (this._inboxStyle) {\n this._inboxStyle.textContent = this.getStyles();\n }\n if (this._unreadIndicatorStyle) {\n this._unreadIndicatorStyle.textContent = CourierUnreadCountBadge.getStyles(this.theme);\n }\n }\n\n private getStyles(): string {\n return `\n ${CourierInbox.id} {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: ${this._defaultProps.height};\n }\n\n ${CourierInbox.id} courier-inbox-list {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n }\n `;\n }\n\n /**\n * Sets a custom header factory for the inbox.\n * @param factory - A function that returns an HTMLElement to render as the header.\n */\n public setHeader(factory: (props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) {\n this._headerFactory = factory;\n this.updateHeader();\n }\n\n /**\n * Removes the custom header factory from the inbox, reverting to the default header.\n */\n public removeHeader() {\n this._headerFactory = null;\n this.updateHeader();\n }\n\n /**\n * Sets a custom loading state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the loading state.\n */\n public setLoadingState(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setLoadingStateFactory(factory);\n }\n\n /**\n * Sets a custom empty state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the empty state.\n */\n public setEmptyState(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setEmptyStateFactory(factory);\n }\n\n /**\n * Sets a custom error state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the error state.\n */\n public setErrorState(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setErrorStateFactory(factory);\n }\n\n /**\n * Sets a custom list item factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as a list item.\n */\n public setListItem(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setListItemFactory(factory);\n }\n\n /**\n * Sets a custom pagination item factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as a pagination item.\n */\n public setPaginationItem(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setPaginationItemFactory(factory);\n }\n\n /**\n * Registers a handler for message click events.\n * @param handler - A function to be called when a message is clicked.\n */\n public onMessageClick(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._onMessageClick = handler;\n\n // Tell the list if we can click. This will update styles if needed.\n this._list?.setCanClickListItems(handler !== undefined);\n }\n\n /**\n * Registers a handler for message action click events.\n * @param handler - A function to be called when a message action is clicked.\n */\n public onMessageActionClick(handler?: (props: CourierInboxListItemActionFactoryProps) => void) {\n this._onMessageActionClick = handler;\n }\n\n /**\n * Registers a handler for message long press events.\n * @param handler - A function to be called when a message is long-pressed.\n */\n public onMessageLongPress(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._onMessageLongPress = handler;\n\n // Tell the list if we can long press. This will update styles if needed.\n this._list?.setCanLongPressListItems(handler !== undefined);\n }\n\n /**\n * Sets the feed type for the inbox (e.g., \"inbox\" or \"archive\").\n * @param feedType - The feed type to display.\n */\n public setFeedType(feedType: CourierInboxFeedType) {\n\n // Do not swap if current feed is same\n if (this._currentFeed === feedType) {\n return;\n }\n\n // Update state\n this._currentFeed = feedType;\n\n // Update components\n this._list?.setFeedType(feedType);\n this.updateHeader();\n\n // Load data\n this.load({\n canUseCache: true\n });\n }\n\n private updateHeader() {\n\n const props = {\n feedType: this._currentFeed,\n unreadCount: CourierInboxDatastore.shared.unreadCount,\n messageCount: this._list?.messages.length ?? 0\n };\n\n switch (this._headerFactory) {\n case undefined:\n this._header?.render(props);\n break;\n case null:\n this._header?.build(null);\n break;\n default:\n const headerElement = this._headerFactory(props);\n this._header?.build(headerElement);\n break;\n }\n\n }\n\n private async load(props: { canUseCache: boolean }) {\n await CourierInboxDatastore.shared.load(props);\n await CourierInboxDatastore.shared.listenForUpdates();\n }\n\n /**\n * Forces a reload of the inbox data, bypassing the cache.\n */\n public refresh() {\n this.load({\n canUseCache: false\n });\n }\n\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\n if (oldValue === newValue) return;\n switch (name) {\n case 'height':\n const height = newValue || this._defaultProps.height;\n this.style.height = height;\n break;\n case 'message-click':\n if (newValue) {\n try {\n this._onMessageClick = new Function('props', newValue) as (props: CourierInboxListItemFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-click handler:', error);\n }\n } else {\n this._onMessageClick = undefined;\n }\n break;\n case 'message-action-click':\n if (newValue) {\n try {\n this._onMessageActionClick = new Function('props', newValue) as (props: CourierInboxListItemActionFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-action-click handler:', error);\n }\n } else {\n this._onMessageActionClick = undefined;\n }\n break;\n case 'message-long-press':\n if (newValue) {\n try {\n this._onMessageLongPress = new Function('props', newValue) as (props: CourierInboxListItemFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-long-press handler:', error);\n }\n } else {\n this._onMessageLongPress = undefined;\n }\n break;\n case 'light-theme':\n if (newValue) {\n this.setLightTheme(JSON.parse(newValue));\n }\n break;\n case 'dark-theme':\n if (newValue) {\n this.setDarkTheme(JSON.parse(newValue));\n }\n break;\n case 'mode':\n this._themeManager.setMode(newValue as CourierComponentThemeMode);\n break;\n }\n }\n\n}\n\nregisterElement(CourierInbox);\n","import { CourierColors, CourierFactoryElement, CourierIconButton, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\n\nexport class CourierInboxMenuButton extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-menu-button';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // Components\n private _style?: HTMLStyleElement;\n private _container?: HTMLDivElement;\n private _triggerButton?: CourierIconButton;\n private _unreadBadge?: HTMLDivElement;\n\n get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(themeBus: CourierInboxThemeManager) {\n super();\n this._themeSubscription = themeBus.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme();\n });\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxMenuButton.id, CourierInboxMenuButton.getStyles(this.theme));\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n defaultElement(): HTMLElement {\n\n // Create trigger button container\n this._container = document.createElement('div');\n this._container.className = 'menu-button-container';\n\n // Create trigger button\n this._triggerButton = new CourierIconButton(CourierIconSVGs.inbox);\n\n // Create unread badge (red 4x4 circle)\n this._unreadBadge = document.createElement('div');\n this._unreadBadge.className = 'unread-badge';\n this._unreadBadge.style.display = 'none'; // Hidden by default\n\n this._container.appendChild(this._triggerButton);\n this._container.appendChild(this._unreadBadge);\n this.appendChild(this._container);\n\n // Set the theme of the button\n this.refreshTheme();\n\n return this._container;\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n return `\n ${CourierInboxMenuButton.id} .menu-button-container {\n position: relative;\n display: inline-block;\n }\n \n ${CourierInboxMenuButton.id} .unread-badge {\n position: absolute;\n top: 2px;\n right: 2px;\n pointer-events: none;\n width: ${theme.popup?.button?.unreadDotIndicator?.height ?? '8px'};\n height: ${theme.popup?.button?.unreadDotIndicator?.width ?? '8px'};\n background: ${theme.popup?.button?.unreadDotIndicator?.backgroundColor ?? 'red'};\n border-radius: ${theme.popup?.button?.unreadDotIndicator?.borderRadius ?? '50%'};\n display: none;\n z-index: 1;\n }\n `;\n }\n\n public onUnreadCountChange(unreadCount: number): void {\n if (this._unreadBadge) {\n this._unreadBadge.style.display = unreadCount > 0 ? 'block' : 'none';\n }\n // Optionally, update theme if needed\n this.refreshTheme();\n }\n\n private refreshTheme() {\n this._triggerButton?.updateIconColor(this.theme?.popup?.button?.icon?.color ?? CourierColors.black[500]);\n this._triggerButton?.updateIconSVG(this.theme?.popup?.button?.icon?.svg ?? CourierIconSVGs.inbox);\n this._triggerButton?.updateBackgroundColor(this.theme?.popup?.button?.backgroundColor ?? 'transparent');\n this._triggerButton?.updateHoverBackgroundColor(this.theme?.popup?.button?.hoverBackgroundColor ?? CourierColors.black[500_10]);\n this._triggerButton?.updateActiveBackgroundColor(this.theme?.popup?.button?.activeBackgroundColor ?? CourierColors.black[500_20]);\n }\n\n}\n\nregisterElement(CourierInboxMenuButton);\n","import { CourierInbox } from \"./courier-inbox\";\nimport { CourierInboxDatastoreEvents } from \"../datastore/datatore-events\";\nimport { CourierInboxDataStoreListener } from \"../datastore/datastore-listener\";\nimport { CourierInboxDatastore } from \"../datastore/datastore\";\nimport { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxMenuButtonFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from \"../types/factories\";\nimport { CourierInboxFeedType } from \"../types/feed-type\";\nimport { CourierInboxMenuButton } from \"./courier-inbox-menu-button\";\nimport { defaultLightTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierComponentThemeMode, injectGlobalStyle } from \"@trycourier/courier-ui-core\";\nimport { Courier } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, registerElement } from \"@trycourier/courier-ui-core\";\n\nexport type CourierInboxPopupAlignment = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'center-right' | 'center-left' | 'center-center';\n\nexport class CourierInboxPopupMenu extends CourierBaseElement implements CourierInboxDatastoreEvents {\n\n static get id(): string {\n return 'courier-inbox-popup-menu';\n }\n\n // State\n private _width: string = '440px';\n private _height: string = '440px';\n private _popupAlignment: CourierInboxPopupAlignment = 'top-left';\n private _top?: string = undefined;\n private _right?: string = undefined;\n private _bottom?: string = undefined;\n private _left?: string = undefined;\n\n // Theming\n private _themeManager = new CourierInboxThemeManager(defaultLightTheme);\n\n /** Returns the current theme object. */\n get theme() {\n return this._themeManager.getTheme();\n }\n\n /** Returns the current feed type. */\n get currentFeed(): CourierInboxFeedType {\n return this._inbox?.currentFeed ?? 'inbox';\n }\n\n /**\n * Set the light theme for the popup menu.\n * @param theme The light theme object to set.\n */\n public setLightTheme(theme: CourierInboxTheme) {\n this._themeManager.setLightTheme(theme);\n }\n\n /**\n * Set the dark theme for the popup menu.\n * @param theme The dark theme object to set.\n */\n public setDarkTheme(theme: CourierInboxTheme) {\n this._themeManager.setDarkTheme(theme);\n }\n\n /**\n * Set the theme mode (light/dark/system).\n * @param mode The theme mode to set.\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._themeManager.setMode(mode);\n }\n\n // Components\n private _triggerButton?: CourierInboxMenuButton;\n private _popup?: HTMLDivElement;\n private _inbox?: CourierInbox;\n private _style?: HTMLStyleElement;\n\n // Listeners\n private _datastoreListener?: CourierInboxDataStoreListener;\n\n // Factories\n private _popupMenuButtonFactory?: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => HTMLElement;\n\n static get observedAttributes() {\n return ['popup-alignment', 'message-click', 'message-action-click', 'message-long-press', 'popup-width', 'popup-height', 'top', 'right', 'bottom', 'left', 'light-theme', 'dark-theme', 'mode'];\n }\n\n constructor() {\n super();\n\n // Refresh the theme on change\n this._themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n }\n\n onComponentMounted() {\n\n // Inject the styles to the head\n this._style = injectGlobalStyle(CourierInboxPopupMenu.id, CourierInboxPopupMenu.getStyles(this.theme, this._width, this._height));\n\n // Create trigger button\n this._triggerButton = new CourierInboxMenuButton(this._themeManager);\n this._triggerButton.build(undefined);\n\n // Create popup container\n this._popup = document.createElement('div');\n this._popup.className = 'popup';\n\n // Create content container\n this._inbox = new CourierInbox(this._themeManager);\n this._inbox.setAttribute('height', '100%');\n\n this.refreshTheme();\n\n this.appendChild(this._triggerButton);\n this.appendChild(this._popup);\n this._popup.appendChild(this._inbox);\n\n // Add event listeners\n this._triggerButton.addEventListener('click', this.togglePopup.bind(this));\n document.addEventListener('click', this.handleOutsideClick.bind(this));\n\n // Initialize popup position\n this.updatePopupPosition();\n\n // Attach the datastore listener\n this._datastoreListener = new CourierInboxDataStoreListener(this);\n CourierInboxDatastore.shared.addDataStoreListener(this._datastoreListener);\n\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n this._datastoreListener?.remove();\n this._themeManager.cleanup();\n }\n\n private refreshTheme() {\n if (this._style) {\n this._style.textContent = CourierInboxPopupMenu.getStyles(this.theme, this._width, this._height);\n }\n }\n\n static getStyles(theme: CourierInboxTheme, width: string, height: string): string {\n return `\n ${CourierInboxPopupMenu.id} {\n display: inline-block;\n position: relative;\n }\n\n ${CourierInboxPopupMenu.id} .menu-button-container {\n position: relative;\n display: inline-block;\n }\n\n ${CourierInboxPopupMenu.id} .popup {\n display: none;\n position: absolute;\n background: ${theme.popup?.window?.backgroundColor ?? 'red'};\n border-radius: ${theme.popup?.window?.borderRadius ?? '8px'};\n border: ${theme.popup?.window?.border ?? `1px solid red`};\n box-shadow: ${theme.popup?.window?.shadow ?? `0px 8px 16px -4px red`};\n z-index: 1000;\n width: ${width};\n height: ${height};\n overflow: hidden;\n transform: translateZ(0);\n will-change: transform;\n }\n \n ${CourierInboxPopupMenu.id} #unread-badge {\n position: absolute;\n top: -8px;\n left: 50%;\n pointer-events: none;\n }\n\n ${CourierInboxPopupMenu.id} courier-inbox {\n height: 100%;\n }\n `;\n }\n\n attributeChangedCallback(name: string, _: string, newValue: string) {\n switch (name) {\n case 'popup-alignment':\n if (this.isValidPosition(newValue)) {\n this._popupAlignment = newValue as CourierInboxPopupAlignment;\n this.updatePopupPosition();\n }\n break;\n case 'popup-width':\n this._width = newValue;\n this.setSize(newValue, this._height);\n break;\n case 'popup-height':\n this._height = newValue;\n this.setSize(this._width, newValue);\n break;\n case 'top':\n this._top = newValue;\n this.updatePopupPosition();\n break;\n case 'right':\n this._right = newValue;\n this.updatePopupPosition();\n break;\n case 'bottom':\n this._bottom = newValue;\n this.updatePopupPosition();\n break;\n case 'left':\n this._left = newValue;\n this.updatePopupPosition();\n break;\n case 'light-theme':\n if (newValue) {\n this.setLightTheme(JSON.parse(newValue));\n }\n break;\n case 'dark-theme':\n if (newValue) {\n this.setDarkTheme(JSON.parse(newValue));\n }\n break;\n case 'mode':\n this._themeManager.setMode(newValue as CourierComponentThemeMode);\n break;\n }\n }\n\n /**\n * Called when the unread count changes.\n * @param _ The new unread count (unused).\n */\n public onUnreadCountChange(_: number): void {\n this.render();\n }\n\n /**\n * Set a handler for message click events.\n * @param handler The function to call when a message is clicked.\n */\n public onMessageClick(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._inbox?.onMessageClick((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n /**\n * Set a handler for message action click events.\n * @param handler The function to call when a message action is clicked.\n */\n public onMessageActionClick(handler?: (props: CourierInboxListItemActionFactoryProps) => void) {\n this._inbox?.onMessageActionClick((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n /**\n * Set a handler for message long press events.\n * @param handler The function to call when a message is long pressed.\n */\n public onMessageLongPress(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._inbox?.onMessageLongPress((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n private isValidPosition(value: string): value is CourierInboxPopupAlignment {\n const validPositions: CourierInboxPopupAlignment[] = [\n 'top-right', 'top-left', 'top-center',\n 'bottom-right', 'bottom-left', 'bottom-center',\n 'center-right', 'center-left', 'center-center'\n ];\n return validPositions.includes(value as CourierInboxPopupAlignment);\n }\n\n private updatePopupPosition() {\n if (!this._popup) return;\n\n // Reset all positions\n this._popup.style.top = '';\n this._popup.style.bottom = '';\n this._popup.style.left = '';\n this._popup.style.right = '';\n this._popup.style.margin = '';\n this._popup.style.transform = '';\n\n switch (this._popupAlignment) {\n case 'top-right':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.right = this._right ?? '0px';\n break;\n case 'top-left':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.left = this._left ?? '0px';\n break;\n case 'top-center':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translateX(-50%)';\n break;\n case 'bottom-right':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.right = this._right ?? '0px';\n break;\n case 'bottom-left':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.left = this._left ?? '0px';\n break;\n case 'bottom-center':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translateX(-50%)';\n break;\n case 'center-right':\n this._popup.style.top = '50%';\n this._popup.style.right = this._right ?? '40px';\n this._popup.style.transform = 'translateY(-50%)';\n break;\n case 'center-left':\n this._popup.style.top = '50%';\n this._popup.style.left = this._left ?? '40px';\n this._popup.style.transform = 'translateY(-50%)';\n break;\n case 'center-center':\n this._popup.style.top = '50%';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translate(-50%, -50%)';\n break;\n }\n }\n\n /**\n * Toggle the popup menu open/closed.\n * @param event The click event that triggered the toggle.\n */\n private togglePopup(event: Event) {\n event.stopPropagation();\n if (!this._popup) return;\n\n const isVisible = this._popup.style.display === 'block';\n this._popup.style.display = isVisible ? 'none' : 'block';\n }\n\n /**\n * Close the popup menu.\n */\n public closePopup() {\n if (!this._popup) return;\n this._popup.style.display = 'none';\n }\n\n private handleOutsideClick = (event: MouseEvent) => {\n if (!this._popup) return;\n\n // Nodes the click may legally occur inside without closing the popup\n const SAFE_SELECTORS = [\n 'courier-inbox-option-menu',\n ];\n\n // composedPath() gives us every node (even inside shadow DOMs)\n const clickIsInsideAllowedArea = event\n .composedPath()\n .some(node => {\n if (!(node instanceof HTMLElement)) return false;\n if (node === this._popup || this._popup!.contains(node)) return true;\n return SAFE_SELECTORS.some(sel => node.matches(sel));\n });\n\n if (clickIsInsideAllowedArea) return;\n\n // Otherwise, it really was an outside click – hide the popup\n this._popup.style.display = 'none';\n };\n\n /**\n * Set the content of the popup inbox.\n * @param element The HTMLElement to set as the content.\n */\n public setContent(element: HTMLElement) {\n if (!this._inbox) return;\n this._inbox.innerHTML = '';\n this._inbox.appendChild(element);\n }\n\n /**\n * Set the size of the popup menu.\n * @param width The width to set.\n * @param height The height to set.\n */\n public setSize(width: string, height: string) {\n this._width = width;\n this._height = height;\n if (!this._popup) return;\n this._popup.style.width = width;\n this._popup.style.height = height;\n }\n\n /**\n * Set the popup alignment/position.\n * @param position The alignment/position to set.\n */\n public setPosition(position: CourierInboxPopupAlignment) {\n if (this.isValidPosition(position)) {\n this._popupAlignment = position;\n this.updatePopupPosition();\n } else {\n Courier.shared.client?.options.logger?.error(`Invalid position: ${position}`);\n }\n }\n\n /**\n * Set the feed type for the inbox.\n * @param feedType The feed type to set.\n */\n public setFeedType(feedType: CourierInboxFeedType) {\n this._inbox?.setFeedType(feedType);\n }\n\n // Factory methods\n /**\n * Set a custom header factory for the inbox.\n * @param factory The factory function for the header.\n */\n public setHeader(factory: (props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setHeader(factory);\n }\n\n /**\n * Remove the custom header from the inbox.\n */\n public removeHeader() {\n this._inbox?.removeHeader();\n }\n\n /**\n * Set a custom loading state factory for the inbox.\n * @param factory The factory function for the loading state.\n */\n public setLoadingState(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setLoadingState(factory);\n }\n\n /**\n * Set a custom empty state factory for the inbox.\n * @param factory The factory function for the empty state.\n */\n public setEmptyState(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setEmptyState(factory);\n }\n\n /**\n * Set a custom error state factory for the inbox.\n * @param factory The factory function for the error state.\n */\n public setErrorState(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setErrorState(factory);\n }\n\n /**\n * Set a custom list item factory for the inbox.\n * @param factory The factory function for the list item.\n */\n public setListItem(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setListItem(factory);\n }\n\n /**\n * Set a custom pagination item factory for the inbox.\n * @param factory The factory function for the pagination item.\n */\n public setPaginationItem(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setPaginationItem(factory);\n }\n\n /**\n * Set a custom menu button factory for the popup trigger.\n * @param factory The factory function for the menu button.\n */\n public setMenuButton(factory: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => HTMLElement) {\n this._popupMenuButtonFactory = factory;\n this.render();\n }\n\n private render() {\n const unreadCount = CourierInboxDatastore.shared.unreadCount;\n if (!this._triggerButton) return;\n\n switch (this._popupMenuButtonFactory) {\n case undefined:\n case null:\n this._triggerButton.build(undefined);\n this._triggerButton.onUnreadCountChange(unreadCount);\n break;\n default:\n const customButton = this._popupMenuButtonFactory({ unreadCount });\n this._triggerButton.build(customButton);\n break;\n }\n }\n\n}\n\nregisterElement(CourierInboxPopupMenu);\n","import { CourierInboxFeedType } from \"../types/feed-type\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\nimport { InboxMessage } from \"@trycourier/courier-js\";\n\nexport class CourierInboxDatastoreEvents {\n public onDataSetChange?(_: InboxDataSet, __: CourierInboxFeedType): void { }\n public onPageAdded?(_: InboxDataSet, __: CourierInboxFeedType): void { }\n public onUnreadCountChange?(_: number): void { }\n public onMessageAdd?(_: InboxMessage, __: number, ___: CourierInboxFeedType): void { }\n public onMessageRemove?(_: InboxMessage, __: number, ___: CourierInboxFeedType): void { }\n public onMessageUpdate?(_: InboxMessage, __: number, ___: CourierInboxFeedType): void { }\n public onError?(_: Error): void { }\n}\n","export * from './components/courier-inbox';\nexport * from './components/courier-inbox-header';\nexport * from './components/courier-inbox-list-item';\nexport * from './components/courier-inbox-popup-menu';\nexport * from './utils/extensions';\nexport * from './types/factories';\nexport * from './types/feed-type';\nexport * from './types/courier-inbox-theme';\nexport * from './types/courier-inbox-theme-manager';\nexport * from './types/inbox-data-set';\nexport * from './datastore/datastore';\nexport * from './datastore/datastore-listener';\nexport * from './datastore/datatore-events';\n\nimport { Courier } from \"@trycourier/courier-js\";\n\nCourier.shared.courierUserAgentName = \"courier-ui-inbox\";\nCourier.shared.courierUserAgentVersion = __PACKAGE_VERSION__;\n\n// Re-export Courier from courier-js for direct import\nexport { Courier };\n\n// Re-export types from courier-js\nexport type {\n CourierProps,\n CourierClientOptions,\n CourierBrand,\n CourierApiUrls,\n CourierUserPreferences,\n CourierUserPreferencesStatus,\n CourierUserPreferencesChannel,\n CourierUserPreferencesPaging,\n CourierUserPreferencesTopic,\n CourierUserPreferencesTopicResponse,\n CourierDevice,\n CourierToken,\n CourierGetInboxMessageResponse,\n CourierGetInboxMessagesResponse,\n InboxMessage,\n InboxAction,\n InboxMessageEventEnvelope,\n} from '@trycourier/courier-js';\n\n// Re-export types from courier-ui-core\nexport type {\n CourierComponentThemeMode\n} from '@trycourier/courier-ui-core'\n"],"names":["_a","_b","_c","message","_d","_e"],"mappings":";;;;;;AAQO,SAAS,YAAY,SAAqC;AAC/D,QAAM,OAAO;AAAA,IACX,GAAG;AAAA,EAAA;AAGL,MAAI,QAAQ,SAAS;AACnB,SAAK,UAAU,QAAQ,QAAQ,IAAI,CAAA,WAAU,gBAAgB,MAAM,CAAC;AAAA,EACtE;AAEA,MAAI,QAAQ,MAAM;AAChB,SAAK,OAAO,KAAK,MAAM,KAAK,UAAU,QAAQ,IAAI,CAAC;AAAA,EACrD;AAEA,MAAI,QAAQ,MAAM;AAChB,SAAK,OAAO,CAAC,GAAG,QAAQ,IAAI;AAAA,EAC9B;AAEA,MAAI,QAAQ,aAAa;AACvB,SAAK,cAAc,EAAE,GAAG,QAAQ,YAAA;AAAA,EAClC;AAEA,SAAO;AACT;AAOO,SAAS,gBAAgB,QAAkC;AAChE,QAAM,OAAO;AAAA,IACX,GAAG;AAAA,EAAA;AAGL,MAAI,OAAO,MAAM;AACf,SAAK,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,IAAI,CAAC;AAAA,EACpD;AA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AAK,OAAA;AAAA,EACP;AAAA,EAEQ,SAAS;AACf,UAAM,cAAc,sBAAsB,OAAO;AACjD,QAAI,CAAC,KAAK,eAAgB;AAE1B,YAAQ,KAAK,yBAAA;AAAA,MACX,KAAK;AAAA,MACL,KAAK;AACH,aAAK,eAAe,MAAM,MAAS;AACnC,aAAK,eAAe,oBAAoB,WAAW;AACnD;AAAA,MACF;AACE,cAAM,eAAe,KAAK,wBAAwB,EAAE,aAAa;AACjE,aAAK,eAAe,MAAM,YAAY;AACtC;AAAA,IAAA;AAAA,EAEN;AAEF;AAEA,gBAAgB,qBAAqB;AC7f9B,MAAM,4BAA4B;AAAA,EAChC,gBAAiB,GAAiB,IAAgC;AAAA,EAAE;AAAA,EACpE,YAAa,GAAiB,IAAgC;AAAA,EAAE;AAAA,EAChE,oBAAqB,GAAiB;AAAA,EAAE;AAAA,EACxC,aAAc,GAAiB,IAAY,KAAiC;AAAA,EAAE;AAAA,EAC9E,gBAAiB,GAAiB,IAAY,KAAiC;AAAA,EAAE;AAAA,EACjF,gBAAiB,GAAiB,IAAY,KAAiC;AAAA,EAAE;AAAA,EACjF,QAAS,GAAgB;AAAA,EAAE;AACpC;ACIA,QAAQ,OAAO,uBAAuB;AACtC,QAAQ,OAAO,0BAA0B;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/utils/utils.ts","../src/components/courier-inbox-list-item-menu.ts","../src/datastore/inbox-dataset.ts","../src/datastore/inbox-datastore.ts","../src/components/courier-inbox-list-item.ts","../src/components/courier-inbox-skeleton-list-item.ts","../src/components/courier-inbox-skeleton-list.ts","../src/components/courier-inbox-pagination-list-item.ts","../src/utils/extensions.ts","../src/types/inbox-defaults.ts","../src/components/courier-inbox-list.ts","../src/components/courier-unread-count-badge.ts","../src/components/courier-inbox-feed-button.ts","../src/components/courier-inbox-tabs.ts","../src/components/courier-inbox-option-menu-item.ts","../src/components/courier-inbox-option-menu.ts","../src/components/courier-inbox-header.ts","../src/datastore/datastore-listener.ts","../src/types/courier-inbox-theme.ts","../src/types/courier-inbox-theme-manager.ts","../src/components/courier-inbox.ts","../src/components/courier-inbox-menu-button.ts","../src/components/courier-inbox-popup-menu.ts","../src/datastore/datatore-events.ts","../src/index.ts"],"sourcesContent":["import { InboxMessage, InboxAction } from \"@trycourier/courier-js\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\n\n/**\n * Copy a message\n * @param message - The message to copy\n * @returns A copy of the message\n */\nexport function copyMessage(message: InboxMessage): InboxMessage {\n const copy = {\n ...message,\n };\n\n if (message.actions) {\n copy.actions = message.actions.map(action => copyInboxAction(action));\n }\n\n if (message.data) {\n copy.data = JSON.parse(JSON.stringify(message.data));\n }\n\n if (message.tags) {\n copy.tags = [...message.tags];\n }\n\n if (message.trackingIds) {\n copy.trackingIds = { ...message.trackingIds };\n }\n\n return copy;\n}\n\n/**\n * Copy an inbox action\n * @param action - The inbox action to copy\n * @returns A copy of the inbox action\n */\nexport function copyInboxAction(action: InboxAction): InboxAction {\n const copy = {\n ...action,\n };\n\n if (action.data) {\n copy.data = JSON.parse(JSON.stringify(action.data));\n }\n\n return copy;\n}\n\n/**\n * Copy an inbox data set\n * @param dataSet - The inbox data set to copy\n * @returns A copy of the inbox data set\n */\nexport function copyInboxDataSet(dataSet?: InboxDataSet): InboxDataSet | undefined {\n\n if (!dataSet) {\n return undefined;\n }\n\n return {\n ...dataSet,\n messages: dataSet.messages.map(message => copyMessage(message)),\n };\n\n}\n\n/**\n * Compare the mutable fields of two InboxMessages.\n * @param message1 - The first inbox message to compare\n * @param message2 - The second inbox message to compare\n * @returns True if the mutable fields are equal, false otherwise\n */\nexport function mutableInboxMessageFieldsEqual(message1: InboxMessage, message2: InboxMessage): boolean {\n // Compare only mutable state fields\n if (message1.archived !== message2.archived) {\n return false;\n }\n if (message1.read !== message2.read) {\n return false;\n }\n if (message1.opened !== message2.opened) {\n return false;\n }\n\n return true;\n}\n\nexport function getMessageTime(message: InboxMessage): string {\n if (!message.created) {\n return 'Now';\n }\n\n const now = new Date();\n const messageDate = new Date(message.created);\n const diffInSeconds = Math.floor((now.getTime() - messageDate.getTime()) / 1000);\n\n if (diffInSeconds < 5) {\n return 'Now';\n }\n if (diffInSeconds < 60) {\n return `${diffInSeconds}s`;\n }\n if (diffInSeconds < 3600) {\n return `${Math.floor(diffInSeconds / 60)}m`;\n }\n if (diffInSeconds < 86400) {\n return `${Math.floor(diffInSeconds / 3600)}h`;\n }\n if (diffInSeconds < 604800) {\n return `${Math.floor(diffInSeconds / 86400)}d`;\n }\n if (diffInSeconds < 31536000) {\n return `${Math.floor(diffInSeconds / 604800)}w`;\n }\n return `${Math.floor(diffInSeconds / 31536000)}y`;\n}\n","import { CourierBaseElement, CourierIconButton, registerElement } from '@trycourier/courier-ui-core';\nimport { CourierInboxIconTheme, CourierInboxTheme } from '../types/courier-inbox-theme';\n\nexport type CourierInboxListItemActionMenuOption = {\n id: string;\n icon: CourierInboxIconTheme;\n onClick: () => void;\n};\n\nexport class CourierInboxListItemMenu extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list-item-menu';\n }\n\n // State\n private _theme: CourierInboxTheme;\n private _options: CourierInboxListItemActionMenuOption[] = [];\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n const menu = document.createElement('ul');\n menu.className = 'menu';\n this.appendChild(menu);\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const menu = theme.inbox?.list?.item?.menu;\n const transition = menu?.animation;\n const initialTransform = transition?.initialTransform ?? 'translate3d(0, 0, 0)';\n const visibleTransform = transition?.visibleTransform ?? 'translate3d(0, 0, 0)';\n\n return `\n ${CourierInboxListItemMenu.id} {\n display: none;\n position: absolute;\n background: ${menu?.backgroundColor ?? 'red'};\n border: ${menu?.border ?? '1px solid red'};\n border-radius: ${menu?.borderRadius ?? '0px'};\n box-shadow: ${menu?.shadow ?? '0 2px 8px red'};\n user-select: none;\n opacity: 0;\n pointer-events: none;\n transition: ${transition?.transition ?? 'all 0.2s ease'};\n overflow: hidden;\n transform: ${initialTransform};\n will-change: transform, opacity;\n }\n\n ${CourierInboxListItemMenu.id}.visible {\n opacity: 1;\n pointer-events: auto;\n transform: ${visibleTransform};\n }\n\n ${CourierInboxListItemMenu.id} ul.menu {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: row;\n }\n\n ${CourierInboxListItemMenu.id} li.menu-item {\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border-bottom: none;\n background: transparent;\n touch-action: none;\n }\n `;\n }\n\n setOptions(options: CourierInboxListItemActionMenuOption[]) {\n this._options = options;\n this.renderMenu();\n }\n\n private renderMenu() {\n // Clear existing menu items\n const menu = this.querySelector('ul.menu');\n if (!menu) return;\n menu.innerHTML = '';\n const menuTheme = this._theme.inbox?.list?.item?.menu;\n\n // Prevent click events from propagating outside of this menu\n const cancelEvent = (e: Event) => {\n e.stopPropagation();\n // Only preventDefault on touchstart to prevent context menu and other default behaviors\n // touchmove doesn't need preventDefault since CSS touch-action handles scrolling\n if (e.type === 'touchstart' || e.type === 'mousedown') {\n e.preventDefault();\n }\n };\n\n // Create new menu items\n this._options.forEach((opt) => {\n const icon = new CourierIconButton(opt.icon.svg, opt.icon.color, menuTheme?.backgroundColor, menuTheme?.item?.hoverBackgroundColor, menuTheme?.item?.activeBackgroundColor, menuTheme?.item?.borderRadius);\n\n // Handle both click and touch events\n const handleInteraction = (e: Event) => {\n e.stopPropagation();\n opt.onClick();\n };\n\n // Add click handler for desktop\n icon.addEventListener('click', handleInteraction);\n\n // Add touch handlers for mobile\n // touchstart needs preventDefault for context menu prevention, so use passive: false\n icon.addEventListener('touchstart', cancelEvent, { passive: false });\n icon.addEventListener('touchend', handleInteraction, { passive: true });\n\n // touchmove can be passive since CSS touch-action: none prevents scrolling\n icon.addEventListener('touchmove', (e: Event) => {\n e.stopPropagation();\n }, { passive: true });\n\n // Prevent mouse events from interfering\n icon.addEventListener('mousedown', cancelEvent);\n icon.addEventListener('mouseup', cancelEvent);\n\n menu.appendChild(icon);\n });\n }\n\n show() {\n // Set display first\n this.style.display = 'block';\n this.classList.remove('visible');\n\n // Trigger transition on next frame\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this.classList.add('visible');\n });\n });\n }\n\n hide() {\n // Remove visible class to trigger transition\n this.classList.remove('visible');\n\n // Wait for transition to complete, then set display none\n const handleTransitionEnd = (e: TransitionEvent) => {\n if (e.target !== this) return;\n if (!this.classList.contains('visible')) {\n this.style.display = 'none';\n this.removeEventListener('transitionend', handleTransitionEnd);\n }\n };\n\n this.addEventListener('transitionend', handleTransitionEnd);\n }\n}\n\nregisterElement(CourierInboxListItemMenu);","import { Courier, InboxMessage } from \"@trycourier/courier-js\";\nimport { copyMessage, mutableInboxMessageFieldsEqual } from \"../utils/utils\";\nimport { CourierInboxDatasetFilter, InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierGetInboxMessagesQueryFilter } from \"@trycourier/courier-js/dist/types/inbox\";\nimport { CourierInboxDataStoreListener } from \"./datastore-listener\";\nimport { CourierInboxDatastore } from \"./inbox-datastore\";\n\nexport class CourierInboxDataset {\n /** The unique ID for this dataset, provided by the consumer to later identify this set of messages. */\n private _id: string;\n\n /** The set of messages in this dataset. */\n private _messages: InboxMessage[] = [];\n\n /**\n * True if the first fetch of messages has completed successfully.\n *\n * This marker is used to distinguish if _messages can be returned when cached messages\n * are acceptable, since an empty array of messages could indicate they weren't\n * ever fetched or that they were fetched but there are currently none in the dataset.\n */\n private _firstFetchComplete: boolean = false;\n\n /** True if the fetched dataset sets hasNextPage to true. */\n private _hasNextPage: boolean = false;\n\n /**\n * The pagination cursor to pass to subsequent fetch requests\n * or null if this is the first request or a response has indicated\n * there is no next page.\n */\n private _lastPaginationCursor?: string;\n\n private readonly _filter: CourierInboxDatasetFilter;\n private readonly _datastoreListeners: CourierInboxDataStoreListener[] = [];\n\n /**\n * The total unread count loaded before messages are fetched.\n * Used to show unread badge counts on tabs before the user clicks into them.\n *\n * Total unread count is maintained manually (rather than derived from _messages) because:\n *\n * 1. We load unread counts for all tabs in view before their messages are loaded.\n * 2. The set of loaded messages may not fully reflect the unread count for a tab.\n * Messages are paginated, so unread messages may be present on the server but\n * but not on the client.\n */\n private _totalUnreadCount: number = 0;\n\n public constructor(\n id: string,\n filter: CourierInboxDatasetFilter,\n ) {\n this._id = id;\n\n // Make a copy of the input filters so this dataset's filters are immutable.\n this._filter = {\n tags: filter.tags ? [...(filter.tags)] : undefined,\n archived: filter.archived || false,\n status: filter.status\n };\n }\n\n /** Get the current total unread count. */\n get totalUnreadCount(): number {\n return this._totalUnreadCount;\n }\n\n /** Private setter for unread count. */\n private set totalUnreadCount(count: number) {\n this._totalUnreadCount = count > 0 ? count : 0;\n }\n\n /**\n * Set the unread count explicitly.\n * Used for batch loading unread counts for all datasets before messages are fetched.\n */\n public setUnreadCount(count: number): void {\n this.totalUnreadCount = count;\n this._datastoreListeners.forEach(listener => {\n listener.events.onUnreadCountChange?.(count, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n }\n\n /**\n * Get the filter configuration for this dataset.\n * Used for batch loading unread counts.\n */\n public getFilter(): CourierGetInboxMessagesQueryFilter {\n return {\n tags: this._filter.tags,\n archived: this._filter.archived,\n status: this._filter.status,\n };\n }\n\n /**\n * Add a message to the dataset if it qualifies based on the dataset's filters.\n *\n * @param message the message to add\n * @returns true if the message was added, otherwise false\n */\n addMessage(message: InboxMessage, insertIndex: number = 0): boolean {\n const messageCopy = copyMessage(message);\n if (this.messageQualifiesForDataset(messageCopy)) {\n this._messages.splice(insertIndex, 0, messageCopy);\n\n if (!messageCopy.read) {\n this.totalUnreadCount += 1;\n }\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onMessageAdd?.(messageCopy, insertIndex, this._id);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Update the messages and unread count for the dataset based on a change in a message.\n *\n * Based on a message's change (unread -> read, archived -> unarchived, etc) this method\n * inserts, updates, removes, or excludes it from the dataset. Given the before/existing\n * and after states, it updates the unread count.\n *\n * The before state identifies messages that would qualify for the dataset\n * before the dataset (or a particular message in the dataset) has been loaded.\n * These messages may not be explicitly removed from the dataset since they aren't\n * yet present, but may have an effect on the unread count.\n *\n * @param beforeMessage the message before the change\n * @param afterMessage the message after the change\n * @returns true if afterMessage qualifies for the dataset and was inserted or updated, false if the message was removed\n */\n updateWithMessageChange(beforeMessage: InboxMessage, afterMessage: InboxMessage): boolean {\n const index = this.indexOfMessage(afterMessage);\n const existingMessage = this._messages[index];\n const newMessage = copyMessage(afterMessage);\n\n // The message was already inserted or updated\n // Exit early to prevent double-counting changes to the unread count\n if (existingMessage && mutableInboxMessageFieldsEqual(existingMessage, newMessage)) {\n return true;\n }\n\n // Message is already in dataset but hasn't been updated yet\n if (existingMessage) {\n\n // Message still qualifies for dataset after mutation\n // Update it in place and modify unread count based on the state change\n if (this.messageQualifiesForDataset(newMessage)) {\n const unreadChange = this.calculateUnreadChange(existingMessage, newMessage);\n\n this._messages.splice(index, 1, newMessage);\n this.totalUnreadCount += unreadChange;\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onMessageUpdate?.(newMessage, index, this._id);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n\n return true;\n }\n\n // Message no longer qualifies for dataset\n // Remove it, which may also update unread count\n this.removeMessage(existingMessage);\n return false;\n }\n\n // Message is not yet in the dataset\n // Check if the after-mutation message qualifies for this dataset\n if (this.messageQualifiesForDataset(afterMessage)) {\n\n // Add the message to the dataset\n // We re-implement the addMessage logic here since the unreadCount change logic differs\n // from the public method\n const insertIndex = this.findInsertIndex(afterMessage);\n this._messages.splice(insertIndex, 0, copyMessage(afterMessage));\n\n // Calculate unread count change based on the transition\n const beforeQualifies = this.messageQualifiesForDataset(beforeMessage);\n const unreadChange = beforeQualifies\n // If beforeMessage qualified but wasn't present, this is a state change and could either\n // increment or decrement the unread count\n ? this.calculateUnreadChange(beforeMessage, afterMessage)\n\n // If beforeMessage didn't qualify, this is a new message to this dataset\n // Update unread count based on afterMessage's read state\n : (!afterMessage.read ? 1 : 0);\n\n this.totalUnreadCount += unreadChange;\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onMessageAdd?.(afterMessage, insertIndex, this._id);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n\n return true;\n }\n\n // At this point the message was neither updated, removed, nor added.\n // We must still determine if the mutation affects the unread count for this dataset.\n //\n // Consider the scenario where the unread count for this dataset has been loaded, but its messages have not.\n // In another dataset, a message which affects the unread count here is marked read.\n // We should update the unread count, even though the message hasn't been loaded here yet.\n\n // beforeMessage would have qualified if the dataset and/or message were loaded\n const beforeQualifies = this.messageQualifiesForDataset(beforeMessage);\n if (beforeQualifies) {\n\n // Update unreadCount based on the transition\n this.totalUnreadCount += this.calculateUnreadChange(beforeMessage, afterMessage);\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onMessageUpdate?.(newMessage, index, this._id);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n }\n\n return false;\n }\n\n private calculateUnreadChange(beforeMessage: InboxMessage, afterMessage: InboxMessage): number {\n // Message transitioned from read to unread\n if (beforeMessage.read && !afterMessage.read) {\n return 1;\n }\n\n // Message transitioned from unread to read\n if (!beforeMessage.read && afterMessage.read) {\n return -1;\n }\n\n // Message did not change read states\n return 0;\n }\n\n /**\n * Remove the specified message from this dataset, if it's present.\n *\n * @param message the message to remove from this dataset\n * @returns true if the message was removed, else false\n */\n removeMessage(message: InboxMessage): boolean {\n const indexToRemove = this.indexOfMessage(message);\n if (indexToRemove > -1) {\n this._messages.splice(indexToRemove, 1);\n\n if (!message.read) {\n this.totalUnreadCount -= 1;\n }\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onMessageRemove?.(message, indexToRemove, this._id);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n\n return true;\n }\n\n return false;\n }\n\n getMessage(messageId: string): InboxMessage | undefined {\n return this._messages.find(message => message.messageId === messageId);\n }\n\n async loadDataset(canUseCache: boolean): Promise<void> {\n // Returned cached data if it's requested and available\n if (canUseCache && this._firstFetchComplete) {\n this._datastoreListeners.forEach(listener => {\n listener.events.onDataSetChange?.(this.toInboxDataset());\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n return;\n }\n\n const fetchedDataset = await this.fetchMessages();\n\n // Unpack response and call listeners\n this._messages = [...fetchedDataset.messages];\n this.totalUnreadCount = fetchedDataset.unreadCount;\n this._hasNextPage = fetchedDataset.canPaginate;\n this._lastPaginationCursor = fetchedDataset.paginationCursor ?? undefined;\n this._firstFetchComplete = true;\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onDataSetChange?.(this.toInboxDataset());\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n }\n\n async fetchNextPageOfMessages(): Promise<InboxDataSet | null> {\n if (!this._hasNextPage) {\n return null;\n }\n\n const fetchedDataset = await this.fetchMessages(this._lastPaginationCursor);\n\n // Unpack response and call listeners\n this._messages = [...this._messages, ...fetchedDataset.messages];\n this._hasNextPage = fetchedDataset.canPaginate;\n this._lastPaginationCursor = fetchedDataset.paginationCursor ?? undefined;\n this._firstFetchComplete = true;\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onDataSetChange?.(this.toInboxDataset());\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onPageAdded?.(fetchedDataset);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n\n return fetchedDataset;\n }\n\n addDatastoreListener(listener: CourierInboxDataStoreListener): void {\n this._datastoreListeners.push(listener);\n }\n\n removeDatastoreListener(listener: CourierInboxDataStoreListener): void {\n const index = this._datastoreListeners.indexOf(listener);\n\n if (index > -1) {\n this._datastoreListeners.splice(index, 1);\n }\n }\n\n toInboxDataset(): InboxDataSet {\n return {\n id: this._id,\n messages: [...this._messages],\n unreadCount: this.totalUnreadCount,\n canPaginate: this._hasNextPage,\n paginationCursor: this._lastPaginationCursor ?? null\n };\n }\n\n private async fetchMessages(startCursor?: string): Promise<InboxDataSet> {\n const client = Courier.shared.client;\n\n if (!client?.options.userId) {\n throw new Error('User is not signed in');\n }\n\n const response = await client.inbox.getMessages({\n paginationLimit: Courier.shared.paginationLimit,\n startCursor,\n filter: this.getFilter(),\n });\n\n return {\n id: this._id,\n messages: [...(response.data?.messages?.nodes ?? [])],\n unreadCount: response.data?.unreadCount ?? 0,\n canPaginate: response.data?.messages?.pageInfo?.hasNextPage ?? false,\n paginationCursor: response.data?.messages?.pageInfo?.startCursor ?? null,\n }\n }\n\n private indexOfMessage(message: InboxMessage): number {\n return this._messages.findIndex(m => m.messageId === message.messageId);\n }\n\n /**\n * Find the insert index for a new message in a data set\n * @param newMessage - The new message to insert\n * @param dataSet - The data set to insert the message into\n * @returns The index to insert the message at\n */\n private findInsertIndex(newMessage: InboxMessage): number {\n const messages = this._messages;\n\n for (let i = 0; i < messages.length; i++) {\n const message = messages[i];\n if (message.created && newMessage.created && message.created < newMessage.created) {\n return i;\n }\n }\n\n return messages.length;\n }\n\n private messageQualifiesForDataset(message: InboxMessage): boolean {\n // Is the message archived state compatible with the dataset?\n if (message.archived && !this._filter.archived ||\n !message.archived && this._filter.archived) {\n return false;\n }\n\n // Is the message read state compatible with the dataset?\n if (message.read && this._filter.status === 'unread' ||\n !message.read && this._filter.status === 'read') {\n return false;\n }\n\n // At this point, the message and dataset have compatible\n // read and archived states.\n\n // If the dataset requires tags, does the message have tags?\n if (this._filter.tags && !message.tags) {\n return false;\n }\n\n // Does one of the message's tags match this dataset's tags?\n if (this._filter.tags && message.tags) {\n for (const tag of this._filter.tags) {\n if (message.tags.includes(tag)) {\n return true;\n }\n }\n return false;\n }\n\n // Either:\n // - dataset and message have no tags\n // - dataset doesn't require tags and\n // the dataset and message have compatible read and archived states\n return true;\n }\n\n /**\n * Restore this dataset from a snapshot.\n *\n * Note: _firstFetchComplete does not need to be restored\n * as it indicates specific lifecycle stages for the dataset.\n */\n public restoreFromSnapshot(snapshot: InboxDataSet): void {\n this._messages = snapshot.messages.map(m => copyMessage(m));\n\n this.totalUnreadCount = snapshot.unreadCount;\n this._hasNextPage = snapshot.canPaginate;\n this._lastPaginationCursor = snapshot.paginationCursor ?? undefined;\n\n this._datastoreListeners.forEach(listener => {\n listener.events.onDataSetChange?.(snapshot);\n listener.events.onUnreadCountChange?.(this.totalUnreadCount, this._id);\n listener.events.onTotalUnreadCountChange?.(CourierInboxDatastore.shared.totalUnreadCount);\n });\n }\n}\n","import { Courier, InboxMessage, InboxMessageEvent, InboxMessageEventEnvelope } from \"@trycourier/courier-js\";\nimport { CourierGetInboxMessagesQueryFilter } from \"@trycourier/courier-js/dist/types/inbox\";\nimport { CourierInboxDatasetFilter, CourierInboxFeed, InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxDataset } from \"./inbox-dataset\";\nimport { CourierInboxDataStoreListener } from \"./datastore-listener\";\nimport { copyInboxDataSet, copyMessage } from \"../utils/utils\";\n\n/**\n * Snapshot of a single dataset's state for rollback purposes\n */\ninterface DatasetSnapshot {\n id: string;\n dataset: InboxDataSet;\n}\n\n/**\n * Snapshot of the entire datastore state for rollback purposes\n */\ninterface DatastoreSnapshot {\n datasets: DatasetSnapshot[];\n globalMessages: Map<string, InboxMessage>;\n}\n\n/**\n * Shared datastore for Inbox components.\n *\n * CourierInboxDatastore is a singleton. Use `CourierInboxDatastore.shared`\n * to access the shared instance.\n *\n * @public\n */\nexport class CourierInboxDatastore {\n private static readonly TAG = \"CourierInboxDatastore\";\n\n private static instance: CourierInboxDatastore;\n\n private _datasets: Map<string, CourierInboxDataset> = new Map();\n private _listeners: CourierInboxDataStoreListener[] = [];\n private _removeMessageEventListener?: () => void;\n\n /**\n * Global message store is a map of Message ID to Message for all messages\n * that have been loaded.\n *\n * This acts as the source of truth to apply messages mutations to a message\n * given its ID and propagate those mutations to individual datasets.\n */\n private _globalMessages = new Map<string, InboxMessage>();\n\n /** Access CourierInboxDatastore through {@link CourierInboxDatastore.shared} */\n private constructor() { }\n\n /**\n * Instantiate the datastore with the feeds specified.\n *\n * Feeds are added to the datastore as datasets. Each feed has a respective\n * dataset. Existing datasets will be cleared before the feeds specified are added.\n *\n * @param feeds - The feeds with which to instantiate the datastore\n */\n public registerFeeds(feeds: CourierInboxFeed[]): void {\n const datasets = new Map<string, CourierInboxDatasetFilter>(\n feeds.flatMap(feed => feed.tabs).map(tab => [tab.datasetId, tab.filter])\n );\n\n this.createDatasetsFromFilters(datasets);\n }\n\n private createDatasetsFromFilters(filters: Map<string, CourierInboxDatasetFilter>): void {\n this.clearDatasets();\n\n for (let [id, filter] of filters) {\n const dataset = new CourierInboxDataset(id, filter);\n\n // Re-attach all existing listeners to the new dataset\n for (let listener of this._listeners) {\n dataset.addDatastoreListener(listener);\n }\n\n this._datasets.set(id, dataset);\n }\n }\n\n /**\n * Add a message to the datastore.\n *\n * The message will be added to any datasets for which it qualifies.\n *\n * @param message - The message to add\n */\n public addMessage(message: InboxMessage) {\n // Add to global store\n this._globalMessages.set(message.messageId, message);\n\n // Add to all qualifying datasets\n for (let dataset of this._datasets.values()) {\n dataset.addMessage(message);\n }\n }\n\n private updateDatasetsWithMessageChange(beforeMessage: InboxMessage, afterMessage: InboxMessage) {\n for (let dataset of this._datasets.values()) {\n dataset.updateWithMessageChange(beforeMessage, afterMessage);\n }\n }\n\n /**\n * Listen for real-time message updates from the Courier backend.\n *\n * If an existing WebSocket connection is open, it will be re-used. If not,\n * a new connection will be opened.\n */\n public async listenForUpdates() {\n const socket = Courier.shared.client?.inbox.socket;\n\n if (!socket) {\n Courier.shared.client?.options.logger?.info('CourierInbox socket not available');\n return;\n }\n\n try {\n // Remove any existing listener before adding a new one.\n // This both prevents multiple listeners from being added to the same WebSocket client\n // and makes sure the listener is on the current WebSocket client (rather than maintaining\n // one from a stale client).\n if (this._removeMessageEventListener) {\n this._removeMessageEventListener();\n }\n\n this._removeMessageEventListener = socket.addMessageEventListener(event => this.handleMessageEvent(event));\n\n // If the socket is already connecting or open, return early\n if (socket.isConnecting || socket.isOpen) {\n Courier.shared.client?.options.logger?.info(`Inbox socket already connecting or open for client ID: [${Courier.shared.client?.options.connectionId}]`);\n return;\n }\n\n // Connect to the socket. By default, the socket will subscribe to all events for the user after opening.\n await socket.connect();\n Courier.shared.client?.options.logger?.info(`Inbox socket connected for client ID: [${Courier.shared.client?.options.connectionId}]`);\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to connect socket:', error);\n }\n }\n\n /**\n * Load unread counts for multiple tabs in a single GraphQL query.\n * This populates tab badges without loading messages.\n * @param tabIds - Array of tab IDs to load counts for\n */\n public async loadUnreadCountsForTabs(tabIds: string[]): Promise<void> {\n const client = Courier.shared.client;\n if (!client) {\n return;\n }\n\n // Build filters map for the specified tabs\n const filtersMap: Record<string, CourierGetInboxMessagesQueryFilter> = {};\n for (const tabId of tabIds) {\n const dataset = this._datasets.get(tabId);\n if (dataset) {\n filtersMap[tabId] = dataset.getFilter();\n }\n }\n\n if (Object.keys(filtersMap).length === 0) {\n return;\n }\n\n const counts = await client.inbox.getUnreadCounts(filtersMap);\n\n // Update datasets with the fetched counts\n for (const [tabId, count] of Object.entries(counts)) {\n const dataset = this._datasets.get(tabId);\n\n // If datasets changed out while the request was in progress,\n // we'll update a dataset with the same ID, but otherwise pass through\n if (dataset) {\n dataset.setUnreadCount(count);\n }\n }\n }\n\n /**\n * Add a datastore listener, whose callbacks will be called in response to various message events.\n * @param listener - The listener instance to add\n */\n public addDataStoreListener(listener: CourierInboxDataStoreListener): void {\n this._listeners.push(listener);\n\n for (let dataset of this._datasets.values()) {\n dataset.addDatastoreListener(listener);\n }\n }\n\n /**\n * Remove a datastore listener.\n * @param listener - The listener instance to remove\n */\n public removeDataStoreListener(listener: CourierInboxDataStoreListener): void {\n this._listeners = this._listeners.filter(l => l !== listener);\n\n for (let dataset of this._datasets.values()) {\n dataset.removeDatastoreListener(listener);\n }\n }\n\n /**\n * Mark a message as read.\n * @param message - The message to mark as read\n */\n public async readMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Don't mark as read if already read\n if (message.read) {\n return;\n }\n\n const beforeMessage = this._globalMessages.get(message.messageId);\n if (!beforeMessage) {\n return;\n }\n\n await this.executeWithRollback(async () => {\n // Mutate in global store\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.read = CourierInboxDatastore.getISONow();\n this._globalMessages.set(message.messageId, afterMessage);\n\n // Update all datasets\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n\n // Apply the read to the server\n await Courier.shared.client?.inbox.read({ messageId: message.messageId });\n });\n }\n\n /**\n * Mark a message as unread.\n * @param message - The message to mark as unread\n */\n public async unreadMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Don't mark as unread if already unread\n if (!message.read) {\n return;\n }\n\n const beforeMessage = this._globalMessages.get(message.messageId);\n if (!beforeMessage) {\n return;\n }\n\n await this.executeWithRollback(async () => {\n // Mutate in global store\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.read = undefined;\n this._globalMessages.set(message.messageId, afterMessage);\n\n // Update all datasets\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n\n // Apply the unread to the server\n await Courier.shared.client?.inbox.unread({ messageId: message.messageId });\n });\n }\n\n /**\n * Mark a message as opened.\n * @param message - The message to mark as opened\n */\n public async openMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Don't mark as opened if already opened\n if (message.opened) {\n return;\n }\n\n const beforeMessage = this._globalMessages.get(message.messageId);\n if (!beforeMessage) {\n return;\n }\n\n await this.executeWithRollback(async () => {\n // Mutate in global store\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.opened = CourierInboxDatastore.getISONow();\n this._globalMessages.set(message.messageId, afterMessage);\n\n // Update all datasets\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n\n // Apply the open to the server\n await Courier.shared.client?.inbox.open({ messageId: message.messageId });\n });\n }\n\n /**\n * Unarchive a message.\n * @param message - The message to unarchive\n */\n public async unarchiveMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Don't unarchive if already unarchived\n if (!message.archived) {\n return;\n }\n\n const beforeMessage = this._globalMessages.get(message.messageId);\n if (!beforeMessage) {\n return;\n }\n\n await this.executeWithRollback(async () => {\n // Mutate in global store\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = undefined;\n this._globalMessages.set(message.messageId, afterMessage);\n\n // Update all datasets\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n\n // Apply the unarchive to the server\n await Courier.shared.client?.inbox.unarchive({ messageId: message.messageId });\n });\n }\n\n /**\n * Archive a message.\n * @param message - The message to archive\n */\n public async archiveMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Don't archive if already archived\n if (message.archived) {\n return;\n }\n\n const beforeMessage = this._globalMessages.get(message.messageId);\n if (!beforeMessage) {\n return;\n }\n\n await this.executeWithRollback(async () => {\n // Mutate in global store\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = CourierInboxDatastore.getISONow();\n this._globalMessages.set(message.messageId, afterMessage);\n\n // Update all datasets\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n\n // Apply the archive to the server\n await Courier.shared.client?.inbox.archive({ messageId: message.messageId });\n });\n }\n\n /**\n * Track a click event for a message.\n * @param message - The message that was clicked\n */\n public async clickMessage({ message }: { message: InboxMessage }): Promise<void> {\n // Clicking a message does not mutate it locally, but we still want error handling\n if (message.trackingIds?.clickTrackingId) {\n try {\n await Courier.shared.client?.inbox.click({\n messageId: message.messageId,\n trackingId: message.trackingIds.clickTrackingId\n });\n } catch (error) {\n // Log error\n Courier.shared.client?.options.logger?.error(`[${CourierInboxDatastore.TAG}] Error clicking message:`, error);\n\n // Notify listeners of error\n this._listeners.forEach(listener => {\n listener.events.onError?.(error as Error);\n });\n\n // Do NOT re-throw - swallow the error\n }\n }\n }\n\n /**\n * Archive all messages for the specified dataset.\n */\n public async archiveAllMessages(): Promise<void> {\n await this.executeWithRollback(async () => {\n const archiveDate = CourierInboxDatastore.getISONow();\n\n // Mutate all messages in global store that aren't already archived\n for (const [messageId, beforeMessage] of this._globalMessages.entries()) {\n if (!beforeMessage.archived) {\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = archiveDate;\n this._globalMessages.set(messageId, afterMessage);\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n }\n }\n\n // Apply the archive to the server\n await Courier.shared.client?.inbox.archiveAll();\n });\n }\n\n /**\n * Mark all messages read across all datasets.\n */\n public async readAllMessages(): Promise<void> {\n await this.executeWithRollback(async () => {\n const readDate = CourierInboxDatastore.getISONow();\n\n // Mutate all messages in global store that aren't already read\n for (const [messageId, beforeMessage] of this._globalMessages.entries()) {\n if (!beforeMessage.read) {\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.read = readDate;\n this._globalMessages.set(messageId, afterMessage);\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n }\n }\n\n // Apply the read to the server\n await Courier.shared.client?.inbox.readAll();\n });\n }\n\n /**\n * Archive all read messages for the specified dataset.\n */\n public async archiveReadMessages(): Promise<void> {\n await this.executeWithRollback(async () => {\n const archiveDate = CourierInboxDatastore.getISONow();\n\n // Mutate all read messages in global store that aren't already archived\n for (const [messageId, beforeMessage] of this._globalMessages.entries()) {\n if (beforeMessage.read && !beforeMessage.archived) {\n const afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = archiveDate;\n this._globalMessages.set(messageId, afterMessage);\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n }\n }\n\n // Apply the archive to the server\n await Courier.shared.client?.inbox.archiveRead();\n });\n }\n\n /**\n * Load datasets from the backend.\n *\n * Props:\n * - canUseCache: If true and the dataset has already been loaded once, this will return the dataset from memory.\n * - datasetIds: Optional: The set of dataset IDs to load. If unset, all known datasets will be loaded.\n *\n * @param props - Options to load datasets, see method documentation\n */\n public async load(props?: { canUseCache: boolean, datasetIds?: string[] }): Promise<void> {\n const client = Courier.shared.client;\n\n if (!client?.options.userId) {\n throw new Error('[Datastore] User is not signed in');\n }\n\n const canUseCache = props?.canUseCache ?? true;\n\n if (props?.datasetIds) {\n // flatMap asserts all members are defined\n const datasets: CourierInboxDataset[] = props.datasetIds.flatMap(id => {\n const dataset = this._datasets.get(id);\n return dataset ? [dataset] : [];\n });\n\n return await this.loadDatasets({ canUseCache, datasets });\n }\n\n return await this.loadDatasets({\n canUseCache,\n datasets: Array.from(this._datasets.values()),\n });\n }\n\n private async loadDatasets(props: { canUseCache: boolean, datasets: CourierInboxDataset[] }): Promise<void> {\n await Promise.all(props.datasets.map(async (dataset) => {\n await dataset.loadDataset(props.canUseCache);\n // Sync loaded messages to global store\n this.syncDatasetMessagesToGlobalStore(dataset);\n }));\n }\n\n /**\n * Sync messages from a dataset to the global message store.\n * This is called after datasets load messages to ensure the global store has all messages.\n */\n private syncDatasetMessagesToGlobalStore(dataset: CourierInboxDataset): void {\n const datasetState = dataset.toInboxDataset();\n for (const message of datasetState.messages) {\n // Only add if not already in global store (don't overwrite)\n if (!this._globalMessages.has(message.messageId)) {\n this._globalMessages.set(message.messageId, message);\n }\n }\n }\n\n /**\n * Fetch the next page of messages for the specified feed or datasetId.\n *\n * feedType is deprecated and will be removed in the next major release.\n * Please migrate to pass the same identifier as datasetId.\n * While both options are present, exactly one is required.\n *\n * @param props - Options to fetch the next page of messages, see method documetation\n */\n public async fetchNextPageOfMessages(props: { feedType?: string, datasetId?: string }): Promise<InboxDataSet | null> {\n const client = Courier.shared.client;\n\n if (!client?.options.userId) {\n throw new Error('User is not signed in');\n }\n\n let datasetIdToFetch: string;\n if (props.feedType && !props.datasetId) {\n Courier.shared.client?.options.logger.warn(`[${CourierInboxDatastore.TAG}] feedType is deprecated and` +\n `will be removed in the next major version. Please update callers to use datasetIds.`);\n datasetIdToFetch = props.feedType;\n } else if (props.datasetId) {\n datasetIdToFetch = props.datasetId;\n } else {\n throw new Error(`[${CourierInboxDatastore.TAG}] Exactly one of feedType or datasetId is required to call fetchNextPageOfMessages.`);\n }\n\n const datasetToFetch = this._datasets.get(datasetIdToFetch);\n if (!datasetToFetch) {\n throw new Error(`[${CourierInboxDatastore.TAG}] Attempted to fetch next page of messages for dataset ${datasetIdToFetch}, but the dataset does not exist.`);\n }\n\n return this.fetchNextPageForDataset({ dataset: datasetToFetch });\n }\n\n /**\n * Get the {@link InboxDataSet} representation of the dataset ID specified.\n * @param datasetId - The dataset ID to get\n */\n public getDatasetById(datasetId: string): InboxDataSet | undefined {\n return this._datasets.get(datasetId)?.toInboxDataset();\n }\n\n /**\n * Get datasets currently in the datastore.\n * @returns A record mapping dataset IDs to their InboxDataSet representations\n */\n public getDatasets(): Record<string, InboxDataSet> {\n const datasets: Record<string, InboxDataSet> = {};\n for (const [id, dataset] of this._datasets.entries()) {\n datasets[id] = dataset.toInboxDataset();\n }\n return datasets;\n }\n\n /**\n * Get the total unread count across all datasets.\n */\n public get totalUnreadCount(): number {\n let unreadCount = 0;\n for (let dataset of this._datasets.values()) {\n unreadCount += dataset.totalUnreadCount;\n }\n\n return unreadCount;\n }\n\n private async fetchNextPageForDataset(props: { dataset: CourierInboxDataset }): Promise<InboxDataSet | null> {\n const result = await props.dataset.fetchNextPageOfMessages();\n if (result) {\n // Sync newly loaded messages to global store\n this.syncDatasetMessagesToGlobalStore(props.dataset);\n }\n return result;\n }\n\n private handleMessageEvent(envelope: InboxMessageEventEnvelope) {\n const event = envelope.event;\n\n // Handle new message\n if (event === InboxMessageEvent.NewMessage) {\n const message = envelope.data as InboxMessage;\n this._globalMessages.set(message.messageId, message);\n for (let dataset of this._datasets.values()) {\n dataset.addMessage(message);\n }\n return;\n }\n\n // Handle all-messages updates\n const isAllMessagesEvent = event === InboxMessageEvent.ArchiveAll ||\n event === InboxMessageEvent.ArchiveRead ||\n event === InboxMessageEvent.MarkAllRead;\n if (isAllMessagesEvent) {\n this.updateAllMessages(event);\n return;\n }\n\n // Handle single-message update\n const messageId = envelope.messageId;\n if (messageId) {\n this.updateMessage(messageId, event);\n return;\n }\n\n Courier.shared.client?.options.logger?.warn(`[${CourierInboxDatastore.TAG}] Received unexpected event: ${event}`);\n }\n\n /**\n * Update all messages across all datasets from an InboxMessageEvent.\n * This only handles InboxMessageEvents that do not specify a messageId\n * and mutate all messages.\n *\n * Related: {@link CourierInboxDatastore.updateMessage}\n */\n private updateAllMessages(event: InboxMessageEvent) {\n const timestamp = CourierInboxDatastore.getISONow();\n\n for (const [messageId, beforeMessage] of this._globalMessages.entries()) {\n let afterMessage: InboxMessage | null = null;\n\n switch (event) {\n case InboxMessageEvent.MarkAllRead:\n if (!beforeMessage.read) {\n afterMessage = copyMessage(beforeMessage);\n afterMessage.read = timestamp;\n }\n break;\n case InboxMessageEvent.ArchiveAll:\n if (!beforeMessage.archived) {\n afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = timestamp;\n }\n break;\n case InboxMessageEvent.ArchiveRead:\n if (beforeMessage.read && !beforeMessage.archived) {\n afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = timestamp;\n }\n break;\n default:\n break;\n }\n\n if (afterMessage) {\n this._globalMessages.set(messageId, afterMessage);\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n }\n }\n }\n\n /**\n * Update a single message across all datasets from an InboxMessageEvent.\n * This only handles InboxMessageEvents that specify a messageId.\n *\n * Related: {@link CourierInboxDatastore.updateAllMessages}\n */\n private updateMessage(messageId: string, event: InboxMessageEvent) {\n // Get the message from global store\n const beforeMessage = this._globalMessages.get(messageId);\n if (!beforeMessage) {\n return;\n }\n\n let afterMessage: InboxMessage;\n\n switch (event) {\n case InboxMessageEvent.Archive:\n afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = CourierInboxDatastore.getISONow();\n break;\n case InboxMessageEvent.Opened:\n afterMessage = copyMessage(beforeMessage);\n afterMessage.opened = CourierInboxDatastore.getISONow();\n break;\n case InboxMessageEvent.Read:\n afterMessage = copyMessage(beforeMessage);\n afterMessage.read = CourierInboxDatastore.getISONow();\n break;\n case InboxMessageEvent.Unarchive:\n afterMessage = copyMessage(beforeMessage);\n afterMessage.archived = undefined;\n break;\n case InboxMessageEvent.Unread:\n afterMessage = copyMessage(beforeMessage);\n afterMessage.read = undefined;\n break;\n case InboxMessageEvent.Clicked:\n case InboxMessageEvent.Unopened:\n default:\n return;\n }\n\n // Update global store and propagate to datasets\n this._globalMessages.set(messageId, afterMessage);\n this.updateDatasetsWithMessageChange(beforeMessage, afterMessage);\n }\n\n private clearDatasets() {\n this._datasets.clear();\n this._globalMessages.clear();\n }\n\n private static getISONow(): string {\n return new Date().toISOString();\n }\n\n /**\n * Create a snapshot of all datasets and global messages for rollback purposes.\n * This captures the current state of all messages and metadata.\n */\n private createDatastoreSnapshot(): DatastoreSnapshot {\n const snapshots: DatasetSnapshot[] = [];\n\n for (const [id, dataset] of this._datasets.entries()) {\n const datasetState = dataset.toInboxDataset();\n if (datasetState) {\n const copy = copyInboxDataSet(datasetState);\n if (copy) {\n snapshots.push({\n id,\n dataset: copy\n });\n }\n }\n }\n\n // Snapshot global messages\n const globalMessagesSnapshot = new Map<string, InboxMessage>();\n for (const [messageId, message] of this._globalMessages.entries()) {\n globalMessagesSnapshot.set(messageId, copyMessage(message));\n }\n\n return {\n datasets: snapshots,\n globalMessages: globalMessagesSnapshot\n };\n }\n\n /**\n * Restore all datasets and global messages from a snapshot, reverting any mutations.\n * This is used for rollback when API calls or updates to downstream datasets fail.\n */\n private restoreDatastoreSnapshot(snapshot: DatastoreSnapshot): void {\n // Restore global messages\n this._globalMessages.clear();\n for (const [messageId, message] of snapshot.globalMessages.entries()) {\n this._globalMessages.set(messageId, copyMessage(message));\n }\n\n // Restore datasets\n for (const datasetSnapshot of snapshot.datasets) {\n const dataset = this._datasets.get(datasetSnapshot.id);\n if (dataset) {\n dataset.restoreFromSnapshot(datasetSnapshot.dataset);\n }\n }\n }\n\n /**\n * Execute an operation with automatic rollback on failure.\n * Snapshots all datasets before the operation and restores them if the operation throws.\n *\n * Note: Errors are caught and logged, but not re-thrown to match the behavior\n * for backwards compatibility with the legacy (inbox/archive) datastore implementation.\n *\n * Note: This method exists at the datastore level (rather than dataset) to handle\n * errors from API calls.\n */\n private async executeWithRollback<T>(\n operation: () => Promise<T>\n ): Promise<T | void> {\n const snapshot = this.createDatastoreSnapshot();\n\n try {\n return await operation();\n } catch (error) {\n Courier.shared.client?.options.logger?.error(`[${CourierInboxDatastore.TAG}] Error during operation:`, error);\n\n this.restoreDatastoreSnapshot(snapshot);\n\n this._listeners.forEach(listener => {\n listener.events.onError?.(error as Error);\n });\n }\n }\n\n /**\n * Get the shared instance of CourierInboxDatastore.\n *\n * CourierInboxDatastore is a singleton. Instance methods should be accessed\n * through this `shared` static accessor.\n */\n public static get shared(): CourierInboxDatastore {\n if (!CourierInboxDatastore.instance) {\n CourierInboxDatastore.instance = new CourierInboxDatastore();\n }\n return CourierInboxDatastore.instance;\n }\n\n}\n","import { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, CourierButton, CourierIcon, CourierIconSVGs, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { getMessageTime } from \"../utils/utils\";\nimport { CourierInboxListItemMenu, CourierInboxListItemActionMenuOption } from \"./courier-inbox-list-item-menu\";\nimport { CourierInboxDatastore } from \"../datastore/inbox-datastore\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxListItemAction } from \"../types/inbox-defaults\";\nimport { CourierInbox } from \"./courier-inbox\";\n\nexport class CourierInboxListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list-item';\n }\n\n // State\n private _themeManager: CourierInboxThemeManager;\n private _theme: CourierInboxTheme;\n private _message: InboxMessage | null = null;\n private _isMobile: boolean = false;\n private _canClick: boolean = false;\n private _listItemActions: CourierInboxListItemAction[] = CourierInbox.defaultListItemActions();\n // private _canLongPress: boolean = false; // Unused for now. But we can use this in the future if needed.\n\n // Elements\n private _titleElement?: HTMLParagraphElement;\n private _subtitleElement?: HTMLParagraphElement;\n private _timeElement?: HTMLParagraphElement;\n private _menu?: CourierInboxListItemMenu;\n private _unreadIndicator?: HTMLDivElement;\n private _actionsContainer?: HTMLDivElement;\n\n // Touch gestures\n private _longPressTimeout: number | null = null;\n private _isLongPress: boolean = false;\n\n // Intersection Observer\n private _observer?: IntersectionObserver;\n\n // Callbacks\n private onItemClick: ((message: InboxMessage) => void) | null = null;\n private onItemLongPress: ((message: InboxMessage) => void) | null = null;\n private onItemActionClick: ((message: InboxMessage, action: InboxAction) => void) | null = null;\n private onItemVisible: ((message: InboxMessage) => void) | null = null;\n\n constructor(themeManager: CourierInboxThemeManager, canClick: boolean, _canLongPress: boolean, listItemActions?: CourierInboxListItemAction[]) {\n super();\n this._canClick = canClick;\n // this._canLongPress = canLongPress;\n this._themeManager = themeManager;\n this._theme = themeManager.getTheme();\n this._isMobile = 'ontouchstart' in window;\n if (listItemActions) {\n this._listItemActions = listItemActions;\n }\n this.render();\n this._setupIntersectionObserver();\n }\n\n private render() {\n\n const contentContainer = document.createElement('div');\n contentContainer.className = 'content-container';\n\n // Title\n this._titleElement = document.createElement('p');\n this._titleElement.className = 'title';\n\n // Subtitle\n this._subtitleElement = document.createElement('p');\n this._subtitleElement.className = 'subtitle';\n\n // Actions\n this._actionsContainer = document.createElement('div');\n this._actionsContainer.className = 'actions-container';\n\n contentContainer.appendChild(this._titleElement);\n contentContainer.appendChild(this._subtitleElement);\n contentContainer.appendChild(this._actionsContainer);\n\n // Time\n this._timeElement = document.createElement('p');\n this._timeElement.className = 'time';\n\n // Unread indicator\n this._unreadIndicator = document.createElement('div');\n this._unreadIndicator.className = 'unread-indicator';\n\n // Action menu\n this._menu = new CourierInboxListItemMenu(this._theme);\n this._menu.setOptions(this._getMenuOptions());\n\n // Append elements into shadow‑DOM\n this.append(this._unreadIndicator, contentContainer, this._timeElement, this._menu);\n\n const cancelPropagation = (e: Event): void => {\n e.stopPropagation();\n e.preventDefault();\n };\n\n this._menu.addEventListener('mousedown', cancelPropagation);\n this._menu.addEventListener('pointerdown', cancelPropagation);\n this._menu.addEventListener('click', cancelPropagation);\n\n this.addEventListener('click', (e) => {\n if (!this._canClick) return;\n if (this._menu && (this._menu.contains(e.target as Node) || e.composedPath().includes(this._menu))) {\n return;\n }\n if (this._message && this.onItemClick && !(e.target instanceof CourierIcon) && !this._isLongPress) {\n this.onItemClick(this._message);\n }\n });\n\n this._setupHoverBehavior();\n this._setupLongPressBehavior();\n\n // Enable clickable class if canClick\n if (this._canClick) {\n this.classList.add('clickable');\n }\n\n }\n\n private _setupIntersectionObserver(): void {\n // Only set up if running in browser and IntersectionObserver is available\n if (typeof window === \"undefined\" || typeof IntersectionObserver === \"undefined\") {\n return;\n }\n\n // Clean up any previous observer\n if (this._observer) {\n this._observer.disconnect();\n }\n\n this._observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio === 1 && this.onItemVisible && this._message) {\n this.onItemVisible(this._message);\n }\n });\n }, { threshold: 1.0 });\n\n this._observer.observe(this);\n }\n\n onComponentUnmounted() {\n this._observer?.disconnect();\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const list = theme.inbox?.list;\n\n return `\n ${CourierInboxListItem.id} {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n border-bottom: ${list?.item?.divider ?? '1px solid red'};\n font-family: inherit;\n cursor: default;\n transition: ${list?.item?.transition ?? 'all 0.2s ease'};\n margin: 0;\n width: 100%;\n box-sizing: border-box;\n padding: 12px 20px;\n position: relative;\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n touch-action: manipulation;\n }\n\n /* Only apply hover/active background if clickable */\n @media (hover: hover) {\n ${CourierInboxListItem.id}.clickable:hover {\n cursor: pointer;\n background-color: ${list?.item?.hoverBackgroundColor ?? 'red'};\n }\n }\n\n ${CourierInboxListItem.id}.clickable:active {\n cursor: pointer;\n background-color: ${list?.item?.activeBackgroundColor ?? 'red'};\n }\n\n /* Menu hover / active */\n @media (hover: hover) {\n ${CourierInboxListItem.id}.clickable:hover:has(courier-inbox-list-item-menu:hover, courier-inbox-list-item-menu *:hover, courier-button:hover, courier-button *:hover) {\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n }\n }\n\n ${CourierInboxListItem.id}.clickable:active:has(courier-inbox-list-item-menu:active, courier-inbox-list-item-menu *:active, courier-button:active, courier-button *:active) {\n background-color: ${list?.item?.backgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxListItem.id}:last-child {\n border-bottom: none;\n }\n\n ${CourierInboxListItem.id} .unread-indicator {\n position: absolute;\n top: 28px;\n left: 6px;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background-color: ${list?.item?.unreadIndicatorColor ?? 'red'};\n display: none;\n }\n\n ${CourierInboxListItem.id}.unread .unread-indicator {\n display: block;\n }\n\n ${CourierInboxListItem.id} .content-container {\n flex: 1;\n display: flex;\n flex-direction: column;\n margin-right: 12px;\n }\n\n ${CourierInboxListItem.id} p {\n margin: 0;\n overflow-wrap: break-word;\n word-break: break-word;\n hyphens: auto;\n line-height: 1.4;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n text-align: left;\n }\n\n ${CourierInboxListItem.id} .title {\n font-family: ${list?.item?.title?.family ?? 'inherit'};\n font-size: ${list?.item?.title?.size ?? '14px'};\n color: ${list?.item?.title?.color ?? 'red'};\n margin-bottom: 4px;\n }\n\n ${CourierInboxListItem.id} .subtitle {\n font-family: ${list?.item?.subtitle?.family ?? 'inherit'};\n font-size: ${list?.item?.subtitle?.size ?? '14px'};\n color: ${list?.item?.subtitle?.color ?? 'red'};\n }\n\n ${CourierInboxListItem.id} .time {\n font-family: ${list?.item?.time?.family ?? 'inherit'};\n font-size: ${list?.item?.time?.size ?? '14px'};\n color: ${list?.item?.time?.color ?? 'red'};\n text-align: right;\n white-space: nowrap;\n }\n\n ${CourierInboxListItem.id} courier-inbox-list-item-menu {\n z-index: 1;\n position: absolute;\n top: 8px;\n right: 8px;\n display: none;\n opacity: 0;\n transition: opacity 0.2s ease;\n }\n\n ${CourierInboxListItem.id} courier-inbox-list-item-menu.visible {\n opacity: 1;\n }\n\n /* Show menu on hover for non-mobile devices - CSS handles this reliably */\n @media (hover: hover) {\n ${CourierInboxListItem.id}.clickable:hover courier-inbox-list-item-menu {\n display: block;\n }\n ${CourierInboxListItem.id}.clickable:hover courier-inbox-list-item-menu.visible {\n display: block;\n }\n ${CourierInboxListItem.id}.clickable:hover .time {\n opacity: 0;\n transition: opacity 0.2s ease;\n }\n }\n\n ${CourierInboxListItem.id} .actions-container {\n display: flex;\n margin-top: 10px;\n flex-wrap: wrap;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n display: none;\n }\n `;\n\n }\n\n private _setupHoverBehavior(): void {\n // CSS handles hover display for non-mobile devices - just update menu options\n if (!this._isMobile) {\n this.addEventListener('mouseenter', () => {\n this._isLongPress = false;\n // Update menu options when hovering\n const menuOptions = this._getMenuOptions();\n if (menuOptions.length > 0 && this._menu) {\n this._menu.setOptions(menuOptions);\n // Trigger show() to add visible class for transitions\n this._menu.show();\n if (this._timeElement) {\n this._timeElement.style.opacity = '0';\n }\n }\n });\n this.addEventListener('mouseleave', () => {\n // Hide menu and restore time opacity\n if (this._menu) {\n this._menu.hide();\n }\n if (this._timeElement) {\n this._timeElement.style.opacity = '1';\n }\n });\n }\n }\n\n private _setupLongPressBehavior(): void {\n const menu = this._theme.inbox?.list?.item?.menu\n\n if (!menu?.enabled) {\n return;\n }\n\n const longPress = menu.longPress;\n\n this.addEventListener(\n 'touchstart',\n () => {\n // Start long press timer\n this._longPressTimeout = window.setTimeout(() => {\n this._isLongPress = true;\n this._showMenu();\n if (this._message && this.onItemLongPress) {\n this.onItemLongPress(this._message);\n // Vibrate device if supported\n if (navigator.vibrate) {\n navigator.vibrate(longPress?.vibrationDuration ?? 50);\n }\n }\n // Keep the menu visible for 2 s, then hide again\n setTimeout(() => {\n this._hideMenu();\n this._isLongPress = false;\n }, longPress?.displayDuration ?? 2000);\n }, 650);\n },\n { passive: true },\n );\n\n this.addEventListener('touchend', () => {\n // Clear long press timeout\n if (this._longPressTimeout) {\n window.clearTimeout(this._longPressTimeout);\n this._longPressTimeout = null;\n }\n });\n }\n\n // Helpers\n private _getMenuOptions(): CourierInboxListItemActionMenuOption[] {\n const menuTheme = this._theme.inbox?.list?.item?.menu?.item;\n let options: CourierInboxListItemActionMenuOption[] = [];\n\n const isArchived = !!this._message?.archived;\n\n // Iterate through list item actions in the order they were specified\n for (const action of this._listItemActions) {\n switch (action.id) {\n case 'read_unread':\n options.push({\n id: this._message?.read ? 'unread' : 'read',\n icon: {\n svg: this._message?.read\n ? (action.unreadIconSVG ?? menuTheme?.unread?.svg ?? CourierIconSVGs.unread)\n : (action.readIconSVG ?? menuTheme?.read?.svg ?? CourierIconSVGs.read),\n color: this._message?.read ? menuTheme?.unread?.color : menuTheme?.read?.color ?? 'red',\n },\n onClick: () => {\n if (this._message) {\n if (this._message.read) {\n CourierInboxDatastore.shared.unreadMessage({ message: this._message });\n } else {\n CourierInboxDatastore.shared.readMessage({ message: this._message });\n }\n }\n },\n });\n break;\n case 'archive_unarchive':\n options.push({\n id: isArchived ? 'unarchive' : 'archive',\n icon: {\n svg: isArchived\n ? (action.unarchiveIconSVG ?? menuTheme?.unarchive?.svg ?? CourierIconSVGs.unarchive)\n : (action.archiveIconSVG ?? menuTheme?.archive?.svg ?? CourierIconSVGs.archive),\n color: isArchived ? menuTheme?.unarchive?.color : menuTheme?.archive?.color ?? 'red',\n },\n onClick: () => {\n if (this._message) {\n if (isArchived) {\n CourierInboxDatastore.shared.unarchiveMessage({ message: this._message });\n } else {\n CourierInboxDatastore.shared.archiveMessage({ message: this._message });\n }\n }\n },\n });\n break;\n }\n }\n\n return options;\n }\n\n // Menu visibility helpers\n private _showMenu(): void {\n const menu = this._theme.inbox?.list?.item?.menu;\n const menuOptions = this._getMenuOptions();\n\n // Don't show menu if there are no actions enabled\n if (menuOptions.length === 0) {\n return;\n }\n\n if (menu && menu.enabled && this._menu && this._timeElement) {\n this._menu.setOptions(menuOptions);\n this._menu.show();\n this._timeElement.style.opacity = '0';\n }\n }\n\n private _hideMenu(): void {\n const menu = this._theme.inbox?.list?.item?.menu;\n\n if (menu && menu.enabled && this._menu && this._timeElement) {\n this._menu.hide();\n this._timeElement.style.opacity = '1';\n }\n }\n\n // Public API\n public setMessage(message: InboxMessage): void {\n this._message = message;\n this._updateContent();\n }\n\n public setOnItemClick(cb: (message: InboxMessage) => void): void {\n this.onItemClick = cb;\n }\n\n public setOnItemActionClick(cb: (message: InboxMessage, action: InboxAction) => void): void {\n this.onItemActionClick = cb;\n }\n\n public setOnItemLongPress(cb: (message: InboxMessage) => void): void {\n this.onItemLongPress = cb;\n }\n\n public setOnItemVisible(cb: (message: InboxMessage) => void): void {\n this.onItemVisible = cb;\n }\n\n // Content rendering\n private _updateContent(): void {\n\n if (!this._message) {\n if (this._titleElement) this._titleElement.textContent = '';\n if (this._subtitleElement) this._subtitleElement.textContent = '';\n return;\n }\n\n // Unread marker\n this.classList.toggle('unread', !this._message.read);\n\n if (this._titleElement) {\n this._titleElement.textContent = this._message.title || 'Untitled Message';\n }\n if (this._subtitleElement) {\n this._subtitleElement.textContent = this._message.preview || this._message.body || '';\n }\n if (this._timeElement) {\n this._timeElement.textContent = getMessageTime(this._message);\n }\n\n // Update menu icons (e.g. read/unread)\n if (this._menu) {\n this._menu.setOptions(this._getMenuOptions());\n }\n\n // Update actions container\n const hasActions = this._message.actions && this._message.actions.length > 0;\n if (this._actionsContainer) {\n this._actionsContainer.style.display = hasActions ? 'flex' : 'none';\n }\n\n const actionsTheme = this._theme.inbox?.list?.item?.actions;\n\n // Add the actions to the actions container\n if (this._actionsContainer && this._message.actions) {\n this._actionsContainer.innerHTML = \"\"; // Clear previous actions to avoid duplicates\n this._message.actions.forEach(action => {\n // Create the action element\n const actionButton = new CourierButton({\n mode: this._themeManager.mode,\n text: action.content,\n variant: 'secondary',\n backgroundColor: actionsTheme?.backgroundColor,\n hoverBackgroundColor: actionsTheme?.hoverBackgroundColor,\n activeBackgroundColor: actionsTheme?.activeBackgroundColor,\n border: actionsTheme?.border,\n borderRadius: actionsTheme?.borderRadius,\n shadow: actionsTheme?.shadow,\n fontFamily: actionsTheme?.font?.family,\n fontSize: actionsTheme?.font?.size,\n fontWeight: actionsTheme?.font?.weight,\n textColor: actionsTheme?.font?.color,\n onClick: () => {\n if (this._message && this.onItemActionClick) {\n this.onItemActionClick(this._message, action);\n }\n },\n });\n\n // Add the action element to the actions container\n this._actionsContainer?.appendChild(actionButton);\n });\n }\n }\n}\n\nregisterElement(CourierInboxListItem);\n","import { CourierBaseElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport class CourierInboxSkeletonListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-skeleton-list-item';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxSkeletonListItem.id, CourierInboxSkeletonListItem.getStyles(this._theme));\n this.render();\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n private render() {\n // Create skeleton items using CourierSkeletonAnimatedRow\n const firstRow = new CourierSkeletonAnimatedRow(this._theme);\n const secondRow = new CourierSkeletonAnimatedRow(this._theme);\n const thirdRow = new CourierSkeletonAnimatedRow(this._theme);\n\n this.appendChild(firstRow);\n this.appendChild(secondRow);\n this.appendChild(thirdRow);\n }\n\n static getStyles(_theme: CourierInboxTheme): string {\n return `\n ${CourierInboxSkeletonListItem.id} {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 16px 20px 16px 20px;\n width: 100%;\n box-sizing: border-box;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:first-child {\n width: 35%;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:nth-child(2) {\n width: 100%;\n }\n\n ${CourierInboxSkeletonListItem.id} > *:nth-child(3) {\n width: 82%;\n }\n `;\n }\n}\n\n// Register the custom element\nregisterElement(CourierInboxSkeletonListItem);\n\nclass CourierSkeletonAnimatedRow extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-skeleton-animated-row';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierSkeletonAnimatedRow.id, CourierSkeletonAnimatedRow.getStyles(this._theme));\n this.render();\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n private render() {\n const skeletonItem = document.createElement('div');\n skeletonItem.className = 'skeleton-item';\n this.appendChild(skeletonItem);\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n const color = theme.inbox?.loading?.animation?.barColor ?? '#000';\n\n // Handle both 3 and 6 character hex colors\n const hexColor = color.length === 4 ?\n `#${color[1]}${color[1]}${color[2]}${color[2]}${color[3]}${color[3]}` :\n color;\n\n // Convert hex to RGB\n const r = parseInt(hexColor.slice(1, 3), 16);\n const g = parseInt(hexColor.slice(3, 5), 16);\n const b = parseInt(hexColor.slice(5, 7), 16);\n\n const colorWithAlpha80 = `rgba(${r}, ${g}, ${b}, 0.8)`; // 80% opacity\n const colorWithAlpha40 = `rgba(${r}, ${g}, ${b}, 0.4)`; // 40% opacity\n\n return `\n ${CourierSkeletonAnimatedRow.id} {\n display: flex;\n height: 100%;\n width: 100%;\n align-items: flex-start;\n justify-content: flex-start;\n }\n\n ${CourierSkeletonAnimatedRow.id} .skeleton-item {\n height: ${theme.inbox?.loading?.animation?.barHeight ?? '14px'};\n width: 100%;\n background: linear-gradient(\n 90deg,\n ${colorWithAlpha80} 25%,\n ${colorWithAlpha40} 50%,\n ${colorWithAlpha80} 75%\n );\n background-size: 200% 100%;\n animation: ${CourierSkeletonAnimatedRow.id}-shimmer ${theme.inbox?.loading?.animation?.duration ?? '2s'} ease-in-out infinite;\n border-radius: ${theme.inbox?.loading?.animation?.barBorderRadius ?? '14px'};\n }\n\n @keyframes ${CourierSkeletonAnimatedRow.id}-shimmer {\n 0% {\n background-position: 200% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n }\n `;\n }\n}\n\nregisterElement(CourierSkeletonAnimatedRow);\n","import { CourierFactoryElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxSkeletonListItem } from \"./courier-inbox-skeleton-list-item\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\n\nexport class CourierInboxSkeletonList extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-skeleton-list';\n }\n\n private _theme: CourierInboxTheme;\n private _style?: HTMLStyleElement;\n\n constructor(theme: CourierInboxTheme) {\n super();\n this._theme = theme;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxSkeletonList.id, CourierInboxSkeletonList.getStyles(this._theme));\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n }\n\n defaultElement(): HTMLElement {\n const list = document.createElement('div');\n list.className = 'list';\n\n // Create skeleton items\n for (let i = 0; i < 3; i++) {\n const skeletonItem = new CourierInboxSkeletonListItem(this._theme); // TODO: Make this a prop\n list.appendChild(skeletonItem);\n }\n\n this.appendChild(list);\n return list;\n\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n return `\n ${CourierInboxSkeletonList.id} {\n display: flex;\n height: 100%;\n width: 100%;\n align-items: flex-start;\n justify-content: flex-start;\n overflow: hidden;\n }\n\n ${CourierInboxSkeletonList.id} .list {\n display: flex;\n flex-direction: column;\n width: 100%;\n overflow: hidden;\n }\n\n ${CourierInboxSkeletonList.id} .list > * {\n border-bottom: ${theme.inbox?.loading?.divider ?? '1px solid red'};\n opacity: 100%;\n }\n\n ${CourierInboxSkeletonList.id} .list > *:nth-child(2) {\n border-bottom: ${theme.inbox?.loading?.divider ?? '1px solid red'};\n opacity: 88%;\n }\n\n ${CourierInboxSkeletonList.id} .list > *:nth-child(3) {\n border-bottom: none;\n opacity: 50%;\n }\n `;\n\n }\n}\n\nregisterElement(CourierInboxSkeletonList);\n","import { CourierBaseElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxSkeletonList } from \"./courier-inbox-skeleton-list\";\n\nexport class CourierInboxPaginationListItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-pagination-list-item';\n }\n\n // State\n private _theme: CourierInboxTheme;\n\n // Components\n private _style?: HTMLStyleElement;\n private _skeletonLoadingList?: CourierInboxSkeletonList;\n private _observer?: IntersectionObserver;\n private _customItem?: HTMLElement;\n\n // Handlers\n private _onPaginationTrigger: () => void;\n\n constructor(props: { theme: CourierInboxTheme, customItem?: HTMLElement, onPaginationTrigger: () => void }) {\n super();\n this._theme = props.theme;\n this._customItem = props.customItem;\n this._onPaginationTrigger = props.onPaginationTrigger;\n }\n\n onComponentMounted() {\n\n this._style = injectGlobalStyle(CourierInboxPaginationListItem.id, CourierInboxPaginationListItem.getStyles(this._theme));\n\n if (this._customItem) {\n this.appendChild(this._customItem);\n } else {\n const container = document.createElement('div');\n container.className = 'skeleton-container';\n\n this._skeletonLoadingList = new CourierInboxSkeletonList(this._theme);\n this._skeletonLoadingList.build(undefined);\n container.appendChild(this._skeletonLoadingList);\n\n this.appendChild(container);\n }\n\n // Initialize intersection observer\n this._observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.isIntersecting) {\n this._onPaginationTrigger();\n }\n });\n });\n\n // Start observing the element\n this._observer.observe(this);\n\n }\n\n onComponentUnmounted() {\n this._observer?.disconnect();\n this._style?.remove();\n }\n\n static getStyles(_theme: CourierInboxTheme): string {\n return `\n ${CourierInboxPaginationListItem.id} {\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n }\n\n ${CourierInboxPaginationListItem.id} .skeleton-container {\n height: 150%;\n }\n `;\n }\n\n}\n\nregisterElement(CourierInboxPaginationListItem);\n","import { InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierInboxDatastore } from \"../datastore/inbox-datastore\";\n\nexport function markAsRead(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.readMessage({ message });\n}\n\nexport function markAsUnread(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.unreadMessage({ message });\n}\n\nexport function clickMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.clickMessage({ message });\n}\n\nexport function archiveMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.archiveMessage({ message });\n}\n\nexport function openMessage(message: InboxMessage): Promise<void> {\n return CourierInboxDatastore.shared.openMessage({ message });\n}\n","import { CourierIconSVGs } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxFeed } from \"./inbox-data-set\";\n\n/**\n * Header action ID types.\n */\nexport type CourierInboxHeaderActionId = 'readAll' | 'archiveRead' | 'archiveAll';\n\n/**\n * List item action ID types.\n */\nexport type CourierInboxListItemActionId = 'read_unread' | 'archive_unarchive';\n\n/**\n * Configuration for a header action.\n */\nexport type CourierInboxHeaderAction = {\n id: CourierInboxHeaderActionId;\n iconSVG?: string;\n text?: string;\n};\n\n/**\n * Configuration for a list item action.\n */\nexport type CourierInboxListItemAction = {\n id: CourierInboxListItemActionId;\n readIconSVG?: string;\n unreadIconSVG?: string;\n archiveIconSVG?: string;\n unarchiveIconSVG?: string;\n};\n\n/**\n * Returns the default feeds for the inbox.\n */\nexport function defaultFeeds(): CourierInboxFeed[] {\n return [\n {\n feedId: 'inbox_feed',\n title: 'Inbox',\n iconSVG: CourierIconSVGs.inbox,\n tabs: [\n {\n datasetId: 'all_messages',\n title: 'All Messages',\n filter: {}\n }\n ]\n },\n {\n feedId: 'archive_feed',\n title: 'Archive',\n iconSVG: CourierIconSVGs.archive,\n tabs: [\n {\n datasetId: 'archived_messages',\n title: 'Archived Messages',\n filter: {\n archived: true\n }\n }\n ]\n }\n ];\n}\n\n/**\n * Returns the default header actions.\n */\nexport function defaultActions(): CourierInboxHeaderAction[] {\n return [\n { id: 'readAll' },\n { id: 'archiveRead' },\n { id: 'archiveAll' }\n ];\n}\n\n/**\n * Returns the default list item actions.\n */\nexport function defaultListItemActions(): CourierInboxListItemAction[] {\n return [\n { id: 'read_unread' },\n { id: 'archive_unarchive' }\n ];\n}\n\n","import { InboxAction, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, CourierInfoState, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxListItem } from \"./courier-inbox-list-item\";\nimport { CourierInboxPaginationListItem } from \"./courier-inbox-pagination-list-item\";\nimport { InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxStateErrorFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateLoadingFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps } from \"../types/factories\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxSkeletonList } from \"./courier-inbox-skeleton-list\";\nimport { CourierInboxListItemMenu } from \"./courier-inbox-list-item-menu\";\nimport { openMessage } from \"../utils/extensions\";\nimport { CourierInboxListItemAction, defaultFeeds } from \"../types/inbox-defaults\";\nimport { CourierInbox } from \"./courier-inbox\";\n\nexport class CourierInboxList extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-list';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _messages: InboxMessage[] = [];\n private _datasetId: string = defaultFeeds()[0].tabs[0].datasetId;\n private _isLoading = true;\n private _error: Error | null = null;\n private _canPaginate = false;\n private _canClickListItems = false;\n private _canLongPressListItems = false;\n private _listItemActions: CourierInboxListItemAction[] = CourierInbox.defaultListItemActions();\n\n // Callbacks\n private _onMessageClick: ((message: InboxMessage, index: number) => void) | null = null;\n private _onMessageActionClick: ((message: InboxMessage, action: InboxAction, index: number) => void) | null = null;\n private _onMessageLongPress: ((message: InboxMessage, index: number) => void) | null = null;\n private _onRefresh: () => void;\n\n // Factories\n private _onPaginationTrigger?: (feedId: string) => void;\n private _listItemFactory?: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement;\n private _paginationItemFactory?: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement;\n private _loadingStateFactory?: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement;\n private _emptyStateFactory?: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement;\n private _errorStateFactory?: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement;\n\n // Getters\n public get messages(): InboxMessage[] {\n return this._messages;\n }\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n // Components\n private _listStyles?: HTMLStyleElement;\n private _listItemStyles?: HTMLStyleElement;\n private _listItemMenuStyles?: HTMLStyleElement;\n private _errorContainer?: CourierInfoState;\n private _emptyContainer?: CourierInfoState;\n\n constructor(props: {\n themeManager: CourierInboxThemeManager,\n listItemActions?: CourierInboxListItemAction[],\n canClickListItems: boolean,\n canLongPressListItems: boolean,\n onRefresh: () => void,\n onPaginationTrigger: (datasetId: string) => void,\n onMessageClick: (message: InboxMessage, index: number) => void,\n onMessageActionClick: (message: InboxMessage, action: InboxAction, index: number) => void,\n onMessageLongPress: (message: InboxMessage, index: number) => void\n }) {\n super();\n\n // Initialize the callbacks\n this._onRefresh = props.onRefresh;\n this._onPaginationTrigger = props.onPaginationTrigger;\n this._onMessageClick = props.onMessageClick;\n this._onMessageActionClick = props.onMessageActionClick;\n this._onMessageLongPress = props.onMessageLongPress;\n\n // Set list item actions\n if (props.listItemActions) {\n this._listItemActions = props.listItemActions;\n }\n\n // Initialize the theme subscription\n this._themeSubscription = props.themeManager.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme();\n });\n\n }\n\n onComponentMounted() {\n\n // Inject styles at head\n // Since list items and menus don't listen to theme changes directly, their styles are created\n // at the parent level, and the parent manages their theming updates.\n this._listStyles = injectGlobalStyle(CourierInboxList.id, CourierInboxList.getStyles(this.theme));\n this._listItemStyles = injectGlobalStyle(CourierInboxListItem.id, CourierInboxListItem.getStyles(this.theme));\n this._listItemMenuStyles = injectGlobalStyle(CourierInboxListItemMenu.id, CourierInboxListItemMenu.getStyles(this.theme));\n\n // Layout the component\n this.render();\n\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._listStyles?.remove();\n this._listItemStyles?.remove();\n this._listItemMenuStyles?.remove();\n }\n\n public setCanClickListItems(canClick: boolean) {\n this._canClickListItems = canClick;\n }\n\n public setCanLongPressListItems(canLongPress: boolean) {\n this._canLongPressListItems = canLongPress;\n }\n\n public setListItemActions(actions: CourierInboxListItemAction[]) {\n this._listItemActions = actions;\n this.render();\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n\n const list = theme.inbox?.list;\n const scrollbar = list?.scrollbar;\n\n return `\n ${CourierInboxList.id} {\n flex: 1;\n width: 100%;\n background-color: ${list?.backgroundColor ?? 'red'};\n scrollbar-width: ${scrollbar?.width ?? 'thin'};\n scrollbar-color: ${scrollbar?.thumbColor ?? 'rgba(0, 0, 0, 0.2)'} ${scrollbar?.trackBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxList.id} ul {\n list-style: none;\n padding: 0;\n margin: 0;\n height: 100%;\n }\n\n /* Webkit scrollbar styling - show thumb, hide track background, overlay above content */\n ${CourierInboxList.id}::-webkit-scrollbar {\n width: ${scrollbar?.width ?? '8px'};\n height: ${scrollbar?.height ?? '8px'};\n }\n\n ${CourierInboxList.id}::-webkit-scrollbar-track {\n background: ${scrollbar?.trackBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxList.id}::-webkit-scrollbar-thumb {\n background: ${scrollbar?.thumbColor ?? 'rgba(0, 0, 0, 0.2)'};\n border-radius: ${scrollbar?.borderRadius ?? '4px'};\n }\n\n ${CourierInboxList.id}::-webkit-scrollbar-thumb:hover {\n background: ${scrollbar?.thumbHoverColor ?? scrollbar?.thumbColor ?? 'rgba(0, 0, 0, 0.3)'};\n }\n `;\n\n }\n\n public setDataSet(dataSet: InboxDataSet): void {\n this._messages = [...dataSet.messages];\n this._canPaginate = Boolean(dataSet.canPaginate);\n this._error = null;\n this._isLoading = false;\n this.render();\n }\n\n public addPage(dataSet: InboxDataSet): void {\n this._messages = [...this._messages, ...dataSet.messages];\n this._canPaginate = Boolean(dataSet.canPaginate);\n this._error = null;\n this._isLoading = false;\n this.render();\n }\n\n public addMessage(message: InboxMessage, index = 0): void {\n this._messages.splice(index, 0, message);\n this.render();\n }\n\n public removeMessage(index = 0): void {\n this._messages.splice(index, 1);\n this.render();\n }\n\n public updateMessage(message: InboxMessage, index = 0): void {\n this._messages[index] = message;\n this.render();\n }\n\n public selectDataset(datasetId: string): void {\n this._datasetId = datasetId;\n this._error = null;\n this._isLoading = true;\n this.render();\n }\n\n public setLoading(isLoading: boolean): void {\n this._error = null;\n this._isLoading = isLoading;\n this.render();\n }\n\n public setError(error: Error | null): void {\n this._error = error;\n this._isLoading = false;\n this._messages = [];\n this.render();\n }\n\n public setErrorNoClient(): void {\n this.setError(new Error('No user signed in'));\n }\n\n private handleRetry(): void {\n this._onRefresh();\n }\n\n private handleRefresh(): void {\n this._onRefresh();\n }\n\n private refreshTheme(): void {\n\n // Update list styles\n if (this._listStyles) {\n this._listStyles.textContent = CourierInboxList.getStyles(this.theme);\n }\n\n // Update list item styles\n if (this._listItemStyles) {\n this._listItemStyles.textContent = CourierInboxListItem.getStyles(this.theme);\n }\n\n // Update list item menu styles\n if (this._listItemMenuStyles) {\n this._listItemMenuStyles.textContent = CourierInboxListItemMenu.getStyles(this.theme);\n }\n\n // Update info state themes if they are rendered\n this.refreshInfoStateThemes();\n }\n\n public refreshInfoStateThemes() {\n this._emptyContainer?.updateStyles(this.errorProps);\n this._emptyContainer?.updateStyles(this.emptyProps);\n }\n\n get errorProps(): any {\n const error = this.theme.inbox?.error;\n const themeMode = this._themeSubscription.manager.mode;\n return {\n title: {\n text: error?.title?.text ?? this._error?.message,\n textColor: error?.title?.font?.color,\n fontFamily: error?.title?.font?.family,\n fontSize: error?.title?.font?.size,\n fontWeight: error?.title?.font?.weight\n },\n button: {\n mode: themeMode,\n text: error?.button?.text,\n backgroundColor: error?.button?.backgroundColor,\n hoverBackgroundColor: error?.button?.hoverBackgroundColor,\n activeBackgroundColor: error?.button?.activeBackgroundColor,\n textColor: error?.button?.font?.color,\n fontFamily: error?.button?.font?.family,\n fontSize: error?.button?.font?.size,\n fontWeight: error?.button?.font?.weight,\n shadow: error?.button?.shadow,\n border: error?.button?.border,\n borderRadius: error?.button?.borderRadius,\n onClick: () => this.handleRetry()\n }\n };\n }\n\n get emptyProps(): any {\n const empty = this.theme.inbox?.empty;\n const themeMode = this._themeSubscription.manager.mode;\n return {\n title: {\n text: empty?.title?.text ?? `No Messages`,\n textColor: empty?.title?.font?.color,\n fontFamily: empty?.title?.font?.family,\n fontSize: empty?.title?.font?.size,\n fontWeight: empty?.title?.font?.weight\n },\n button: {\n mode: themeMode,\n text: empty?.button?.text,\n backgroundColor: empty?.button?.backgroundColor,\n hoverBackgroundColor: empty?.button?.hoverBackgroundColor,\n activeBackgroundColor: empty?.button?.activeBackgroundColor,\n textColor: empty?.button?.font?.color,\n fontFamily: empty?.button?.font?.family,\n fontSize: empty?.button?.font?.size,\n fontWeight: empty?.button?.font?.weight,\n shadow: empty?.button?.shadow,\n border: empty?.button?.border,\n borderRadius: empty?.button?.borderRadius,\n onClick: () => this.handleRefresh()\n },\n };\n }\n\n private render(): void {\n\n // Remove all existing elements\n while (this.firstChild) {\n this.removeChild(this.firstChild);\n this._errorContainer = undefined;\n this._emptyContainer = undefined;\n }\n\n // Refresh theme-related styles and info states\n this.refreshTheme();\n\n // Error state\n if (this._error) {\n this._errorContainer = new CourierInfoState(this.errorProps);\n this._errorContainer.build(this._errorStateFactory?.({ datasetId: this._datasetId, error: this._error }));\n this.appendChild(this._errorContainer);\n return;\n }\n\n // Loading state\n if (this._isLoading) {\n const loadingElement = new CourierInboxSkeletonList(this.theme);\n loadingElement.build(this._loadingStateFactory?.({ datasetId: this._datasetId }));\n this.appendChild(loadingElement);\n return;\n }\n\n // Empty state\n if (this._messages.length === 0) {\n this._emptyContainer = new CourierInfoState(this.emptyProps);\n this._emptyContainer.build(this._emptyStateFactory?.({ datasetId: this._datasetId }));\n this.appendChild(this._emptyContainer);\n return;\n }\n\n // Create list before adding messages\n const list = document.createElement('ul');\n this.appendChild(list);\n\n // Add messages to the list\n this._messages.forEach((message, index) => {\n if (this._listItemFactory) {\n list.appendChild(this._listItemFactory({ message, index }));\n return;\n }\n const listItem = new CourierInboxListItem(this._themeSubscription.manager, this._canClickListItems, this._canLongPressListItems, this._listItemActions);\n listItem.setMessage(message);\n listItem.setOnItemClick((message) => this._onMessageClick?.(message, index));\n listItem.setOnItemActionClick((message, action) => this._onMessageActionClick?.(message, action, index));\n listItem.setOnItemLongPress((message) => this._onMessageLongPress?.(message, index));\n listItem.setOnItemVisible((message) => this.openVisibleMessage(message))\n list.appendChild(listItem);\n });\n\n // Add pagination item if can paginate\n if (this._canPaginate) {\n const paginationItem = new CourierInboxPaginationListItem({\n theme: this.theme,\n customItem: this._paginationItemFactory?.({ datasetId: this._datasetId }),\n onPaginationTrigger: () => this._onPaginationTrigger?.(this._datasetId),\n });\n list.appendChild(paginationItem);\n }\n }\n\n private async openVisibleMessage(message: InboxMessage) {\n try {\n await openMessage(message);\n } catch (error) {\n // Error ignored. Will get logged in the openMessage function\n }\n }\n\n // Factories\n public setLoadingStateFactory(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement): void {\n this._loadingStateFactory = factory;\n this.render();\n }\n\n public setEmptyStateFactory(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement): void {\n this._emptyStateFactory = factory;\n this.render();\n }\n\n public setErrorStateFactory(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement): void {\n this._errorStateFactory = factory;\n this.render();\n }\n\n public setListItemFactory(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement): void {\n this._listItemFactory = factory;\n this.render();\n }\n\n public setPaginationItemFactory(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement): void {\n this._paginationItemFactory = factory;\n this.render();\n }\n\n public scrollToTop(animate: boolean = true): void {\n this.scrollTo({ top: 0, behavior: animate ? 'smooth' : 'instant' });\n }\n\n}\n\nregisterElement(CourierInboxList);\n","import { CourierBaseElement, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme, CourierInboxUnreadCountIndicatorTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\n\nexport type CourierUnreadCountBadgeLocation = \"feed\" | \"tab\";\n\nexport class CourierUnreadCountBadge extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-unread-count-badge';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n private _location: CourierUnreadCountBadgeLocation;\n\n // State\n private _count: number = 0;\n\n // Elements\n private _style?: HTMLStyleElement;\n private _shadowRoot?: ShadowRoot;\n private _container?: HTMLElement;\n\n get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(props: { themeBus: CourierInboxThemeManager, location: CourierUnreadCountBadgeLocation }) {\n super();\n this._location = props.location;\n\n this._themeSubscription = props.themeBus.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme();\n });\n }\n\n onComponentMounted() {\n this.attachElements();\n this.setActive(true);\n this.updateBadge();\n }\n\n private attachElements() {\n // Attach shadow DOM\n this._shadowRoot = this.attachShadow({ mode: 'closed' });\n\n // Create container element\n this._container = document.createElement('div');\n this._container.className = 'badge-container';\n\n // Create and add style\n this._style = document.createElement('style');\n this._style.textContent = this.getStyles();\n this._shadowRoot.appendChild(this._style);\n this._shadowRoot.appendChild(this._container);\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n }\n\n private static getThemePath(\n theme: CourierInboxTheme,\n location: CourierUnreadCountBadgeLocation,\n active: boolean\n ): CourierInboxUnreadCountIndicatorTheme | undefined {\n if (location === \"tab\") {\n const tabsTheme = theme.inbox?.header?.tabs;\n return active\n ? tabsTheme?.selected?.unreadIndicator\n : tabsTheme?.default?.unreadIndicator;\n } else {\n // Default to \"feed\" location\n return theme.inbox?.header?.feeds?.button?.unreadCountIndicator;\n }\n }\n\n static getStyles(theme: CourierInboxTheme, location: CourierUnreadCountBadgeLocation = \"feed\"): string {\n const activeTheme = CourierUnreadCountBadge.getThemePath(theme, location, true);\n const inactiveTheme = CourierUnreadCountBadge.getThemePath(theme, location, false);\n\n // Fallback to feed button theme if location-specific theme is not available\n const fallbackTheme = theme.inbox?.header?.feeds?.button?.unreadCountIndicator;\n\n return `\n :host {\n display: inline-block;\n }\n\n .badge-container {\n display: none;\n pointer-events: none;\n }\n\n :host(.active) .badge-container {\n display: inline-block;\n background-color: ${activeTheme?.backgroundColor ?? fallbackTheme?.backgroundColor};\n color: ${activeTheme?.font?.color ?? fallbackTheme?.font?.color};\n border-radius: ${activeTheme?.borderRadius ?? fallbackTheme?.borderRadius};\n font-size: ${activeTheme?.font?.size ?? fallbackTheme?.font?.size};\n font-family: ${activeTheme?.font?.family ?? fallbackTheme?.font?.family ?? 'inherit'};\n font-weight: ${activeTheme?.font?.weight ?? fallbackTheme?.font?.weight ?? 'inherit'};\n padding: ${activeTheme?.padding ?? fallbackTheme?.padding};\n }\n\n :host(.inactive) .badge-container {\n display: inline-block;\n background-color: ${inactiveTheme?.backgroundColor ?? fallbackTheme?.backgroundColor};\n color: ${inactiveTheme?.font?.color ?? fallbackTheme?.font?.color};\n border-radius: ${inactiveTheme?.borderRadius ?? fallbackTheme?.borderRadius};\n font-size: ${inactiveTheme?.font?.size ?? fallbackTheme?.font?.size};\n font-family: ${inactiveTheme?.font?.family ?? fallbackTheme?.font?.family ?? 'inherit'};\n font-weight: ${inactiveTheme?.font?.weight ?? fallbackTheme?.font?.weight ?? 'inherit'};\n padding: ${inactiveTheme?.padding ?? fallbackTheme?.padding};\n }\n `\n }\n\n private getStyles(): string {\n return CourierUnreadCountBadge.getStyles(this.theme, this._location);\n }\n\n public setCount(count: number) {\n this._count = count;\n this.updateBadge();\n }\n\n public setActive(active: boolean) {\n this.className = active ? 'active' : 'inactive';\n if (this._style) {\n this._style.textContent = this.getStyles();\n }\n this.updateBadge();\n }\n\n public refreshTheme() {\n if (this._style) {\n this._style.textContent = this.getStyles();\n }\n this.updateBadge();\n }\n\n private updateBadge() {\n if (!this._container) return;\n\n // Set display on the host element (this element)\n if (this._count > 0) {\n this.style.display = 'inline-block';\n this._container.textContent = this._count > 99 ? '99+' : this._count.toString();\n } else {\n this.style.display = 'none';\n this._container.textContent = '';\n }\n }\n}\n\nregisterElement(CourierUnreadCountBadge);\n","import { CourierBaseElement, CourierIcon, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxFeed } from \"../types/inbox-data-set\";\nimport { CourierUnreadCountBadge } from \"./courier-unread-count-badge\";\n\nexport class CourierInboxFeedButton extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-header-title';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _feeds: CourierInboxFeed[];\n private _selectedFeed?: CourierInboxFeed;\n\n get selectedFeed(): CourierInboxFeed | undefined {\n return this._selectedFeed;\n }\n\n // Components\n private _style?: HTMLStyleElement;\n private _iconElement?: CourierIcon;\n private _titleElement?: HTMLHeadingElement;\n private _switchIconElement?: CourierIcon;\n private _unreadBadge?: CourierUnreadCountBadge;\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(themeManager: CourierInboxThemeManager, feeds: CourierInboxFeed[]) {\n super();\n\n this._feeds = feeds;\n\n // Subscribe to the theme bus\n this._themeSubscription = themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n }\n\n private getStyles(theme: CourierInboxTheme): string {\n const hasMultipleFeeds = this._feeds.length > 1;\n const hoverStyle = hasMultipleFeeds\n ? `${CourierInboxFeedButton.id}:hover {\n background: ${theme.inbox?.header?.feeds?.button?.hoverBackgroundColor ?? 'red'};\n }`\n : '';\n const activeStyle = hasMultipleFeeds\n ? `${CourierInboxFeedButton.id}:active {\n background: ${theme.inbox?.header?.feeds?.button?.activeBackgroundColor ?? 'red'};\n }`\n : '';\n\n return `\n ${CourierInboxFeedButton.id} {\n display: flex;\n align-items: center;\n gap: 8px;\n position: relative;\n transition: ${theme.inbox?.header?.feeds?.button?.transition ?? 'all 0.2s ease'};\n border-radius: 6px;\n padding-top: 4px;\n padding-bottom: 4px;\n padding-left: 4px;\n padding-right: 8px;\n }\n\n ${hoverStyle}\n\n ${activeStyle}\n\n ${CourierInboxFeedButton.id} courier-icon {\n display: flex;\n align-items: center;\n }\n\n ${CourierInboxFeedButton.id} .title-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0px;\n }\n\n ${CourierInboxFeedButton.id} .title-container h2 {\n margin: 0;\n font-family: ${theme.inbox?.header?.feeds?.button?.font?.family ?? 'inherit'};\n font-size: ${theme.inbox?.header?.feeds?.button?.font?.size ?? '16px'};\n font-weight: ${theme.inbox?.header?.feeds?.button?.font?.weight ?? '500'};\n color: ${theme.inbox?.header?.feeds?.button?.font?.color ?? 'red'};\n }\n\n `;\n }\n\n onComponentMounted() {\n this.render();\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private render() {\n this._style = injectGlobalStyle(CourierInboxFeedButton.id, this.getStyles(this.theme));\n\n // Icon\n this._iconElement = new CourierIcon();\n this.appendChild(this._iconElement);\n\n // Title wrapped in a div\n const titleContainer = document.createElement('div');\n titleContainer.className = 'title-container';\n this._titleElement = document.createElement('h2');\n titleContainer.appendChild(this._titleElement);\n\n // Switch icon\n const switchIcon = this.theme.inbox?.header?.feeds?.button?.changeFeedIcon;\n this._switchIconElement = new CourierIcon(switchIcon?.color ?? 'red', switchIcon?.svg ?? CourierIconSVGs.chevronDown);\n this._switchIconElement.style.display = this._feeds.length > 1 ? 'flex' : 'none';\n titleContainer.appendChild(this._switchIconElement);\n\n this.appendChild(titleContainer);\n\n // Unread badge\n this._unreadBadge = new CourierUnreadCountBadge({\n themeBus: this._themeSubscription.manager,\n location: \"feed\"\n });\n this.appendChild(this._unreadBadge);\n\n // Refresh theme\n this.refreshTheme();\n }\n\n public setUnreadCount(count: number) {\n this._unreadBadge?.setCount(count);\n }\n\n public setFeeds(feeds: CourierInboxFeed[]) {\n this._feeds = feeds;\n if (this._switchIconElement) {\n this._switchIconElement.style.display = this._feeds.length > 1 ? 'flex' : 'none';\n }\n // Refresh theme to update hover/active styles based on feed count\n this.refreshTheme();\n }\n\n public setSelectedFeed(feedId: string) {\n this._selectedFeed = this._feeds.find(feed => feed.feedId === feedId);\n this.refreshSelectedFeed();\n }\n\n private refreshTheme() {\n if (this._style) {\n this._style.textContent = this.getStyles(this.theme);\n }\n this.refreshSelectedFeed();\n this.refreshSwitchIcon();\n this.refreshUnreadBadge();\n }\n\n private refreshSelectedFeed() {\n if (this._selectedFeed) {\n this._iconElement?.updateSVG(this._selectedFeed.iconSVG ?? CourierIconSVGs.inbox);\n this._iconElement?.updateColor(this.theme.inbox?.header?.feeds?.button?.selectedFeedIconColor ?? 'red');\n if (this._titleElement) {\n this._titleElement.textContent = this._selectedFeed.title;\n }\n }\n }\n\n private refreshSwitchIcon() {\n if (this._switchIconElement) {\n const switchIcon = this.theme.inbox?.header?.feeds?.button?.changeFeedIcon;\n this._switchIconElement.updateSVG(switchIcon?.svg ?? CourierIconSVGs.chevronDown);\n this._switchIconElement.updateColor(switchIcon?.color ?? 'red');\n }\n }\n\n private refreshUnreadBadge() {\n if (this._unreadBadge) {\n this._unreadBadge.refreshTheme();\n }\n }\n\n}\n\nregisterElement(CourierInboxFeedButton);\n","import { CourierBaseElement, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxTab } from \"../types/inbox-data-set\";\nimport { CourierUnreadCountBadge } from \"./courier-unread-count-badge\";\n\nexport class CourierInboxTabs extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-tabs';\n }\n\n // Theme\n private _themeManager: CourierInboxThemeManager;\n private _themeSubscription: CourierInboxThemeSubscription;\n\n private _selectedTabId?: string;\n private _tabs: CourierInboxTab[] = [];\n private _onTabClick: (tab: CourierInboxTab) => void;\n private _onTabReselected: (tab: CourierInboxTab) => void;\n private _tabBadges: Map<string, CourierUnreadCountBadge> = new Map();\n\n // Components\n private _style?: HTMLStyleElement;\n\n get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(props: { themeManager: CourierInboxThemeManager, onTabClick: (tab: CourierInboxTab) => void, onTabReselected: (tab: CourierInboxTab) => void }) {\n super();\n this._themeManager = props.themeManager;\n this._onTabClick = props.onTabClick;\n this._onTabReselected = props.onTabReselected;\n this._themeSubscription = props.themeManager.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme();\n });\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxTabs.id, CourierInboxTabs.getStyles(this.theme));\n this.render();\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private render() {\n // Clear the existing tabs\n this.innerHTML = '';\n\n // Create a single container that holds all tabs\n const tabContainer = document.createElement('div');\n tabContainer.className = 'tab-container';\n\n // Create the tab elements inside the container\n for (let tab of this._tabs) {\n const tabElement = this.createTab(tab);\n tabContainer.appendChild(tabElement);\n }\n\n // Append the container to the main element\n this.appendChild(tabContainer);\n\n // Set the theme of the button\n this.refreshTheme();\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n const tabs = theme.inbox?.header?.tabs;\n\n // Helper function to convert borderRadius to CSS\n const getBorderRadius = (borderRadius?: string | { topLeft?: string; topRight?: string; bottomLeft?: string; bottomRight?: string }): string => {\n if (!borderRadius) return '';\n if (typeof borderRadius === 'string') {\n return `border-radius: ${borderRadius};`;\n }\n const parts: string[] = [];\n if (borderRadius.topLeft) parts.push(borderRadius.topLeft);\n else parts.push('0');\n if (borderRadius.topRight) parts.push(borderRadius.topRight);\n else parts.push('0');\n if (borderRadius.bottomRight) parts.push(borderRadius.bottomRight);\n else parts.push('0');\n if (borderRadius.bottomLeft) parts.push(borderRadius.bottomLeft);\n else parts.push('0');\n return `border-radius: ${parts.join(' ')};`;\n };\n\n return `\n ${CourierInboxTabs.id} {\n position: relative;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n margin-top: -5px;\n overflow-x: auto;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE and Edge */\n height: 41px;\n }\n\n ${CourierInboxTabs.id}::-webkit-scrollbar {\n display: none;\n }\n\n ${CourierInboxTabs.id} .tab-container {\n display: flex;\n flex-direction: row;\n gap: 4px;\n padding: 0 10px;\n width: fit-content;\n height: 100%;\n }\n\n ${CourierInboxTabs.id} .tab-item {\n position: relative;\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: ${tabs?.transition ?? 'all 0.2s ease'};\n user-select: none;\n padding: 0 10px;\n flex-shrink: 0;\n height: 100%;\n ${getBorderRadius(tabs?.borderRadius)}\n }\n\n ${CourierInboxTabs.id} .tab {\n position: relative;\n display: flex;\n align-items: center;\n gap: 8px;\n border-bottom: ${tabs?.default?.indicatorHeight ?? '1px'} solid ${tabs?.default?.indicatorColor ?? 'transparent'};\n height: 40px;\n min-width: 40px;\n justify-content: center;\n position: relative;\n }\n\n ${CourierInboxTabs.id} .tab-item:hover {\n background-color: ${tabs?.default?.hoverBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxTabs.id} .tab-item:active {\n background-color: ${tabs?.default?.activeBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxTabs.id} .tab.selected {\n border-bottom: ${(tabs?.selected?.indicatorHeight ?? '1px')} solid ${(tabs?.selected?.indicatorColor ?? 'transparent')};\n }\n\n ${CourierInboxTabs.id} .tab-item:hover.selected {\n background-color: ${tabs?.selected?.hoverBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxTabs.id} .tab-item:active.selected {\n background-color: ${tabs?.selected?.activeBackgroundColor ?? 'transparent'};\n }\n\n ${CourierInboxTabs.id} .tab-label {\n font-size: ${tabs?.default?.font?.size ?? '14px'};\n font-family: ${tabs?.default?.font?.family ?? 'inherit'};\n font-weight: ${tabs?.default?.font?.weight ?? 'inherit'};\n color: ${tabs?.default?.font?.color ?? 'red'};\n user-select: none;\n white-space: nowrap;\n }\n\n ${CourierInboxTabs.id} .tab.selected .tab-label {\n color: ${tabs?.selected?.font?.color ?? 'red'};\n }\n `;\n }\n\n public setTabs(tabs: CourierInboxTab[]) {\n this._tabs = tabs;\n this._tabBadges.clear(); // Clear existing badges when tabs are reset\n this.render();\n }\n\n public setSelectedTab(tabId: string) {\n this._selectedTabId = tabId;\n this.reloadTabs();\n this.updateBadgeStates();\n }\n\n public updateTabUnreadCount(tabId: string, count: number) {\n const badge = this._tabBadges.get(tabId);\n if (badge) {\n badge.setCount(count);\n }\n }\n\n public scrollToStart(animate: boolean = true) {\n if (animate) {\n this.scrollTo({\n left: 0,\n behavior: 'smooth'\n });\n } else {\n this.scrollLeft = 0;\n }\n }\n\n private refreshTheme() {\n if (this._style) {\n this._style.textContent = CourierInboxTabs.getStyles(this.theme);\n }\n }\n\n private reloadTabs() {\n const tabContainer = this.querySelector('.tab-container');\n if (!tabContainer) return;\n\n for (let child of Array.from(tabContainer.children)) {\n if (child instanceof HTMLElement && child.classList.contains('tab-item')) {\n const tabId = child.getAttribute('data-tab-id');\n const tabElement = child.querySelector('.tab');\n if (tabElement instanceof HTMLElement) {\n if (tabId === this._selectedTabId) {\n tabElement.classList.add('selected');\n } else {\n tabElement.classList.remove('selected');\n }\n }\n }\n }\n }\n\n private updateBadgeStates() {\n for (let [tabId, badge] of this._tabBadges) {\n badge.setActive(tabId === this._selectedTabId);\n }\n }\n\n private createTab(tab: CourierInboxTab): HTMLDivElement {\n const container = document.createElement('div');\n container.className = 'tab-item';\n container.setAttribute('data-tab-id', tab.datasetId);\n\n const el = document.createElement('div');\n el.className = 'tab';\n if (tab.datasetId === this._selectedTabId) {\n el.classList.add('selected');\n }\n\n const label = document.createElement('div');\n label.className = 'tab-label';\n label.innerText = tab.title;\n\n const unreadBadge = new CourierUnreadCountBadge({\n themeBus: this._themeManager,\n location: \"tab\"\n });\n this._tabBadges.set(tab.datasetId, unreadBadge);\n\n el.appendChild(label);\n el.appendChild(unreadBadge);\n container.appendChild(el);\n\n container.addEventListener('click', () => {\n if (tab.datasetId === this._selectedTabId) {\n this._onTabReselected(tab);\n } else {\n this._onTabClick(tab);\n }\n });\n\n return container;\n }\n\n}\n\nregisterElement(CourierInboxTabs);\n","import { CourierBaseElement, CourierIcon, CourierIconSVGs, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxMenuOption } from \"./courier-inbox-option-menu\";\n\nexport class CourierInboxOptionMenuItem extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-option-menu-item';\n }\n\n // State\n private _option: CourierInboxMenuOption;\n private _isSelectedable: boolean;\n private _isSelected?: boolean;\n private _theme: CourierInboxThemeManager;\n\n // Components\n private _content?: HTMLDivElement;\n private _itemIcon?: CourierIcon;\n private _title?: HTMLParagraphElement;\n private _selectionIcon?: CourierIcon;\n\n constructor(props: { option: CourierInboxMenuOption, selectable: boolean, isSelected: boolean, themeManager: CourierInboxThemeManager }) {\n super();\n this._option = props.option;\n this._isSelected = props.isSelected;\n this._isSelectedable = props.selectable;\n this._theme = props.themeManager;\n }\n\n onComponentMounted() {\n\n this._content = document.createElement('div');\n this._content.className = 'menu-item';\n\n this._itemIcon = new CourierIcon(this._option.icon.svg ?? CourierIconSVGs.inbox);\n this._itemIcon.setAttribute('size', '16');\n\n this._title = document.createElement('p');\n this._title.textContent = this._option.text;\n\n const spacer = document.createElement('div');\n spacer.className = 'spacer';\n\n this._selectionIcon = new CourierIcon(CourierIconSVGs.check);\n this._selectionIcon.classList.add('check-icon');\n\n this._content.appendChild(this._itemIcon);\n this._content.appendChild(this._title);\n this._content.appendChild(spacer);\n\n // Add check icon if selectable\n if (this._isSelectedable) {\n this._content.appendChild(this._selectionIcon);\n }\n\n this.appendChild(this._content);\n\n this.updateSelectionState();\n\n this.refreshTheme();\n\n }\n\n public refreshTheme() {\n\n // Set title text\n if (this._title) {\n this._title.textContent = this._option.text ?? 'Missing Text';\n }\n\n // Set selected icon color\n const theme = this._theme.getTheme();\n this._selectionIcon?.updateColor(theme.inbox?.header?.feeds?.menu?.list?.selectedIcon?.color ?? 'red');\n this._selectionIcon?.updateSVG(theme.inbox?.header?.feeds?.menu?.list?.selectedIcon?.svg ?? CourierIconSVGs.check);\n\n // Set item icon color and SVG\n this._itemIcon?.updateColor(this._option.icon?.color ?? 'red');\n this._itemIcon?.updateSVG(this._option.icon?.svg ?? CourierIconSVGs.inbox);\n\n }\n\n public setSelected(isSelected: boolean) {\n this._isSelected = isSelected;\n this.updateSelectionState();\n }\n\n private updateSelectionState() {\n if (this._selectionIcon) {\n this._selectionIcon.style.display = this._isSelected ? 'block' : 'none';\n }\n }\n\n}\n\nregisterElement(CourierInboxOptionMenuItem);\n","import { CourierBaseElement, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxOptionMenuItem } from \"./courier-inbox-option-menu-item\";\nimport { CourierInboxIconTheme } from \"../types/courier-inbox-theme\";\n\nexport type CourierInboxMenuOption = {\n id: string;\n text: string;\n icon: CourierInboxIconTheme;\n onClick: (option: CourierInboxMenuOption) => void;\n};\n\nexport type CourierInboxOptionMenuType = 'feed' | 'action';\n\nexport class CourierInboxOptionMenu extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox-option-menu';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _selectedIndex: number = 0;\n private _options: CourierInboxMenuOption[];\n private _selectable: boolean;\n private _onMenuOpen?: () => void;\n private _isOpen: boolean = false;\n private _menuType: CourierInboxOptionMenuType;\n\n // Components\n private _style?: HTMLStyleElement;\n private _shadowRoot?: ShadowRoot;\n private _container?: HTMLElement;\n\n constructor(themeManager: CourierInboxThemeManager, selectable: boolean, options: CourierInboxMenuOption[], menuType: CourierInboxOptionMenuType, onMenuOpen?: () => void) {\n super();\n\n this._selectable = selectable;\n this._options = options;\n this._onMenuOpen = onMenuOpen;\n this._menuType = menuType;\n\n // Handle the theme change\n this._themeSubscription = themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n }\n\n onComponentMounted() {\n this.attachElements();\n document.addEventListener('click', this.handleOutsideClick.bind(this));\n this.refreshTheme();\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n }\n\n private attachElements() {\n // Attach shadow DOM\n this._shadowRoot = this.attachShadow({ mode: 'closed' });\n\n // Create container element\n this._container = document.createElement('div');\n this._container.className = 'menu-container';\n\n // Create and add style\n this._style = document.createElement('style');\n this._style.textContent = this.getStyles();\n this._shadowRoot.appendChild(this._style);\n this._shadowRoot.appendChild(this._container);\n }\n\n private getStyles(): string {\n const theme = this._themeSubscription.manager.getTheme();\n const transition = this._menuType === 'feed'\n ? theme.inbox?.header?.feeds?.menu?.animation\n : theme.inbox?.header?.actions?.animation;\n const menuTheme = this._menuType === 'feed'\n ? theme.inbox?.header?.feeds?.menu\n : theme.inbox?.header?.actions?.menu ?? theme.inbox?.header?.feeds?.menu;\n const initialTransform = transition?.initialTransform ?? 'translate3d(0, 0, 0)';\n const visibleTransform = transition?.visibleTransform ?? 'translate3d(0, 0, 0)';\n\n return `\n :host {\n position: absolute;\n top: 42px;\n z-index: 1000;\n min-width: 200px;\n user-select: none;\n opacity: 0;\n pointer-events: none;\n transition: ${transition?.transition ?? 'all 0.2s ease'};\n transform: ${initialTransform};\n will-change: transform, opacity;\n display: none;\n }\n\n :host(.displayed) {\n display: block;\n }\n\n :host(.visible) {\n opacity: 1;\n pointer-events: auto;\n transform: ${visibleTransform};\n }\n\n .menu-container {\n display: flex;\n flex-direction: column;\n border-radius: ${menuTheme?.borderRadius ?? '6px'};\n border: ${menuTheme?.border ?? '1px solid red'};\n background: ${menuTheme?.backgroundColor ?? 'red'};\n box-shadow: ${menuTheme?.shadow ?? '0 4px 12px 0 red'};\n overflow: hidden;\n padding: 4px 0;\n }\n\n courier-inbox-option-menu-item {\n border-bottom: ${menuTheme?.list?.divider ?? 'none'};\n }\n\n courier-inbox-option-menu-item:last-child {\n border-bottom: none;\n }\n\n ${CourierInboxOptionMenuItem.id} {\n display: flex;\n flex-direction: row;\n padding: 6px 12px;\n cursor: pointer;\n }\n\n ${CourierInboxOptionMenuItem.id}:hover {\n background-color: ${menuTheme?.list?.hoverBackgroundColor ?? 'red'};\n }\n\n ${CourierInboxOptionMenuItem.id}:active {\n background-color: ${menuTheme?.list?.activeBackgroundColor ?? 'red'};\n }\n\n ${CourierInboxOptionMenuItem.id} .menu-item {\n display: flex;\n align-items: center;\n width: 100%;\n gap: 12px;\n }\n\n ${CourierInboxOptionMenuItem.id} .spacer {\n flex: 1;\n }\n\n ${CourierInboxOptionMenuItem.id} p {\n margin: 0;\n font-family: ${menuTheme?.list?.font?.family ?? 'inherit'};\n font-weight: ${menuTheme?.list?.font?.weight ?? 'inherit'};\n font-size: ${menuTheme?.list?.font?.size ?? '14px'};\n color: ${menuTheme?.list?.font?.color ?? 'red'};\n white-space: nowrap;\n }\n\n ${CourierInboxOptionMenuItem.id} .check-icon {\n display: block;\n }\n `;\n }\n\n public setPosition(position: { right?: string, left?: string, top?: string }) {\n this.style.left = position.left ?? 'auto';\n this.style.right = position.right ?? 'auto';\n this.style.top = position.top ?? 'auto';\n }\n\n private refreshTheme() {\n // Update styles\n if (this._style) {\n this._style.textContent = this.getStyles();\n }\n\n // Reload menu items\n this.refreshMenuItems();\n }\n\n public setOptions(options: CourierInboxMenuOption[]) {\n this._options = options;\n this.refreshMenuItems();\n }\n\n private refreshMenuItems() {\n if (!this._container) return;\n\n const container = this._container;\n\n // Clear existing items\n container.innerHTML = '';\n\n this._options.forEach((option, index) => {\n const menuItem = new CourierInboxOptionMenuItem({\n option: option,\n selectable: this._selectable,\n isSelected: this._selectedIndex === index,\n themeManager: this._themeSubscription.manager\n });\n\n menuItem.addEventListener('click', () => {\n\n // Select if possible\n if (this._selectable) {\n this.selectionItemAtIndex(index);\n }\n\n // Handle the click\n option.onClick(option);\n this.closeMenu();\n\n });\n\n container.appendChild(menuItem);\n });\n }\n\n public toggleMenu() {\n this._isOpen = !this._isOpen;\n if (this._isOpen) {\n this.showMenu();\n this._onMenuOpen?.();\n } else {\n this.hideMenu();\n }\n }\n\n private showMenu() {\n // Remove visible class first to reset state\n this.classList.remove('visible');\n\n // Add displayed class to set display: block (but keep opacity 0 and initial transform)\n this.classList.add('displayed');\n\n // Trigger transition on next frame\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n this.classList.add('visible');\n });\n });\n }\n\n private hideMenu() {\n // Remove visible class to trigger transition\n this.classList.remove('visible');\n\n // If there is no transition, remove the displayed class immediately\n const style = window.getComputedStyle(this);\n const durations = style.transitionDuration.split(',').map(d => parseFloat(d) || 0);\n const hasTransition = durations.some(d => d > 0);\n if (!hasTransition) {\n this.classList.remove('displayed');\n return;\n }\n\n // Wait for transition to complete, then remove displayed class\n const handleTransitionEnd = (e: TransitionEvent) => {\n if (e.target !== this) return;\n if (!this.classList.contains('visible')) {\n this.classList.remove('displayed');\n this.removeEventListener('transitionend', handleTransitionEnd);\n }\n };\n\n this.addEventListener('transitionend', handleTransitionEnd);\n }\n\n public closeMenu() {\n this._isOpen = false;\n this.hideMenu();\n }\n\n private handleOutsideClick(event: MouseEvent) {\n const target = event.target as Node;\n // contains() checks the entire tree including shadow DOM\n if (!this.contains(target)) {\n this.closeMenu();\n }\n }\n\n public selectionItemAtIndex(index: number) {\n if (!this._selectable || !this._container) {\n return;\n }\n\n this._selectedIndex = index;\n\n // Update all menu items to reflect the new selection\n this._options.forEach((_, idx) => {\n const item = this._container?.children[idx] as CourierInboxOptionMenuItem;\n if (item && item.setSelected) {\n item.setSelected(idx === index);\n }\n });\n }\n\n}\n\nregisterElement(CourierInboxOptionMenu);\n","import { CourierFactoryElement, registerElement, CourierColors, injectGlobalStyle, CourierIconButton, CourierIconSVGs } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxFeedButton } from \"./courier-inbox-feed-button\";\nimport { CourierInboxHeaderFactoryProps } from \"../types/factories\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxFeed, CourierInboxTab } from \"../types/inbox-data-set\";\nimport { CourierInboxTabs } from \"./courier-inbox-tabs\";\nimport { CourierInboxMenuOption, CourierInboxOptionMenu } from \"./courier-inbox-option-menu\";\nimport { CourierInboxDatastore } from \"../datastore/inbox-datastore\";\nimport { CourierInboxHeaderAction } from \"../types/inbox-defaults\";\nimport { CourierInbox } from \"./courier-inbox\";\n\nexport class CourierInboxHeader extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-header';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // State\n private _feeds: CourierInboxFeed[] = [];\n private _currentFeedId?: string;\n private _actions: CourierInboxHeaderAction[] = CourierInbox.defaultActions();\n\n // Components\n private _feedButton?: CourierInboxFeedButton;\n private _feedMenu?: CourierInboxOptionMenu;\n private _actionMenuButton?: CourierIconButton;\n private _actionMenu?: CourierInboxOptionMenu;\n public tabs?: CourierInboxTabs;\n private _style?: HTMLStyleElement;\n private _feedButtonClickHandler?: (event: Event) => void;\n\n // Callbacks\n private _onFeedChange: (feed: CourierInboxFeed) => void;\n private _onFeedReselected: (feed: CourierInboxFeed) => void;\n private _onTabChange: (tab: CourierInboxTab) => void;\n private _onTabReselected: (tab: CourierInboxTab) => void;\n\n private get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n /** Returns whether the tabs are currently visible based on the current feed having more than 1 tab. */\n get showTabs(): boolean {\n const currentFeed = this._feeds.find(feed => feed.feedId === this._currentFeedId);\n return (currentFeed?.tabs?.length ?? 0) > 1;\n }\n\n constructor(props: {\n themeManager: CourierInboxThemeManager,\n actions?: CourierInboxHeaderAction[],\n onFeedChange: (feed: CourierInboxFeed) => void,\n onFeedReselected: (feed: CourierInboxFeed) => void,\n onTabChange: (tab: CourierInboxTab) => void,\n onTabReselected: (tab: CourierInboxTab) => void\n }) {\n super();\n\n // Subscribe to the theme bus\n this._themeSubscription = props.themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n // Set actions\n if (props.actions) {\n this._actions = props.actions;\n }\n\n // Set the callbacks\n this._onFeedChange = props.onFeedChange;\n this._onFeedReselected = props.onFeedReselected;\n this._onTabChange = props.onTabChange;\n this._onTabReselected = props.onTabReselected;\n }\n\n onComponentMounted() {\n this._style = injectGlobalStyle(CourierInboxHeader.id, CourierInboxHeader.getStyles(this.theme));\n }\n\n onComponentUmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n private getActionOptions(): CourierInboxMenuOption[] {\n const theme = this._themeSubscription.manager.getTheme();\n const actionMenu = theme.inbox?.header?.actions;\n const options: CourierInboxMenuOption[] = [];\n\n // Iterate through actions in the order they were specified\n for (const action of this._actions) {\n switch (action.id) {\n case 'readAll':\n options.push({\n id: 'make_all_read',\n text: action.text ?? actionMenu?.markAllRead?.text ?? 'Mark All as Read',\n icon: {\n color: actionMenu?.markAllRead?.icon?.color ?? 'red',\n svg: action.iconSVG ?? actionMenu?.markAllRead?.icon?.svg ?? CourierIconSVGs.read\n },\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.readAllMessages();\n }\n });\n break;\n case 'archiveAll':\n options.push({\n id: 'archive_all',\n text: action.text ?? actionMenu?.archiveAll?.text ?? 'Archive All',\n icon: {\n color: actionMenu?.archiveAll?.icon?.color ?? 'red',\n svg: action.iconSVG ?? actionMenu?.archiveAll?.icon?.svg ?? CourierIconSVGs.archive\n },\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.archiveAllMessages();\n }\n });\n break;\n case 'archiveRead':\n options.push({\n id: 'archive_read',\n text: action.text ?? actionMenu?.archiveRead?.text ?? 'Archive Read',\n icon: {\n color: actionMenu?.archiveRead?.icon?.color ?? 'red',\n svg: action.iconSVG ?? actionMenu?.archiveRead?.icon?.svg ?? CourierIconSVGs.archiveRead\n },\n onClick: (_: CourierInboxMenuOption) => {\n CourierInboxDatastore.shared.archiveReadMessages();\n }\n });\n break;\n }\n }\n\n return options;\n }\n\n private refreshTheme() {\n if (this._style) {\n this._style.textContent = CourierInboxHeader.getStyles(this.theme);\n }\n\n this.refreshActionMenuButton();\n this._actionMenu?.setOptions(this.getActionOptions());\n this._feedMenu?.setOptions(this.getFeedMenuOptions());\n\n // Update action menu button visibility\n if (this._actionMenuButton) {\n this._actionMenuButton.style.display = this._actions.length > 0 ? '' : 'none';\n }\n if (this._actionMenu) {\n this._actionMenu.style.display = this._actions.length > 0 ? '' : 'none';\n }\n }\n\n private getFeedMenuOptions(): CourierInboxMenuOption[] {\n return this._feeds.map((feed, _index) => ({\n id: feed.feedId,\n text: feed.title,\n icon: {\n color: this.theme.inbox?.header?.feeds?.button?.selectedFeedIconColor ?? 'red',\n svg: feed.iconSVG ?? CourierIconSVGs.inbox\n },\n onClick: (_: CourierInboxMenuOption) => {\n if (feed.feedId === this._currentFeedId) {\n this._onFeedReselected(feed);\n } else {\n this._onFeedChange(feed);\n }\n }\n }));\n }\n\n public render(props: CourierInboxHeaderFactoryProps): void {\n const selectedFeed = props.feeds.find(feed => feed.isSelected);\n const selectedTab = selectedFeed?.tabs.find(tab => tab.isSelected);\n const showTabs = (selectedFeed?.tabs.length ?? 0) > 1;\n\n if (this._feedButton) {\n // Use the original feed's feedId (which maps to the header feed's id)\n this._feedButton.setSelectedFeed(selectedFeed?.feedId ?? '');\n this._feedButton.setUnreadCount(showTabs ? 0 : (selectedTab?.unreadCount ?? 0));\n this.updateFeedButtonInteraction();\n }\n\n if (this.tabs) {\n this.tabs.style.display = showTabs ? 'flex' : 'none';\n this.tabs.setSelectedTab(selectedTab?.datasetId ?? '');\n this.tabs.updateTabUnreadCount(selectedTab?.datasetId ?? '', selectedTab?.unreadCount ?? 0);\n }\n }\n\n build(newElement: HTMLElement | undefined | null) {\n super.build(newElement);\n this.refreshTheme();\n }\n\n defaultElement(): HTMLElement {\n // Create feed button\n this._feedButton = new CourierInboxFeedButton(\n this._themeSubscription.manager,\n this._feeds\n );\n\n // Set the feed menu up\n this._feedMenu = new CourierInboxOptionMenu(this._themeSubscription.manager, true, this.getFeedMenuOptions(), 'feed');\n this._feedMenu.setPosition({ left: '12px', top: '51px' });\n\n // Add click handler to feed button to toggle menu (only if multiple feeds)\n this._feedButtonClickHandler = (event: Event) => {\n event.stopPropagation();\n this._feedMenu?.toggleMenu();\n this._actionMenu?.closeMenu();\n };\n this.updateFeedButtonInteraction();\n\n // Action menu\n this._actionMenu = new CourierInboxOptionMenu(this._themeSubscription.manager, false, this.getActionOptions(), 'action');\n this._actionMenu.setPosition({ right: '12px', top: '51px' }); // 51px just looks better\n\n // Action menu button\n this._actionMenuButton = new CourierIconButton(CourierIconSVGs.overflow);\n this.refreshActionMenuButton();\n this._actionMenuButton.addEventListener('click', (event: Event) => {\n event.stopPropagation();\n this._actionMenu?.toggleMenu();\n this._feedMenu?.closeMenu();\n });\n\n // Create title section with feed button\n const titleSection = document.createElement('div');\n titleSection.className = 'title';\n titleSection.appendChild(this._feedButton);\n\n // Create flexible spacer\n const spacer = document.createElement('div');\n spacer.className = 'spacer';\n\n const headerContent = document.createElement('div');\n headerContent.className = 'header-content';\n headerContent.appendChild(titleSection);\n headerContent.appendChild(spacer);\n\n // Add action menu button and menu only if there are actions\n if (this._actions.length > 0) {\n headerContent.appendChild(this._actionMenuButton);\n headerContent.appendChild(this._actionMenu);\n }\n\n // Add feed menu if it exists (for multiple feeds)\n headerContent.appendChild(this._feedMenu);\n\n this.tabs = new CourierInboxTabs({\n themeManager: this._themeSubscription.manager,\n onTabClick: (tab: CourierInboxTab) => {\n this._onTabChange(tab);\n },\n onTabReselected: (tab: CourierInboxTab) => {\n this._onTabReselected(tab);\n }\n });\n\n const header = document.createElement('div');\n header.className = 'header';\n header.appendChild(headerContent);\n header.appendChild(this.tabs);\n\n return header;\n }\n\n private refreshActionMenuButton() {\n const buttonConfig = this.theme?.inbox?.header?.actions?.button;\n this._actionMenuButton?.updateIconSVG(buttonConfig?.icon?.svg ?? CourierIconSVGs.overflow);\n this._actionMenuButton?.updateIconColor(buttonConfig?.icon?.color ?? 'red');\n this._actionMenuButton?.updateBackgroundColor(buttonConfig?.backgroundColor ?? 'transparent');\n this._actionMenuButton?.updateHoverBackgroundColor(buttonConfig?.hoverBackgroundColor ?? CourierColors.black[500_10]);\n this._actionMenuButton?.updateActiveBackgroundColor(buttonConfig?.activeBackgroundColor ?? CourierColors.black[500_20]);\n }\n\n private updateFeedButtonInteraction() {\n if (!this._feedButton || !this._feedButtonClickHandler) {\n return;\n }\n\n // Always remove the listener first to avoid duplicates\n this._feedButton.removeEventListener('click', this._feedButtonClickHandler);\n\n const hasMultipleFeeds = this._feeds.length > 1;\n\n if (hasMultipleFeeds) {\n // Enable interaction: add click handler and set cursor to pointer\n this._feedButton.style.cursor = 'pointer';\n this._feedButton.addEventListener('click', this._feedButtonClickHandler);\n } else {\n // Disable interaction: remove click handler and set cursor to default\n this._feedButton.style.cursor = 'default';\n }\n }\n\n public setFeeds(feeds: CourierInboxFeed[]) {\n if (feeds.length === 0) {\n throw new Error('[CourierInboxHeader] Cannot set feeds to an empty array.');\n }\n\n if (!feeds[0].tabs.length) {\n throw new Error('[CourierInboxHeader] First feed does not have a tab.');\n }\n\n this._feeds = feeds;\n\n // Set the feeds and select the first feed\n this._feedButton?.setFeeds(feeds);\n this.selectFeed(feeds[0].feedId, feeds[0].tabs[0].datasetId);\n\n // Set the feed menu options\n this._feedMenu?.setOptions(this.getFeedMenuOptions());\n\n // Update feed button interaction based on number of feeds\n this.updateFeedButtonInteraction();\n }\n\n public setActions(actions: CourierInboxHeaderAction[]) {\n this._actions = actions;\n this._actionMenu?.setOptions(this.getActionOptions());\n\n // Show/hide action menu button based on whether there are actions\n if (this._actionMenuButton) {\n this._actionMenuButton.style.display = this._actions.length > 0 ? '' : 'none';\n }\n if (this._actionMenu) {\n this._actionMenu.style.display = this._actions.length > 0 ? '' : 'none';\n }\n }\n\n public selectFeed(feedId: string, tabId: string) {\n // Set the selected feed\n this._currentFeedId = feedId;\n this._feedButton?.setSelectedFeed(feedId);\n const feedIndex = this._feeds.findIndex(feed => feed.feedId === feedId);\n this._feedMenu?.selectionItemAtIndex(feedIndex);\n\n // Set the selected tabs\n const tabs = this._feeds.find(feed => feed.feedId === feedId)?.tabs ?? [];\n if (tabs.length > 0 && this.tabs) {\n this.tabs.style.display = tabs.length > 1 ? 'flex' : 'none';\n this.tabs.setTabs(tabs);\n this.tabs.setSelectedTab(tabId);\n\n // Immediately update unread counts for all tabs from the datastore\n for (const tab of tabs) {\n const dataset = CourierInboxDatastore.shared.getDatasetById(tab.datasetId);\n if (dataset) {\n this.tabs.updateTabUnreadCount(tab.datasetId, dataset.unreadCount);\n }\n }\n }\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n return `\n ${CourierInboxHeader.id} {\n display: flex;\n }\n\n ${CourierInboxHeader.id} > .header {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n position: relative;\n overflow-y: visible;\n background-color: ${theme.inbox?.header?.backgroundColor ?? CourierColors.white[500]};\n box-shadow: ${theme.inbox?.header?.shadow ?? `0px 1px 0px 0px red`};\n border-bottom: ${theme.inbox?.header?.border ?? '1px solid red'};\n z-index: 100;\n }\n\n ${CourierInboxHeader.id} .header-content {\n padding-top: 10px;\n padding-right: 12px;\n padding-bottom: 10px;\n padding-left: 12px;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n width: 100%;\n max-width: 100%;\n min-width: 0;\n position: relative;\n box-sizing: border-box;\n }\n\n ${CourierInboxHeader.id} .title {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n\n ${CourierInboxHeader.id} .spacer {\n flex: 1;\n }\n\n ${CourierInboxHeader.id} .actions {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n `;\n }\n\n}\n\nregisterElement(CourierInboxHeader);\n","import { CourierInboxDatastore } from \"./inbox-datastore\";\nimport { CourierInboxDatastoreEvents } from \"./datatore-events\";\n\nexport class CourierInboxDataStoreListener {\n readonly events: CourierInboxDatastoreEvents;\n\n constructor(events: CourierInboxDatastoreEvents) {\n this.events = events;\n }\n\n remove() {\n CourierInboxDatastore.shared.removeDataStoreListener(this);\n }\n\n}\n","import { CourierColors, CourierIconSVGs, SystemThemeMode, CourierFontTheme, CourierIconTheme, CourierButtonTheme, CourierIconButtonTheme } from \"@trycourier/courier-ui-core\";\n\n// Re-export common types from core for convenience\nexport type CourierInboxFontTheme = CourierFontTheme;\nexport type CourierInboxIconTheme = CourierIconTheme;\nexport type CourierInboxButtonTheme = CourierButtonTheme;\nexport type CourierInboxIconButtonTheme = CourierIconButtonTheme;\n\nexport type CourierInboxUnreadDotIndicatorTheme = {\n backgroundColor?: string;\n borderRadius?: string;\n height?: string;\n width?: string;\n}\n\nexport type CourierInboxUnreadCountIndicatorTheme = {\n font?: CourierInboxFontTheme;\n backgroundColor?: string;\n borderRadius?: string;\n padding?: string;\n}\n\nexport type CourierInboxMenuButtonTheme = CourierInboxIconButtonTheme & {\n unreadDotIndicator?: CourierInboxUnreadDotIndicatorTheme;\n}\n\nexport type CourierInboxAnimationTheme = {\n transition?: string;\n initialTransform?: string;\n visibleTransform?: string;\n}\n\nexport type CourierInboxPopupTheme = {\n backgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n animation?: CourierInboxAnimationTheme;\n list?: {\n font?: CourierInboxFontTheme;\n selectedIcon?: CourierInboxIconTheme;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n divider?: string;\n };\n}\n\nexport type CourierInboxListItemTheme = {\n unreadIndicatorColor?: string;\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n transition?: string;\n title?: CourierInboxFontTheme;\n subtitle?: CourierInboxFontTheme;\n time?: CourierInboxFontTheme;\n archiveIcon?: CourierInboxIconTheme;\n divider?: string;\n actions?: {\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n font?: CourierInboxFontTheme;\n }\n menu?: {\n enabled?: boolean;\n backgroundColor?: string;\n border?: string;\n borderRadius?: string;\n shadow?: string;\n animation?: CourierInboxAnimationTheme;\n longPress?: {\n displayDuration?: number;\n vibrationDuration?: number;\n };\n item?: {\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n borderRadius?: string;\n read?: CourierInboxIconTheme;\n unread?: CourierInboxIconTheme;\n archive?: CourierInboxIconTheme;\n unarchive?: CourierInboxIconTheme;\n };\n };\n}\n\nexport type CourierInboxSkeletonLoadingStateTheme = {\n animation?: {\n barColor?: string;\n barHeight?: string;\n barBorderRadius?: string;\n duration?: string;\n },\n divider?: string;\n}\n\nexport type CourierInboxInfoStateTheme = {\n title?: {\n font?: CourierInboxFontTheme;\n text?: string;\n },\n button?: CourierInboxButtonTheme;\n}\n\nexport type CourierMenuItemTheme = {\n icon?: CourierInboxIconTheme;\n text?: string;\n}\n\nexport type CourierActionMenuTheme = {\n button?: CourierInboxIconButtonTheme;\n markAllRead?: CourierMenuItemTheme;\n archiveAll?: CourierMenuItemTheme;\n archiveRead?: CourierMenuItemTheme;\n animation?: CourierInboxAnimationTheme;\n menu?: CourierInboxPopupTheme;\n}\n\nexport type CourierInboxTabsBorderRadius =\n | string\n | {\n topLeft?: string;\n topRight?: string;\n bottomLeft?: string;\n bottomRight?: string;\n };\n\nexport type CourierInboxListScrollbarTheme = {\n trackBackgroundColor?: string;\n thumbColor?: string;\n thumbHoverColor?: string;\n width?: string;\n height?: string;\n borderRadius?: string;\n}\n\nexport type CourierInboxTabsTheme = {\n borderRadius?: CourierInboxTabsBorderRadius;\n transition?: string;\n default?: {\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n font?: CourierInboxFontTheme;\n indicatorColor?: string;\n indicatorHeight?: string;\n unreadIndicator?: CourierInboxUnreadCountIndicatorTheme;\n },\n selected?: {\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n font?: CourierInboxFontTheme;\n indicatorColor?: string;\n indicatorHeight?: string;\n unreadIndicator?: CourierInboxUnreadCountIndicatorTheme;\n }\n}\n\nexport type CourierInboxTheme = {\n popup?: {\n button?: CourierInboxMenuButtonTheme;\n window?: {\n backgroundColor?: string;\n borderRadius?: string;\n border?: string;\n shadow?: string;\n animation?: CourierInboxAnimationTheme;\n };\n }\n inbox?: {\n header?: {\n backgroundColor?: string;\n shadow?: string;\n border?: string;\n feeds?: {\n button?: {\n selectedFeedIconColor?: string;\n font?: CourierInboxFontTheme;\n changeFeedIcon?: CourierIconTheme;\n unreadCountIndicator?: CourierInboxUnreadCountIndicatorTheme;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n transition?: string;\n }\n menu?: CourierInboxPopupTheme;\n tabs?: CourierInboxTabsTheme;\n }\n tabs?: CourierInboxTabsTheme;\n actions?: CourierActionMenuTheme\n }\n list?: {\n backgroundColor?: string;\n scrollbar?: CourierInboxListScrollbarTheme;\n item?: CourierInboxListItemTheme;\n },\n loading?: CourierInboxSkeletonLoadingStateTheme,\n empty?: CourierInboxInfoStateTheme,\n error?: CourierInboxInfoStateTheme\n }\n};\n\nexport const defaultLightTheme: CourierInboxTheme = {\n popup: {\n button: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.inbox\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.black[500_10],\n activeBackgroundColor: CourierColors.black[500_20],\n unreadDotIndicator: {\n backgroundColor: CourierColors.blue[500],\n borderRadius: '50%',\n height: '8px',\n width: '8px',\n }\n },\n window: {\n backgroundColor: CourierColors.white[500],\n borderRadius: '8px',\n border: `1px solid ${CourierColors.gray[500]}`,\n shadow: `0px 8px 16px -4px ${CourierColors.gray[500]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n }\n }\n },\n inbox: {\n header: {\n backgroundColor: CourierColors.white[500],\n shadow: `none`,\n border: `1px solid ${CourierColors.gray[500]}`,\n feeds: {\n button: {\n selectedFeedIconColor: CourierColors.black[500],\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n transition: 'all 0.2s ease',\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '16px'\n },\n changeFeedIcon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.chevronDown\n },\n unreadCountIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n },\n menu: {\n backgroundColor: CourierColors.white[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '6px',\n shadow: `0px 4px 8px -2px ${CourierColors.gray[500]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n },\n list: {\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n divider: `none`,\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n },\n selectedIcon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.check\n }\n }\n },\n tabs: {\n borderRadius: {\n topLeft: '4px',\n topRight: '4px'\n },\n transition: 'all 0.2s ease',\n default: {\n indicatorHeight: '1px',\n indicatorColor: 'transparent',\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n font: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.black[500_10],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n },\n selected: {\n indicatorHeight: '1px',\n indicatorColor: CourierColors.blue[500],\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n font: {\n color: CourierColors.blue[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n }\n }\n },\n tabs: {\n borderRadius: {\n topLeft: '4px',\n topRight: '4px'\n },\n transition: 'all 0.2s ease',\n default: {\n indicatorHeight: '1px',\n indicatorColor: 'transparent',\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n font: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.black[500_10],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n },\n selected: {\n indicatorHeight: '1px',\n indicatorColor: CourierColors.blue[500],\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n font: {\n color: CourierColors.blue[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '2px 6px',\n }\n }\n },\n actions: {\n button: {\n icon: {\n color: CourierColors.black[500],\n svg: CourierIconSVGs.overflow\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n },\n markAllRead: {\n icon: {\n color: CourierColors.black[500]\n },\n text: 'Read All'\n },\n archiveAll: {\n icon: {\n color: CourierColors.black[500]\n },\n text: 'Archive All'\n },\n archiveRead: {\n icon: {\n color: CourierColors.black[500]\n },\n text: 'Archive Read'\n },\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n }\n }\n },\n list: {\n backgroundColor: CourierColors.white[500],\n scrollbar: {\n trackBackgroundColor: 'transparent',\n thumbColor: CourierColors.black[500_20],\n thumbHoverColor: CourierColors.black[500_20],\n width: '8px',\n height: '8px',\n borderRadius: '4px'\n },\n item: {\n backgroundColor: 'transparent',\n unreadIndicatorColor: CourierColors.blue[500],\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n transition: 'all 0.2s ease',\n actions: {\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '4px',\n shadow: '0px 1px 2px 0px rgba(0, 0, 0, 0.06)',\n font: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n }\n },\n title: {\n color: CourierColors.black[500],\n family: undefined,\n size: '14px'\n },\n subtitle: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n time: {\n color: CourierColors.gray[600],\n family: undefined,\n size: '14px'\n },\n divider: `1px solid ${CourierColors.gray[200]}`,\n menu: {\n enabled: true,\n backgroundColor: CourierColors.white[500],\n border: `1px solid ${CourierColors.gray[500]}`,\n borderRadius: '4px',\n shadow: `0px 2px 4px -2px ${CourierColors.gray[500]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n },\n longPress: {\n displayDuration: 4000,\n vibrationDuration: 50\n },\n item: {\n hoverBackgroundColor: CourierColors.gray[200],\n activeBackgroundColor: CourierColors.gray[500],\n borderRadius: '0px',\n read: {\n color: CourierColors.black[500]\n },\n unread: {\n color: CourierColors.black[500]\n },\n archive: {\n color: CourierColors.black[500]\n },\n unarchive: {\n color: CourierColors.black[500]\n }\n }\n }\n }\n },\n loading: {\n animation: {\n barColor: CourierColors.gray[500],\n barHeight: '14px',\n barBorderRadius: '14px',\n duration: '2s'\n },\n divider: `1px solid ${CourierColors.gray[200]}`\n },\n empty: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.black[500],\n }\n },\n button: {\n text: 'Refresh'\n }\n },\n error: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.black[500],\n }\n },\n button: {\n text: 'Retry'\n }\n }\n }\n};\n\nexport const defaultDarkTheme: CourierInboxTheme = {\n popup: {\n button: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.inbox\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n unreadDotIndicator: {\n backgroundColor: CourierColors.blue[500],\n borderRadius: '50%',\n height: '8px',\n width: '8px',\n }\n },\n window: {\n backgroundColor: CourierColors.black[500],\n borderRadius: '8px',\n border: `1px solid ${CourierColors.gray[400]}`,\n shadow: `0px 4px 8px -2px ${CourierColors.white[500_20]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n }\n }\n },\n inbox: {\n header: {\n backgroundColor: CourierColors.black[500],\n shadow: `none`,\n border: `1px solid ${CourierColors.gray[400]}`,\n feeds: {\n button: {\n selectedFeedIconColor: CourierColors.white[500],\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n transition: 'all 0.2s ease',\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '16px'\n },\n changeFeedIcon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.chevronDown\n },\n unreadCountIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n },\n menu: {\n backgroundColor: CourierColors.black[500],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '6px',\n shadow: `0px 4px 8px -2px ${CourierColors.white[500_20]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n },\n list: {\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n divider: `none`,\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n selectedIcon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.check\n }\n }\n },\n tabs: {\n borderRadius: {\n topLeft: '4px',\n topRight: '4px'\n },\n transition: 'all 0.2s ease',\n default: {\n indicatorHeight: '1px',\n indicatorColor: 'transparent',\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.white[500_10],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n },\n selected: {\n indicatorHeight: '1px',\n indicatorColor: CourierColors.blue[500],\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n font: {\n color: CourierColors.blue[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n }\n }\n },\n tabs: {\n borderRadius: {\n topLeft: '4px',\n topRight: '4px'\n },\n transition: 'all 0.2s ease',\n default: {\n indicatorHeight: '1px',\n indicatorColor: 'transparent',\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.white[500_10],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n },\n selected: {\n indicatorHeight: '1px',\n indicatorColor: CourierColors.blue[500],\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n font: {\n color: CourierColors.blue[500],\n family: undefined,\n size: '14px'\n },\n unreadIndicator: {\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '12px'\n },\n backgroundColor: CourierColors.blue[500],\n borderRadius: '4px',\n padding: '3px 8px',\n }\n }\n },\n actions: {\n button: {\n icon: {\n color: CourierColors.white[500],\n svg: CourierIconSVGs.overflow\n },\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n },\n markAllRead: {\n icon: {\n color: CourierColors.white[500]\n },\n text: 'Read All'\n },\n archiveAll: {\n icon: {\n color: CourierColors.white[500]\n },\n text: 'Archive All'\n },\n archiveRead: {\n icon: {\n color: CourierColors.white[500]\n },\n text: 'Archive Read'\n },\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n }\n }\n },\n list: {\n backgroundColor: CourierColors.black[500],\n scrollbar: {\n trackBackgroundColor: 'transparent',\n thumbColor: CourierColors.white[500_20],\n thumbHoverColor: CourierColors.white[500_20],\n width: '8px',\n height: '8px',\n borderRadius: '4px'\n },\n item: {\n backgroundColor: 'transparent',\n unreadIndicatorColor: CourierColors.blue[500],\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n transition: 'all 0.2s ease',\n actions: {\n backgroundColor: 'transparent',\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '4px',\n shadow: `0px 1px 2px 0px ${CourierColors.white[500_10]}`,\n font: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n }\n },\n title: {\n color: CourierColors.white[500],\n family: undefined,\n size: '14px'\n },\n subtitle: {\n color: CourierColors.gray[500],\n family: undefined,\n size: '14px'\n },\n time: {\n color: CourierColors.gray[500],\n family: undefined,\n size: '12px'\n },\n divider: `1px solid ${CourierColors.gray[400]}`,\n menu: {\n enabled: true,\n backgroundColor: CourierColors.black[500],\n border: `1px solid ${CourierColors.gray[400]}`,\n borderRadius: '4px',\n shadow: `0px 2px 4px -2px ${CourierColors.white[500_20]}`,\n animation: {\n transition: 'none',\n initialTransform: 'translate3d(0, 0, 0)',\n visibleTransform: 'translate3d(0, 0, 0)'\n },\n longPress: {\n displayDuration: 4000,\n vibrationDuration: 50\n },\n item: {\n hoverBackgroundColor: CourierColors.white[500_10],\n activeBackgroundColor: CourierColors.white[500_20],\n borderRadius: '0px',\n read: {\n color: CourierColors.white[500]\n },\n unread: {\n color: CourierColors.white[500]\n },\n archive: {\n color: CourierColors.white[500]\n },\n unarchive: {\n color: CourierColors.white[500]\n }\n }\n }\n }\n },\n loading: {\n animation: {\n barColor: CourierColors.gray[400],\n barHeight: '14px',\n barBorderRadius: '14px',\n duration: '2s'\n },\n divider: `1px solid ${CourierColors.gray[400]}`\n },\n empty: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.white[500],\n }\n },\n button: {\n text: 'Refresh'\n }\n },\n error: {\n title: {\n font: {\n size: '16px',\n weight: '500',\n color: CourierColors.white[500],\n }\n },\n button: {\n text: 'Retry'\n }\n }\n }\n};\n\n// Deep merge the themes, only overwriting non-optional properties\nexport const mergeTheme = (mode: SystemThemeMode, theme: CourierInboxTheme): CourierInboxTheme => {\n const defaultTheme = mode === 'light' ? defaultLightTheme : defaultDarkTheme;\n return {\n popup: {\n button: {\n ...defaultTheme.popup?.button,\n ...theme.popup?.button,\n icon: {\n ...defaultTheme.popup?.button?.icon,\n ...theme.popup?.button?.icon\n },\n unreadDotIndicator: {\n ...defaultTheme.popup?.button?.unreadDotIndicator,\n ...theme.popup?.button?.unreadDotIndicator\n }\n },\n window: {\n ...defaultTheme.popup?.window,\n ...theme.popup?.window,\n animation: {\n ...defaultTheme.popup?.window?.animation,\n ...theme.popup?.window?.animation\n }\n }\n },\n inbox: {\n header: {\n ...defaultTheme.inbox?.header,\n ...theme.inbox?.header,\n feeds: {\n ...defaultTheme.inbox?.header?.feeds,\n ...theme.inbox?.header?.feeds,\n button: {\n ...defaultTheme.inbox?.header?.feeds?.button,\n ...theme.inbox?.header?.feeds?.button,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.button?.font,\n ...theme.inbox?.header?.feeds?.button?.font\n },\n changeFeedIcon: {\n ...defaultTheme.inbox?.header?.feeds?.button?.changeFeedIcon,\n ...theme.inbox?.header?.feeds?.button?.changeFeedIcon\n },\n unreadCountIndicator: {\n ...defaultTheme.inbox?.header?.feeds?.button?.unreadCountIndicator,\n ...theme.inbox?.header?.feeds?.button?.unreadCountIndicator,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.button?.unreadCountIndicator?.font,\n ...theme.inbox?.header?.feeds?.button?.unreadCountIndicator?.font\n }\n }\n },\n menu: {\n ...defaultTheme.inbox?.header?.feeds?.menu,\n ...theme.inbox?.header?.feeds?.menu,\n animation: {\n ...defaultTheme.inbox?.header?.feeds?.menu?.animation,\n ...theme.inbox?.header?.feeds?.menu?.animation\n },\n list: {\n ...defaultTheme.inbox?.header?.feeds?.menu?.list,\n ...theme.inbox?.header?.feeds?.menu?.list,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.menu?.list?.font,\n ...theme.inbox?.header?.feeds?.menu?.list?.font\n },\n selectedIcon: {\n ...defaultTheme.inbox?.header?.feeds?.menu?.list?.selectedIcon,\n ...theme.inbox?.header?.feeds?.menu?.list?.selectedIcon\n }\n }\n },\n tabs: {\n ...defaultTheme.inbox?.header?.feeds?.tabs,\n ...theme.inbox?.header?.feeds?.tabs,\n default: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.default,\n ...theme.inbox?.header?.feeds?.tabs?.default,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.default?.font,\n ...theme.inbox?.header?.feeds?.tabs?.default?.font\n },\n unreadIndicator: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.default?.unreadIndicator,\n ...theme.inbox?.header?.feeds?.tabs?.default?.unreadIndicator,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.default?.unreadIndicator?.font,\n ...theme.inbox?.header?.feeds?.tabs?.default?.unreadIndicator?.font\n }\n }\n },\n selected: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.selected,\n ...theme.inbox?.header?.feeds?.tabs?.selected,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.selected?.font,\n ...theme.inbox?.header?.feeds?.tabs?.selected?.font\n },\n unreadIndicator: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.selected?.unreadIndicator,\n ...theme.inbox?.header?.feeds?.tabs?.selected?.unreadIndicator,\n font: {\n ...defaultTheme.inbox?.header?.feeds?.tabs?.selected?.unreadIndicator?.font,\n ...theme.inbox?.header?.feeds?.tabs?.selected?.unreadIndicator?.font\n }\n }\n }\n }\n },\n tabs: {\n ...defaultTheme.inbox?.header?.tabs,\n ...theme.inbox?.header?.tabs,\n default: {\n ...defaultTheme.inbox?.header?.tabs?.default,\n ...theme.inbox?.header?.tabs?.default,\n font: {\n ...defaultTheme.inbox?.header?.tabs?.default?.font,\n ...theme.inbox?.header?.tabs?.default?.font\n },\n unreadIndicator: {\n ...defaultTheme.inbox?.header?.tabs?.default?.unreadIndicator,\n ...theme.inbox?.header?.tabs?.default?.unreadIndicator,\n font: {\n ...defaultTheme.inbox?.header?.tabs?.default?.unreadIndicator?.font,\n ...theme.inbox?.header?.tabs?.default?.unreadIndicator?.font\n }\n }\n },\n selected: {\n ...defaultTheme.inbox?.header?.tabs?.selected,\n ...theme.inbox?.header?.tabs?.selected,\n font: {\n ...defaultTheme.inbox?.header?.tabs?.selected?.font,\n ...theme.inbox?.header?.tabs?.selected?.font\n },\n unreadIndicator: {\n ...defaultTheme.inbox?.header?.tabs?.selected?.unreadIndicator,\n ...theme.inbox?.header?.tabs?.selected?.unreadIndicator,\n font: {\n ...defaultTheme.inbox?.header?.tabs?.selected?.unreadIndicator?.font,\n ...theme.inbox?.header?.tabs?.selected?.unreadIndicator?.font\n }\n }\n }\n },\n actions: {\n ...defaultTheme.inbox?.header?.actions,\n ...theme.inbox?.header?.actions,\n button: {\n ...defaultTheme.inbox?.header?.actions?.button,\n ...theme.inbox?.header?.actions?.button,\n icon: {\n ...defaultTheme.inbox?.header?.actions?.button?.icon,\n ...theme.inbox?.header?.actions?.button?.icon\n }\n },\n markAllRead: {\n ...defaultTheme.inbox?.header?.actions?.markAllRead,\n ...theme.inbox?.header?.actions?.markAllRead,\n icon: {\n ...defaultTheme.inbox?.header?.actions?.markAllRead?.icon,\n ...theme.inbox?.header?.actions?.markAllRead?.icon\n }\n },\n archiveAll: {\n ...defaultTheme.inbox?.header?.actions?.archiveAll,\n ...theme.inbox?.header?.actions?.archiveAll,\n icon: {\n ...defaultTheme.inbox?.header?.actions?.archiveAll?.icon,\n ...theme.inbox?.header?.actions?.archiveAll?.icon\n }\n },\n archiveRead: {\n ...defaultTheme.inbox?.header?.actions?.archiveRead,\n ...theme.inbox?.header?.actions?.archiveRead,\n icon: {\n ...defaultTheme.inbox?.header?.actions?.archiveRead?.icon,\n ...theme.inbox?.header?.actions?.archiveRead?.icon\n }\n },\n animation: {\n ...defaultTheme.inbox?.header?.actions?.animation,\n ...theme.inbox?.header?.actions?.animation\n }\n }\n },\n list: {\n ...defaultTheme.inbox?.list,\n ...theme.inbox?.list,\n scrollbar: {\n ...defaultTheme.inbox?.list?.scrollbar,\n ...theme.inbox?.list?.scrollbar\n },\n item: {\n ...defaultTheme.inbox?.list?.item,\n ...theme.inbox?.list?.item,\n actions: {\n ...defaultTheme.inbox?.list?.item?.actions,\n ...theme.inbox?.list?.item?.actions,\n font: {\n ...defaultTheme.inbox?.list?.item?.actions?.font,\n ...theme.inbox?.list?.item?.actions?.font\n }\n },\n title: {\n ...defaultTheme.inbox?.list?.item?.title,\n ...theme.inbox?.list?.item?.title\n },\n subtitle: {\n ...defaultTheme.inbox?.list?.item?.subtitle,\n ...theme.inbox?.list?.item?.subtitle\n },\n time: {\n ...defaultTheme.inbox?.list?.item?.time,\n ...theme.inbox?.list?.item?.time\n },\n menu: {\n ...defaultTheme.inbox?.list?.item?.menu,\n ...theme.inbox?.list?.item?.menu,\n animation: {\n ...defaultTheme.inbox?.list?.item?.menu?.animation,\n ...theme.inbox?.list?.item?.menu?.animation\n },\n item: {\n ...defaultTheme.inbox?.list?.item?.menu?.item,\n ...theme.inbox?.list?.item?.menu?.item,\n read: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.read,\n ...theme.inbox?.list?.item?.menu?.item?.read\n },\n unread: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.unread,\n ...theme.inbox?.list?.item?.menu?.item?.unread\n },\n archive: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.archive,\n ...theme.inbox?.list?.item?.menu?.item?.archive\n },\n unarchive: {\n ...defaultTheme.inbox?.list?.item?.menu?.item?.unarchive,\n ...theme.inbox?.list?.item?.menu?.item?.unarchive\n }\n }\n }\n }\n },\n loading: {\n ...defaultTheme.inbox?.loading,\n ...theme.inbox?.loading,\n animation: {\n ...defaultTheme.inbox?.loading?.animation,\n ...theme.inbox?.loading?.animation\n }\n },\n empty: {\n ...defaultTheme.inbox?.empty,\n ...theme.inbox?.empty,\n title: {\n ...defaultTheme.inbox?.empty?.title,\n ...theme.inbox?.empty?.title,\n font: {\n ...defaultTheme.inbox?.empty?.title?.font,\n ...theme.inbox?.empty?.title?.font\n }\n },\n button: {\n ...defaultTheme.inbox?.empty?.button,\n ...theme.inbox?.empty?.button,\n font: {\n ...defaultTheme.inbox?.empty?.button?.font,\n ...theme.inbox?.empty?.button?.font\n }\n }\n },\n error: {\n ...defaultTheme.inbox?.error,\n ...theme.inbox?.error,\n title: {\n ...defaultTheme.inbox?.error?.title,\n ...theme.inbox?.error?.title,\n font: {\n ...defaultTheme.inbox?.error?.title?.font,\n ...theme.inbox?.error?.title?.font\n }\n },\n button: {\n ...defaultTheme.inbox?.error?.button,\n ...theme.inbox?.error?.button,\n font: {\n ...defaultTheme.inbox?.error?.button?.font,\n ...theme.inbox?.error?.button?.font\n }\n }\n }\n }\n };\n};\n","import { CourierThemeManager, CourierThemeSubscription, SystemThemeMode } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme, defaultDarkTheme, defaultLightTheme, mergeTheme } from \"./courier-inbox-theme\";\n\nexport interface CourierInboxThemeSubscription extends CourierThemeSubscription<CourierInboxTheme> {\n manager: CourierInboxThemeManager;\n}\n\n/**\n * Inbox-specific theme manager that extends the abstract CourierThemeManager.\n * Provides inbox theme management with light/dark mode support.\n */\nexport class CourierInboxThemeManager extends CourierThemeManager<CourierInboxTheme> {\n\n // Event ID for inbox theme changes\n protected readonly THEME_CHANGE_EVENT: string = 'courier_inbox_theme_change';\n\n constructor(initialTheme: CourierInboxTheme) {\n super(initialTheme);\n }\n\n /**\n * Get the default light theme for inbox\n */\n protected getDefaultLightTheme(): CourierInboxTheme {\n return defaultLightTheme;\n }\n\n /**\n * Get the default dark theme for inbox\n */\n protected getDefaultDarkTheme(): CourierInboxTheme {\n return defaultDarkTheme;\n }\n\n /**\n * Merge the inbox theme with defaults\n */\n protected mergeTheme(mode: SystemThemeMode, theme: CourierInboxTheme): CourierInboxTheme {\n return mergeTheme(mode, theme);\n }\n\n /**\n * Subscribe to inbox theme changes\n * @param callback - Function to run when the theme changes\n * @returns Object with unsubscribe method to stop listening\n */\n public subscribe(callback: (theme: CourierInboxTheme) => void): CourierInboxThemeSubscription {\n const baseSubscription = super.subscribe(callback);\n return {\n ...baseSubscription,\n manager: this\n };\n }\n\n}\n","import { AuthenticationListener, Courier, InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierInboxList } from \"./courier-inbox-list\";\nimport { CourierInboxHeader } from \"./courier-inbox-header\";\nimport { CourierBaseElement, CourierComponentThemeMode, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxFeed, CourierInboxTab, InboxDataSet } from \"../types/inbox-data-set\";\nimport { CourierInboxDataStoreListener } from \"../datastore/datastore-listener\";\nimport { CourierInboxDatastore } from \"../datastore/inbox-datastore\";\nimport { CourierInboxHeaderFactoryProps, CourierInboxHeaderFeed, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from \"../types/factories\";\nimport { CourierInboxTheme, defaultLightTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierInboxHeaderAction, CourierInboxListItemAction, defaultFeeds, defaultActions, defaultListItemActions } from \"../types/inbox-defaults\";\n\nexport class CourierInbox extends CourierBaseElement {\n\n static get id(): string {\n return 'courier-inbox';\n }\n\n /**\n * Returns the default set of feeds used by CourierInbox.\n * Exposed as a convenience for constructing matching datasets in\n * custom integrations (for example, when using CourierInboxDatastore directly).\n * \n * @example\n * Returns:\n * [\n * {\n * feedId: 'inbox_feed',\n * title: 'Inbox',\n * iconSVG: CourierIconSVGs.inbox,\n * tabs: [\n * {\n * datasetId: 'all_messages',\n * title: 'All Messages',\n * filter: {}\n * }\n * ]\n * },\n * {\n * feedId: 'archive_feed',\n * title: 'Archive',\n * iconSVG: CourierIconSVGs.archive,\n * tabs: [\n * {\n * datasetId: 'archived_messages',\n * title: 'Archived Messages',\n * filter: {\n * archived: true\n * }\n * }\n * ]\n * }\n * ]\n */\n public static defaultFeeds(): CourierInboxFeed[] {\n return defaultFeeds();\n }\n\n /**\n * Returns the default header actions used by CourierInbox.\n * Exposed as a convenience for building matching headers in custom UIs.\n * \n * @example\n * Returns:\n * [\n * { id: 'readAll' },\n * { id: 'archiveRead' },\n * { id: 'archiveAll' }\n * ]\n */\n public static defaultActions(): CourierInboxHeaderAction[] {\n return defaultActions();\n }\n\n /**\n * Returns the default list item actions used by CourierInbox.\n * Exposed as a convenience for building matching message menus in custom UIs.\n * \n * @example\n * Returns:\n * [\n * { id: 'read_unread' },\n * { id: 'archive_unarchive' }\n * ]\n */\n public static defaultListItemActions(): CourierInboxListItemAction[] {\n return defaultListItemActions();\n }\n\n // State\n private _currentFeedId: string = defaultFeeds()[0].feedId;\n private _feedTabMap: Map<string, string> = new Map();\n\n /** Returns the current feed type. */\n get currentFeedId(): string {\n return this._currentFeedId;\n }\n\n /** Returns the current tab ID for the current feed. */\n private get _currentTabId(): string {\n return this.getSelectedTabIdForFeed(this._currentFeedId);\n }\n\n /** Returns the selected tab ID for a given feed ID. */\n private getSelectedTabIdForFeed(feedId: string): string {\n return this._feedTabMap.get(feedId) ?? 'unknown_tab';\n }\n\n // Theming\n // Theme manager instance for handling theming logic\n private _themeManager: CourierInboxThemeManager;\n\n /** Returns the current theme object. */\n get theme() {\n return this._themeManager.getTheme();\n }\n\n /**\n * Set the light theme for the inbox.\n * @param theme The light theme object to set.\n */\n public setLightTheme(theme: CourierInboxTheme) {\n this._themeManager.setLightTheme(theme);\n }\n\n /**\n * Set the dark theme for the inbox.\n * @param theme The dark theme object to set.\n */\n public setDarkTheme(theme: CourierInboxTheme) {\n this._themeManager.setDarkTheme(theme);\n }\n\n /**\n * Set the theme mode (light/dark/system).\n * @param mode The theme mode to set.\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._themeManager.setMode(mode);\n }\n\n\n // Components\n private _inboxStyle?: HTMLStyleElement;\n private _list?: CourierInboxList;\n private _datastoreListener: CourierInboxDataStoreListener | undefined;\n private _authListener: AuthenticationListener | undefined;\n private _feeds: CourierInboxFeed[] = defaultFeeds();\n\n // Header\n private _header?: CourierInboxHeader;\n private _headerFactory: ((props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) | undefined | null = undefined;\n private _actions: CourierInboxHeaderAction[] = CourierInbox.defaultActions();\n\n // List\n private _onMessageClick?: (props: CourierInboxListItemFactoryProps) => void;\n private _onMessageActionClick?: (props: CourierInboxListItemActionFactoryProps) => void;\n private _onMessageLongPress?: (props: CourierInboxListItemFactoryProps) => void;\n private _listItemActions: CourierInboxListItemAction[] = CourierInbox.defaultListItemActions();\n\n // Default props\n private _defaultProps = {\n height: 'auto'\n };\n\n static get observedAttributes() {\n return ['height', 'light-theme', 'dark-theme', 'mode', 'message-click', 'message-action-click', 'message-long-press'];\n }\n\n constructor(themeManager?: CourierInboxThemeManager) {\n super();\n this._themeManager = themeManager ?? new CourierInboxThemeManager(defaultLightTheme);\n }\n\n private resetInitialFeedAndTab() {\n if (!this._feeds.length) {\n throw new Error('No feeds are available to initialize.');\n }\n\n // Clear the feed tab map\n this._feedTabMap.clear();\n\n // Set the default (first) tab for each feed in the map\n for (const feed of this._feeds) {\n if (!feed.tabs || !feed.tabs.length) {\n throw new Error(`Feed \"${feed.feedId}\" does not contain any tabs. You must have at least one tab in each feed.`);\n }\n // Set the default (first) tab for each feed in the map\n this._feedTabMap.set(feed.feedId, feed.tabs[0].datasetId);\n }\n\n // Optionally set current feed and tab if not already set\n this._currentFeedId = this._feeds[0].feedId;\n }\n\n onComponentMounted() {\n this.readInitialThemeAttributes();\n this.attachElements();\n this.setupThemeSubscription();\n this.setupAuthListener();\n this.initializeInboxData();\n }\n\n private readInitialThemeAttributes() {\n const lightTheme = this.getAttribute('light-theme');\n if (lightTheme) {\n try {\n this.setLightTheme(JSON.parse(lightTheme));\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse light-theme attribute:', error);\n }\n }\n\n const darkTheme = this.getAttribute('dark-theme');\n if (darkTheme) {\n try {\n this.setDarkTheme(JSON.parse(darkTheme));\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse dark-theme attribute:', error);\n }\n }\n\n const mode = this.getAttribute('mode');\n if (mode) {\n this._themeManager.setMode(mode as CourierComponentThemeMode);\n }\n }\n\n private setupThemeSubscription() {\n\n // Subscribe to theme changes\n this._themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n // Refresh the theme\n this.refreshTheme();\n }\n\n private setupAuthListener() {\n this._authListener = Courier.shared.addAuthenticationListener(async ({ userId }) => {\n if (userId) {\n await this.refresh();\n }\n });\n }\n\n private initializeInboxData() {\n\n // Reset the initial feed and tab\n this.resetInitialFeedAndTab();\n\n // Create the datasets from the feeds\n CourierInboxDatastore.shared.registerFeeds(this._feeds);\n\n // Create the data store listener\n this._datastoreListener = new CourierInboxDataStoreListener({\n onError: (error: Error) => {\n this._list?.setError(error);\n },\n onDataSetChange: (dataset: InboxDataSet) => {\n if (this._currentTabId === dataset.id) {\n this._list?.setDataSet(dataset);\n this.updateHeader();\n }\n },\n onPageAdded: (dataset: InboxDataSet) => {\n if (this._currentTabId === dataset.id) {\n this._list?.addPage(dataset);\n this.updateHeader();\n }\n },\n onMessageAdd: (message: InboxMessage, index: number, datasetId: string) => {\n if (this._currentTabId === datasetId) {\n this._list?.addMessage(message, index);\n this.updateHeader();\n }\n },\n onMessageRemove: (_: InboxMessage, index: number, datasetId: string) => {\n if (this._currentTabId === datasetId) {\n this._list?.removeMessage(index);\n this.updateHeader();\n }\n },\n onMessageUpdate: (message: InboxMessage, index: number, datasetId: string) => {\n if (this._currentTabId === datasetId) {\n this._list?.updateMessage(message, index);\n this.updateHeader();\n }\n },\n onUnreadCountChange: (unreadCount: number, datasetId: string) => {\n // Always update the tab badges for all tabs\n this._header?.tabs?.updateTabUnreadCount(datasetId, unreadCount);\n\n // Only update the main unread count if it's the current tab\n if (this._currentTabId === datasetId) {\n this.updateHeader();\n }\n },\n onTotalUnreadCountChange: (_totalUnreadCount: number) => {\n // Re-render the header so custom headers that depend on total unread count can update\n this.updateHeader();\n }\n });\n\n // Add the data store listener to the datastore\n CourierInboxDatastore.shared.addDataStoreListener(this._datastoreListener);\n\n // Refresh the inbox\n this.refresh();\n }\n\n private attachElements() {\n\n // Inject style\n this._inboxStyle = injectGlobalStyle(CourierInbox.id, this.getStyles());\n\n // Header\n this._header = new CourierInboxHeader({\n themeManager: this._themeManager,\n actions: this._actions,\n onFeedChange: (feed: CourierInboxFeed) => {\n this.selectFeed(feed.feedId);\n },\n onFeedReselected: (feed: CourierInboxFeed) => {\n this.selectTab(feed.tabs[0].datasetId);\n this._list?.scrollToTop();\n this._header?.tabs?.scrollToStart();\n },\n onTabChange: (tab: CourierInboxTab) => {\n this.selectTab(tab.datasetId);\n },\n onTabReselected: (_tab: CourierInboxTab) => {\n this._list?.scrollToTop();\n }\n });\n\n // Build the element and set the initial feeds\n this._header?.build(undefined);\n this._header?.setFeeds(this._feeds);\n this.appendChild(this._header);\n\n // Create list and ensure it's properly initialized\n this._list = new CourierInboxList({\n themeManager: this._themeManager,\n listItemActions: this._listItemActions,\n canClickListItems: false,\n canLongPressListItems: false,\n onRefresh: () => {\n this.refresh();\n },\n onPaginationTrigger: async (datasetId: string) => {\n try {\n await CourierInboxDatastore.shared.fetchNextPageOfMessages({\n datasetId: datasetId\n });\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to fetch next page of messages:', error);\n }\n },\n onMessageClick: (message, index) => {\n CourierInboxDatastore.shared.clickMessage({ message });\n\n this.dispatchEvent(new CustomEvent('message-click', {\n detail: { message, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageClick?.({ message, index });\n },\n onMessageActionClick: (message, action, index) => {\n\n // TODO: Track action click?\n\n this.dispatchEvent(new CustomEvent('message-action-click', {\n detail: { message, action, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageActionClick?.({ message, action, index });\n },\n onMessageLongPress: (message, index) => {\n this.dispatchEvent(new CustomEvent('message-long-press', {\n detail: { message, index },\n bubbles: true,\n composed: true\n }));\n\n this._onMessageLongPress?.({ message, index });\n }\n });\n\n this.appendChild(this._list);\n\n }\n\n onComponentUnmounted() {\n this._themeManager.cleanup();\n this._datastoreListener?.remove();\n this._authListener?.remove();\n this._inboxStyle?.remove();\n }\n\n private refreshTheme() {\n this._list?.refreshInfoStateThemes();\n if (this._inboxStyle) {\n this._inboxStyle.textContent = this.getStyles();\n }\n }\n\n private getStyles(): string {\n return `\n ${CourierInbox.id} {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: ${this._defaultProps.height};\n }\n\n ${CourierInbox.id} courier-inbox-list {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n }\n `;\n }\n\n /**\n * Sets a custom header factory for the inbox.\n * @param factory - A function that returns an HTMLElement to render as the header.\n */\n public setHeader(factory: (props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) {\n this._headerFactory = factory;\n this.updateHeader();\n }\n\n /**\n * Removes the custom header factory from the inbox, reverting to the default header.\n */\n public removeHeader() {\n this._headerFactory = null;\n this.updateHeader();\n }\n\n /**\n * Sets a custom loading state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the loading state.\n */\n public setLoadingState(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setLoadingStateFactory(factory);\n }\n\n /**\n * Sets a custom empty state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the empty state.\n */\n public setEmptyState(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setEmptyStateFactory(factory);\n }\n\n /**\n * Sets a custom error state factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as the error state.\n */\n public setErrorState(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setErrorStateFactory(factory);\n }\n\n /**\n * Sets a custom list item factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as a list item.\n */\n public setListItem(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setListItemFactory(factory);\n }\n\n /**\n * Sets a custom pagination item factory for the inbox list.\n * @param factory - A function that returns an HTMLElement to render as a pagination item.\n */\n public setPaginationItem(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement) {\n this._list?.setPaginationItemFactory(factory);\n }\n\n /**\n * Registers a handler for message click events.\n * @param handler - A function to be called when a message is clicked.\n */\n public onMessageClick(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._onMessageClick = handler;\n\n // Tell the list if we can click. This will update styles if needed.\n this._list?.setCanClickListItems(handler !== undefined);\n }\n\n /**\n * Registers a handler for message action click events.\n * @param handler - A function to be called when a message action is clicked.\n */\n public onMessageActionClick(handler?: (props: CourierInboxListItemActionFactoryProps) => void) {\n this._onMessageActionClick = handler;\n }\n\n /**\n * Registers a handler for message long press events.\n * @param handler - A function to be called when a message is long-pressed.\n */\n public onMessageLongPress(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._onMessageLongPress = handler;\n\n // Tell the list if we can long press. This will update styles if needed.\n this._list?.setCanLongPressListItems(handler !== undefined);\n }\n\n private async reloadListForTab() {\n this._list?.selectDataset(this._currentTabId);\n\n // Load data for the tab\n await CourierInboxDatastore.shared.load({\n canUseCache: true,\n datasetIds: [this._currentTabId]\n });\n }\n\n /**\n * Sets the active feed for the inbox.\n * @param feedId - The feed ID to display.\n */\n public selectFeed(feedId: string) {\n const feed = this._feeds.find(f => f.feedId === feedId);\n if (!feed) {\n throw new Error(`Feed \"${feedId}\" does not exist.`);\n }\n\n // If reselecting the current feed, reset to first tab and reload\n if (this._currentFeedId === feedId) {\n if (!feed.tabs || feed.tabs.length === 0) {\n throw new Error(`Feed \"${feedId}\" does not contain any tabs. You must have at least one tab in each feed.`);\n }\n const firstTabId = feed.tabs[0].datasetId;\n this._header?.selectFeed(feedId, firstTabId);\n this.selectTab(firstTabId);\n return;\n }\n\n // Set the current feed and update the header\n this._currentFeedId = feedId;\n this._header?.selectFeed(feedId, this._currentTabId);\n this.selectTab(this._currentTabId);\n }\n\n /**\n * Switches to a tab by updating components and loading data.\n * @param tabId - The tab ID to switch to.\n * @param animate - Whether to animate the scroll to top.\n */\n public selectTab(tabId: string) {\n const currentFeed = this._feeds.find(feed => feed.feedId === this._currentFeedId);\n if (!currentFeed) {\n throw new Error(`Feed \"${this._currentFeedId}\" does not exist.`);\n }\n\n const tabExistsInCurrentFeed = currentFeed.tabs?.some(tab => tab.datasetId === tabId);\n if (!tabExistsInCurrentFeed) {\n throw new Error(`Tab \"${tabId}\" does not exist in feed \"${currentFeed.feedId}\".`);\n }\n\n // Save the selected tab for the current feed\n this._feedTabMap.set(this._currentFeedId, tabId);\n\n // Update components\n this._header?.tabs?.setSelectedTab(tabId);\n this.reloadListForTab();\n }\n\n /**\n * Updates unread counts for a list of tabs.\n * @param tabs - The tabs to update unread counts for.\n */\n private updateTabUnreadCounts(tabs: CourierInboxTab[]) {\n for (const tab of tabs) {\n const dataset = CourierInboxDatastore.shared.getDatasetById(tab.datasetId);\n if (dataset) {\n this._header?.tabs?.updateTabUnreadCount(tab.datasetId, dataset.unreadCount);\n }\n }\n }\n\n /**\n * Sets the enabled header actions for the inbox.\n * Pass an empty array to remove all actions.\n * @param actions - The header actions to enable (e.g., [{ id: 'readAll', iconSVG: '...', text: '...' }]).\n */\n public setActions(actions: CourierInboxHeaderAction[]) {\n this._actions = actions;\n this._header?.setActions(this._actions);\n }\n\n /**\n * Sets the enabled list item actions for the inbox.\n * Pass an empty array to remove all actions.\n * @param actions - The list item actions to enable (e.g., [{ id: 'read_unread', readIconSVG: '...', unreadIconSVG: '...' }]).\n */\n public setListItemActions(actions: CourierInboxListItemAction[]) {\n this._listItemActions = actions;\n this._list?.setListItemActions(this._listItemActions);\n }\n\n /**\n * Sets the feeds for the inbox.\n * @param feeds - The feeds to set for the inbox.\n */\n public setFeeds(feeds: CourierInboxFeed[]) {\n this._feeds = feeds;\n\n // Reset the initial feed and tab\n this.resetInitialFeedAndTab();\n\n // Create datasets from the feeds\n CourierInboxDatastore.shared.registerFeeds(this._feeds);\n\n // Update the header with new feeds\n this._header?.setFeeds(this._feeds);\n\n // Select the correct feed and tab before updating header to avoid tabs flashing\n this._header?.selectFeed(this._currentFeedId, this._currentTabId);\n\n // Update header (now with correct feed/tab selected)\n this.updateHeader();\n\n // Reload the list for the current tab\n this._list?.selectDataset(this._currentTabId);\n this._list?.scrollToTop(false);\n\n // Refresh the inbox data\n this.refresh();\n }\n\n /** Get the current set of feeds. */\n public getFeeds() {\n return this._feeds;\n }\n\n /**\n * Returns the header feeds in the format expected by header factories.\n * @public\n */\n public getHeaderFeeds(): CourierInboxHeaderFeed[] {\n return this._feeds.map(feed => ({\n feedId: feed.feedId,\n title: feed.title,\n iconSVG: feed.iconSVG,\n tabs: feed.tabs.map(tab => ({\n datasetId: tab.datasetId,\n title: tab.title,\n unreadCount: CourierInboxDatastore.shared.getDatasetById(tab.datasetId)?.unreadCount ?? 0,\n isSelected: tab.datasetId === this._currentTabId,\n filter: tab.filter\n })),\n isSelected: feed.feedId === this._currentFeedId\n }));\n }\n\n private updateHeader() {\n const tabId = this._currentTabId;\n if (!tabId) {\n return;\n }\n const props: CourierInboxHeaderFactoryProps = {\n feeds: this.getHeaderFeeds()\n };\n\n switch (this._headerFactory) {\n case undefined:\n // Render default header\n this._header?.render(props);\n break;\n case null:\n // Remove header\n this._header?.build(null);\n break;\n default:\n // Render custom header\n const headerElement = this._headerFactory(props);\n this._header?.build(headerElement);\n break;\n }\n\n }\n\n private async load(props: { canUseCache: boolean }) {\n\n // Load the inbox data\n await CourierInboxDatastore.shared.load(props);\n\n // Update all tab unread counts immediately after loading data\n for (const feed of this._feeds) {\n this.updateTabUnreadCounts(feed.tabs);\n }\n\n // Connect to socket for realtime updates (don't wait for this)\n await CourierInboxDatastore.shared.listenForUpdates();\n }\n\n /**\n * Forces a reload of the inbox data, bypassing the cache.\n */\n public async refresh() {\n\n // Refresh the inbox if the user is already signed in\n if (!Courier.shared.client?.options.userId) {\n Courier.shared.client?.options.logger.error('No user signed in. Please call Courier.shared.signIn(...) to load the inbox.')\n return;\n }\n\n // Load the inbox data\n return this.load({\n canUseCache: false\n });\n\n }\n\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\n if (oldValue === newValue) return;\n switch (name) {\n case 'height':\n const height = newValue || this._defaultProps.height;\n this.style.height = height;\n break;\n case 'message-click':\n if (newValue) {\n try {\n this._onMessageClick = new Function('props', newValue) as (props: CourierInboxListItemFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-click handler:', error);\n }\n } else {\n this._onMessageClick = undefined;\n }\n break;\n case 'message-action-click':\n if (newValue) {\n try {\n this._onMessageActionClick = new Function('props', newValue) as (props: CourierInboxListItemActionFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-action-click handler:', error);\n }\n } else {\n this._onMessageActionClick = undefined;\n }\n break;\n case 'message-long-press':\n if (newValue) {\n try {\n this._onMessageLongPress = new Function('props', newValue) as (props: CourierInboxListItemFactoryProps) => void;\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse message-long-press handler:', error);\n }\n } else {\n this._onMessageLongPress = undefined;\n }\n break;\n case 'light-theme':\n if (newValue) {\n this.setLightTheme(JSON.parse(newValue));\n }\n break;\n case 'dark-theme':\n if (newValue) {\n this.setDarkTheme(JSON.parse(newValue));\n }\n break;\n case 'mode':\n this._themeManager.setMode(newValue as CourierComponentThemeMode);\n break;\n }\n }\n\n}\n\nregisterElement(CourierInbox);\n","import { CourierColors, CourierFactoryElement, CourierIconButton, CourierIconSVGs, injectGlobalStyle, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager, CourierInboxThemeSubscription } from \"../types/courier-inbox-theme-manager\";\n\nexport class CourierInboxMenuButton extends CourierFactoryElement {\n\n static get id(): string {\n return 'courier-inbox-menu-button';\n }\n\n // Theme\n private _themeSubscription: CourierInboxThemeSubscription;\n\n // Components\n private _style?: HTMLStyleElement;\n private _container?: HTMLDivElement;\n private _triggerButton?: CourierIconButton;\n private _unreadBadge?: HTMLDivElement;\n\n get theme(): CourierInboxTheme {\n return this._themeSubscription.manager.getTheme();\n }\n\n constructor(themeBus: CourierInboxThemeManager) {\n super();\n this._themeSubscription = themeBus.subscribe((_: CourierInboxTheme) => {\n this.refreshTheme();\n });\n }\n\n onComponentMounted() {\n this.refreshTheme();\n }\n\n onComponentUnmounted() {\n this._themeSubscription.unsubscribe();\n this._style?.remove();\n }\n\n defaultElement(): HTMLElement {\n\n // Create trigger button container\n this._container = document.createElement('div');\n this._container.className = 'menu-button-container';\n\n // Create trigger button\n this._triggerButton = new CourierIconButton(CourierIconSVGs.inbox);\n\n // Create unread badge (red 4x4 circle)\n this._unreadBadge = document.createElement('div');\n this._unreadBadge.id = 'unread-badge';\n this._unreadBadge.style.display = 'none'; // Hidden by default\n\n this._container.appendChild(this._triggerButton);\n this._container.appendChild(this._unreadBadge);\n\n return this._container;\n }\n\n static getStyles(theme: CourierInboxTheme): string {\n return `\n ${CourierInboxMenuButton.id} {\n display: inline-block;\n }\n\n ${CourierInboxMenuButton.id} .menu-button-container {\n position: relative;\n display: inline-block;\n }\n \n ${CourierInboxMenuButton.id} .menu-button-container #unread-badge {\n position: absolute;\n top: 2px;\n right: 2px;\n pointer-events: none;\n width: ${theme.popup?.button?.unreadDotIndicator?.width ?? '8px'};\n height: ${theme.popup?.button?.unreadDotIndicator?.height ?? '8px'};\n background: ${theme.popup?.button?.unreadDotIndicator?.backgroundColor ?? 'red'};\n border-radius: ${theme.popup?.button?.unreadDotIndicator?.borderRadius ?? '50%'};\n display: none;\n z-index: 1;\n }\n `;\n }\n\n public onUnreadCountChange(unreadCount: number): void {\n if (this._unreadBadge) {\n this._unreadBadge.style.display = unreadCount > 0 ? 'block' : 'none';\n }\n this.refreshTheme();\n }\n\n private refreshTheme() {\n this._style?.remove();\n this._style = injectGlobalStyle(CourierInboxMenuButton.id, CourierInboxMenuButton.getStyles(this.theme));\n this._triggerButton?.updateIconColor(this.theme?.popup?.button?.icon?.color ?? CourierColors.black[500]);\n this._triggerButton?.updateIconSVG(this.theme?.popup?.button?.icon?.svg ?? CourierIconSVGs.inbox);\n this._triggerButton?.updateBackgroundColor(this.theme?.popup?.button?.backgroundColor ?? 'transparent');\n this._triggerButton?.updateHoverBackgroundColor(this.theme?.popup?.button?.hoverBackgroundColor ?? CourierColors.black[500_10]);\n this._triggerButton?.updateActiveBackgroundColor(this.theme?.popup?.button?.activeBackgroundColor ?? CourierColors.black[500_20]);\n }\n\n}\n\nregisterElement(CourierInboxMenuButton);\n","import { CourierInbox } from \"./courier-inbox\";\nimport { CourierInboxDatastoreEvents } from \"../datastore/datatore-events\";\nimport { CourierInboxDataStoreListener } from \"../datastore/datastore-listener\";\nimport { CourierInboxDatastore } from \"../datastore/inbox-datastore\";\nimport { CourierInboxHeaderFactoryProps, CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxMenuButtonFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxStateLoadingFactoryProps } from \"../types/factories\";\nimport { CourierInboxFeed } from \"../types/inbox-data-set\";\nimport { CourierInboxMenuButton } from \"./courier-inbox-menu-button\";\nimport { defaultLightTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxTheme } from \"../types/courier-inbox-theme\";\nimport { CourierInboxThemeManager } from \"../types/courier-inbox-theme-manager\";\nimport { CourierComponentThemeMode, injectGlobalStyle } from \"@trycourier/courier-ui-core\";\nimport { Courier } from \"@trycourier/courier-js\";\nimport { CourierBaseElement, registerElement } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxHeaderAction, CourierInboxListItemAction } from \"../types/inbox-defaults\";\n\nexport type CourierInboxPopupAlignment = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center' | 'center-right' | 'center-left' | 'center-center';\n\nexport class CourierInboxPopupMenu extends CourierBaseElement implements CourierInboxDatastoreEvents {\n\n static get id(): string {\n return 'courier-inbox-popup-menu';\n }\n\n // State\n private _width: string = '440px';\n private _height: string = '440px';\n private _popupAlignment: CourierInboxPopupAlignment = 'top-left';\n private _top?: string = undefined;\n private _right?: string = undefined;\n private _bottom?: string = undefined;\n private _left?: string = undefined;\n\n // Theming\n private _themeManager = new CourierInboxThemeManager(defaultLightTheme);\n\n /** Returns the current theme object. */\n get theme() {\n return this._themeManager.getTheme();\n }\n\n /**\n * Set the light theme for the popup menu.\n * @param theme The light theme object to set.\n */\n public setLightTheme(theme: CourierInboxTheme) {\n this._themeManager.setLightTheme(theme);\n }\n\n /**\n * Set the dark theme for the popup menu.\n * @param theme The dark theme object to set.\n */\n public setDarkTheme(theme: CourierInboxTheme) {\n this._themeManager.setDarkTheme(theme);\n }\n\n /**\n * Set the theme mode (light/dark/system).\n * @param mode The theme mode to set.\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._themeManager.setMode(mode);\n }\n\n // Components\n private _triggerButton?: CourierInboxMenuButton;\n private _popup?: HTMLDivElement;\n private _inbox?: CourierInbox;\n private _style?: HTMLStyleElement;\n\n // Listeners\n private _datastoreListener?: CourierInboxDataStoreListener;\n\n // State\n private _totalUnreadCount: number = 0;\n\n // Factories\n private _popupMenuButtonFactory?: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => HTMLElement;\n\n static get observedAttributes() {\n return ['popup-alignment', 'message-click', 'message-action-click', 'message-long-press', 'popup-width', 'popup-height', 'top', 'right', 'bottom', 'left', 'light-theme', 'dark-theme', 'mode'];\n }\n\n constructor() {\n super();\n\n // Refresh the theme on change\n this._themeManager.subscribe((_) => {\n this.refreshTheme();\n });\n\n }\n\n onComponentMounted() {\n // Read initial theme attributes\n this.readInitialThemeAttributes();\n\n // Inject the styles to the head\n this._style = injectGlobalStyle(CourierInboxPopupMenu.id, CourierInboxPopupMenu.getStyles(this.theme, this._width, this._height));\n\n // Create trigger button\n this._triggerButton = new CourierInboxMenuButton(this._themeManager);\n\n // Create popup container\n this._popup = document.createElement('div');\n this._popup.className = 'popup';\n\n // Create content container\n this._inbox = new CourierInbox(this._themeManager);\n this._inbox.setAttribute('height', '100%');\n\n this.refreshTheme();\n\n this.appendChild(this._triggerButton);\n this.appendChild(this._popup);\n this._popup.appendChild(this._inbox);\n\n // Add event listeners\n this._triggerButton.addEventListener('click', this.togglePopup.bind(this));\n document.addEventListener('click', this.handleOutsideClick.bind(this));\n\n // Initialize popup position\n this.updatePopupPosition();\n\n // Attach the datastore listener\n this._datastoreListener = new CourierInboxDataStoreListener(this);\n CourierInboxDatastore.shared.addDataStoreListener(this._datastoreListener);\n\n // Initial render so any pre-configured factories (like setMenuButton) are applied\n this.render();\n }\n\n onComponentUnmounted() {\n this._style?.remove();\n this._datastoreListener?.remove();\n this._themeManager.cleanup();\n }\n\n private readInitialThemeAttributes() {\n const lightTheme = this.getAttribute('light-theme');\n if (lightTheme) {\n try {\n this.setLightTheme(JSON.parse(lightTheme));\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse light-theme attribute:', error);\n }\n }\n\n const darkTheme = this.getAttribute('dark-theme');\n if (darkTheme) {\n try {\n this.setDarkTheme(JSON.parse(darkTheme));\n } catch (error) {\n Courier.shared.client?.options.logger?.error('Failed to parse dark-theme attribute:', error);\n }\n }\n\n const mode = this.getAttribute('mode');\n if (mode) {\n this._themeManager.setMode(mode as CourierComponentThemeMode);\n }\n }\n\n private refreshTheme() {\n if (this._style) {\n this._style.textContent = CourierInboxPopupMenu.getStyles(this.theme, this._width, this._height);\n }\n }\n\n static getStyles(theme: CourierInboxTheme, width: string, height: string): string {\n const transition = theme.popup?.window?.animation;\n const initialTransform = transition?.initialTransform ?? 'translate3d(-10px, -10px, 0) scale(0.9)';\n const visibleTransform = transition?.visibleTransform ?? 'translate3d(0, 0, 0) scale(1)';\n\n return `\n ${CourierInboxPopupMenu.id} {\n display: inline-block;\n position: relative;\n }\n\n ${CourierInboxPopupMenu.id} .popup {\n display: none;\n position: absolute;\n background: ${theme.popup?.window?.backgroundColor ?? 'red'};\n border-radius: ${theme.popup?.window?.borderRadius ?? '8px'};\n border: ${theme.popup?.window?.border ?? `1px solid red`};\n box-shadow: ${theme.popup?.window?.shadow ?? `0px 8px 16px -4px red`};\n z-index: 1000;\n width: ${width};\n height: ${height};\n overflow: hidden;\n transform: ${initialTransform};\n will-change: transform, opacity;\n transition: ${transition?.transition ?? 'all 0.2s ease'};\n opacity: 0;\n }\n\n ${CourierInboxPopupMenu.id} .popup.displayed {\n display: block;\n }\n\n ${CourierInboxPopupMenu.id} .popup.visible {\n opacity: 1;\n transform: ${visibleTransform};\n }\n\n ${CourierInboxPopupMenu.id} courier-inbox {\n height: 100%;\n }\n `;\n }\n\n attributeChangedCallback(name: string, _: string, newValue: string) {\n switch (name) {\n case 'popup-alignment':\n if (this.isValidPosition(newValue)) {\n this._popupAlignment = newValue as CourierInboxPopupAlignment;\n this.updatePopupPosition();\n }\n break;\n case 'popup-width':\n this._width = newValue;\n this.setSize(newValue, this._height);\n break;\n case 'popup-height':\n this._height = newValue;\n this.setSize(this._width, newValue);\n break;\n case 'top':\n this._top = newValue;\n this.updatePopupPosition();\n break;\n case 'right':\n this._right = newValue;\n this.updatePopupPosition();\n break;\n case 'bottom':\n this._bottom = newValue;\n this.updatePopupPosition();\n break;\n case 'left':\n this._left = newValue;\n this.updatePopupPosition();\n break;\n case 'light-theme':\n if (newValue) {\n this.setLightTheme(JSON.parse(newValue));\n }\n break;\n case 'dark-theme':\n if (newValue) {\n this.setDarkTheme(JSON.parse(newValue));\n }\n break;\n case 'mode':\n this._themeManager.setMode(newValue as CourierComponentThemeMode);\n break;\n }\n }\n\n /**\n * Called when the per-dataset unread count changes.\n * Triggers a render to update the factory with latest feeds data\n * (which includes per-tab unread counts).\n */\n public onUnreadCountChange(_: number): void {\n this.render();\n }\n\n /**\n * Called when the total unread count across all datasets changes.\n * Updates the popup trigger button badge.\n */\n public onTotalUnreadCountChange(totalUnreadCount: number): void {\n this._totalUnreadCount = totalUnreadCount;\n this.render();\n }\n\n /**\n * Set a handler for message click events.\n * @param handler The function to call when a message is clicked.\n */\n public onMessageClick(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._inbox?.onMessageClick((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n /**\n * Set a handler for message action click events.\n * @param handler The function to call when a message action is clicked.\n */\n public onMessageActionClick(handler?: (props: CourierInboxListItemActionFactoryProps) => void) {\n this._inbox?.onMessageActionClick((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n /**\n * Set a handler for message long press events.\n * @param handler The function to call when a message is long pressed.\n */\n public onMessageLongPress(handler?: (props: CourierInboxListItemFactoryProps) => void) {\n this._inbox?.onMessageLongPress((props) => {\n if (handler) {\n handler(props);\n }\n this.closePopup();\n });\n }\n\n private isValidPosition(value: string): value is CourierInboxPopupAlignment {\n const validPositions: CourierInboxPopupAlignment[] = [\n 'top-right', 'top-left', 'top-center',\n 'bottom-right', 'bottom-left', 'bottom-center',\n 'center-right', 'center-left', 'center-center'\n ];\n return validPositions.includes(value as CourierInboxPopupAlignment);\n }\n\n private updatePopupPosition() {\n if (!this._popup) return;\n\n // Reset all positions\n this._popup.style.top = '';\n this._popup.style.bottom = '';\n this._popup.style.left = '';\n this._popup.style.right = '';\n this._popup.style.margin = '';\n this._popup.style.transform = '';\n\n switch (this._popupAlignment) {\n case 'top-right':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.right = this._right ?? '0px';\n break;\n case 'top-left':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.left = this._left ?? '0px';\n break;\n case 'top-center':\n this._popup.style.top = this._top ?? '40px';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translateX(-50%)';\n break;\n case 'bottom-right':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.right = this._right ?? '0px';\n break;\n case 'bottom-left':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.left = this._left ?? '0px';\n break;\n case 'bottom-center':\n this._popup.style.bottom = this._bottom ?? '40px';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translateX(-50%)';\n break;\n case 'center-right':\n this._popup.style.top = '50%';\n this._popup.style.right = this._right ?? '40px';\n this._popup.style.transform = 'translateY(-50%)';\n break;\n case 'center-left':\n this._popup.style.top = '50%';\n this._popup.style.left = this._left ?? '40px';\n this._popup.style.transform = 'translateY(-50%)';\n break;\n case 'center-center':\n this._popup.style.top = '50%';\n this._popup.style.left = '50%';\n this._popup.style.transform = 'translate(-50%, -50%)';\n break;\n }\n }\n\n /**\n * Toggle the popup menu open/closed.\n * @param event The click event that triggered the toggle.\n */\n private togglePopup(event: Event) {\n event.stopPropagation();\n if (!this._popup) return;\n\n const isVisible = this._popup.classList.contains('visible');\n if (isVisible) {\n this.hidePopup();\n } else {\n this.showPopup();\n }\n }\n\n /**\n * Show the popup menu with transition.\n */\n public showPopup() {\n if (!this._popup) return;\n\n // Remove visible class first to reset state\n this._popup.classList.remove('visible');\n\n // Add displayed class to set display: block (but keep opacity 0 and initial transform)\n this._popup.classList.add('displayed');\n\n // Trigger transition on next frame\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (this._popup) {\n this._popup.classList.add('visible');\n }\n });\n });\n }\n\n /**\n * Hide the popup menu with transition.\n */\n public hidePopup() {\n if (!this._popup) return;\n\n // Remove visible class to trigger transition\n this._popup.classList.remove('visible');\n\n // If there is no transition, remove the displayed class immediately\n const style = window.getComputedStyle(this._popup);\n const durations = style.transitionDuration.split(',').map(d => parseFloat(d) || 0);\n const hasTransition = durations.some(d => d > 0);\n if (!hasTransition) {\n this._popup.classList.remove('displayed');\n return;\n }\n\n // Wait for transition to complete, then remove displayed class\n const handleTransitionEnd = (e: TransitionEvent) => {\n if (e.target !== this._popup) return;\n if (e.propertyName !== 'opacity') return;\n if (this._popup && !this._popup.classList.contains('visible')) {\n this._popup.classList.remove('displayed');\n this._popup.removeEventListener('transitionend', handleTransitionEnd);\n }\n };\n\n this._popup.addEventListener('transitionend', handleTransitionEnd);\n }\n\n /**\n * Close the popup menu.\n */\n public closePopup() {\n this.hidePopup();\n }\n\n private handleOutsideClick = (event: MouseEvent) => {\n if (!this._popup) return;\n\n // Nodes the click may legally occur inside without closing the popup\n const SAFE_SELECTORS = [\n 'courier-inbox-option-menu',\n ];\n\n // composedPath() gives us every node (even inside shadow DOMs)\n const clickIsInsideAllowedArea = event\n .composedPath()\n .some(node => {\n if (!(node instanceof HTMLElement)) return false;\n if (node === this._popup || this._popup!.contains(node)) return true;\n return SAFE_SELECTORS.some(sel => node.matches(sel));\n });\n\n if (clickIsInsideAllowedArea) return;\n\n // Otherwise, it really was an outside click – hide the popup\n this.hidePopup();\n };\n\n /**\n * Set the content of the popup inbox.\n * @param element The HTMLElement to set as the content.\n */\n public setContent(element: HTMLElement) {\n if (!this._inbox) return;\n this._inbox.innerHTML = '';\n this._inbox.appendChild(element);\n }\n\n /**\n * Set the size of the popup menu.\n * @param width The width to set.\n * @param height The height to set.\n */\n public setSize(width: string, height: string) {\n this._width = width;\n this._height = height;\n if (!this._popup) return;\n this._popup.style.width = width;\n this._popup.style.height = height;\n }\n\n /**\n * Set the popup alignment/position.\n * @param position The alignment/position to set.\n */\n public setPosition(position: CourierInboxPopupAlignment) {\n if (this.isValidPosition(position)) {\n this._popupAlignment = position;\n this.updatePopupPosition();\n } else {\n Courier.shared.client?.options.logger?.error(`Invalid position: ${position}`);\n }\n }\n\n // Factory methods\n /**\n * Set a custom header factory for the inbox.\n * @param factory The factory function for the header.\n */\n public setHeader(factory: (props: CourierInboxHeaderFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setHeader(factory);\n }\n\n /**\n * Remove the custom header from the inbox.\n */\n public removeHeader() {\n this._inbox?.removeHeader();\n }\n\n /**\n * Set a custom loading state factory for the inbox.\n * @param factory The factory function for the loading state.\n */\n public setLoadingState(factory: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setLoadingState(factory);\n }\n\n /**\n * Set a custom empty state factory for the inbox.\n * @param factory The factory function for the empty state.\n */\n public setEmptyState(factory: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setEmptyState(factory);\n }\n\n /**\n * Set a custom error state factory for the inbox.\n * @param factory The factory function for the error state.\n */\n public setErrorState(factory: (props: CourierInboxStateErrorFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setErrorState(factory);\n }\n\n /**\n * Set a custom list item factory for the inbox.\n * @param factory The factory function for the list item.\n */\n public setListItem(factory: (props: CourierInboxListItemFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setListItem(factory);\n }\n\n /**\n * Set a custom pagination item factory for the inbox.\n * @param factory The factory function for the pagination item.\n */\n public setPaginationItem(factory: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => HTMLElement) {\n this._inbox?.setPaginationItem(factory);\n }\n\n /**\n * Set a custom menu button factory for the popup trigger.\n * @param factory The factory function for the menu button.\n */\n public setMenuButton(factory: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => HTMLElement) {\n this._popupMenuButtonFactory = factory;\n this.render();\n }\n\n /**\n * Sets the active feed for the inbox.\n * @param feedId The feed ID to display.\n */\n public selectFeed(feedId: string) {\n this._inbox?.selectFeed(feedId);\n }\n\n /**\n * Switches to a tab by updating components and loading data.\n * @param tabId The tab ID to switch to.\n */\n public selectTab(tabId: string) {\n this._inbox?.selectTab(tabId);\n }\n\n /**\n * Set the feeds for this Inbox, replacing any existing feeds.\n * @param feeds The list of feeds to set for the Inbox.\n */\n public setFeeds(feeds: CourierInboxFeed[]) {\n this._inbox?.setFeeds(feeds);\n }\n\n /**\n * Get the current set of feeds.\n */\n public getFeeds() {\n return this._inbox?.getFeeds() ?? [];\n }\n\n /**\n * Sets the enabled header actions for the inbox.\n * @param actions - The header actions to enable (e.g., [{ id: 'readAll', iconSVG: '...', text: '...' }]).\n */\n public setActions(actions: CourierInboxHeaderAction[]) {\n this._inbox?.setActions(actions);\n }\n\n /**\n * Sets the enabled list item actions for the inbox.\n * @param actions - The list item actions to enable (e.g., [{ id: 'read_unread', readIconSVG: '...', unreadIconSVG: '...' }]).\n */\n public setListItemActions(actions: CourierInboxListItemAction[]) {\n this._inbox?.setListItemActions(actions);\n }\n\n /**\n * Returns the current feed type.\n */\n get currentFeedId(): string {\n return this._inbox?.currentFeedId ?? '';\n }\n\n /**\n * Forces a reload of the inbox data, bypassing the cache.\n */\n public async refresh() {\n return this._inbox?.refresh();\n }\n\n private render() {\n const unreadCount = this._totalUnreadCount;\n if (!this._triggerButton) return;\n\n // Get feeds from the inbox component in the format expected by the factory\n const feeds = this._inbox?.getHeaderFeeds() ?? [];\n\n switch (this._popupMenuButtonFactory) {\n case undefined:\n case null:\n this._triggerButton.build(undefined);\n this._triggerButton.onUnreadCountChange(unreadCount);\n break;\n default:\n const customButton = this._popupMenuButtonFactory({\n totalUnreadCount: unreadCount,\n feeds: feeds\n });\n this._triggerButton.build(customButton);\n break;\n }\n }\n\n}\n\nregisterElement(CourierInboxPopupMenu);","import { InboxDataSet } from \"../types/inbox-data-set\";\nimport { InboxMessage } from \"@trycourier/courier-js\";\n\n/**\n * Event callbacks which may be fully or partially implemented to be called when\n * {@link CourierInboxDatastore} has updates.\n *\n * @public\n */\nexport class CourierInboxDatastoreEvents {\n /**\n * Called when the dataset changes.\n * @public\n * @param _dataset - The updated inbox dataset\n */\n public onDataSetChange?(_dataset: InboxDataSet): void { }\n\n /**\n * Called when a new page is added to the dataset.\n * @public\n * @param _dataset - The updated inbox dataset with the new page\n */\n public onPageAdded?(_dataset: InboxDataSet): void { }\n\n /**\n * Called when the unread count changes.\n * @public\n * @param _unreadCount - The new unread count\n * @param _datasetId - The dataset ID that was updated\n */\n public onUnreadCountChange?(_unreadCount: number, _datasetId: string): void { }\n\n /**\n * Called when the total unread count across all datasets changes.\n * @public\n * @param _totalUnreadCount - The new total unread count\n */\n public onTotalUnreadCountChange?(_totalUnreadCount: number): void { }\n\n /**\n * Called when a new message is added.\n * @public\n * @param _message - The added InboxMessage\n * @param _index - The index where the message was added\n * @param _datasetId - The dataset ID that was updated\n */\n public onMessageAdd?(_message: InboxMessage, _index: number, _datasetId: string): void { }\n\n /**\n * Called when a message is removed.\n * @public\n * @param _message - The InboxMessage that was removed\n * @param _index - The index from which the message was removed\n * @param _datasetId - The dataset ID that was updated\n */\n public onMessageRemove?(_message: InboxMessage, _index: number, _datasetId: string): void { }\n\n /**\n * Called when a message is updated.\n * @public\n * @param _message - The updated InboxMessage\n * @param _index - The index where the message was updated\n * @param _datasetId - The dataset ID that was updated\n */\n public onMessageUpdate?(_message: InboxMessage, _index: number, _datasetId: string): void { }\n\n /**\n * Called when an error occurs in the data store.\n * @public\n * @param _error - The error object\n */\n public onError?(_error: Error): void { }\n}\n","export * from './components/courier-inbox';\nexport * from './components/courier-inbox-header';\nexport * from './components/courier-inbox-list-item';\nexport * from './components/courier-inbox-popup-menu';\nexport * from './utils/extensions';\nexport * from './types/factories';\nexport * from './types/courier-inbox-theme';\nexport * from './types/courier-inbox-theme-manager';\nexport * from './types/inbox-data-set';\nexport * from './types/inbox-defaults';\nexport * from './datastore/inbox-datastore';\nexport * from './datastore/datastore-listener';\nexport * from './datastore/datatore-events';\n\nimport { Courier } from \"@trycourier/courier-js\";\n\nCourier.shared.courierUserAgentName = \"courier-ui-inbox\";\nCourier.shared.courierUserAgentVersion = __PACKAGE_VERSION__;\n\n// Re-export Courier from courier-js for direct import\nexport { Courier };\n\n// Re-export types from courier-js\nexport type {\n CourierProps,\n CourierClientOptions,\n CourierBrand,\n CourierApiUrls,\n CourierUserPreferences,\n CourierUserPreferencesStatus,\n CourierUserPreferencesChannel,\n CourierUserPreferencesPaging,\n CourierUserPreferencesTopic,\n CourierUserPreferencesTopicResponse,\n CourierDevice,\n CourierToken,\n CourierGetInboxMessageResponse,\n CourierGetInboxMessagesResponse,\n InboxMessage,\n InboxAction,\n InboxMessageEventEnvelope,\n} from '@trycourier/courier-js';\n\n// Re-export types from courier-ui-core\nexport type {\n CourierComponentThemeMode\n} from '@trycourier/courier-ui-core'\n"],"names":["_a","_b","_c","beforeQualifies","message"],"mappings":";;;;;;AAQO,SAAS,YAAY,SAAqC;AAC/D,QAAM,OAAO;AAAA,IACX,GAAG;AAAA,EAAA;AAGL,MAAI,QAAQ,SAAS;AACnB,SAAK,UAAU,QAAQ,QAAQ,IAAI,CAAA,WAAU,gBAAgB,MAAM,CAAC;AAAA,EACtE;AAEA,MAAI,QAAQ,MAAM;AAChB,SAAK,OAAO,KAAK,MAAM,KAAK,UAAU,QAAQ,IAAI,CAAC;AAAA,EACrD;AAEA,MAAI,QAAQ,MAAM;AAChB,SAAK,OAAO,CAAC,GAAG,QAAQ,IAAI;AAAA,EAC9B;AAEA,MAAI,QAAQ,aAAa;AACvB,SAAK,cAAc,EAAE,GAAG,QAAQ,YAAA;AAAA,EAClC;AAEA,SAAO;AACT;AAOO,SAAS,gBAAgB,QAAkC;AAChE,QAAM,OAAO;AAAA,IACX,GAAG;AAAA,EAAA;AAGL,MAAI,OAAO,MAAM;AACf,SAAK,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,IAAI,CAAC;AAAA,EACpD;AAEA,SAAO;AACT;AAOO,SAAS,iBAAiB,SAAkD;AAEjF,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,QAAQ,SAAS,IAAI,CAAA,YAAW,YAAY,OAAO,CAAC;AAAA,EAAA;AAGlE;AAQO,SAAS,+BAA+B,UAAwB,UAAiC;AAEtG,MAAI,SAAS,aAAa,SAAS,UAAU;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,SAAS,SAAS,SAAS,MAAM;AACnC,WAAO;AAAA,EACT;AACA,MAAI,SAAS,WAAW,SAAS,QAAQ;AACvC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,SAAS,eAAe,SAA+B;AAC5D,MAAI,CAAC,QAAQ,SA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