/* Same contract as @posthog/react's PostHogProvider.
   These pages use the global React build, so the provider lives here
   and receives the client that posthog.js already initialized. */

const PostHogContext = React.createContext(undefined);

function PostHogProvider({ client, children }) {
  return <PostHogContext.Provider value={client}>{children}</PostHogContext.Provider>;
}

function usePostHog() {
  return React.useContext(PostHogContext);
}
