{"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\nexport const SettingsSchema = z.object({\n  apiKey: z\n    .string()\n    .min(1)\n    .regex(\n      /^\\d+$/,\n      'Must be a numeric LinkedIn Partner ID (digits only, e.g. \"123456\")',\n    )\n    .describe(\n      'Your LinkedIn Partner ID (numeric string, typically 6 to 7 digits). Find it in Campaign Manager under Insight Tag. Assigned to window._linkedin_partner_id before the Insight Tag script loads (like 1234567).',\n    ),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * LinkedIn per-rule mapping schema.\n *\n * Every field on `conversion` is a walkerOS mapping value (static literal,\n * string path, or `{ map, value, key, fn, ... }` object). The schema uses\n * `z.unknown()` for each so users can supply any valid mapping shape — the\n * destination resolves it via `getMappingValue()` at push time.\n */\nexport const MappingSchema = z.object({\n  conversion: z\n    .unknown()\n    .describe(\n      'Resolves to a LinkedIn conversion object with short keys: { id (required number — the Campaign Manager conversion_id), value? (number), currency? (ISO code), eventId? (string for deduplication with a future server/Conversions API destination) }. Events without a resolved id are silently ignored.',\n    )\n    .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\n","import type { Env, Lintrk } from '../types';\n\n/**\n * Example environment configurations for LinkedIn Insight Tag destination.\n *\n * Tests clone `push` and replace `window.lintrk` with a jest.fn() to collect\n * calls. Production leaves `env` undefined — the destination mutates the real\n * `window` object and injects the LinkedIn CDN script via `addScript()`.\n */\n\nconst noop = () => {};\n\n/**\n * Pre-init environment — no LinkedIn state present. The destination's init\n * will populate _linkedin_partner_id and install the lintrk queue.\n */\nexport const init: Env | undefined = {\n  window: {\n    _linkedin_partner_id: undefined,\n    _linkedin_data_partner_ids: undefined,\n    lintrk: undefined,\n  },\n  document: {\n    createElement: () => ({\n      src: '',\n      async: false,\n      dataset: {},\n      setAttribute: () => {},\n      removeAttribute: () => {},\n    }),\n    head: { appendChild: () => {} },\n    querySelector: () => null,\n  },\n};\n\n/**\n * Post-init environment — lintrk is a spy-able no-op function carrying the\n * queue shape the real script installs. Tests clone this and replace\n * `window.lintrk` with a jest.fn() before pushing events, so every call is\n * captured.\n */\nexport const push: Env = {\n  window: {\n    _linkedin_partner_id: '123456',\n    _linkedin_data_partner_ids: ['123456'],\n    lintrk: Object.assign(noop, { q: [] as unknown[] }) as unknown as Lintrk,\n  },\n  document: {\n    createElement: () => ({\n      src: '',\n      async: false,\n      dataset: {},\n      setAttribute: () => {},\n      removeAttribute: () => {},\n    }),\n    head: { appendChild: () => {} },\n    querySelector: () => null,\n  },\n};\n\n/**\n * Simulation tracking paths — used by CLI `--simulate` to record which\n * function calls happened during an event push.\n */\nexport const simulation = ['call:window.lintrk'];\n","import type { Flow } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally override destination-level settings for a test.\n * The test runner reads `settings` from the example and merges it into the\n * base destination settings (on top of the fixed `apiKey`). Rarely needed\n * for LinkedIn - conversion config lives on the rule, not destination-level.\n */\nexport type LinkedInStepExample = Flow.StepExample & {\n  settings?: Partial<Settings>;\n};\n\n/**\n * OPT-IN: Unmapped event is silently ignored.\n *\n * LinkedIn's core behavioral difference from analytics destinations: events\n * without `mapping.settings.conversion` produce ZERO lintrk() calls. The\n * destination is opt-in - each conversion must reference a pre-created\n * Conversion Rule from Campaign Manager.\n */\nexport const unmappedEventIgnored: LinkedInStepExample = {\n  public: false,\n  in: getEvent('product view', { timestamp: 1700000100 }),\n  out: [],\n};\n\n/**\n * Simplest possible conversion - just a `conversion_id` from Campaign Manager.\n *\n * Form submission → LinkedIn Lead conversion. The mapping resolves `id` as a\n * literal value (no walker event field needed). The destination translates\n * `{ id }` → `lintrk('track', { conversion_id })`.\n */\nexport const simpleConversionId: LinkedInStepExample = {\n  title: 'Simple conversion',\n  description:\n    'A form submit fires a LinkedIn lintrk track with only a conversion_id from Campaign Manager.',\n  in: getEvent('form submit', { timestamp: 1700000101 }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 12345 },\n        },\n      },\n    },\n  },\n  out: [['lintrk', 'track', { conversion_id: 12345 }]],\n};\n\n/**\n * Full e-commerce conversion - every supported lintrk field populated.\n *\n * mapping config uses short walkerOS keys (`id`, `value`, `currency`, `eventId`);\n * the destination translates them to the vendor parameter names\n * (`conversion_id`, `conversion_value`, `currency`, `event_id`).\n *\n * Currency uses the walkerOS fallback syntax: `{ key, value }` - pull from\n * `data.currency` first, fall back to `\"EUR\"` if absent. The default\n * `order complete` fixture from `getEvent` already sets `data.currency: \"EUR\"`,\n * so the resolved value is \"EUR\" here.\n *\n * `eventId` maps from the walkerOS event.id - stable per event, unique, and\n * ready for deduplication with a future server (Conversions API) destination.\n */\nexport const orderCompleteFullConversion: LinkedInStepExample = {\n  title: 'Ecommerce conversion',\n  description:\n    'A completed order fires a LinkedIn lintrk track with conversion_id, value, currency, and event_id for deduplication.',\n  in: getEvent('order complete', {\n    timestamp: 1700000102,\n    id: '1700000102abcdef',\n  }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 67890 },\n          value: 'data.total',\n          currency: { key: 'data.currency', value: 'EUR' },\n          eventId: 'id',\n        },\n      },\n    },\n  },\n  out: [\n    [\n      'lintrk',\n      'track',\n      {\n        conversion_id: 67890,\n        conversion_value: 555,\n        currency: 'EUR',\n        event_id: '1700000102abcdef',\n      },\n    ],\n  ],\n};\n\n/**\n * Page view as an explicit conversion.\n *\n * LinkedIn's Insight Tag automatically fires a page view on load for\n * retargeting / audience building - that call is NOT something the\n * destination controls. This example tests the OTHER case: mapping a\n * specific walkerOS `page view` event to a Campaign Manager KEY_PAGE_VIEW\n * conversion rule, which fires an EXPLICIT lintrk('track') call in addition\n * to the auto page view.\n */\nexport const pageViewConversion: LinkedInStepExample = {\n  title: 'Key page view',\n  description:\n    'A page view fires an explicit lintrk track mapped to a LinkedIn KEY_PAGE_VIEW conversion rule.',\n  in: getEvent('page view', {\n    timestamp: 1700000103,\n    id: '1700000103abcdef',\n  }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 11111 },\n          eventId: 'id',\n        },\n      },\n    },\n  },\n  out: [\n    [\n      'lintrk',\n      'track',\n      {\n        conversion_id: 11111,\n        event_id: '1700000103abcdef',\n      },\n    ],\n  ],\n};\n\n/**\n * Middle-funnel LEAD conversion - demo request without monetary value.\n *\n * LinkedIn's conversion types include LEAD, CONTACT, SIGN_UP, etc. The\n * destination is agnostic to the type (set in Campaign Manager, not at call\n * time) - all we forward is the conversion_id. This fixture exercises the\n * \"id + eventId only\" shape.\n */\nexport const demoRequestLead: LinkedInStepExample = {\n  title: 'Lead conversion',\n  description:\n    'A demo request fires a LinkedIn lintrk track for a lead conversion with id and event_id only.',\n  in: getEvent('demo request', {\n    timestamp: 1700000104,\n    id: '1700000104abcdef',\n  }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 44444 },\n          eventId: 'id',\n        },\n      },\n    },\n  },\n  out: [\n    [\n      'lintrk',\n      'track',\n      {\n        conversion_id: 44444,\n        event_id: '1700000104abcdef',\n      },\n    ],\n  ],\n};\n\n/**\n * rule.silent - fully-configured conversion rule temporarily disabled.\n *\n * The rule has a valid `conversion.map` but `silent: true` tells the destination\n * to produce zero calls. This is distinct from the opt-in default (no\n * `conversion` at all): silent explicitly keeps the rule on disk for quick\n * reactivation without deleting it.\n */\nexport const conversionSilenced: LinkedInStepExample = {\n  public: false,\n  in: getEvent('form submit', { timestamp: 1700000105 }),\n  mapping: {\n    silent: true,\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 12345 },\n        },\n      },\n    },\n  },\n  out: [],\n};\n\n/**\n * Falsy `id` → entire lintrk call is skipped.\n *\n * If the resolved conversion object has no truthy `id`, the destination does\n * NOT call lintrk at all. This protects against misconfigured mappings\n * (e.g. pulling id from a non-existent field).\n *\n * Here we map `id` from `data.nonexistentField` - it resolves to undefined,\n * so zero calls are produced.\n */\nexport const missingConversionIdIgnored: LinkedInStepExample = {\n  public: false,\n  in: getEvent('form submit', { timestamp: 1700000106 }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: 'data.nonexistentField',\n        },\n      },\n    },\n  },\n  out: [],\n};\n\n/**\n * Partial conversion - value missing → omitted from the lintrk call.\n *\n * The rule asks for `value: 'data.missingTotal'` (undefined), `currency`\n * (undefined), and `eventId: 'id'` (present). Only `conversion_id` and\n * `event_id` appear in the final call - no `conversion_value`, no `currency`.\n */\nexport const partialFieldsOmitted: LinkedInStepExample = {\n  public: false,\n  in: getEvent('order complete', {\n    timestamp: 1700000107,\n    id: '1700000107abcdef',\n  }),\n  mapping: {\n    settings: {\n      conversion: {\n        map: {\n          id: { value: 67890 },\n          value: 'data.missingTotal',\n          eventId: 'id',\n        },\n      },\n    },\n  },\n  out: [\n    [\n      'lintrk',\n      'track',\n      {\n        conversion_id: 67890,\n        event_id: '1700000107abcdef',\n      },\n    ],\n  ],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AACJ,CAAC;;;ACbD,SAAS,KAAAA,UAAS;AAUX,IAAM,gBAAgBA,GAAE,OAAO;AAA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