import type { Theme } from "vitepress"; import type { ConsentConfig, GA4RouteEvent } from "../core/types"; import { createConsentPlugin, ConsentBanner } from "../vue/index"; /** * VitePress frontmatter fields for GA4 tracking. * Add these to your markdown files' frontmatter. * * @example * ```md * --- * ga4Title: Custom Page Title * ga4Event: * name: sign_up * params: * method: docs * --- * ``` */ export interface VitePressGA4Frontmatter { /** Custom page title for GA4 page_view event */ ga4Title?: string; /** GA4 event to fire when page is viewed */ ga4Event?: GA4RouteEvent; } /** * VitePress theme enhancement for cookie consent with SPA page tracking * * Automatically: * - Disables automatic page_view (SPA mode) * - Tracks initial page view after mount * - Watches Vue Router for SPA navigation and sends page_view events * * @example * ```ts * // docs/.vitepress/theme/index.ts * import DefaultTheme from 'vitepress/theme'; * import { enhanceWithConsent } from '@structured-world/vue-privacy/vitepress'; * * export default enhanceWithConsent(DefaultTheme, { * gaId: 'G-XXXXXXXXXX', * }); * ``` */ export declare function enhanceWithConsent(theme: Theme, config: ConsentConfig): Theme; /** * VitePress composable for adding consent banner to layout * * @example * ```ts * // docs/.vitepress/theme/index.ts * import DefaultTheme from 'vitepress/theme'; * import { createConsentPlugin, ConsentBanner } from '@structured-world/vue-privacy/vitepress'; * import { h } from 'vue'; * * export default { * extends: DefaultTheme, * enhanceApp({ app }) { * app.use(createConsentPlugin({ gaId: 'G-XXX', sendPageView: false })); * }, * Layout() { * return h(DefaultTheme.Layout, null, { * 'layout-bottom': () => h(ConsentBanner), * }); * }, * }; * ``` */ export { createConsentPlugin, ConsentBanner }; export { useConsent } from "../vue/index"; export type { ConsentConfig, GA4RouteEvent } from "../core/types";