/**
 * useObjectClickedBuffer — accessor for the Object Clicked buffer.
 *
 * Phase 2b V4 pivot (SCRUM-259). Cards on EITHER a search-attributed
 * surface OR a non-search surface push clicks through this single hook;
 * the surface discriminator drives whether the flushed event lands as
 * `Object Clicked` (with search_id) or `Object Clicked Outside Search`.
 *
 * Flush triggers:
 *   - 1000 ms of inactivity (idle timeout)
 *   - `beforeunload` / `pagehide` from the provider's window listener
 *   - explicit `buffer.flush()` (e.g. paired with a Segment SDK flush)
 *
 * If no `<BufferProvider>` is above, returns a no-op buffer so consumer
 * components don't crash; per-click side effects (navigation, etc.)
 * still happen because they live in the consumer's onClick handler, not
 * in this buffer.
 */
import { useMemo } from "react";
import { useBufferTrio, } from "../components/buffers/BufferProvider";
const NOOP = {
    record: () => undefined,
    recordOutsideSearch: () => undefined,
    flush: () => undefined,
};
export function useObjectClickedBuffer() {
    const trio = useBufferTrio();
    return useMemo(() => trio?.click ?? NOOP, [trio]);
}
