@trycourier/courier-ui-inbox 1.0.18 → 1.2.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/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../courier-ui-core/dist/index.mjs","../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"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __typeError = (msg) => {\n throw TypeError(msg);\n};\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __accessCheck = (obj, member, msg) => member.has(obj) || __typeError(\"Cannot \" + msg);\nvar __privateGet = (obj, member, getter) => (__accessCheck(obj, member, \"read from private field\"), getter ? getter.call(obj) : member.get(obj));\nvar __privateAdd = (obj, member, value) => member.has(obj) ? __typeError(\"Cannot add the same private member more than once\") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);\nvar __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, \"write to private field\"), setter ? setter.call(obj, value) : member.set(obj, value), value);\nvar _isInitialised;\nconst CourierColors = {\n black: {\n 400: \"#0A0A0A\",\n 500: \"#171717\",\n 50010: \"#1717171A\",\n 50020: \"#17171733\"\n },\n gray: {\n 200: \"#F5F5F5\",\n 400: \"#3A3A3A\",\n 500: \"#E5E5E5\",\n 600: \"#737373\"\n },\n white: {\n 500: \"#FFFFFF\",\n 50010: \"#FFFFFF1A\",\n 50020: \"#FFFFFF33\"\n },\n blue: {\n 400: \"#60A5FA\",\n 500: \"#2563EB\"\n }\n};\nconst theme = {\n light: {\n colors: {\n primary: CourierColors.black[500],\n secondary: CourierColors.white[500],\n border: CourierColors.gray[500],\n link: CourierColors.blue[500],\n icon: CourierColors.black[500]\n },\n button: {\n cornerRadius: \"4px\"\n }\n },\n dark: {\n colors: {\n primary: CourierColors.white[500],\n secondary: CourierColors.black[500],\n border: CourierColors.gray[400],\n link: CourierColors.blue[400],\n icon: CourierColors.white[500]\n },\n button: {\n cornerRadius: \"4px\"\n }\n }\n};\nconst getSystemThemeMode = () => {\n if (typeof window === \"undefined\") {\n return \"light\";\n }\n return window.matchMedia(\"(prefers-color-scheme: dark)\").matches ? \"dark\" : \"light\";\n};\nconst addSystemThemeModeListener = (callback) => {\n if (typeof window === \"undefined\") {\n return () => {\n };\n }\n const mediaQuery = window.matchMedia(\"(prefers-color-scheme: dark)\");\n const handler = (e) => {\n callback(e.matches ? \"dark\" : \"light\");\n };\n mediaQuery.addEventListener(\"change\", handler);\n return () => {\n mediaQuery.removeEventListener(\"change\", handler);\n };\n};\nconst HTMLElementBase = (() => {\n try {\n return typeof HTMLElement === \"undefined\" ? class {\n } : HTMLElement;\n } catch {\n return class {\n };\n }\n})();\nclass CourierBaseElement extends HTMLElementBase {\n constructor() {\n super(...arguments);\n /** Prevents double-initialisation when the node is re-inserted. */\n __privateAdd(this, _isInitialised, false);\n }\n /** Tag-name you’ll use in `customElements.define()` */\n static get id() {\n return \"courier-base-element\";\n }\n /* ------------------------------------------------------------------ */\n /* Custom-elements lifecycle hooks */\n /* ------------------------------------------------------------------ */\n connectedCallback() {\n var _a;\n if (__privateGet(this, _isInitialised)) return;\n __privateSet(this, _isInitialised, true);\n (_a = this.onComponentMounted) == null ? void 0 : _a.call(this);\n }\n disconnectedCallback() {\n var _a;\n __privateSet(this, _isInitialised, false);\n (_a = this.onComponentUnmounted) == null ? void 0 : _a.call(this);\n }\n /* ------------------------------------------------------------------ */\n /* Overridable hooks */\n /* ------------------------------------------------------------------ */\n /** Called **once** when the element first becomes part of the DOM. */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onComponentMounted() {\n }\n /** Called when the element is removed from the DOM. */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onComponentUnmounted() {\n }\n}\n_isInitialised = new WeakMap();\nclass CourierSystemThemeElement extends CourierBaseElement {\n constructor() {\n super();\n // State\n __publicField(this, \"_currentSystemTheme\");\n // System theme\n __publicField(this, \"_systemThemeCleanup\");\n this._currentSystemTheme = getSystemThemeMode();\n this._systemThemeCleanup = addSystemThemeModeListener((mode) => {\n this._currentSystemTheme = mode;\n this.onSystemThemeChange(mode);\n });\n }\n static get id() {\n return \"courier-system-theme-element\";\n }\n get currentSystemTheme() {\n return this._currentSystemTheme;\n }\n onComponentUnmounted() {\n var _a;\n (_a = this._systemThemeCleanup) == null ? void 0 : _a.call(this);\n super.onComponentUnmounted();\n }\n onSystemThemeChange(_) {\n }\n}\nconst baseButtonStyles = {\n borderRadius: \"4px\",\n fontSize: \"14px\"\n};\nconst CourierButtonVariants = {\n primary: (mode) => {\n return {\n ...baseButtonStyles,\n backgroundColor: theme[mode].colors.primary,\n textColor: theme[mode].colors.secondary,\n fontWeight: \"500\",\n shadow: \"none\"\n };\n },\n secondary: (mode) => {\n return {\n ...baseButtonStyles,\n backgroundColor: theme[mode].colors.secondary,\n textColor: theme[mode].colors.primary,\n fontWeight: \"500\",\n border: `1px solid ${theme[mode].colors.border}`,\n shadow: mode === \"light\" ? \"0px 1px 2px 0px rgba(0, 0, 0, 0.06)\" : \"0px 1px 2px 0px rgba(255, 255, 255, 0.1)\"\n };\n },\n tertiary: (mode) => {\n return {\n ...baseButtonStyles,\n backgroundColor: theme[mode].colors.border,\n textColor: theme[mode].colors.primary,\n fontWeight: \"500\",\n border: \"none\",\n shadow: \"none\"\n };\n }\n};\nclass CourierButton extends CourierSystemThemeElement {\n constructor(props) {\n super();\n // Components\n __publicField(this, \"_button\");\n __publicField(this, \"_style\");\n const shadow = this.attachShadow({ mode: \"open\" });\n this._button = document.createElement(\"button\");\n this._button.setAttribute(\"part\", \"button\");\n this._style = document.createElement(\"style\");\n this._style.textContent = this.getStyles(props);\n shadow.appendChild(this._style);\n shadow.appendChild(this._button);\n this.updateButton(props);\n this._button.addEventListener(\"click\", (e) => {\n e.preventDefault();\n e.stopPropagation();\n if (props.onClick) {\n props.onClick();\n }\n });\n }\n static get id() {\n return \"courier-button\";\n }\n getStyles(props) {\n const mode = props.mode === \"system\" ? this.currentSystemTheme : props.mode;\n const defaultTextColor = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.textColor;\n };\n const defaultBackgroundColor = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.backgroundColor;\n };\n const defaultBorder = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.border;\n };\n const defaultShadow = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.shadow;\n };\n const defaultBorderRadius = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.borderRadius;\n };\n const defaultFontSize = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.fontSize;\n };\n const defaultFontWeight = () => {\n const secondary = CourierButtonVariants.secondary(mode);\n return secondary.fontWeight;\n };\n return `\n :host {\n display: inline-block;\n }\n\n button {\n border: none;\n border-radius: ${props.borderRadius ?? defaultBorderRadius()};\n font-weight: ${props.fontWeight ?? defaultFontWeight()};\n font-family: ${props.fontFamily ?? \"inherit\"};\n font-size: ${props.fontSize ?? defaultFontSize()};\n padding: 6px 10px;\n cursor: pointer;\n width: 100%;\n height: 100%;\n background-color: ${props.backgroundColor ?? defaultBackgroundColor()};\n color: ${props.textColor ?? defaultTextColor()};\n border: ${props.border ?? defaultBorder()};\n box-shadow: ${props.shadow ?? defaultShadow()};\n touch-action: manipulation;\n }\n\n button:hover {\n ${props.hoverBackgroundColor ? `background-color: ${props.hoverBackgroundColor};` : \"filter: brightness(0.9);\"}\n }\n\n button:active {\n ${props.activeBackgroundColor ? `background-color: ${props.activeBackgroundColor};` : \"filter: brightness(0.8);\"}\n }\n\n button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n `;\n }\n updateButton(props) {\n if (props.text) {\n this._button.textContent = props.text;\n }\n this._style.textContent = this.getStyles(props);\n }\n}\nconst CourierIconSVGs = {\n inbox: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.5 14.5V17C5.5 17.2812 5.71875 17.5 6 17.5H18C18.25 17.5 18.5 17.2812 18.5 17V14.5H15.9375L15.2812 15.8125C15.0938 16.25 14.6562 16.5 14.1875 16.5H9.78125C9.3125 16.5 8.875 16.25 8.6875 15.8125L8.03125 14.5H5.5ZM18.1875 13L16.6562 6.90625C16.5938 6.65625 16.4062 6.5 16.1875 6.5H7.8125C7.5625 6.5 7.375 6.65625 7.3125 6.90625L5.78125 13H8.1875C8.65625 13 9.09375 13.2812 9.3125 13.7188L9.9375 15H14.0312L14.6875 13.7188C14.875 13.2812 15.3125 13 15.7812 13H18.1875ZM4 14.25C4 14.0938 4 13.9375 4.03125 13.7812L5.84375 6.53125C6.09375 5.625 6.875 5 7.8125 5H16.1875C17.0938 5 17.9062 5.625 18.125 6.53125L19.9375 13.7812C19.9688 13.9375 20 14.0938 20 14.25V17C20 18.125 19.0938 19 18 19H6C4.875 19 4 18.125 4 17V14.25Z\" fill=\"currentColor\"/>\n</svg>`,\n archive: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.5 6.5V8H18.5V6.5H5.5ZM5 5H19C19.5312 5 20 5.46875 20 6V8.5C20 9.0625 19.5312 9.5 19 9.5H5C4.4375 9.5 4 9.0625 4 8.5V6C4 5.46875 4.4375 5 5 5ZM9 11.75C9 11.3438 9.3125 11 9.75 11H14.25C14.6562 11 15 11.3438 15 11.75C15 12.1875 14.6562 12.5 14.25 12.5H9.75C9.3125 12.5 9 12.1875 9 11.75ZM5 17V10.5H6.5V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V10.5H19V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17Z\" fill=\"currentColor\"/>\n</svg>`,\n check: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.793 7.33203C19.0742 7.64453 19.0742 8.11328 18.793 8.39453L10.543 16.6445C10.2305 16.957 9.76172 16.957 9.48047 16.6445L5.23047 12.3945C4.91797 12.1133 4.91797 11.6445 5.23047 11.3633C5.51172 11.0508 5.98047 11.0508 6.26172 11.3633L9.98047 15.082L17.7305 7.33203C18.0117 7.05078 18.4805 7.05078 18.7617 7.33203H18.793Z\" fill=\"currentColor\"/>\n</svg>`,\n filter: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5 7C5 6.59375 5.3125 6.25 5.75 6.25H18.25C18.6562 6.25 19 6.59375 19 7C19 7.4375 18.6562 7.75 18.25 7.75H5.75C5.3125 7.75 5 7.4375 5 7ZM7 12C7 11.5938 7.3125 11.25 7.75 11.25H16.25C16.6562 11.25 17 11.5938 17 12C17 12.4375 16.6562 12.75 16.25 12.75H7.75C7.3125 12.75 7 12.4375 7 12ZM14 17C14 17.4375 13.6562 17.75 13.25 17.75H10.75C10.3125 17.75 10 17.4375 10 17C10 16.5938 10.3125 16.25 10.75 16.25H13.25C13.6562 16.25 14 16.5938 14 17Z\" fill=\"currentColor\"/>\n</svg>`,\n right: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.75 12.547L13.25 17.797C12.9375 18.0783 12.4688 18.0783 12.1875 17.7658C11.9062 17.4533 11.9062 16.9845 12.2188 16.7033L16.375 12.7345H5.75C5.3125 12.7345 5 12.422 5 11.9845C5 11.5783 5.3125 11.2345 5.75 11.2345H16.375L12.2188 7.29703C11.9062 7.01578 11.9062 6.51578 12.1875 6.23453C12.4688 5.92203 12.9688 5.92203 13.25 6.20328L18.75 11.4533C18.9062 11.6095 19 11.797 19 11.9845C19 12.2033 18.9062 12.3908 18.75 12.547Z\" fill=\"currentColor\"/>\n</svg>`,\n remove: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M16.7969 8.27344L13.0469 12.0234L16.7656 15.7422C17.0781 16.0234 17.0781 16.4922 16.7656 16.7734C16.4844 17.0859 16.0156 17.0859 15.7344 16.7734L11.9844 13.0547L8.26562 16.7734C7.98438 17.0859 7.51562 17.0859 7.23438 16.7734C6.92188 16.4922 6.92188 16.0234 7.23438 15.7109L10.9531 11.9922L7.23438 8.27344C6.92188 7.99219 6.92188 7.52344 7.23438 7.21094C7.51562 6.92969 7.98438 6.92969 8.29688 7.21094L12.0156 10.9609L15.7344 7.24219C16.0156 6.92969 16.4844 6.92969 16.7969 7.24219C17.0781 7.52344 17.0781 7.99219 16.7969 8.27344Z\" fill=\"currentColor\"/>\n</svg>`,\n overflow: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M18.5117 11.9883C18.5117 12.5508 18.1992 13.0195 17.7617 13.3008C17.293 13.582 16.6992 13.582 16.2617 13.3008C15.793 13.0195 15.5117 12.5508 15.5117 11.9883C15.5117 11.457 15.793 10.9883 16.2617 10.707C16.6992 10.4258 17.293 10.4258 17.7617 10.707C18.1992 10.9883 18.5117 11.457 18.5117 11.9883ZM13.5117 11.9883C13.5117 12.5508 13.1992 13.0195 12.7617 13.3008C12.293 13.582 11.6992 13.582 11.2617 13.3008C10.793 13.0195 10.5117 12.5508 10.5117 11.9883C10.5117 11.457 10.793 10.9883 11.2617 10.707C11.6992 10.4258 12.293 10.4258 12.7617 10.707C13.1992 10.9883 13.5117 11.457 13.5117 11.9883ZM7.01172 13.4883C6.44922 13.4883 5.98047 13.207 5.69922 12.7383C5.41797 12.3008 5.41797 11.707 5.69922 11.2383C5.98047 10.8008 6.44922 10.4883 7.01172 10.4883C7.54297 10.4883 8.01172 10.8008 8.29297 11.2383C8.57422 11.707 8.57422 12.3008 8.29297 12.7383C8.01172 13.207 7.54297 13.4883 7.01172 13.4883Z\" fill=\"currentColor\"/>\n</svg>`,\n read: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7 6.5C6.71875 6.5 6.5 6.75 6.5 7V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V7C17.5 6.75 17.25 6.5 17 6.5H7ZM5 7C5 5.90625 5.875 5 7 5H17C18.0938 5 19 5.90625 19 7V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17V7ZM15.5312 10.5312L11.5312 14.5312C11.2188 14.8438 10.75 14.8438 10.4688 14.5312L8.46875 12.5312C8.15625 12.25 8.15625 11.7812 8.46875 11.5C8.75 11.1875 9.21875 11.1875 9.53125 11.5L11 12.9688L14.4688 9.46875C14.75 9.1875 15.2188 9.1875 15.5 9.46875C15.8125 9.78125 15.8125 10.25 15.5 10.5312H15.5312Z\" fill=\"currentColor\"/>\n</svg>`,\n archiveRead: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7.5 6.5V15.25H16.5V6.5H7.5ZM6 15.25V6.5C6 5.6875 6.65625 5 7.5 5H16.5C17.3125 5 18 5.6875 18 6.5V15.25C18.4062 15.25 18.75 15.5938 18.75 16C18.75 16.4375 18.4062 16.75 18 16.75H6C5.5625 16.75 5.25 16.4375 5.25 16C5.25 15.5938 5.5625 15.25 6 15.25ZM5 13V14.5H4.5V17.5H19.5V14.5H19V13H19.5C20.3125 13 21 13.6875 21 14.5V17.5C21 18.3438 20.3125 19 19.5 19H4.5C3.65625 19 3 18.3438 3 17.5V14.5C3 13.6875 3.65625 13 4.5 13H5ZM15.0312 9.625L11.6875 12.9688C11.5312 13.0938 11.3438 13.1875 11.1562 13.1875C10.9375 13.1875 10.75 13.0938 10.625 12.9688L8.96875 11.2812C8.65625 11 8.65625 10.5312 8.96875 10.25C9.25 9.9375 9.71875 9.9375 10 10.25L11.1562 11.375L13.9688 8.5625C14.25 8.28125 14.7188 8.28125 15 8.5625C15.3125 8.875 15.3125 9.34375 15 9.625H15.0312Z\" fill=\"currentColor\"/>\n</svg>`,\n unread: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M17 6.5H7C6.71875 6.5 6.5 6.75 6.5 7V17C6.5 17.2812 6.71875 17.5 7 17.5H17C17.25 17.5 17.5 17.2812 17.5 17V7C17.5 6.75 17.25 6.5 17 6.5ZM7 5H17C18.0938 5 19 5.90625 19 7V17C19 18.125 18.0938 19 17 19H7C5.875 19 5 18.125 5 17V7C5 5.90625 5.875 5 7 5Z\" fill=\"currentColor\"/>\n</svg>`,\n unarchive: `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M5.5 11C5.0625 11 4.75 10.6875 4.75 10.25V5.75C4.75 5.34375 5.0625 5 5.5 5C5.90625 5 6.25 5.34375 6.25 5.75V8.28125L6.875 7.53125C8.15625 6 10.0625 5 12.25 5C16.0938 5 19.25 8.15625 19.25 12C19.25 15.875 16.0938 19 12.25 19C10.6562 19 9.21875 18.5 8.03125 17.625C7.71875 17.375 7.625 16.9062 7.875 16.5625C8.125 16.2188 8.59375 16.1562 8.9375 16.4062C9.84375 17.0938 11 17.5 12.25 17.5C15.2812 17.5 17.75 15.0625 17.75 12C17.75 8.96875 15.2812 6.5 12.25 6.5C10.5312 6.5 9.03125 7.28125 8 8.5L7.15625 9.5H10C10.4062 9.5 10.75 9.84375 10.75 10.25C10.75 10.6875 10.4062 11 10 11H5.5Z\" fill=\"currentColor\"/>\n</svg>`\n};\nclass CourierIcon extends CourierBaseElement {\n constructor(color, svg) {\n super();\n // State\n __publicField(this, \"_color\");\n __publicField(this, \"_svg\");\n // Components\n __publicField(this, \"_iconContainer\");\n __publicField(this, \"_style\");\n this._color = color ?? CourierColors.black[500];\n this._svg = svg;\n const shadow = this.attachShadow({ mode: \"open\" });\n this._iconContainer = document.createElement(\"div\");\n shadow.appendChild(this._iconContainer);\n this._style = document.createElement(\"style\");\n this._style.textContent = this.getStyles(this._color);\n shadow.appendChild(this._style);\n this.refresh();\n }\n static get id() {\n return \"courier-icon\";\n }\n getStyles(color) {\n return `\n :host {\n display: inline-block;\n line-height: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n svg {\n width: 24px;\n height: 24px;\n color: ${color};\n }\n `;\n }\n refresh() {\n if (this._svg) {\n this._iconContainer.innerHTML = this._svg;\n }\n if (this._color) {\n this._style.textContent = this.getStyles(this._color);\n }\n }\n updateColor(color) {\n this._color = color;\n this.refresh();\n }\n updateSVG(svg) {\n this._svg = svg;\n this.refresh();\n }\n}\nclass CourierLink extends CourierBaseElement {\n constructor() {\n super();\n __publicField(this, \"link\");\n const shadow = this.attachShadow({ mode: \"open\" });\n this.link = document.createElement(\"a\");\n this.link.setAttribute(\"part\", \"link\");\n const style = document.createElement(\"style\");\n style.textContent = `\n :host {\n display: inline-block;\n }\n\n a {\n text-decoration: none;\n border-radius: 4px;\n cursor: pointer;\n font-weight: 500;\n transition: all 0.2s ease;\n font-family: var(--courier-link-font-family, inherit);\n font-size: var(--courier-link-font-size, inherit);\n }\n\n /* Variants */\n a[data-variant=\"primary\"][data-mode=\"light\"] {\n color: var(--courier-link-color, ${theme.light.colors.link});\n }\n\n a[data-variant=\"primary\"][data-mode=\"light\"]:hover {\n opacity: 0.8;\n }\n\n a[data-variant=\"primary\"][data-mode=\"light\"]:active {\n opacity: 0.6;\n }\n\n a[data-variant=\"primary\"][data-mode=\"dark\"] {\n color: var(--courier-link-color, ${theme.dark.colors.link});\n }\n\n a[data-variant=\"primary\"][data-mode=\"dark\"]:hover {\n opacity: 0.8;\n }\n\n a[data-variant=\"primary\"][data-mode=\"dark\"]:active {\n opacity: 0.6;\n }\n\n a[data-underline=\"true\"] {\n text-decoration: underline;\n }\n\n a:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n pointer-events: none;\n }\n `;\n shadow.appendChild(style);\n shadow.appendChild(this.link);\n this.updateVariant();\n this.updateUnderline();\n this.updateMode();\n }\n static get id() {\n return \"courier-link\";\n }\n connectedCallback() {\n const slot = document.createElement(\"slot\");\n this.link.appendChild(slot);\n this.updateHref();\n }\n attributeChangedCallback(name, oldValue, newValue) {\n if (oldValue === newValue) return;\n switch (name) {\n case \"href\":\n this.updateHref();\n break;\n case \"variant\":\n case \"mode\":\n this.updateVariant();\n break;\n case \"disabled\":\n this.link.style.pointerEvents = this.hasAttribute(\"disabled\") ? \"none\" : \"auto\";\n this.link.style.opacity = this.hasAttribute(\"disabled\") ? \"0.6\" : \"1\";\n break;\n case \"color\":\n this.updateColor();\n break;\n case \"underline\":\n this.updateUnderline();\n break;\n case \"target\":\n this.updateTarget();\n break;\n case \"font-family\":\n this.updateFontFamily();\n break;\n case \"font-size\":\n this.updateFontSize();\n break;\n }\n }\n updateHref() {\n const href = this.getAttribute(\"href\");\n if (href) {\n this.link.href = href;\n }\n }\n updateVariant() {\n const variant = this.getAttribute(\"variant\") || \"primary\";\n const mode = this.getAttribute(\"mode\") || \"light\";\n this.link.setAttribute(\"data-variant\", variant);\n this.link.setAttribute(\"data-mode\", mode);\n }\n updateColor() {\n const color = this.getAttribute(\"color\");\n if (color) {\n this.link.style.setProperty(\"--courier-link-color\", color);\n } else {\n this.link.style.removeProperty(\"--courier-link-color\");\n }\n }\n updateUnderline() {\n const underline = this.getAttribute(\"underline\") === \"true\";\n this.link.setAttribute(\"data-underline\", underline.toString());\n }\n updateMode() {\n const mode = this.getAttribute(\"mode\") || \"light\";\n this.link.setAttribute(\"data-mode\", mode);\n }\n updateTarget() {\n const target = this.getAttribute(\"target\");\n if (target) {\n this.link.target = target;\n }\n }\n updateFontFamily() {\n const fontFamily = this.getAttribute(\"font-family\");\n if (fontFamily) {\n this.link.style.setProperty(\"--courier-link-font-family\", fontFamily);\n } else {\n this.link.style.removeProperty(\"--courier-link-font-family\");\n }\n }\n updateFontSize() {\n const fontSize = this.getAttribute(\"font-size\");\n if (fontSize) {\n this.link.style.setProperty(\"--courier-link-font-size\", fontSize);\n } else {\n this.link.style.removeProperty(\"--courier-link-font-size\");\n }\n }\n}\n__publicField(CourierLink, \"observedAttributes\", [\n \"href\",\n \"variant\",\n \"disabled\",\n \"color\",\n \"underline\",\n \"mode\",\n \"target\",\n \"font-family\",\n \"font-size\"\n]);\nclass CourierFactoryElement extends CourierSystemThemeElement {\n constructor() {\n super();\n }\n // Build the element with a factory function\n build(newElement) {\n if (newElement === null) {\n this.replaceChildren();\n return;\n }\n const element = newElement ?? this.defaultElement();\n this.replaceChildren(element);\n }\n // Default element to be used if no factory is provided\n defaultElement() {\n const element = document.createElement(\"div\");\n element.textContent = \"Default Element Factory\";\n element.style.cssText = `\n background-color: red;\n text-align: center;\n padding: 12px;\n `;\n return element;\n }\n}\nclass CourierInfoState extends CourierFactoryElement {\n constructor(props) {\n super();\n // Props\n __publicField(this, \"_props\");\n // Components\n __publicField(this, \"_title\");\n __publicField(this, \"_button\");\n __publicField(this, \"_style\");\n this._props = props;\n }\n static get id() {\n return \"courier-info-state\";\n }\n defaultElement() {\n var _a;\n const container = document.createElement(\"div\");\n this._title = document.createElement(\"h2\");\n if ((_a = this._props.title) == null ? void 0 : _a.text) {\n this._title.textContent = this._props.title.text;\n }\n this._button = new CourierButton(this._props.button ?? CourierButtonVariants.secondary(this.currentSystemTheme));\n this._style = document.createElement(\"style\");\n this._style.textContent = this.getStyles(this._props);\n container.className = \"container\";\n container.appendChild(this._style);\n container.appendChild(this._title);\n container.appendChild(this._button);\n this.appendChild(container);\n return container;\n }\n onSystemThemeChange(_) {\n this.updateStyles(this._props);\n }\n getStyles(props) {\n var _a, _b, _c, _d;\n return `\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n width: 100%;\n }\n\n .container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n text-align: center;\n padding: 24px;\n box-sizing: border-box;\n height: 100%;\n }\n\n .container h2 {\n margin: 0;\n color: ${((_a = props.title) == null ? void 0 : _a.textColor) ?? \"red\"};\n font-size: ${((_b = props.title) == null ? void 0 : _b.fontSize) ?? \"16px\"};\n font-weight: ${((_c = props.title) == null ? void 0 : _c.fontWeight) ?? \"500\"};\n font-family: ${((_d = props.title) == null ? void 0 : _d.fontFamily) ?? \"inherit\"};\n }\n `;\n }\n updateStyles(props) {\n this._props = props;\n if (this._style) {\n this._style.textContent = this.getStyles(props);\n }\n if (this._button) {\n this._button.updateButton(props.button);\n }\n }\n}\nclass CourierIconButton extends CourierBaseElement {\n constructor(svg, color, backgroundColor, hoverBackgroundColor, activeBackgroundColor, borderRadius, height, width) {\n super();\n // State\n __publicField(this, \"_backgroundColor\");\n __publicField(this, \"_hoverBackgroundColor\");\n __publicField(this, \"_activeBackgroundColor\");\n __publicField(this, \"_borderRadius\");\n __publicField(this, \"_height\");\n __publicField(this, \"_width\");\n // Elements\n __publicField(this, \"_style\");\n __publicField(this, \"_button\");\n __publicField(this, \"_icon\");\n this._borderRadius = borderRadius;\n this._backgroundColor = backgroundColor;\n this._hoverBackgroundColor = hoverBackgroundColor;\n this._activeBackgroundColor = activeBackgroundColor;\n this._height = height;\n this._width = width;\n const shadow = this.attachShadow({ mode: \"open\" });\n this._button = document.createElement(\"button\");\n this._button.setAttribute(\"part\", \"button\");\n this._icon = new CourierIcon(color, svg);\n this._style = document.createElement(\"style\");\n this.refresh();\n shadow.appendChild(this._style);\n this._button.appendChild(this._icon);\n shadow.appendChild(this._button);\n }\n static get id() {\n return \"courier-icon-button\";\n }\n refresh() {\n this._style.textContent = this.getStyles();\n }\n getStyles() {\n return `\n :host {\n display: inline-block;\n border-radius: ${this._borderRadius ?? \"50%\"};\n }\n\n button {\n border: none;\n border-radius: ${this._borderRadius ?? \"50%\"};\n cursor: pointer;\n width: ${this._width ?? \"36px\"};\n height: ${this._height ?? \"36px\"};\n display: flex;\n align-items: center;\n justify-content: center;\n background: ${this._backgroundColor ?? \"transparent\"};\n transition: background-color 0.2s ease;\n touch-action: manipulation;\n }\n\n button:hover {\n background-color: ${this._hoverBackgroundColor ?? \"red\"};\n }\n\n button:active {\n background-color: ${this._activeBackgroundColor ?? \"red\"};\n }\n\n button:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n [part=\"icon\"] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n }\n `;\n }\n updateIconColor(color) {\n this._icon.updateColor(color);\n }\n updateIconSVG(svg) {\n this._icon.updateSVG(svg);\n }\n updateBackgroundColor(color) {\n this._backgroundColor = color;\n this.refresh();\n }\n updateHoverBackgroundColor(color) {\n this._hoverBackgroundColor = color;\n this.refresh();\n }\n updateActiveBackgroundColor(color) {\n this._activeBackgroundColor = color;\n this.refresh();\n }\n}\nfunction registerElement(element) {\n if (typeof window !== \"undefined\" && !customElements.get(element.id)) {\n customElements.define(element.id, element);\n }\n}\nfunction injectGlobalStyle(styleId, styles) {\n const selector = `style[data-${styleId}]`;\n const existingStyle = document.querySelector(selector);\n if (!existingStyle) {\n const style = document.createElement(\"style\");\n style.setAttribute(`data-${styleId}`, \"\");\n style.textContent = styles;\n document.head.appendChild(style);\n return style;\n }\n return existingStyle;\n}\nregisterElement(CourierButton);\nregisterElement(CourierIcon);\nregisterElement(CourierLink);\nregisterElement(CourierInfoState);\nregisterElement(CourierIconButton);\nregisterElement(CourierSystemThemeElement);\nexport {\n CourierBaseElement,\n CourierButton,\n CourierButtonVariants,\n CourierColors,\n CourierFactoryElement,\n CourierIcon,\n CourierIconButton,\n CourierIconSVGs,\n CourierInfoState,\n CourierLink,\n CourierSystemThemeElement,\n addSystemThemeModeListener,\n getSystemThemeMode,\n injectGlobalStyle,\n registerElement,\n theme\n};\n//# sourceMappingURL=index.mjs.map\n","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 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 // 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 // Handle message events\n 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 // 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 } from \"@trycourier/courier-ui-core\";\n\nexport type CourierInboxFontTheme = {\n family?: string;\n weight?: string;\n size?: string;\n color?: string;\n}\n\nexport type CourierInboxIconTheme = {\n color?: string;\n svg?: string;\n}\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 CourierInboxIconButtonTheme = {\n icon?: CourierInboxIconTheme;\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: string;\n}\n\nexport type CourierInboxButtonTheme = {\n font?: CourierInboxFontTheme;\n text?: string;\n shadow?: string;\n border?: string;\n borderRadius?: string;\n backgroundColor?: string;\n hoverBackgroundColor?: string;\n activeBackgroundColor?: 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 { CourierComponentThemeMode, SystemThemeMode, addSystemThemeModeListener, getSystemThemeMode } from \"@trycourier/courier-ui-core\";\nimport { CourierInboxTheme, defaultDarkTheme, defaultLightTheme, mergeTheme } from \"./courier-inbox-theme\";\n\nexport interface CourierInboxThemeSubscription {\n manager: CourierInboxThemeManager;\n unsubscribe: () => void;\n}\n\nexport class CourierInboxThemeManager {\n\n // Event IDs\n private readonly THEME_CHANGE_EVENT: string = 'courier_inbox_theme_change';\n\n // State\n private _theme: CourierInboxTheme;\n private _lightTheme: CourierInboxTheme = defaultLightTheme;\n private _darkTheme: CourierInboxTheme = defaultDarkTheme;\n private _target: EventTarget;\n private _subscriptions: CourierInboxThemeSubscription[] = [];\n\n // System theme\n private _userMode: CourierComponentThemeMode;\n private _systemMode: SystemThemeMode;\n private _systemThemeCleanup: (() => void) | undefined;\n\n public setLightTheme(theme: CourierInboxTheme) {\n this._lightTheme = theme;\n if (this._systemMode === 'light') {\n this.updateTheme();\n }\n }\n\n public setDarkTheme(theme: CourierInboxTheme) {\n this._darkTheme = theme;\n if (this._systemMode === 'dark') {\n this.updateTheme();\n }\n }\n\n constructor(initialTheme: CourierInboxTheme) {\n this._theme = initialTheme;\n this._target = new EventTarget();\n this._userMode = 'system' as CourierComponentThemeMode;\n\n // Get the initial system theme\n this._systemMode = getSystemThemeMode();\n this.setLightTheme(defaultLightTheme);\n this.setDarkTheme(defaultDarkTheme);\n\n // Set up system theme listener\n this._systemThemeCleanup = addSystemThemeModeListener((mode: SystemThemeMode) => {\n this._systemMode = mode;\n this.updateTheme();\n });\n }\n\n /**\n * Get the current system theme\n */\n public get currentSystemTheme(): SystemThemeMode {\n return this._systemMode;\n }\n\n /**\n * Get the current theme\n */\n public getTheme() {\n return this._theme;\n }\n\n /**\n * Update the theme\n */\n private updateTheme() {\n\n // Use the user mode or fallback to the system mode\n const mode = this._userMode === 'system' ? this._systemMode : this._userMode;\n\n // Get the theme \n const theme = mode === 'light' ? this._lightTheme : this._darkTheme;\n\n // Merge the theme\n const mergedTheme = mergeTheme(mode, theme);\n\n // Set the theme\n this.setTheme(mergedTheme);\n }\n\n /**\n * Set the theme and notify all listeners\n */\n private setTheme(theme: CourierInboxTheme) {\n if (theme === this._theme) return;\n this._theme = theme;\n this._target.dispatchEvent(new CustomEvent(this.THEME_CHANGE_EVENT, {\n detail: { theme }\n }));\n }\n\n /**\n * Set the mode and notify all listeners\n */\n public setMode(mode: CourierComponentThemeMode) {\n this._userMode = mode;\n this.updateTheme();\n }\n\n public get mode(): CourierComponentThemeMode {\n return this._userMode;\n }\n\n /**\n * Subscribe to theme changes\n * @param {Function} callback - Function to run when the theme changes\n * @returns {CourierInboxThemeSubscription} - Object with remove method to stop listening\n */\n subscribe(callback: (theme: CourierInboxTheme) => void): CourierInboxThemeSubscription {\n const controller = new AbortController();\n this._target.addEventListener(this.THEME_CHANGE_EVENT, ((e: Event) => {\n callback((e as CustomEvent<{ theme: CourierInboxTheme }>).detail.theme);\n }) as EventListener, { signal: controller.signal });\n\n const subscription: CourierInboxThemeSubscription = {\n manager: this,\n unsubscribe: () => {\n controller.abort();\n const index = this._subscriptions.indexOf(subscription);\n if (index > -1) {\n this._subscriptions.splice(index, 1);\n }\n }\n };\n\n this._subscriptions.push(subscription);\n return subscription;\n }\n\n /**\n * Clean up event listeners\n */\n public cleanup() {\n if (this._systemThemeCleanup) {\n this._systemThemeCleanup();\n }\n this._subscriptions.forEach(subscription => subscription.unsubscribe());\n this._subscriptions = [];\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((_) => {\n this.refresh();\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);","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"],"names":["_isInitialised","__defProp","Object","defineProperty","__typeError","msg","TypeError","__publicField","obj","key","value","enumerable","configurable","writable","__defNormalProp","__accessCheck","member","has","__privateSet","setter","set","CourierColors","theme","light","colors","primary","secondary","border","link","icon","button","cornerRadius","dark","getSystemThemeMode","window","matchMedia","matches","addSystemThemeModeListener","callback","mediaQuery","handler","e","addEventListener","removeEventListener","HTMLElementBase","HTMLElement","CourierBaseElement","constructor","super","arguments","this","WeakSet","add","id","connectedCallback","_a","get","onComponentMounted","call","disconnectedCallback","onComponentUnmounted","WeakMap","CourierSystemThemeElement","_currentSystemTheme","_systemThemeCleanup","mode","onSystemThemeChange","currentSystemTheme","_","baseButtonStyles","borderRadius","fontSize","CourierButtonVariants","backgroundColor","textColor","fontWeight","shadow","CourierButton","props","attachShadow","_button","document","createElement","setAttribute","_style","textContent","getStyles","appendChild","updateButton","preventDefault","stopPropagation","onClick","fontFamily","hoverBackgroundColor","activeBackgroundColor","text","CourierIconSVGs","inbox","archive","check","filter","overflow","read","archiveRead","unread","unarchive","CourierIcon","color","svg","_color","_svg","_iconContainer","refresh","innerHTML","updateColor","updateSVG","CourierLink","style","updateVariant","updateUnderline","updateMode","slot","updateHref","attributeChangedCallback","name","oldValue","newValue","pointerEvents","hasAttribute","opacity","updateTarget","updateFontFamily","updateFontSize","href","getAttribute","variant","setProperty","removeProperty","underline","toString","target","CourierFactoryElement","build","newElement","replaceChildren","element","defaultElement","cssText","CourierInfoState","_props","container","_title","title","className","updateStyles","_b","_c","_d","CourierIconButton","height","width","_borderRadius","_backgroundColor","_hoverBackgroundColor","_activeBackgroundColor","_height","_width","_icon","updateIconColor","updateIconSVG","updateBackgroundColor","updateHoverBackgroundColor","updateActiveBackgroundColor","registerElement","customElements","define","injectGlobalStyle","styleId","styles","selector","existingStyle","querySelector","head","copyMessage","message","copy","actions","map","action","data","JSON","parse","stringify","copyInboxAction","tags","trackingIds","copyInboxDataSet","dataSet","messages","CourierInboxListItemMenu","_theme","menu","list","item","setOptions","options","_options","renderMenu","menuTheme","cancelEvent","forEach","opt","handleInteraction","show","display","classList","hide","remove","_CourierInboxDatastore","shared","instance","unreadCount","_unreadCount","inboxDataSet","_inboxDataSet","feedType","canPaginate","paginationCursor","archiveDataSet","_archiveDataSet","addDataStoreListener","listener","_dataStoreListeners","push","removeDataStoreListener","l","fetchCachableDataSet","canUseCache","response","fetch","nodes","_e","pageInfo","hasNextPage","_h","_f","_g","startCursor","fetchUnreadCount","Courier","client","getUnreadMessageCount","load","userId","Error","properties","Promise","all","getMessages","getArchivedMessages","events","onDataSetChange","onUnreadCountChange","error","logger","onError","listenForUpdates","connectSocket","socket","info","isConnecting","isOpen","connectionId","addMessageEventListener","event","InboxMessageEvent","NewMessage","addMessage","getMessage","messageId","MarkAllRead","readAllMessages","canCallApi","Read","readMessage","Unread","unreadMessage","Opened","openMessage","Archive","archiveMessage","ArchiveRead","archiveReadMessages","ArchiveAll","archiveAllMessages","Clicked","clickMessage","Unarchive","unarchiveMessage","Unopened","connect","find","m","fetchNextPageOfMessages","isPaginatingInbox","paginationLimit","_j","_i","addPage","isPaginatingArchive","_m","_p","_o","_s","_q","_r","_v","_t","_u","canMutate","datastoreSnapshot","getDatastoreSnapshot","snapshot","getMessageSnapshot","Date","toISOString","applyMessageSnapshot","applyDatastoreSnapshot","inboxIndex","archiveIndex","opened","open","clickTrackingId","click","trackingId","messageSnapshot","archived","removeMessage","insertIndex","findInsertIndex","timestamp","findIndex","splice","archiveAll","readAll","newMessage","i","length","created","onPageAdded","index","onMessageAdd","onMessageRemove","updateMessage","onMessageUpdate","CourierInboxDatastore","CourierInboxListItem","themeManager","canClick","_canLongPress","_canClick","_themeManager","getTheme","_isMobile","render","_setupIntersectionObserver","contentContainer","_titleElement","_subtitleElement","_actionsContainer","_timeElement","_unreadIndicator","_menu","_getMenuOptions","append","cancelPropagation","contains","composedPath","includes","_message","onItemClick","_isLongPress","_setupHoverBehavior","_setupLongPressBehavior","IntersectionObserver","_observer","disconnect","entries","entry","intersectionRatio","onItemVisible","threshold","observe","divider","unreadIndicatorColor","family","_l","_k","size","_n","subtitle","time","_x","_w","_z","_y","_showMenu","_hideMenu","enabled","longPress","_longPressTimeout","setTimeout","onItemLongPress","navigator","vibrate","vibrationDuration","displayDuration","passive","clearTimeout","isArchiveFeed","_feedType","setMessage","_updateContent","setOnItemClick","cb","setOnItemActionClick","onItemActionClick","setOnItemLongPress","setOnItemVisible","toggle","preview","body","now","messageDate","diffInSeconds","Math","floor","getTime","getMessageTime","hasActions","actionsTheme","actionButton","content","font","weight","CourierInboxSkeletonListItem","firstRow","CourierSkeletonAnimatedRow","secondRow","thirdRow","skeletonItem","loading","animation","barColor","hexColor","r","parseInt","slice","g","b","colorWithAlpha80","colorWithAlpha40","barHeight","duration","barBorderRadius","CourierInboxSkeletonList","CourierInboxPaginationListItem","_customItem","customItem","_onPaginationTrigger","onPaginationTrigger","_skeletonLoadingList","isIntersecting","CourierInboxList","_onRefresh","onRefresh","_onMessageClick","onMessageClick","_onMessageActionClick","onMessageActionClick","_onMessageLongPress","onMessageLongPress","_themeSubscription","subscribe","_messages","manager","_listStyles","_listItemStyles","_listItemMenuStyles","unsubscribe","setCanClickListItems","_canClickListItems","setCanLongPressListItems","canLongPress","_canLongPressListItems","setDataSet","_canPaginate","Boolean","_error","_isLoading","setFeedType","setLoading","isLoading","setError","setErrorNoClient","handleRetry","handleRefresh","refreshInfoStateThemes","_emptyContainer","errorProps","emptyProps","themeMode","empty","firstChild","removeChild","_errorContainer","_errorStateFactory","loadingElement","_loadingStateFactory","_emptyStateFactory","_listItemFactory","listItem","openVisibleMessage","paginationItem","_paginationItemFactory","setLoadingStateFactory","factory","setEmptyStateFactory","setErrorStateFactory","setListItemFactory","setPaginationItemFactory","CourierInboxOptionMenuItem","_option","option","_isSelected","isSelected","_isSelectedable","selectable","_content","_itemIcon","spacer","_selectionIcon","refreshTheme","selectionIcon","CourierInboxOptionMenu","type","onMenuOpen","_type","_selectable","_selectedIndex","_onMenuOpen","_menuButton","toggleMenu","bind","handleOutsideClick","header","menus","popup","_E","_D","_C","_B","_A","_K","_J","_I","_H","_G","_F","_Q","_P","_O","_N","_M","_L","_W","_V","_U","_T","_S","_R","_aa","_$","__","_Z","_Y","_X","isFilter","buttonConfig","filters","defaultIcon","refreshMenuItems","menuItem","closeMenu","isOpening","selectOption","o","CourierUnreadCountBadge","_location","location","themeBus","_badge","updateBadge","unreadIndicator","padding","setCount","count","_count","CourierInboxHeaderTitle","_iconElement","_unreadBadge","updateFilter","updateSelectedOption","CourierInboxHeader","_onFeedTypeChange","onFeedTypeChange","observedAttributes","onComponentUmounted","getFilterOptions","filterMenu","handleOptionMenuItemClick","getActionOptions","actionMenu","markAllRead","_filterMenu","_actionMenu","_titleSection","filterOptions","headerContent","CourierInboxDataStoreListener","defaultLightTheme","unreadDotIndicator","defaultDarkTheme","mergeTheme","defaultTheme","_ba","_ea","_da","_ca","_ha","_ga","_la","_ia","_ja","_ka","_pa","_oa","_na","_ma","_ua","_ta","_sa","_ra","_qa","_za","_ya","_xa","_wa","_va","_Ea","_Da","_Ca","_Ba","_Aa","_Ja","_Ia","_Ha","_Ga","_Fa","_Ma","_La","_Ka","_Pa","_Oa","_Ta","_Qa","_Ra","_Sa","_Xa","_Wa","_Va","_Ua","_ab","_$a","__a","_Za","_Ya","_fb","_eb","_db","_cb","_bb","_jb","_gb","_hb","_ib","_nb","_mb","_lb","_kb","_sb","_rb","_qb","_pb","_ob","_xb","_wb","_vb","_ub","_tb","_Ab","_zb","_yb","_Db","_Cb","_Hb","_Eb","_Fb","_Gb","_Lb","_Kb","_Jb","_Ib","_Qb","_Pb","_Ob","_Nb","_Mb","_Vb","_Ub","_Tb","_Sb","_Rb","_Zb","_Wb","_Xb","_Yb","_bc","_ac","_$b","__b","_gc","_fc","_ec","_dc","_cc","_lc","_kc","_jc","_ic","_hc","_pc","_mc","_nc","_oc","_tc","_sc","_rc","_qc","_yc","_xc","_wc","_vc","_uc","_Dc","_Cc","_Bc","_Ac","_zc","_Ec","_Fc","_Hc","_Gc","_Jc","_Ic","_Mc","_Lc","_Kc","_Pc","_Oc","_Tc","_Qc","_Rc","_Sc","_Xc","_Wc","_Vc","_Uc","_ad","_$c","__c","_Zc","_Yc","_fd","_ed","_dd","_cd","_bd","_kd","_jd","_id","_hd","_gd","_pd","_od","_nd","_md","_ld","_ud","_td","_sd","_rd","_qd","_zd","_yd","_xd","_wd","_vd","_Ed","_Dd","_Cd","_Bd","_Ad","_Jd","_Id","_Hd","_Gd","_Fd","_Kd","_Ld","_Md","_Nd","_Od","_Pd","CourierInboxThemeManager","initialTheme","_target","EventTarget","_userMode","_systemMode","setLightTheme","setDarkTheme","updateTheme","_lightTheme","_darkTheme","mergedTheme","setTheme","dispatchEvent","CustomEvent","THEME_CHANGE_EVENT","detail","setMode","controller","AbortController","signal","subscription","abort","_subscriptions","indexOf","cleanup","CourierInbox","_currentFeed","currentFeed","_inboxStyle","_unreadIndicatorStyle","_header","_list","canClickListItems","canLongPressListItems","async","bubbles","composed","_datastoreListener","updateHeader","_authListener","addAuthenticationListener","_defaultProps","setHeader","_headerFactory","removeHeader","setLoadingState","setEmptyState","setErrorState","setListItem","setPaginationItem","messageCount","headerElement","Function","CourierInboxMenuButton","_container","_triggerButton","CourierInboxPopupMenu","_popup","SAFE_SELECTORS","some","node","sel","_inbox","togglePopup","updatePopupPosition","isValidPosition","_popupAlignment","setSize","_top","_right","_bottom","_left","closePopup","top","bottom","left","right","margin","transform","isVisible","setContent","setPosition","position","setMenuButton","_popupMenuButtonFactory","customButton","___"],"mappings":"mUAUIA,wJAVAC,EAAYC,OAAOC,eACnBC,EAAeC,IACjB,MAAMC,UAAUD,EAAG,EAGjBE,EAAgB,CAACC,EAAKC,EAAKC,IADT,EAACF,EAAKC,EAAKC,IAAUD,KAAOD,EAAMP,EAAUO,EAAKC,EAAK,CAAEE,YAAY,EAAMC,cAAc,EAAMC,UAAU,EAAMH,UAAWF,EAAIC,GAAOC,EACjHI,CAAgBN,EAAoB,iBAARC,EAAmBA,EAAM,GAAKA,EAAKC,GACpGK,EAAgB,CAACP,EAAKQ,EAAQX,IAAQW,EAAOC,IAAIT,IAAQJ,EAAY,UAAYC,GAGjFa,EAAe,CAACV,EAAKQ,EAAQN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E,YACjD,GAAK3K,KAAKw0B,eAEV,OAAQx0B,KAAKq2B,yBACX,UAAK,EACL,KAAK,KACHr2B,KAAKw0B,eAAe5uB,WAAM,GAC1B5F,KAAKw0B,eAAepnB,oBAAoBzC,GACxC,MACF,QACE,MAAM2rB,EAAet2B,KAAKq2B,wBAAwB,CAAE1rB,gBACpD3K,KAAKw0B,eAAe5uB,MAAM0wB,GAGhC,EAIF3uB,EAAgB8sB,oLC7fT,MACE,eAAAtnB,CAAiBjM,EAAiBmgB,GAAkC,CACpE,WAAA1O,CAAazR,EAAiBmgB,GAAkC,CAChE,mBAAAjU,CAAqBlM,GAAmB,CACxC,YAAA2R,CAAc3R,EAAiBmgB,EAAYkV,GAAmC,CAC9E,eAAAzjB,CAAiB5R,EAAiBmgB,EAAYkV,GAAmC,CACjF,eAAAvjB,CAAiB9R,EAAiBmgB,EAAYkV,GAAmC,CACjF,OAAAhpB,CAASrM,GAAkB,4HbI7B,SAAwBoH,GAC7B,OAAO2K,EAAsBxI,OAAOuE,eAAe,CAAE1G,WACvD,iBANO,SAAsBA,GAC3B,OAAO2K,EAAsBxI,OAAO6E,aAAa,CAAEhH,WACrD,0DAVO,SAAoBA,GACzB,OAAO2K,EAAsBxI,OAAOiE,YAAY,CAAEpG,WACpD,iBAEO,SAAsBA,GAC3B,OAAO2K,EAAsBxI,OAAOmE,cAAc,CAAEtG,WACtD"}
1
+ {"version":3,"file":"index.js","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/index.ts","../src/datastore/datatore-events.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 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 // Handle message events\n 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((_) => {\n this.refresh();\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);","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","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","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"],"names":["copyMessage","message","copy","actions","map","action","data","JSON","parse","stringify","copyInboxAction","tags","trackingIds","copyInboxDataSet","dataSet","messages","CourierInboxListItemMenu","CourierBaseElement","constructor","theme","super","__publicField","this","_theme","id","onComponentMounted","menu","document","createElement","className","appendChild","getStyles","_c","_b","_a","inbox","list","item","backgroundColor","border","borderRadius","shadow","setOptions","options","_options","renderMenu","querySelector","innerHTML","menuTheme","cancelEvent","e","stopPropagation","preventDefault","forEach","opt","icon","CourierIconButton","svg","color","hoverBackgroundColor","activeBackgroundColor","handleInteraction","onClick","addEventListener","show","style","display","classList","add","hide","remove","registerElement","_CourierInboxDatastore","shared","instance","unreadCount","_unreadCount","inboxDataSet","_inboxDataSet","feedType","canPaginate","paginationCursor","archiveDataSet","_archiveDataSet","addDataStoreListener","listener","_dataStoreListeners","push","removeDataStoreListener","filter","l","fetchCachableDataSet","props","canUseCache","response","fetch","nodes","_e","_d","pageInfo","hasNextPage","_h","_f","_g","startCursor","fetchUnreadCount","Courier","client","getUnreadMessageCount","load","userId","Error","properties","Promise","all","getMessages","getArchivedMessages","events","onDataSetChange","call","onUnreadCountChange","error","logger","onError","listenForUpdates","connectSocket","socket","info","addMessageEventListener","event","InboxMessageEvent","NewMessage","addMessage","getMessage","messageId","MarkAllRead","readAllMessages","canCallApi","Read","readMessage","Unread","unreadMessage","Opened","openMessage","Archive","archiveMessage","ArchiveRead","archiveReadMessages","ArchiveAll","archiveAllMessages","Clicked","clickMessage","Unarchive","unarchiveMessage","Unopened","isConnecting","isOpen","connectionId","connect","find","m","fetchNextPageOfMessages","isPaginatingInbox","paginationLimit","_j","_i","addPage","isPaginatingArchive","_m","_p","_o","_s","_q","_r","_v","_t","_u","canMutate","datastoreSnapshot","getDatastoreSnapshot","snapshot","getMessageSnapshot","read","Date","toISOString","applyMessageSnapshot","applyDatastoreSnapshot","unread","inboxIndex","archiveIndex","opened","open","clickTrackingId","click","trackingId","messageSnapshot","archived","removeMessage","insertIndex","findInsertIndex","archive","unarchive","timestamp","findIndex","splice","archiveRead","archiveAll","readAll","newMessage","i","length","created","onPageAdded","index","onMessageAdd","onMessageRemove","updateMessage","onMessageUpdate","CourierInboxDatastore","CourierInboxListItem","themeManager","canClick","_canLongPress","_canClick","_themeManager","getTheme","_isMobile","window","render","_setupIntersectionObserver","contentContainer","_titleElement","_subtitleElement","_actionsContainer","_timeElement","_unreadIndicator","_menu","_getMenuOptions","append","cancelPropagation","contains","target","composedPath","includes","_message","onItemClick","CourierIcon","_isLongPress","_setupHoverBehavior","_setupLongPressBehavior","IntersectionObserver","_observer","disconnect","entries","entry","intersectionRatio","onItemVisible","threshold","observe","onComponentUnmounted","divider","unreadIndicatorColor","title","family","_l","_k","size","_n","subtitle","time","_x","_w","_z","_y","_showMenu","_hideMenu","enabled","longPress","_longPressTimeout","setTimeout","onItemLongPress","navigator","vibrate","vibrationDuration","displayDuration","passive","clearTimeout","isArchiveFeed","_feedType","opacity","setMessage","_updateContent","setOnItemClick","cb","setOnItemActionClick","onItemActionClick","setOnItemLongPress","setOnItemVisible","textContent","toggle","preview","body","now","messageDate","diffInSeconds","Math","floor","getTime","getMessageTime","hasActions","actionsTheme","actionButton","CourierButton","mode","text","content","variant","fontFamily","font","fontSize","fontWeight","weight","textColor","CourierInboxSkeletonListItem","_style","injectGlobalStyle","firstRow","CourierSkeletonAnimatedRow","secondRow","thirdRow","skeletonItem","loading","animation","barColor","hexColor","r","parseInt","slice","g","b","colorWithAlpha80","colorWithAlpha40","barHeight","duration","barBorderRadius","CourierInboxSkeletonList","CourierFactoryElement","defaultElement","CourierInboxPaginationListItem","_customItem","customItem","_onPaginationTrigger","onPaginationTrigger","container","_skeletonLoadingList","build","isIntersecting","CourierInboxList","_onRefresh","onRefresh","_onMessageClick","onMessageClick","_onMessageActionClick","onMessageActionClick","_onMessageLongPress","onMessageLongPress","_themeSubscription","subscribe","_","_messages","manager","_listStyles","_listItemStyles","_listItemMenuStyles","unsubscribe","setCanClickListItems","_canClickListItems","setCanLongPressListItems","canLongPress","_canLongPressListItems","setDataSet","_canPaginate","Boolean","_error","_isLoading","setFeedType","setLoading","isLoading","setError","setErrorNoClient","handleRetry","handleRefresh","refreshInfoStateThemes","_emptyContainer","updateStyles","errorProps","emptyProps","themeMode","button","empty","firstChild","removeChild","_errorContainer","CourierInfoState","_errorStateFactory","loadingElement","_loadingStateFactory","_emptyStateFactory","_listItemFactory","listItem","openVisibleMessage","paginationItem","_paginationItemFactory","setLoadingStateFactory","factory","setEmptyStateFactory","setErrorStateFactory","setListItemFactory","setPaginationItemFactory","CourierInboxOptionMenuItem","_option","option","_isSelected","isSelected","_isSelectedable","selectable","_content","_itemIcon","CourierIconSVGs","setAttribute","_title","spacer","_selectionIcon","check","refreshTheme","updateColor","selectionIcon","updateSVG","CourierInboxOptionMenu","type","onMenuOpen","_type","_selectable","_selectedIndex","_onMenuOpen","_menuButton","overflow","toggleMenu","bind","handleOutsideClick","header","menus","popup","_E","_D","_C","_B","_A","_K","_J","_I","_H","_G","_F","_Q","_P","_O","_N","_M","_L","_W","_V","_U","_T","_S","_R","_aa","_$","__","_Z","_Y","_X","isFilter","buttonConfig","filters","defaultIcon","updateIconSVG","updateIconColor","updateBackgroundColor","updateHoverBackgroundColor","updateActiveBackgroundColor","refreshMenuItems","menuItem","closeMenu","isOpening","selectOption","o","CourierUnreadCountBadge","_location","location","themeBus","_badge","updateBadge","unreadIndicator","padding","setCount","count","_count","toString","CourierInboxHeaderTitle","_iconElement","_unreadBadge","updateFilter","updateSelectedOption","CourierInboxHeader","_onFeedTypeChange","onFeedTypeChange","observedAttributes","onComponentUmounted","getFilterOptions","filterMenu","handleOptionMenuItemClick","getActionOptions","actionMenu","markAllRead","_filterMenu","_actionMenu","_titleSection","newElement","filterOptions","headerContent","CourierColors","white","CourierInboxDataStoreListener","defaultLightTheme","black","unreadDotIndicator","blue","height","width","gray","defaultDarkTheme","mergeTheme","defaultTheme","_ba","_ea","_da","_ca","_ha","_ga","_fa","_la","_ia","_ja","_ka","_pa","_ma","_na","_oa","_ua","_ta","_sa","_ra","_qa","_za","_ya","_xa","_wa","_va","_Ea","_Da","_Ca","_Ba","_Aa","_Ja","_Ia","_Ha","_Ga","_Fa","_Ma","_La","_Ka","_Pa","_Oa","_Na","_Ta","_Qa","_Ra","_Sa","_Xa","_Ua","_Va","_Wa","_ab","_$a","__a","_Za","_Ya","_fb","_eb","_db","_cb","_bb","_jb","_gb","_hb","_ib","_nb","_kb","_lb","_mb","_sb","_rb","_qb","_pb","_ob","_xb","_wb","_vb","_ub","_tb","_Ab","_zb","_yb","_Db","_Cb","_Bb","_Hb","_Eb","_Fb","_Gb","_Lb","_Ib","_Jb","_Kb","_Qb","_Pb","_Ob","_Nb","_Mb","_Vb","_Ub","_Tb","_Sb","_Rb","_Zb","_Wb","_Xb","_Yb","_bc","__b","_$b","_ac","_gc","_fc","_ec","_dc","_cc","_lc","_kc","_jc","_ic","_hc","_pc","_mc","_nc","_oc","_tc","_qc","_rc","_sc","_yc","_xc","_wc","_vc","_uc","_Dc","_Cc","_Bc","_Ac","_zc","_Ec","_Fc","_Hc","_Gc","_Jc","_Ic","_Mc","_Lc","_Kc","_Pc","_Oc","_Nc","_Tc","_Qc","_Rc","_Sc","_Xc","_Uc","_Vc","_Wc","_ad","_$c","__c","_Zc","_Yc","_fd","_ed","_dd","_cd","_bd","_kd","_jd","_id","_hd","_gd","_pd","_od","_nd","_md","_ld","_ud","_td","_sd","_rd","_qd","_zd","_yd","_xd","_wd","_vd","_Ed","_Dd","_Cd","_Bd","_Ad","_Jd","_Id","_Hd","_Gd","_Fd","_Kd","_Ld","_Md","_Nd","_Od","_Pd","CourierInboxThemeManager","CourierThemeManager","initialTheme","getDefaultLightTheme","getDefaultDarkTheme","callback","CourierInbox","_currentFeed","currentFeed","setLightTheme","setDarkTheme","setMode","_inboxStyle","_unreadIndicatorStyle","_header","_list","canClickListItems","canLongPressListItems","refresh","async","dispatchEvent","CustomEvent","detail","bubbles","composed","_datastoreListener","updateHeader","_authListener","addAuthenticationListener","cleanup","_defaultProps","setHeader","_headerFactory","removeHeader","setLoadingState","setEmptyState","setErrorState","setListItem","setPaginationItem","handler","messageCount","headerElement","attributeChangedCallback","name","oldValue","newValue","Function","CourierInboxMenuButton","_container","_triggerButton","CourierInboxPopupMenu","_popup","SAFE_SELECTORS","some","node","HTMLElement","sel","matches","_inbox","_width","_height","togglePopup","updatePopupPosition","isValidPosition","_popupAlignment","setSize","_top","_right","_bottom","_left","closePopup","value","top","bottom","left","right","margin","transform","isVisible","setContent","element","setPosition","position","setMenuButton","_popupMenuButtonFactory","customButton","courierUserAgentName","courierUserAgentVersion","___"],"mappings":"gjBAQO,SAASA,EAAYC,GAC1B,MAAMC,EAAO,IACRD,GAmBL,OAhBIA,EAAQE,UACVD,EAAKC,QAAUF,EAAQE,QAAQC,KAAIC,GAuBhC,SAAyBA,GAC9B,MAAMH,EAAO,IACRG,GAGDA,EAAOC,OACTJ,EAAKI,KAAOC,KAAKC,MAAMD,KAAKE,UAAUJ,EAAOC,QAG/C,OAAOJ,CACT,CAjCiDQ,CAAgBL,MAG3DJ,EAAQK,OACVJ,EAAKI,KAAOC,KAAKC,MAAMD,KAAKE,UAAUR,EAAQK,QAG5CL,EAAQU,OACVT,EAAKS,KAAO,IAAIV,EAAQU,OAGtBV,EAAQW,cACVV,EAAKU,YAAc,IAAKX,EAAQW,cAG3BV,CACT,CAwBO,SAASW,EAAiBC,GAE/B,GAAKA,EAIL,MAAO,IACFA,EACHC,SAAUD,EAAQC,SAASX,KAAIH,GAAWD,EAAYC,KAG1D,CCxDO,MAAMe,UAAiCC,EAAAA,mBAU5C,WAAAC,CAAYC,GACVC,QAJMC,EAAAC,KAAA,UACAD,EAAAC,KAAA,WAAmD,IAIzDA,KAAKC,OAASJ,CAChB,CAXA,aAAWK,GACT,MAAO,8BAC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