Provides a React context for sharing API endpoint URL literals across OSS-lib components, enabling host applications to override paths (e.g., when running behind a reverse proxy). ## Key Components ### `EndpointsRuntime` Interface Defines the shape of the endpoint configuration: | Field | Type | Description | |---|---|---| | `announcementsUrl` | `string` | GET active announcement (used by ``) | | `accessCode.validateUrl` | `string` | POST validate access code | | `accessCode.consumeUrl` | `string` | POST redeem access code after registration | | `contactUrl` | `string` | POST contact-form submission | ### `EndpointsRuntimeContext` A React context initialized to `null`. Mount `` at your application root with the appropriate endpoint paths. ### `useEndpointsRuntime()` Optional hook — returns `null` when no provider is mounted. Use for components that should silently no-op when outside the provider tree (e.g., announcement polling). ### `useRequiredEndpointsRuntime()` Strict hook — throws a descriptive error when no provider is mounted. Use for components that cannot function without endpoints (form submission, code validation). ## Usage Example ```typescript // Mounting the provider (e.g., in your root layout) const endpoints: EndpointsRuntime = React.useMemo(() => ({ announcementsUrl: '/api/announcements/active', accessCode: { validateUrl: '/api/access-codes/validate', consumeUrl: '/api/access-codes/consume', }, contactUrl: '/api/contact', }), []) // Optional consumer const endpoints = useEndpointsRuntime() // null if no provider if (endpoints) fetchAnnouncement(endpoints.announcementsUrl) // Strict consumer const { contactUrl } = useRequiredEndpointsRuntime() // throws if no provider ``` > **Embedders:** Always memoize the value passed to the provider. Reference changes invalidate downstream effect dependencies and cause unnecessary re-fetches. ## Source [`endpoints-runtime-context.tsx`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/endpoints-runtime-context.tsx)