// Generated by scripts/generate-manifest.mjs. Do not edit by hand. import type { AddOnCompiled } from '../../../../../types.js' type TemplateRecord = Record type TemplateAddOn = TemplateRecord & { integrations?: Array routes?: Array } type TemplateRenderContext = { [key: string]: any packageManager: any projectName: any typescript: any tailwind: any blank: any js: any jsx: any fileRouter: any codeRouter: any routerOnly: any includeExamples: any addOnEnabled: Record addOnOption: Record addOns: Array integrations: Array routes: Array getPackageManagerAddScript: (...args: Array) => string getPackageManagerRunScript: (...args: Array) => string getPackageManagerExecuteScript: (...args: Array) => string relativePath: (...args: Array) => string integrationImportContent: (...args: Array) => string integrationImportCode: (...args: Array) => string | undefined renderTemplate: (content: string) => string ignoreFile: () => never } type TemplateRenderer = (context: TemplateRenderContext) => string | undefined function __escapeXML(value: unknown) { if (value === undefined || value === null) { return '' } return String(value).replace(/[&<>'"]/g, (character) => { switch (character) { case '&': return '&' case '<': return '<' case '>': return '>' case '"': return '"' case "'": return ''' default: return character } }) } export function getManifestTemplateKey(template: string) { let hash = 0x811c9dc5 for (let i = 0; i < template.length; i++) { hash ^= template.charCodeAt(i) hash = Math.imul(hash, 0x01000193) >>> 0 } return `${hash.toString(16).padStart(8, '0')}:${template.length}` } const templateRenderers: Record = { } export function hasManifestTemplate(template: string) { return getManifestTemplateKey(template) in templateRenderers } export function renderManifestTemplate( template: string, context: TemplateRenderContext, ) { const key = getManifestTemplateKey(template) const renderer = templateRenderers[key] if (!renderer) { throw new Error(`Template ${key} was not precompiled into the manifest`) } return renderer(context) ?? '' } export const addOn = { "name": "PostHog", "description": "Product analytics, session replay, and feature flags", "phase": "add-on", "modes": [ "file-router" ], "type": "add-on", "category": "analytics", "color": "#1D4AFF", "priority": 20, "link": "https://posthog.com", "routes": [ { "icon": "BarChart", "url": "/demo/posthog", "name": "PostHog", "path": "src/routes/demo/posthog.tsx", "jsName": "PostHogDemo" } ], "integrations": [ { "type": "provider", "jsName": "PostHogProvider", "path": "src/integrations/posthog/provider.tsx" } ], "id": "posthog", "version": "0.0.0", "packageAdditions": { "dependencies": { "@posthog/react": "^1.7.0", "posthog-js": "^1.358.1" } }, "readme": "## Setting up PostHog\n\n1. Create a PostHog account at [posthog.com](https://posthog.com)\n2. Get your Project API Key from [Project Settings](https://app.posthog.com/project/settings)\n3. Set `VITE_POSTHOG_KEY` in your `.env.local`\n\n### Optional Configuration\n\n- `VITE_POSTHOG_HOST` - Set this if you're using PostHog Cloud EU (`https://eu.i.posthog.com`) or self-hosting\n", "readmeIsEjs": false, "files": { "_dot_env.local.append": "# PostHog configuration, get your key from https://app.posthog.com/project/settings\nVITE_POSTHOG_KEY=phc_xxx\n# Optional: PostHog API host (for self-hosted or EU cloud)\n# VITE_POSTHOG_HOST=https://us.i.posthog.com\n", "src/integrations/posthog/provider.tsx": "import posthog from 'posthog-js'\nimport { PostHogProvider as BasePostHogProvider } from '@posthog/react'\nimport type { ReactNode } from 'react'\n\nif (typeof window !== 'undefined' && import.meta.env.VITE_POSTHOG_KEY) {\n posthog.init(import.meta.env.VITE_POSTHOG_KEY, {\n api_host: import.meta.env.VITE_POSTHOG_HOST || 'https://us.i.posthog.com',\n person_profiles: 'identified_only',\n capture_pageview: false,\n defaults: '2025-11-30',\n })\n}\n\ninterface PostHogProviderProps {\n children: ReactNode\n}\n\nexport default function PostHogProvider({ children }: PostHogProviderProps) {\n return {children}\n}\n", "src/routes/demo/posthog.tsx": "import { createFileRoute, Link } from '@tanstack/react-router'\nimport { usePostHog } from '@posthog/react'\nimport { useState } from 'react'\n\nexport const Route = createFileRoute('/demo/posthog')({\n component: PostHogDemo,\n})\n\nfunction PostHogDemo() {\n const posthog = usePostHog()\n const [eventCount, setEventCount] = useState(0)\n const posthogKey = import.meta.env.VITE_POSTHOG_KEY\n const isConfigured = Boolean(posthogKey) && posthogKey !== 'phc_xxx'\n\n const trackEvent = (\n eventName: string,\n properties?: Record,\n ) => {\n posthog.capture(eventName, properties)\n setEventCount((c) => c + 1)\n }\n\n return (\n
\n
\n

Analytics

\n

PostHog Demo

\n\n {!isConfigured && (\n
\n

\n Warning: VITE_POSTHOG_KEY is not configured.\n Events won't be sent to PostHog. Add it to your .env{' '}\n file.\n

\n
\n )}\n\n
\n

\n Click the button below to send events to PostHog. Check your PostHog\n dashboard to see them appear in real-time.\n

\n\n trackEvent('button_clicked', { button: 'demo' })}\n className=\"demo-button w-full\"\n >\n Track Click\n \n\n {isConfigured && (\n
\n

Events sent this session:

\n

{eventCount}

\n
\n )}\n
\n\n

\n Open your{' '}\n \n PostHog Events\n {' '}\n page to see these events appear.\n

\n\n

\n Learn more in the{' '}\n \n PostHog React docs\n \n .\n

\n\n
\n ← Back to Home\n
\n
\n
\n )\n}\n" }, "deletedFiles": [] } satisfies AddOnCompiled