{"version":3,"file":"index.mjs","sources":["../src/utils/render.tsx","../src/components/courier-inbox.tsx","../src/components/courier-inbox-popup-menu.tsx","../src/components/courier-toast.tsx","../src/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport { createRoot } from \"react-dom/client\";\n\nexport function reactNodeToHTMLElement(node: ReactNode): HTMLElement {\n  const container = document.createElement('div');\n\n  // Use React 18 root\n  const root = createRoot(container);\n  flushSync(() => {\n    root.render(node);\n  });\n\n  /**\n   * Always return the container to preserve React's event delegation system.\n   * React uses event delegation at the root level, so the React root container\n   * must stay in the DOM for event handlers to work.\n   * \n   * We use `display: contents` to make the container transparent to CSS layout,\n   * so it doesn't introduce a visual wrapper while still preserving React's\n   * event system.\n   */\n  container.style.display = 'contents';\n  container.setAttribute('data-react-root', 'true');\n  return container;\n}\n","import { forwardRef } from \"react\";\nimport { CourierInbox as CourierInboxElement } from \"@trycourier/courier-ui-inbox\";\nimport { CourierInboxComponent, CourierInboxProps, CourierRenderContext } from \"@trycourier/courier-react-components\";\nimport { reactNodeToHTMLElement } from \"../utils/render\";\n\n/**\n * CourierInbox React component.\n *\n * @example\n * ```tsx\n * const courier = useCourier();\n *\n * useEffect(() => {\n *   // Generate a JWT for your user (do this on your backend server)\n *   const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT\n *\n *   // Authenticate the user with the inbox\n *   courier.shared.signIn({\n *     userId: $YOUR_USER_ID,\n *     jwt: jwt,\n *   });\n * }, []);\n *\n * return <CourierInbox />;\n * ```\n */\nexport const CourierInbox = forwardRef<CourierInboxElement, CourierInboxProps>((props, ref) => {\n  return (\n    <CourierRenderContext.Provider value={reactNodeToHTMLElement}>\n      <CourierInboxComponent {...props} ref={ref} />\n    </CourierRenderContext.Provider>\n  );\n});\n\nCourierInbox.displayName = 'CourierInbox';\n","import { forwardRef } from \"react\";\nimport { CourierInboxPopupMenu as CourierInboxPopupMenuElement } from \"@trycourier/courier-ui-inbox\";\nimport { CourierInboxPopupMenuComponent, CourierInboxPopupMenuProps, CourierRenderContext } from \"@trycourier/courier-react-components\";\nimport { reactNodeToHTMLElement } from \"../utils/render\";\n\n/**\n * CourierInboxPopupMenu React component.\n *\n * This component is used to display a popup menu for a message in the inbox.\n *\n * @example\n * ```tsx\n * const courier = useCourier();\n *\n * useEffect(() => {\n *   // Generate a JWT for your user (do this on your backend server)\n *   const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT\n *\n *   // Authenticate the user with the inbox\n *   courier.shared.signIn({\n *     userId: $YOUR_USER_ID,\n *     jwt: jwt,\n *   });\n * }, []);\n *\n * return <CourierInboxPopupMenu />;\n * ```\n */\nexport const CourierInboxPopupMenu = forwardRef<CourierInboxPopupMenuElement, CourierInboxPopupMenuProps>((props, ref) => {\n  return (\n    <CourierRenderContext.Provider value={reactNodeToHTMLElement}>\n      <CourierInboxPopupMenuComponent {...props} ref={ref} />\n    </CourierRenderContext.Provider>\n  );\n});\n\nCourierInboxPopupMenu.displayName = 'CourierInboxPopupMenu';\n","import { forwardRef } from \"react\";\nimport { CourierToast as CourierToastElement } from \"@trycourier/courier-ui-toast\";\nimport { CourierToastComponent, CourierToastProps, CourierRenderContext } from \"@trycourier/courier-react-components\";\nimport { reactNodeToHTMLElement } from \"../utils/render\";\n\n/**\n * CourierToast React component.\n *\n * @example\n * ```tsx\n * const courier = useCourier();\n *\n * useEffect(() => {\n *   // Generate a JWT for your user (do this on your backend server)\n *   const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT\n *\n *   // Authenticate the user with the inbox\n *   courier.shared.signIn({\n *     userId: $YOUR_USER_ID,\n *     jwt: jwt,\n *   });\n * }, []);\n *\n * return <CourierToast />;\n * ```\n */\nexport const CourierToast = forwardRef<CourierToastElement, CourierToastProps>((props, ref) => {\n  return (\n    <CourierRenderContext.Provider value={reactNodeToHTMLElement}>\n      <CourierToastComponent {...props} ref={ref} />\n    </CourierRenderContext.Provider>\n  );\n});\n\nCourierToast.displayName = 'CourierToast';\n","import { Courier } from '@trycourier/courier-js';\n\nCourier.shared.courierUserAgentName = \"courier-react\";\nCourier.shared.courierUserAgentVersion = __PACKAGE_VERSION__;\n\nexport { CourierInbox } from './components/courier-inbox';\nexport { CourierInboxPopupMenu } from './components/courier-inbox-popup-menu';\nexport { CourierToast } from './components/courier-toast';\n\nexport { useCourier } from '@trycourier/courier-react-components';\n\nexport type {\n  CourierInboxProps,\n  CourierInboxPopupMenuProps,\n  CourierToastProps,\n} from '@trycourier/courier-react-components';\n\n// Re-export types from courier-js\nexport type {\n  CourierProps,\n  CourierClientOptions,\n  CourierBrand,\n  CourierApiRegion,\n  CourierApiUrls,\n  CourierUserPreferences,\n  CourierUserPreferencesStatus,\n  CourierUserPreferencesChannel,\n  CourierUserPreferencesPaging,\n  CourierUserPreferencesTopic,\n  CourierUserPreferencesTopicResponse,\n  CourierDigestScheduleOption,\n  CourierDevice,\n  CourierToken,\n  CourierGetInboxMessageResponse,\n  CourierGetInboxMessagesResponse,\n  InboxMessage,\n  InboxAction,\n  InboxMessageEventEnvelope,\n} from '@trycourier/courier-js';\n\nexport {\n  DEFAULT_COURIER_API_URLS,\n  EU_COURIER_API_URLS,\n  getCourierApiUrls,\n  getCourierApiUrlsForRegion\n} from '@trycourier/courier-js';\n\n// Re-export utility functions from courier-ui-inbox\nexport {\n  markAsRead,\n  markAsUnread,\n  clickMessage,\n  archiveMessage,\n  openMessage\n} from '@trycourier/courier-ui-inbox';\n\n// Re-export default configuration functions from courier-ui-inbox\nexport {\n  defaultFeeds,\n  defaultActions,\n  defaultListItemActions\n} from '@trycourier/courier-ui-inbox';\n\n// Re-export factory prop types from courier-ui-inbox\nexport type {\n  CourierInboxHeaderFactoryProps,\n  CourierInboxStateLoadingFactoryProps,\n  CourierInboxStateEmptyFactoryProps,\n  CourierInboxStateErrorFactoryProps,\n  CourierInboxListItemFactoryProps,\n  CourierInboxListItemActionFactoryProps,\n  CourierInboxPaginationItemFactoryProps,\n  CourierInboxMenuButtonFactoryProps,\n  CourierInboxFeed,\n  CourierInboxTab,\n  CourierInboxDatasetFilter\n} from '@trycourier/courier-ui-inbox';\n\n// Re-export theme types from courier-ui-inbox\nexport type {\n  CourierInboxTheme,\n  CourierInboxFontTheme,\n  CourierInboxIconTheme,\n  CourierInboxUnreadCountIndicatorTheme,\n  CourierInboxUnreadDotIndicatorTheme,\n  CourierInboxIconButtonTheme,\n  CourierInboxButtonTheme,\n  CourierInboxMenuButtonTheme,\n  CourierInboxPopupTheme,\n  CourierInboxListItemTheme,\n  CourierInboxSkeletonLoadingStateTheme,\n  CourierInboxInfoStateTheme,\n  CourierMenuItemTheme,\n  CourierActionMenuTheme\n} from '@trycourier/courier-ui-inbox';\n\n// Re-export theme utilities from courier-ui-inbox\nexport {\n  defaultLightTheme,\n  defaultDarkTheme,\n  mergeTheme\n} from '@trycourier/courier-ui-inbox';\n\n// Re-export element types from courier-ui-inbox\nexport type { CourierInbox as CourierInboxElement } from '@trycourier/courier-ui-inbox';\nexport type { CourierInboxPopupMenu as CourierInboxPopupMenuElement } from '@trycourier/courier-ui-inbox';\n\n// Re-export element types from courier-ui-toast\nexport type { CourierToast as CourierToastElement } from '@trycourier/courier-ui-toast';\n\n// Re-export toast types from courier-ui-toast\nexport type {\n  CourierToastTheme,\n  CourierToastFontTheme,\n  CourierToastIconTheme,\n  CourierToastItemTheme,\n  CourierToastItemFactoryProps,\n  CourierToastItemClickEvent,\n  CourierToastDismissButtonOption\n} from '@trycourier/courier-ui-toast';\n\n// Re-export toast theme utilities from courier-ui-toast\nexport {\n  defaultLightTheme as defaultToastLightTheme,\n  defaultDarkTheme as defaultToastDarkTheme,\n  mergeTheme as mergeToastTheme\n} from '@trycourier/courier-ui-toast';\n\n// Re-export types from courier-ui-core\nexport type {\n  CourierComponentThemeMode\n} from '@trycourier/courier-ui-core'\n"],"names":[],"mappings":";;;;;;;;;;AAIO,SAAS,uBAAuB,MAA8B;AACnE,QAAM,YAAY,SAAS,cAAc,KAAK;AAG9C,QAAM,OAAO,WAAW,SAAS;AACjC,YAAU,MAAM;AACd,SAAK,OAAO,IAAI;AAAA,EAClB,CAAC;AAWD,YAAU,MAAM,UAAU;AAC1B,YAAU,aAAa,mBAAmB,MAAM;AAChD,SAAO;AACT;ACCO,MAAM,eAAe,WAAmD,CAAC,OAAO,QAAQ;AAC7F,SACE,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,wBACpC,UAAA,oBAAC,uBAAA,EAAuB,GAAG,OAAO,IAAA,CAAU,EAAA,CAC9C;AAEJ,CAAC;AAED,aAAa,cAAc;ACNpB,MAAM,wBAAwB,WAAqE,CAAC,OAAO,QAAQ;AACxH,SACE,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,wBACpC,UAAA,oBAAC,gCAAA,EAAgC,GAAG,OAAO,IAAA,CAAU,EAAA,CACvD;AAEJ,CAAC;AAED,sBAAsB,cAAc;ACV7B,MAAM,eAAe,WAAmD,CAAC,OAAO,QAAQ;AAC7F,SACE,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,wBACpC,UAAA,oBAAC,uBAAA,EAAuB,GAAG,OAAO,IAAA,CAAU,EAAA,CAC9C;AAEJ,CAAC;AAED,aAAa,cAAc;AChC3B,QAAQ,OAAO,uBAAuB;AACtC,QAAQ,OAAO,0BAA0B;"}