{"version":3,"sources":["../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nconst hostnameRegex =\n  /^(?=.{1,253}$)(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\\.[A-Za-z0-9-]{1,63}(?<!-))*$/;\n\nexport const SettingsSchema = z.object({\n  domain: z\n    .string()\n    .regex(hostnameRegex, 'Must be a valid hostname')\n    .describe(\n      'The domain of your site as registered in Plausible (like walkeros.io)',\n    )\n    .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * Plausible Mapping Schema\n * Plausible has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for Plausible destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\n// Simple no-op function for mocking\nconst noop = () => {};\n\nexport const init: Env | undefined = {\n  window: {\n    // plausible absent: init() is expected to install the stub.\n  },\n  document: {\n    createElement: () => ({\n      src: '',\n      dataset: {},\n      setAttribute: () => {},\n      removeAttribute: () => {},\n    }),\n    head: { appendChild: () => {} },\n    querySelector: () => null,\n  },\n};\n\nexport const push: Env = {\n  window: {\n    plausible: Object.assign(noop, {\n      // Add queue property for analytics loading pattern\n      q: [] as IArguments[],\n    }),\n  },\n  document: {\n    createElement: () => ({\n      src: '',\n      dataset: {},\n      setAttribute: () => {},\n      removeAttribute: () => {},\n    }),\n    head: { appendChild: () => {} },\n    querySelector: () => null,\n  },\n};\n\n/**\n * Simulation tracking paths\n * Specifies which function calls to track during simulation\n */\nexport const simulation = [\n  'call:window.plausible', // Track plausible function calls\n];\n\n// Future: error scenarios (v2)\n// export const error: Env = { ... };\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n/**\n * Destination bootstrap.\n * Given the canonical settings, init loads the Plausible script tag\n * with the configured domain and installs the global `plausible` queue.\n */\nexport const init: Flow.StepExample = {\n  title: 'Initialization',\n  description:\n    'Destination bootstrap loads the Plausible script for the configured domain and installs the queue.',\n  in: {\n    loadScript: true,\n    settings: {\n      domain: 'example.com',\n    },\n  },\n  out: [\n    [\n      'script.appendChild',\n      {\n        src: 'https://plausible.io/js/script.manual.js',\n        domain: 'example.com',\n      },\n    ],\n  ],\n};\n\nexport const purchase: Flow.StepExample = {\n  title: 'Purchase',\n  description:\n    'A completed order fires a Plausible purchase event with revenue currency and amount.',\n  in: getEvent('order complete', { timestamp: 1700000200 }),\n  mapping: {\n    name: 'purchase',\n    data: {\n      map: {\n        revenue: {\n          map: {\n            currency: { value: 'EUR' },\n            amount: 'data.total',\n          },\n        },\n      },\n    },\n  },\n  out: [\n    [\n      'plausible',\n      'purchase',\n      {\n        revenue: {\n          currency: 'EUR',\n          amount: 555,\n        },\n      },\n    ],\n  ],\n};\n\nexport const customEvent: Flow.StepExample = {\n  title: 'Custom event',\n  description:\n    'A generic entity action fires a Plausible custom event with mapped props and a revenue field.',\n  in: getEvent('entity action', { timestamp: 1700000201 }),\n  mapping: {\n    name: 'Custom Event',\n    data: {\n      map: {\n        props: 'data',\n        revenue: 'data.number',\n      },\n    },\n  },\n  out: [\n    [\n      'plausible',\n      'Custom Event',\n      {\n        props: {\n          string: 'foo',\n          number: 1,\n          boolean: true,\n          array: [0, 'text', false],\n        },\n        revenue: 1,\n      },\n    ],\n  ],\n};\n"],"mappings":";;;;;;;AAAA;AAA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