import type { Plugin } from "vue"; import type { Router } from "vue-router"; import type { ConsentConfig } from "../core/types"; import { ConsentManager } from "../core/consent-manager"; import ConsentBanner from "./ConsentBanner.vue"; import ConsentPreferenceModal from "./ConsentPreferenceModal.vue"; import { type RouterMiddlewareOptions } from "./router-middleware"; /** * Vue plugin options */ export interface ConsentPluginOptions extends ConsentConfig { /** Auto-initialize on plugin install */ autoInit?: boolean; /** Vue Router instance for automatic SPA tracking */ router?: Router; /** Router middleware options (beforeTrack, afterTrack) */ routerMiddleware?: RouterMiddlewareOptions; } /** * Symbol for injection */ export declare const CONSENT_MANAGER_KEY: unique symbol; /** * Create Vue plugin for cookie consent * * @example * ```ts * // Basic usage * import { createApp } from 'vue'; * import { createConsentPlugin } from '@structured-world/vue-privacy/vue'; * * const app = createApp(App); * app.use(createConsentPlugin({ * gaId: 'G-XXXXXXXXXX', * })); * ``` * * @example * ```ts * // With automatic router tracking * import { createApp } from 'vue'; * import { createConsentPlugin } from '@structured-world/vue-privacy/vue'; * import router from './router'; * * const app = createApp(App); * app.use(router); * app.use(createConsentPlugin({ * gaId: 'G-XXXXXXXXXX', * router: router, // Enables automatic page_view tracking * routerMiddleware: { * beforeTrack: (to) => !to.path.startsWith('/admin'), * }, * })); * ``` */ export declare function createConsentPlugin(options?: ConsentPluginOptions): Plugin; /** * Composable to access consent manager * * @example * ```vue * * ``` */ export declare function useConsent(): { /** Accept all cookies */ acceptAll: () => Promise; /** Reject all non-essential cookies */ rejectAll: () => Promise; /** Save custom preferences */ savePreferences: (categories: Parameters<(categories: Partial>) => Promise>[0]) => Promise; /** Get current consent state */ getConsent: () => import("..").StoredConsent | null; /** Check if user has made a consent choice */ hasConsent: () => boolean; /** Reset consent and show banner again */ resetConsent: () => void; /** Track a page view manually (for SPA navigation) */ trackPageView: (path: string, title?: string) => void; /** Track a custom event (GA4 recommended events, ecommerce, or custom) */ trackEvent: (eventName: string, params?: Record) => void; /** Track purchase event */ trackPurchase: (params: Parameters<(params: import("..").GA4PurchaseParams) => void>[0]) => void; /** Track add_to_cart event */ trackAddToCart: (params: Parameters<(params: import("..").GA4EcommerceParams) => void>[0]) => void; /** Track begin_checkout event */ trackBeginCheckout: (params: Parameters<(params: import("..").GA4EcommerceParams) => void>[0]) => void; /** Track view_item event */ trackViewItem: (params: Parameters<(params: import("..").GA4EcommerceParams) => void>[0]) => void; /** Track view_item_list event */ trackViewItemList: (params: Parameters<(params: Omit & { item_list_id?: string; item_list_name?: string; }) => void>[0]) => void; /** Track select_item event */ trackSelectItem: (params: Parameters<(params: Omit & { item_list_id?: string; item_list_name?: string; }) => void>[0]) => void; /** Track add_shipping_info event */ trackAddShippingInfo: (params: Parameters<(params: import("..").GA4EcommerceParams & { shipping_tier?: string; }) => void>[0]) => void; /** Track add_payment_info event */ trackAddPaymentInfo: (params: Parameters<(params: import("..").GA4EcommerceParams & { payment_type?: string; }) => void>[0]) => void; /** Track sign_up event */ trackSignUp: (method?: string) => void; /** Track login event */ trackLogin: (method?: string) => void; /** Track generate_lead event */ trackGenerateLead: (params?: Parameters<(params?: import("..").GA4GenerateLeadParams) => void>[0]) => void; /** Check if user is detected as EU */ isEUUser: () => boolean | null; /** Check if user is in a CCPA-covered US state (California, Virginia, etc.) */ isCCPAUser: () => boolean; /** Get the region/state detected for the user */ getRegion: () => string | undefined; /** Get geo-detection result (country, method, isEU, region) */ getGeoResult: () => import("..").GeoDetectionResult | null; /** Programmatically show the preference center modal */ showPreferenceCenter: () => void; /** Get the underlying manager instance */ manager: ConsentManager; }; export { ConsentBanner, ConsentPreferenceModal }; export { consentBannerCSS } from "./banner-styles"; export { consentModalCSS } from "./modal-styles"; export { setupRouterTracking } from "./router-middleware"; export type { RouterMiddlewareOptions } from "./router-middleware"; export type { ConsentConfig, ConsentManager }; export type { GA4Item, GA4EcommerceParams, GA4PurchaseParams, GA4GenerateLeadParams, GA4RouteEvent, GA4RouteMeta, } from "../core/types";