{"version":3,"file":"index.mjs","sources":["../src/hooks/use-courier.tsx","../src/components/courier-client-component.tsx","../src/context/render-context.ts","../src/components/courier-inbox-component.tsx","../src/components/courier-inbox-popup-menu-component.tsx","../src/components/courier-toast-component.tsx","../src/components/courier-preferences-component.tsx"],"sourcesContent":["import React from 'react';\nimport { Courier, CourierProps, InboxMessage, CourierUserPreferences, CourierUserPreferencesStatus, CourierUserPreferencesChannel, CourierUserPreferencesTopic, CourierDigestScheduleOption } from '@trycourier/courier-js';\nimport { CourierInboxDatastore, CourierInboxDataStoreListener, InboxDataSet, CourierInboxFeed } from '@trycourier/courier-ui-inbox';\nimport { CourierToastDatastore, CourierToastDatastoreListener } from '@trycourier/courier-ui-toast';\n\ntype AuthenticationHooks = {\n  userId?: string,\n  signIn: (props: CourierProps) => void,\n  signOut: () => void\n}\n\ntype InboxHooks = {\n  load: (props?: { canUseCache: boolean }) => Promise<void>,\n  fetchNextPageOfMessages: (props: { datasetId: string }) => Promise<InboxDataSet | null>,\n  setPaginationLimit: (limit: number) => void,\n  readMessage: (message: InboxMessage) => Promise<void>,\n  unreadMessage: (message: InboxMessage) => Promise<void>,\n  clickMessage: (message: InboxMessage) => Promise<void>,\n  archiveMessage: (message: InboxMessage) => Promise<void>,\n  openMessage: (message: InboxMessage) => void,\n  unarchiveMessage: (message: InboxMessage) => Promise<void>,\n  readAllMessages: () => Promise<void>,\n  registerFeeds: (feeds: CourierInboxFeed[]) => void,\n  listenForUpdates: () => Promise<void>,\n  feeds: Record<string, InboxDataSet>,\n  totalUnreadCount?: number,\n  error?: Error\n}\n\ntype ToastHooks = {\n  addMessage: (message: InboxMessage) => void;\n  removeMessage: (message: InboxMessage) => void;\n  error?: Error,\n}\n\ntype PreferencesHooks = {\n  getUserPreferences: (props?: { paginationCursor?: string }) => Promise<CourierUserPreferences>;\n  getUserPreferenceTopic: (props: { topicId: string }) => Promise<CourierUserPreferencesTopic>;\n  putUserPreferenceTopic: (props: {\n    topicId: string;\n    status: CourierUserPreferencesStatus;\n    hasCustomRouting: boolean;\n    customRouting: CourierUserPreferencesChannel[];\n    digestSchedule?: string;\n  }) => Promise<CourierUserPreferencesTopic>;\n  getDigestSchedules: (props: { topicId: string }) => Promise<CourierDigestScheduleOption[]>;\n  getNotificationCenterUrl: (props: { clientKey: string }) => string;\n}\n\n// A hook for managing the shared state of Courier\n// If you want to use more functions, checkout the Courier JS SDK which\n// can be used directly by importing from '@trycourier/courier-js'\nexport const useCourier = () => {\n\n  // Authentication Functions\n  const signIn = (props: CourierProps) => Courier.shared.signIn(props);\n  const signOut = () => Courier.shared.signOut();\n\n  // Inbox Functions\n  const loadInbox = (props?: { canUseCache: boolean }) => CourierInboxDatastore.shared.load(props);\n  const fetchNextPageOfMessages = (props: { datasetId: string }) => CourierInboxDatastore.shared.fetchNextPageOfMessages(props);\n  const setPaginationLimit = (limit: number) => Courier.shared.paginationLimit = limit;\n  const readMessage = (message: InboxMessage) => CourierInboxDatastore.shared.readMessage({ message });\n  const unreadMessage = (message: InboxMessage) => CourierInboxDatastore.shared.unreadMessage({ message });\n  const clickMessage = (message: InboxMessage) => CourierInboxDatastore.shared.clickMessage({ message });\n  const archiveMessage = (message: InboxMessage) => CourierInboxDatastore.shared.archiveMessage({ message });\n  const openMessage = (message: InboxMessage) => CourierInboxDatastore.shared.openMessage({ message });\n  const unarchiveMessage = (message: InboxMessage) => CourierInboxDatastore.shared.unarchiveMessage({ message });\n  const readAllMessages = () => CourierInboxDatastore.shared.readAllMessages();\n  const registerFeeds = (feeds: CourierInboxFeed[]) => CourierInboxDatastore.shared.registerFeeds(feeds);\n  const listenForUpdates = () => CourierInboxDatastore.shared.listenForUpdates();\n\n  // State\n  const [auth, setAuth] = React.useState<AuthenticationHooks>({\n    userId: undefined,\n    signIn,\n    signOut\n  });\n\n  const [inbox, setInbox] = React.useState<InboxHooks>({\n    load: loadInbox,\n    fetchNextPageOfMessages,\n    setPaginationLimit,\n    readMessage,\n    unreadMessage,\n    clickMessage,\n    archiveMessage,\n    openMessage,\n    unarchiveMessage,\n    readAllMessages,\n    registerFeeds,\n    listenForUpdates,\n    feeds: {}\n  });\n\n  const addToastMessage = (message: InboxMessage) => CourierToastDatastore.shared.addMessage(message);\n  const removeToastMessage = (message: InboxMessage) => CourierToastDatastore.shared.removeMessage(message);\n\n  const [toast, setToast] = React.useState<ToastHooks>({\n    addMessage: addToastMessage,\n    removeMessage: removeToastMessage,\n  });\n\n  const getUserPreferences = (props?: { paginationCursor?: string }) => Courier.shared.client!.preferences.getUserPreferences(props);\n  const getUserPreferenceTopic = (props: { topicId: string }) => Courier.shared.client!.preferences.getUserPreferenceTopic(props);\n  const putUserPreferenceTopic = (props: { topicId: string; status: CourierUserPreferencesStatus; hasCustomRouting: boolean; customRouting: CourierUserPreferencesChannel[]; digestSchedule?: string }) => Courier.shared.client!.preferences.putUserPreferenceTopic(props);\n  const getDigestSchedules = (props: { topicId: string }) => Courier.shared.client!.preferences.getDigestSchedules(props);\n  const getNotificationCenterUrl = (props: { clientKey: string }) => Courier.shared.client!.preferences.getNotificationCenterUrl(props);\n\n  const preferences: PreferencesHooks = {\n    getUserPreferences,\n    getUserPreferenceTopic,\n    putUserPreferenceTopic,\n    getDigestSchedules,\n    getNotificationCenterUrl,\n  };\n\n  React.useEffect(() => {\n\n    // Add a listener to the Courier instance\n    const listener = Courier.shared.addAuthenticationListener(() => refreshAuth());\n\n    // Add inbox data store listener\n    const inboxListener = new CourierInboxDataStoreListener({\n      onError: (error: Error) => refreshInbox(error),\n      onDataSetChange: () => refreshInbox(),\n      onPageAdded: () => refreshInbox(),\n      onMessageAdd: () => refreshInbox(),\n      onMessageRemove: () => refreshInbox(),\n      onMessageUpdate: () => refreshInbox(),\n      onUnreadCountChange: () => refreshInbox(),\n      onTotalUnreadCountChange: () => refreshInbox()\n    });\n    CourierInboxDatastore.shared.addDataStoreListener(inboxListener);\n\n    const toastListener = new CourierToastDatastoreListener({\n      onMessageAdd: () => refreshToast(),\n      onMessageRemove: () => refreshToast(),\n      onError: (error: Error) => refreshToast(error),\n    });\n    CourierToastDatastore.shared.addDatastoreListener(toastListener);\n\n    // Set initial values\n    refreshAuth();\n    refreshInbox();\n    refreshToast();\n\n    // Remove listeners when the component unmounts\n    return () => {\n      listener.remove();\n      inboxListener.remove();\n      toastListener.remove();\n    };\n  }, []);\n\n  const refreshAuth = () => {\n    const options = Courier.shared.client?.options;\n    setAuth({\n      userId: options?.userId,\n      signIn,\n      signOut\n    });\n  }\n\n  const refreshInbox = (error?: Error) => {\n    const datastore = CourierInboxDatastore.shared;\n    const allDatasets = datastore.getDatasets();\n    setInbox({\n      load: loadInbox,\n      fetchNextPageOfMessages,\n      setPaginationLimit,\n      readMessage,\n      unreadMessage,\n      clickMessage,\n      archiveMessage,\n      openMessage,\n      unarchiveMessage,\n      readAllMessages,\n      registerFeeds,\n      listenForUpdates,\n      feeds: allDatasets,\n      totalUnreadCount: datastore.totalUnreadCount,\n      error: error,\n    });\n  }\n\n  const refreshToast = (error?: Error) => {\n    setToast({\n      addMessage: addToastMessage,\n      removeMessage: removeToastMessage,\n      error,\n    });\n  };\n\n  return {\n    shared: Courier.shared,\n    auth: auth,\n    inbox: inbox,\n    toast: toast,\n    preferences: preferences,\n  };\n};\n","import React, { useState, useEffect } from 'react';\n\ninterface CourierClientProps {\n  children: React.ReactNode;\n}\n\n// This class prevents issues with server side rendering react components\n// It will force the component to only render client side\n// A future update could support server side rendering if there is enough demand\nexport const CourierClientComponent: React.FC<CourierClientProps> = ({ children }) => {\n  const [isMounted, setIsMounted] = useState(false);\n\n  useEffect(() => {\n    setIsMounted(true);\n  }, []);\n\n  // During SSR, render nothing or fallback\n  if (typeof window === 'undefined') {\n    return null;\n  }\n\n  if (!isMounted) {\n    return null;\n  }\n\n  return <>{children}</>;\n};","import { createContext, ReactNode } from \"react\";\n\ntype RenderFn = (node: ReactNode) => HTMLElement;\n\n/**\n * Context providing a function to render a React component.\n *\n * Courier's React package renders as follows:\n *\n *   - React engine (client application)\n *     - Courier React components\n *       - Courier web components\n *         - [Optional] User-provided React components (ex. a list item)\n *\n * By default, React will not render the user-provided React components within Courier's\n * web components. We instead manually render the user-provided React components and inject\n * them into the Courier web components.\n *\n * Client rendering changed between React 17 and 18, so the SDKs provide React version-specific\n * rendering functions. See\n * https://18.react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis.\n */\nexport const CourierRenderContext = createContext<RenderFn | null>(null);\n","import { useRef, useEffect, useMemo, forwardRef, ReactNode, useContext, useState } from \"react\";\nimport { CourierInboxListItemActionFactoryProps, CourierInboxListItemFactoryProps, CourierInboxTheme, CourierInbox as CourierInboxElement, CourierInboxHeaderFactoryProps, CourierInboxStateEmptyFactoryProps, CourierInboxStateLoadingFactoryProps, CourierInboxStateErrorFactoryProps, CourierInboxPaginationItemFactoryProps, CourierInboxFeed } from \"@trycourier/courier-ui-inbox\";\nimport { CourierComponentThemeMode } from \"@trycourier/courier-ui-core\";\nimport { InboxMessage } from \"@trycourier/courier-js\";\nimport { CourierClientComponent } from \"./courier-client-component\";\nimport { CourierRenderContext } from \"../context/render-context\";\n\nexport interface CourierInboxProps {\n  /** Height of the inbox container. Defaults to \"auto\" and will resize itself based on it's children. */\n  height?: string;\n\n  /** Theme object for light mode */\n  lightTheme?: CourierInboxTheme;\n\n  /** Theme object for dark mode */\n  darkTheme?: CourierInboxTheme;\n\n  /** Theme mode: \"light\", \"dark\", or \"system\". Defaults to \"system\" */\n  mode?: CourierComponentThemeMode;\n\n  /** Type of feed to display in the inbox. Defaults to \"inbox\" */\n  feedType?: string;\n\n  /** Array of feeds to display in the inbox. Each feed contains tabs with different filters. */\n  feeds?: CourierInboxFeed[];\n\n  /** Callback fired when a message is clicked. */\n  onMessageClick?: (props: CourierInboxListItemFactoryProps) => void;\n\n  /** Callback fired when a message action (e.g., button) is clicked. */\n  onMessageActionClick?: (props: CourierInboxListItemActionFactoryProps) => void;\n\n  /** Callback fired when a message is long-pressed (for mobile/gesture support). Only works on devices that support touch. */\n  onMessageLongPress?: (props: CourierInboxListItemFactoryProps) => void;\n\n  /** Allows you to pass a custom component as the header. */\n  renderHeader?: (props: CourierInboxHeaderFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the list item. */\n  renderListItem?: (props: CourierInboxListItemFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the empty state. */\n  renderEmptyState?: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the loading state. */\n  renderLoadingState?: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the error state. */\n  renderErrorState?: (props: CourierInboxStateErrorFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the pagination list item. */\n  renderPaginationItem?: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => ReactNode;\n\n  /**\n   * Render injected \"dummy\" inbox messages instead of fetching from the API.\n   * No sign-in / network is required, and the live (shared) inbox is unaffected.\n   */\n  previewMessages?: InboxMessage[];\n\n  /** Optional unread-count override for the preview (defaults to unread messages). */\n  previewUnreadCount?: number;\n}\n\nexport const CourierInboxComponent = forwardRef<CourierInboxElement, CourierInboxProps>((props, ref) => {\n  const render = useContext(CourierRenderContext);\n  if (!render) {\n    throw new Error(\"RenderContext not found. Ensure CourierInbox is wrapped in a CourierRenderContext.\");\n  }\n\n  // Element ref for use in effects, updated by handleRef.\n  const inboxRef = useRef<CourierInboxElement | null>(null);\n  const [elementReady, setElementReady] = useState(false);\n\n  // Callback ref passed to rendered component, used to propagate the DOM element's ref to the parent component.\n  // We use a callback ref (rather than a React.RefObject) since we want the parent ref to be up-to-date with\n  // rendered component. Updating the parent ref via useEffect does not work, since mutating a RefObject\n  // does not trigger useEffect (see https://stackoverflow.com/a/60476525).\n  function handleRef(el: CourierInboxElement | null) {\n    if (ref) {\n\n      // Propagate ref to ref callback functions\n      if (typeof ref === 'function') {\n        ref(el);\n      } else {\n        // Propagate ref to ref objects\n        // @ts-ignore - RefObject.current is readonly in React 17, however it's not frozen and is equivalent the widened type MutableRefObject\n        (ref as React.RefObject<CourierInboxElement | null>).current = el;\n      }\n    }\n\n    // Store the element for use in effects\n    inboxRef.current = el;\n\n    // Update element ready state\n    setElementReady(!!el);\n  }\n\n  // Helper to get the current element\n  function getEl(): CourierInboxElement | null {\n    return inboxRef.current;\n  }\n\n  // Handle message click\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox) return;\n    inbox.onMessageClick(props.onMessageClick);\n  }, [props.onMessageClick, elementReady]);\n\n  // Handle message action click\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox) return;\n    inbox.onMessageActionClick(props.onMessageActionClick);\n  }, [props.onMessageActionClick, elementReady]);\n\n  // Handle message long press\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox) return;\n    inbox.onMessageLongPress(props.onMessageLongPress);\n  }, [props.onMessageLongPress, elementReady]);\n\n  // Inject preview/dummy data (skips fetch + the shared datastore)\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox) return;\n    inbox.setPreviewData(props.previewMessages ?? null, {\n      unreadCount: props.previewUnreadCount,\n    });\n  }, [props.previewMessages, props.previewUnreadCount, elementReady]);\n\n  // Render header\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderHeader) return;\n    queueMicrotask(() => {\n      inbox.setHeader((headerProps?: CourierInboxHeaderFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderHeader!(headerProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderHeader, elementReady]);\n\n  // Render list item\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderListItem) return;\n    queueMicrotask(() => {\n      inbox.setListItem((itemProps?: CourierInboxListItemFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderListItem!(itemProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderListItem, elementReady]);\n\n  // Render empty state\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderEmptyState) return;\n    queueMicrotask(() => {\n      inbox.setEmptyState((emptyStateProps?: CourierInboxStateEmptyFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderEmptyState!(emptyStateProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderEmptyState, elementReady]);\n\n  // Render loading state\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderLoadingState) return;\n    queueMicrotask(() => {\n      inbox.setLoadingState((loadingStateProps?: CourierInboxStateLoadingFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderLoadingState!(loadingStateProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderLoadingState, elementReady]);\n\n  // Render error state\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderErrorState) return;\n    queueMicrotask(() => {\n      inbox.setErrorState((errorStateProps?: CourierInboxStateErrorFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderErrorState!(errorStateProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderErrorState, elementReady]);\n\n  // Render pagination item\n  useEffect(() => {\n    const inbox = getEl();\n    if (!inbox || !props.renderPaginationItem) return;\n    queueMicrotask(() => {\n      inbox.setPaginationItem((paginationProps?: CourierInboxPaginationItemFactoryProps | undefined | null): HTMLElement => {\n        const reactNode = props.renderPaginationItem!(paginationProps);\n        return render(reactNode);\n      });\n    });\n  }, [props.renderPaginationItem, elementReady]);\n\n  const feedsAttr = useMemo(\n    () => props.feeds ? JSON.stringify(props.feeds) : undefined,\n    [props.feeds]\n  );\n\n  const children = (\n    /* @ts-ignore */\n    <courier-inbox\n      ref={handleRef}\n      height={props.height}\n      light-theme={props.lightTheme ? JSON.stringify(props.lightTheme) : undefined}\n      dark-theme={props.darkTheme ? JSON.stringify(props.darkTheme) : undefined}\n      mode={props.mode}\n      feeds={feedsAttr as any}\n      {...({ preview: props.previewMessages ? \"true\" : undefined } as any)}\n    />\n  );\n\n  return (\n    <CourierClientComponent children={children} />\n  );\n});\n","import { useEffect, useMemo, useRef, forwardRef, ReactNode, useContext, useState } from 'react';\nimport {\n  CourierInboxHeaderFactoryProps,\n  CourierInboxListItemActionFactoryProps,\n  CourierInboxListItemFactoryProps,\n  CourierInboxMenuButtonFactoryProps,\n  CourierInboxPopupMenu as CourierInboxPopupMenuElement,\n  CourierInboxPaginationItemFactoryProps,\n  CourierInboxPopupAlignment,\n  CourierInboxStateEmptyFactoryProps,\n  CourierInboxStateErrorFactoryProps,\n  CourierInboxStateLoadingFactoryProps,\n  CourierInboxTheme,\n  CourierInboxFeed,\n} from '@trycourier/courier-ui-inbox';\nimport { CourierComponentThemeMode } from '@trycourier/courier-ui-core';\nimport { InboxMessage } from '@trycourier/courier-js';\nimport { CourierClientComponent } from './courier-client-component';\nimport { CourierRenderContext } from '../context/render-context';\n\nexport interface CourierInboxPopupMenuProps {\n  /** Alignment of the popup menu: 'top-right', 'top-left', 'top-center', 'bottom-right', 'bottom-left', 'bottom-center', 'center-right', 'center-left', 'center-center'. */\n  popupAlignment?: CourierInboxPopupAlignment;\n\n  /** Width of the popup menu container. */\n  popupWidth?: string;\n\n  /** Height of the popup menu container. */\n  popupHeight?: string;\n\n  /** CSS left position for the popup menu. */\n  left?: string;\n\n  /** CSS top position for the popup menu. */\n  top?: string;\n\n  /** CSS right position for the popup menu. */\n  right?: string;\n\n  /** CSS bottom position for the popup menu. */\n  bottom?: string;\n\n  /** Theme object for light mode. */\n  lightTheme?: CourierInboxTheme;\n\n  /** Theme object for dark mode. */\n  darkTheme?: CourierInboxTheme;\n\n  /** Theme mode: 'light', 'dark', or 'system'. */\n  mode?: CourierComponentThemeMode;\n\n  /** Array of feeds to display in the inbox. Each feed contains tabs with different filters. */\n  feeds?: CourierInboxFeed[];\n\n  /** Callback fired when a message is clicked. */\n  onMessageClick?: (props: CourierInboxListItemFactoryProps) => void;\n\n  /** Callback fired when a message action (e.g., button) is clicked. */\n  onMessageActionClick?: (props: CourierInboxListItemActionFactoryProps) => void;\n\n  /** Callback fired when a message is long-pressed (for mobile/gesture support). */\n  onMessageLongPress?: (props: CourierInboxListItemFactoryProps) => void;\n\n  /** Allows you to pass a custom component as the header. */\n  renderHeader?: (props: CourierInboxHeaderFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the list item. */\n  renderListItem?: (props: CourierInboxListItemFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the empty state. */\n  renderEmptyState?: (props: CourierInboxStateEmptyFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the loading state. */\n  renderLoadingState?: (props: CourierInboxStateLoadingFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the error state. */\n  renderErrorState?: (props: CourierInboxStateErrorFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the pagination list item. */\n  renderPaginationItem?: (props: CourierInboxPaginationItemFactoryProps | undefined | null) => ReactNode;\n\n  /** Allows you to pass a custom component as the menu button. */\n  renderMenuButton?: (props: CourierInboxMenuButtonFactoryProps | undefined | null) => ReactNode;\n\n  /**\n   * Render injected \"dummy\" inbox messages instead of fetching from the API.\n   * No sign-in / network is required, and the live (shared) inbox is unaffected.\n   */\n  previewMessages?: InboxMessage[];\n\n  /** Optional unread-count override for the preview (defaults to unread messages). */\n  previewUnreadCount?: number;\n}\n\nexport const CourierInboxPopupMenuComponent = forwardRef<CourierInboxPopupMenuElement, CourierInboxPopupMenuProps>(\n  (props, ref) => {\n    const render = useContext(CourierRenderContext);\n    if (!render) {\n      throw new Error(\"RenderContext not found. Ensure CourierInboxPopupMenu is wrapped in a CourierRenderContext.\");\n    }\n\n    // Element ref for use in effects, updated by handleRef.\n    const inboxRef = useRef<CourierInboxPopupMenuElement | null>(null);\n    const [elementReady, setElementReady] = useState(false);\n\n    // Callback ref passed to rendered component, used to propagate the DOM element's ref to the parent component.\n    // We use a callback ref (rather than a React.RefObject) since we want the parent ref to be up-to-date with\n    // rendered component. Updating the parent ref via useEffect does not work, since mutating a RefObject\n    // does not trigger useEffect (see https://stackoverflow.com/a/60476525).\n    function handleRef(el: CourierInboxPopupMenuElement | null) {\n      if (ref) {\n        if (typeof ref === 'function') {\n          ref(el);\n        } else {\n          // @ts-ignore - RefObject.current is readonly in React 17, however it's not frozen and is equivalent the widened type MutableRefObject\n          (ref as React.RefObject<CourierInboxPopupMenuElement | null>).current = el;\n        }\n      }\n\n      // Store the element for use in effects\n      inboxRef.current = el;\n\n      // Update element ready state\n      setElementReady(!!el);\n    }\n\n    // Helper to get the current element\n    function getEl(): CourierInboxPopupMenuElement | null {\n      return inboxRef.current;\n    }\n\n    // Handle message click\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu) return;\n      menu.onMessageClick(props.onMessageClick);\n    }, [props.onMessageClick, elementReady]);\n\n    // Handle message action click\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu) return;\n      menu.onMessageActionClick(props.onMessageActionClick);\n    }, [props.onMessageActionClick, elementReady]);\n\n    // Handle message long press\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu) return;\n      menu.onMessageLongPress(props.onMessageLongPress);\n    }, [props.onMessageLongPress, elementReady]);\n\n    // Inject preview/dummy data (skips fetch + the shared datastore)\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu) return;\n      menu.setPreviewData(props.previewMessages ?? null, {\n        unreadCount: props.previewUnreadCount,\n      });\n    }, [props.previewMessages, props.previewUnreadCount, elementReady]);\n\n    // Render header\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderHeader) return;\n      queueMicrotask(() => {\n        menu.setHeader((headerProps?: CourierInboxHeaderFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderHeader!(headerProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderHeader, elementReady]);\n\n    // Render list item\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderListItem) return;\n      queueMicrotask(() => {\n        menu.setListItem((itemProps?: CourierInboxListItemFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderListItem!(itemProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderListItem, elementReady]);\n\n    // Render empty state\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderEmptyState) return;\n      queueMicrotask(() => {\n        menu.setEmptyState((emptyStateProps?: CourierInboxStateEmptyFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderEmptyState!(emptyStateProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderEmptyState, elementReady]);\n\n    // Render loading state\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderLoadingState) return;\n      queueMicrotask(() => {\n        menu.setLoadingState((loadingStateProps?: CourierInboxStateLoadingFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderLoadingState!(loadingStateProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderLoadingState, elementReady]);\n\n    // Render error state\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderErrorState) return;\n      queueMicrotask(() => {\n        menu.setErrorState((errorStateProps?: CourierInboxStateErrorFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderErrorState!(errorStateProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderErrorState, elementReady]);\n\n    // Render pagination item\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderPaginationItem) return;\n      queueMicrotask(() => {\n        menu.setPaginationItem((paginationProps?: CourierInboxPaginationItemFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderPaginationItem!(paginationProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderPaginationItem, elementReady]);\n\n    // Render menu button\n    useEffect(() => {\n      const menu = getEl();\n      if (!menu || !props.renderMenuButton) return;\n      queueMicrotask(() => {\n        menu.setMenuButton((buttonProps?: CourierInboxMenuButtonFactoryProps | undefined | null): HTMLElement => {\n          const reactNode = props.renderMenuButton!(buttonProps);\n          return render(reactNode);\n        });\n      });\n    }, [props.renderMenuButton, elementReady]);\n\n    const feedsAttr = useMemo(\n      () => props.feeds ? JSON.stringify(props.feeds) : undefined,\n      [props.feeds]\n    );\n\n    const children = (\n      /* @ts-ignore */\n      <courier-inbox-popup-menu\n        ref={handleRef}\n        popup-alignment={props.popupAlignment}\n        popup-width={props.popupWidth}\n        popup-height={props.popupHeight}\n        left={props.left}\n        top={props.top}\n        right={props.right}\n        bottom={props.bottom}\n        light-theme={props.lightTheme ? JSON.stringify(props.lightTheme) : undefined}\n        dark-theme={props.darkTheme ? JSON.stringify(props.darkTheme) : undefined}\n        mode={props.mode}\n        feeds={feedsAttr as any}\n        {...({ preview: props.previewMessages ? \"true\" : undefined } as any)}\n      />\n    );\n\n    return (\n      <CourierClientComponent children={children} />\n    );\n  }\n);\n","import { useRef, useEffect, forwardRef, ReactNode, useContext, CSSProperties, useState, useCallback } from \"react\";\nimport { CourierToastTheme, CourierToast as CourierToastElement, CourierToastItemFactoryProps } from \"@trycourier/courier-ui-toast\";\nimport { CourierComponentThemeMode } from \"@trycourier/courier-ui-core\";\nimport { CourierClientComponent } from \"./courier-client-component\";\nimport { CourierRenderContext } from \"../context/render-context\";\nimport { CourierToastDismissButtonOption, CourierToastItemClickEvent, CourierToastItemActionClickEvent } from \"@trycourier/courier-ui-toast\";\n\n/** Props that may be passed to the CourierToast component. */\nexport interface CourierToastProps {\n  /**\n   * Styles applied to the CourierToast component.\n   *\n   * By default, the component has the following styles:\n   *\n   * ```css\n   * position: \"fixed\";\n   * width: \"380px\";\n   * top: \"30px\";\n   * right: \"30px\";\n   * z-index: 999;\n   * ```\n   *\n   * Setting styles directly on the component is useful to customize the component's\n   * position and layout. Setting `height` is effectively a no-op, as `height`\n   * will be dynamically set by the component as toast items are added and removed.\n   */\n  style?: CSSProperties;\n\n  /** Theme object used to render the component when light mode is used. */\n  lightTheme?: CourierToastTheme;\n\n  /** Theme object used to render the component when dark mode is used. */\n  darkTheme?: CourierToastTheme;\n\n  /** Manually set the theme mode to one of \"light\", \"dark\", or \"system\". Defaults to \"system\". */\n  mode?: CourierComponentThemeMode;\n\n  /** Enable toasts to auto-dismiss, including a timer bar at the top of the toast. Defaults to false. */\n  autoDismiss?: boolean;\n\n  /**\n   * The timeout before a toast auto-dismisses, if {@link CourierToastProps.autoDismiss} is enabled.\n   * Defaults to 5000ms.\n   */\n  autoDismissTimeoutMs?: number;\n\n  /**\n   * Set the dismiss button's visibility.\n   *\n   * Defaults to \"auto\", which makes the button always visible if `autoDismiss` is false\n   * and visible on hover if `autoDismiss` is true.\n   */\n  dismissButton?: CourierToastDismissButtonOption;\n\n  /** Callback function invoked when a toast item is clicked. */\n  onToastItemClick?: (props: CourierToastItemClickEvent) => void;\n\n  /** Callback function invoked when a toast item action button is clicked. */\n  onToastItemActionClick?: (props: CourierToastItemActionClickEvent) => void;\n\n  /**\n   * Callback function invoked when the component is ready to receive messages.\n   *\n   * Use onReady to ensure CourierToast has applied event listeners and\n   * render props passed to the component before toasts are presented.\n   *\n   * @example\n   * ```tsx\n   * const [toastReady, setToastReady] = useState(false);\n   * const courier = useCourier();\n   *\n   * useEffect(() => {\n   *   if (toastReady) {\n   *     courier.shared.signIn({ userId, jwt });\n   *   }\n   * }, [toastReady]);\n   *\n   * return <CourierToast onReady={setToastReady} renderToastItem={myCustomItem} />\n   * ```\n   */\n  onReady?: (ready: boolean) => void;\n\n  /** Render prop specifying how to render an entire toast item. */\n  renderToastItem?: (props: CourierToastItemFactoryProps) => ReactNode;\n\n  /**\n   * Render prop specifying how to render a toast item's content.\n   *\n   * The toast item's container, including the stack, auto-dismiss timer, and dismiss button\n   * are still present when this prop is set.\n   *\n   * This callback is stabilized internally, so wrapping it in `useCallback` is optional.\n   * Memoizing in parent components can still reduce parent re-renders.\n   *\n   * See {@link CourierToastProps.dismissButton} to customize the dismiss button's visibility and\n   * {@link CourierToastProps.renderToastItem} to customize the entire toast item, including\n   * its container.\n   */\n  renderToastItemContent?: (props: CourierToastItemFactoryProps) => ReactNode;\n}\n\ntype SetupSteps = {\n  elementMounted: boolean;\n  onItemClickSet: boolean;\n  onItemActionClickSet: boolean;\n  renderToastItemSet: boolean;\n  renderToastItemContentSet: boolean;\n};\n\nexport const CourierToastComponent = forwardRef<CourierToastElement, CourierToastProps>((props, ref) => {\n  const render = useContext(CourierRenderContext);\n  if (!render) {\n    throw new Error(\"RenderContext not found. Ensure CourierToast is wrapped in a CourierRenderContext.\");\n  }\n\n  // Track ready state for each of the useEffects that is called for a prop set on CourierToastComponent\n  // which must be translated into an imperative call on <courier-toast>.\n  // When all the steps are complete, props.onReady is called to indicate the component is ready to receive toasts.\n  const [setupSteps, setSetupSteps] = useState<SetupSteps>({\n    elementMounted: false,\n    onItemClickSet: false,\n    onItemActionClickSet: false,\n    renderToastItemSet: false,\n    renderToastItemContentSet: false\n  });\n  const [elementReady, setElementReady] = useState(false);\n\n  // Element ref for use in effects, updated by handleRef.\n  const toastRef = useRef<CourierToastElement | null>(null);\n  const isMountedRef = useRef(false);\n  const onReadyCalledRef = useRef(false);\n  const renderToastItemRef = useRef<CourierToastProps[\"renderToastItem\"]>(props.renderToastItem);\n  const renderToastItemContentRef = useRef<CourierToastProps[\"renderToastItemContent\"]>(props.renderToastItemContent);\n\n  if (props.renderToastItem) {\n    renderToastItemRef.current = props.renderToastItem;\n  }\n\n  if (props.renderToastItemContent) {\n    renderToastItemContentRef.current = props.renderToastItemContent;\n  }\n\n  const hasRenderToastItem = !!props.renderToastItem;\n  const hasRenderToastItemContent = !!props.renderToastItemContent;\n\n  const markSetupStepComplete = useCallback((step: keyof SetupSteps) => {\n    setSetupSteps(prev => {\n      if (prev[step]) {\n        return prev;\n      }\n\n      return {\n        ...prev,\n        [step]: true,\n      } as SetupSteps;\n    });\n  }, []);\n\n  useEffect(() => {\n    isMountedRef.current = true;\n\n    return () => {\n      isMountedRef.current = false;\n    };\n  }, []);\n\n  // Callback ref passed to rendered component, used to propagate the DOM element's ref to the parent component.\n  // We use a callback ref (rather than a React.RefObject) since we want the parent ref to be up-to-date with\n  // rendered component. Updating the parent ref via useEffect does not work, since mutating a RefObject\n  // does not trigger useEffect (see https://stackoverflow.com/a/60476525).\n  function handleRef(el: CourierToastElement | null) {\n    if (ref) {\n\n      // Propagate ref to ref callback functions\n      if (typeof ref === 'function') {\n        ref(el);\n      } else {\n        // Propagate ref to ref objects\n        // @ts-ignore - RefObject.current is readonly in React 17, however it's not frozen and is equivalent the widened type MutableRefObject\n        (ref as React.RefObject<CourierToastElement | null>).current = el;\n      }\n    }\n\n    // Store the element for use in effects\n    toastRef.current = el;\n\n    // Update element ready state\n    setElementReady(!!el);\n  }\n\n  // Helper to get the current element\n  function getEl(): CourierToastElement | null {\n    return toastRef.current;\n  }\n\n  // Check if all setup steps are complete and fire onReady\n  useEffect(() => {\n    const allStepsComplete = Object.values(setupSteps).every(step => step);\n    if (allStepsComplete && props.onReady && !onReadyCalledRef.current) {\n      onReadyCalledRef.current = true;\n      props.onReady(true);\n    }\n  }, [setupSteps, props.onReady]);\n\n  // Track when element is mounted\n  useEffect(() => {\n    if (elementReady) {\n      markSetupStepComplete(\"elementMounted\");\n    }\n  }, [elementReady, markSetupStepComplete]);\n\n  // Handle toast item click\n  useEffect(() => {\n    if (!elementReady) return;\n    const toast = getEl();\n    if (!toast) return;\n    toast.onToastItemClick(props.onToastItemClick);\n    markSetupStepComplete(\"onItemClickSet\");\n  }, [props.onToastItemClick, elementReady, markSetupStepComplete]);\n\n  // Handle toast item action click\n  useEffect(() => {\n    if (!elementReady) return;\n    const toast = getEl();\n    if (!toast) return;\n    toast.onToastItemActionClick(props.onToastItemActionClick);\n    markSetupStepComplete(\"onItemActionClickSet\");\n  }, [props.onToastItemActionClick, elementReady, markSetupStepComplete]);\n\n  // Render toast item\n  useEffect(() => {\n    if (!elementReady) return;\n    const toast = getEl();\n    if (!toast) return;\n\n    if (!hasRenderToastItem) {\n      toast.setToastItem();\n      markSetupStepComplete(\"renderToastItemSet\");\n      return;\n    }\n\n    let cancelled = false;\n    queueMicrotask(() => {\n      if (cancelled || !isMountedRef.current) {\n        return;\n      }\n\n      const currentToast = getEl();\n      if (!currentToast || !currentToast.isConnected) {\n        return;\n      }\n\n      currentToast.setToastItem((itemProps: CourierToastItemFactoryProps): HTMLElement => {\n        const renderToastItem = renderToastItemRef.current;\n        if (!renderToastItem) {\n          return document.createElement(\"div\");\n        }\n\n        const reactNode = renderToastItem(itemProps);\n        return render(reactNode);\n      });\n      markSetupStepComplete(\"renderToastItemSet\");\n    });\n\n    return () => {\n      cancelled = true;\n    };\n  }, [elementReady, hasRenderToastItem, markSetupStepComplete, render]);\n\n  // Render toast item content\n  useEffect(() => {\n    if (!elementReady) return;\n    const toast = getEl();\n    if (!toast) return;\n\n    if (!hasRenderToastItemContent) {\n      toast.setToastItemContent();\n      markSetupStepComplete(\"renderToastItemContentSet\");\n      return;\n    }\n\n    let cancelled = false;\n    queueMicrotask(() => {\n      if (cancelled || !isMountedRef.current) {\n        return;\n      }\n\n      const currentToast = getEl();\n      if (!currentToast || !currentToast.isConnected) {\n        return;\n      }\n\n      currentToast.setToastItemContent((itemProps: CourierToastItemFactoryProps): HTMLElement => {\n        const renderToastItemContent = renderToastItemContentRef.current;\n        if (!renderToastItemContent) {\n          return document.createElement(\"div\");\n        }\n\n        const reactNode = renderToastItemContent(itemProps);\n        return render(reactNode);\n      });\n      markSetupStepComplete(\"renderToastItemContentSet\");\n    });\n\n    return () => {\n      cancelled = true;\n    };\n  }, [elementReady, hasRenderToastItemContent, markSetupStepComplete, render]);\n\n  const children = (\n    /* @ts-ignore */\n    <courier-toast\n      ref={handleRef}\n      style={props.style}\n      light-theme={props.lightTheme ? JSON.stringify(props.lightTheme) : undefined}\n      dark-theme={props.darkTheme ? JSON.stringify(props.darkTheme) : undefined}\n      mode={props.mode}\n      auto-dismiss={props.autoDismiss}\n      auto-dismiss-timeout-ms={props.autoDismissTimeoutMs}\n      dismiss-button={props.dismissButton}\n    />\n  );\n\n  return (\n    <CourierClientComponent children={children} />\n  );\n});\n","import { useRef, useEffect, useState, forwardRef, CSSProperties } from \"react\";\nimport {\n  CourierPreferencesTheme,\n  CourierPreferences as CourierPreferencesElement,\n} from \"@trycourier/courier-ui-preferences\";\nimport { CourierComponentThemeMode } from \"@trycourier/courier-ui-core\";\nimport { CourierPreferencePage } from \"@trycourier/courier-js\";\nimport { CourierClientComponent } from \"./courier-client-component\";\n\n/** Props for the CourierPreferences React component. */\nexport interface CourierPreferencesProps {\n  style?: CSSProperties;\n  lightTheme?: CourierPreferencesTheme;\n  darkTheme?: CourierPreferencesTheme;\n  mode?: CourierComponentThemeMode;\n  title?: string;\n  subtitle?: string;\n  brandId?: string;\n  channelLabels?: Record<string, string>;\n  /**\n   * Render injected \"dummy\" preference data instead of fetching from the API.\n   * Pass a full `CourierPreferencePage`; no sign-in / network is required.\n   */\n  previewData?: CourierPreferencePage;\n  /**\n   * Force the component's loading skeleton on/off. Useful while the host fetches\n   * data it will inject via `previewData` (e.g. a brand) and wants the\n   * component's own loading state shown in the meantime.\n   */\n  isLoading?: boolean;\n  /**\n   * Render the unpublished working draft instead of the published page (fetches\n   * `draftPreferencePage`). Used by the hosted draft preview.\n   */\n  draft?: boolean;\n  onError?: (error: Error) => void;\n}\n\nexport const CourierPreferencesComponent = forwardRef<CourierPreferencesElement, CourierPreferencesProps>((props, ref) => {\n  const elRef = useRef<CourierPreferencesElement | null>(null);\n  // The element renders behind CourierClientComponent (client-only), so it can\n  // mount AFTER these effects first run. Track readiness and include it in the\n  // deps so imperative setters fire once the element exists.\n  const [elementReady, setElementReady] = useState(false);\n\n  function handleRef(el: CourierPreferencesElement | null) {\n    if (ref) {\n      if (typeof ref === 'function') {\n        ref(el);\n      } else {\n        // @ts-ignore\n        (ref as React.RefObject<CourierPreferencesElement | null>).current = el;\n      }\n    }\n    elRef.current = el;\n    setElementReady(!!el);\n  }\n\n  useEffect(() => {\n    const el = elRef.current;\n    if (!el) return;\n    if (props.channelLabels) {\n      el.setChannelLabels(props.channelLabels);\n    }\n  }, [props.channelLabels, elementReady]);\n\n  useEffect(() => {\n    const el = elRef.current;\n    if (!el) return;\n    el.setPreviewData(props.previewData ?? null);\n  }, [props.previewData, elementReady]);\n\n  useEffect(() => {\n    const el = elRef.current;\n    if (!el) return;\n    el.setLoading(Boolean(props.isLoading));\n  }, [props.isLoading, elementReady]);\n\n  // When themes change, the web component's setDarkTheme/setLightTheme only calls\n  // updateTheme() when _systemMode matches — it ignores an explicit _userMode override.\n  // Re-calling setMode() always triggers updateTheme(), picking up the new theme values.\n  useEffect(() => {\n    const el = elRef.current;\n    if (!el || !props.mode) return;\n    el.setMode(props.mode);\n  }, [props.lightTheme, props.darkTheme, props.mode, elementReady]);\n\n  const children = (\n    /* @ts-ignore */\n    <courier-preferences\n      ref={handleRef}\n      style={props.style}\n      light-theme={props.lightTheme ? JSON.stringify(props.lightTheme) : undefined}\n      dark-theme={props.darkTheme ? JSON.stringify(props.darkTheme) : undefined}\n      mode={props.mode}\n      title={props.title}\n      subtitle={props.subtitle}\n      brand-id={props.brandId}\n      preview={props.previewData ? \"true\" : undefined}\n      draft={props.draft ? \"true\" : undefined}\n    />\n  );\n\n  return (\n    <CourierClientComponent children={children} />\n  );\n});\n\nCourierPreferencesComponent.displayName = 'CourierPreferencesComponent';\n"],"names":[],"mappings":";;;;;;AAoDO,MAAM,aAAa,MAAM;AAG9B,QAAM,SAAS,CAAC,UAAwB,QAAQ,OAAO,OAAO,KAAK;AACnE,QAAM,UAAU,MAAM,QAAQ,OAAO,QAAA;AAGrC,QAAM,YAAY,CAAC,UAAqC,sBAAsB,OAAO,KAAK,KAAK;AAC/F,QAAM,0BAA0B,CAAC,UAAiC,sBAAsB,OAAO,wBAAwB,KAAK;AAC5H,QAAM,qBAAqB,CAAC,UAAkB,QAAQ,OAAO,kBAAkB;AAC/E,QAAM,cAAc,CAAC,YAA0B,sBAAsB,OAAO,YAAY,EAAE,SAAS;AACnG,QAAM,gBAAgB,CAAC,YAA0B,sBAAsB,OAAO,cAAc,EAAE,SAAS;AACvG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