@walkeros/web-destination-linkedin 4.8.2 → 4.8.3-next-1793115089237
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +6 -1
- package/dist/dev.d.mts +13 -11
- package/dist/dev.d.ts +13 -11
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +11 -10
- package/dist/examples/index.d.ts +11 -10
- package/dist/examples/index.js +9 -1
- package/dist/examples/index.mjs +8 -1
- package/dist/index.d.mts +8 -12
- package/dist/index.d.ts +8 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +22 -11
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @walkeros/web-destination-linkedin
|
|
2
2
|
|
|
3
|
+
## 4.8.3-next-1793115089237
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5313635: The sample events from `getEvent` now use the standard event names:
|
|
8
|
+
`checkout start` replaces `checkout view`, an order carries `tax` and `total`,
|
|
9
|
+
a promotion names its placement `slot`, and product events carry `currency`.
|
|
10
|
+
Order `value` is now the merchandise value: the `order complete` sample goes
|
|
11
|
+
from 555 to 462, and the gross amount charged is `total` (467.22). The
|
|
12
|
+
destination examples read `data.tax`, `data.slot` and the search keys
|
|
13
|
+
`data.term` and `data.results`, and gross fields such as Matomo `grandTotal`
|
|
14
|
+
read `data.total` first, then `data.value`. The CLI ships default event
|
|
15
|
+
contracts for common site types in `examples/contracts/`.
|
|
16
|
+
- 9316f2a: The `conversion` mapping description now says what happens when the
|
|
17
|
+
conversion resolves to no id: no `lintrk` call is made and the push fails with
|
|
18
|
+
`missing-input`. It no longer says such events are ignored, and it names the
|
|
19
|
+
server LinkedIn destination as the deduplication partner of `eventId`.
|
|
20
|
+
- 5313635: The package publishes a minimal example: the LinkedIn Partner ID,
|
|
21
|
+
with the Insight Tag script loaded by the destination. The docs page renders
|
|
22
|
+
the install line, the integrated code and the flow from it, and the package
|
|
23
|
+
test runs the same setup, so the setup a reader copies is the one that was
|
|
24
|
+
tested.
|
|
25
|
+
- Updated dependencies [29d2218]
|
|
26
|
+
- Updated dependencies [34fd225]
|
|
27
|
+
- Updated dependencies [5313635]
|
|
28
|
+
- Updated dependencies [5313635]
|
|
29
|
+
- Updated dependencies [5313635]
|
|
30
|
+
- Updated dependencies [5313635]
|
|
31
|
+
- Updated dependencies [5313635]
|
|
32
|
+
- Updated dependencies [34fd225]
|
|
33
|
+
- Updated dependencies [5313635]
|
|
34
|
+
- Updated dependencies [5313635]
|
|
35
|
+
- @walkeros/web-core@4.8.3-next-1793115089237
|
|
36
|
+
- @walkeros/core@4.8.3-next-1793115089237
|
|
37
|
+
|
|
3
38
|
## 4.8.2
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -32,7 +32,10 @@ npm install @walkeros/web-destination-linkedin
|
|
|
32
32
|
"destinations": {
|
|
33
33
|
"linkedin": {
|
|
34
34
|
"package": "@walkeros/web-destination-linkedin",
|
|
35
|
-
"config": {
|
|
35
|
+
"config": {
|
|
36
|
+
"loadScript": true,
|
|
37
|
+
"settings": { "apiKey": "123456" }
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
}
|
|
@@ -40,6 +43,8 @@ npm install @walkeros/web-destination-linkedin
|
|
|
40
43
|
}
|
|
41
44
|
```
|
|
42
45
|
|
|
46
|
+
LinkedIn tracks only the events whose rule sets a `conversion`, see the docs.
|
|
47
|
+
|
|
43
48
|
## Documentation
|
|
44
49
|
|
|
45
50
|
Full configuration, mapping, and examples live in the docs:
|
package/dist/dev.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
|
13
13
|
*
|
|
14
14
|
* Every field on `conversion` is a walkerOS mapping value (static literal,
|
|
15
15
|
* string path, or `{ map, value, key, fn, ... }` object). The schema uses
|
|
16
|
-
* `z.unknown()` for each so users can supply any valid mapping shape
|
|
16
|
+
* `z.unknown()` for each so users can supply any valid mapping shape; the
|
|
17
17
|
* destination resolves it via `getMappingValue()` at push time.
|
|
18
18
|
*/
|
|
19
19
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -36,7 +36,7 @@ declare namespace index$1 {
|
|
|
36
36
|
/**
|
|
37
37
|
* LinkedIn Insight Tag runtime surface.
|
|
38
38
|
*
|
|
39
|
-
* The Insight Tag script installs `window.lintrk
|
|
39
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
40
40
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
41
41
|
*
|
|
42
42
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -64,19 +64,14 @@ declare global {
|
|
|
64
64
|
/**
|
|
65
65
|
* Destination-level settings.
|
|
66
66
|
*
|
|
67
|
-
* apiKey
|
|
68
|
-
*
|
|
69
|
-
* include — event sections made available for mapping resolution. Present for
|
|
70
|
-
* consistency with other destinations; has no effect at call time
|
|
71
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
72
|
-
* can reference section-prefixed keys in future custom mapping
|
|
73
|
-
* strategies without a breaking change.
|
|
67
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
68
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
74
69
|
*/
|
|
75
70
|
interface Settings {
|
|
76
71
|
apiKey: string;
|
|
77
72
|
}
|
|
78
73
|
/**
|
|
79
|
-
* Env
|
|
74
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
80
75
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
81
76
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
82
77
|
* a spy to skip the script injection path.
|
|
@@ -225,10 +220,17 @@ declare namespace step {
|
|
|
225
220
|
export { type step_LinkedInStepExample as LinkedInStepExample, step_consentRevoke as consentRevoke, step_conversionSilenced as conversionSilenced, step_demoRequestLead as demoRequestLead, step_missingConversionIdIgnored as missingConversionIdIgnored, step_orderCompleteFullConversion as orderCompleteFullConversion, step_pageViewConversion as pageViewConversion, step_partialFieldsOmitted as partialFieldsOmitted, step_simpleConversionId as simpleConversionId, step_unmappedEventIgnored as unmappedEventIgnored };
|
|
226
221
|
}
|
|
227
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The settings the Insight Tag needs to deliver: the Partner ID, with the
|
|
225
|
+
* Insight Tag script loaded by the destination.
|
|
226
|
+
*/
|
|
227
|
+
declare const minimal: Flow.MinimalExample;
|
|
228
|
+
|
|
228
229
|
declare const index_env: typeof env;
|
|
230
|
+
declare const index_minimal: typeof minimal;
|
|
229
231
|
declare const index_step: typeof step;
|
|
230
232
|
declare namespace index {
|
|
231
|
-
export { index_env as env, index_step as step };
|
|
233
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type Settings$1 = z.infer<typeof SettingsSchema>;
|
|
|
13
13
|
*
|
|
14
14
|
* Every field on `conversion` is a walkerOS mapping value (static literal,
|
|
15
15
|
* string path, or `{ map, value, key, fn, ... }` object). The schema uses
|
|
16
|
-
* `z.unknown()` for each so users can supply any valid mapping shape
|
|
16
|
+
* `z.unknown()` for each so users can supply any valid mapping shape; the
|
|
17
17
|
* destination resolves it via `getMappingValue()` at push time.
|
|
18
18
|
*/
|
|
19
19
|
declare const MappingSchema: z.ZodObject<{
|
|
@@ -36,7 +36,7 @@ declare namespace index$1 {
|
|
|
36
36
|
/**
|
|
37
37
|
* LinkedIn Insight Tag runtime surface.
|
|
38
38
|
*
|
|
39
|
-
* The Insight Tag script installs `window.lintrk
|
|
39
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
40
40
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
41
41
|
*
|
|
42
42
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -64,19 +64,14 @@ declare global {
|
|
|
64
64
|
/**
|
|
65
65
|
* Destination-level settings.
|
|
66
66
|
*
|
|
67
|
-
* apiKey
|
|
68
|
-
*
|
|
69
|
-
* include — event sections made available for mapping resolution. Present for
|
|
70
|
-
* consistency with other destinations; has no effect at call time
|
|
71
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
72
|
-
* can reference section-prefixed keys in future custom mapping
|
|
73
|
-
* strategies without a breaking change.
|
|
67
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
68
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
74
69
|
*/
|
|
75
70
|
interface Settings {
|
|
76
71
|
apiKey: string;
|
|
77
72
|
}
|
|
78
73
|
/**
|
|
79
|
-
* Env
|
|
74
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
80
75
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
81
76
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
82
77
|
* a spy to skip the script injection path.
|
|
@@ -225,10 +220,17 @@ declare namespace step {
|
|
|
225
220
|
export { type step_LinkedInStepExample as LinkedInStepExample, step_consentRevoke as consentRevoke, step_conversionSilenced as conversionSilenced, step_demoRequestLead as demoRequestLead, step_missingConversionIdIgnored as missingConversionIdIgnored, step_orderCompleteFullConversion as orderCompleteFullConversion, step_pageViewConversion as pageViewConversion, step_partialFieldsOmitted as partialFieldsOmitted, step_simpleConversionId as simpleConversionId, step_unmappedEventIgnored as unmappedEventIgnored };
|
|
226
221
|
}
|
|
227
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The settings the Insight Tag needs to deliver: the Partner ID, with the
|
|
225
|
+
* Insight Tag script loaded by the destination.
|
|
226
|
+
*/
|
|
227
|
+
declare const minimal: Flow.MinimalExample;
|
|
228
|
+
|
|
228
229
|
declare const index_env: typeof env;
|
|
230
|
+
declare const index_minimal: typeof minimal;
|
|
229
231
|
declare const index_step: typeof step;
|
|
230
232
|
declare namespace index {
|
|
231
|
-
export { index_env as env, index_step as step };
|
|
233
|
+
export { index_env as env, index_minimal as minimal, index_step as step };
|
|
232
234
|
}
|
|
233
235
|
|
|
234
236
|
export { index as examples, index$1 as schemas };
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,i=Object.defineProperty,n=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,
|
|
1
|
+
"use strict";var e,i=Object.defineProperty,n=Object.getOwnPropertyDescriptor,t=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,r=(e,n)=>{for(var t in n)i(e,t,{get:n[t],enumerable:!0})},a={};r(a,{examples:()=>g,schemas:()=>s}),module.exports=(e=a,((e,r,a,s)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let d of t(r))o.call(e,d)||d===a||i(e,d,{get:()=>r[d],enumerable:!(s=n(r,d))||s.enumerable});return e})(i({},"__esModule",{value:!0}),e));var s={};r(s,{MappingSchema:()=>m,SettingsSchema:()=>l,mapping:()=>u,settings:()=>v});var d=require("@walkeros/core/dev"),c=require("@walkeros/core/dev"),l=c.z.object({apiKey:c.z.string().min(1).regex(/^\d+$/,'Must be a numeric LinkedIn Partner ID (digits only, e.g. "123456")').describe("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).")}).strict(),p=require("@walkeros/core/dev"),m=p.z.object({conversion:p.z.unknown().describe("Resolves to a LinkedIn conversion object with short keys: { id (required number, the Campaign Manager conversion_id), value? (number), currency? (ISO code), eventId? (string, the same event id the server LinkedIn destination sends, for deduplication) }. A rule whose conversion resolves to no id makes no lintrk call and fails the push with missing-input.").optional()}),v=(0,d.zodToSchema)(l),u=(0,d.zodToSchema)(m),g={};r(g,{env:()=>k,minimal:()=>C,step:()=>h});var k={};r(k,{init:()=>_,push:()=>b,simulation:()=>f});var _={window:{_linkedin_partner_id:void 0,_linkedin_data_partner_ids:void 0,lintrk:void 0}},b={window:{_linkedin_partner_id:"123456",_linkedin_data_partner_ids:["123456"],lintrk:Object.assign(()=>{},{q:[]})}},f=["call:window.lintrk"],h={};r(h,{consentRevoke:()=>A,conversionSilenced:()=>j,demoRequestLead:()=>O,missingConversionIdIgnored:()=>q,orderCompleteFullConversion:()=>E,pageViewConversion:()=>L,partialFieldsOmitted:()=>S,simpleConversionId:()=>y,unmappedEventIgnored:()=>I});var w=require("@walkeros/core"),I={public:!1,in:(0,w.getEvent)("product view",{timestamp:1700000100}),out:[]},y={title:"Simple conversion",description:"A form submit fires a LinkedIn lintrk track with only a conversion_id from Campaign Manager.",in:(0,w.createEvent)({name:"form submit",timestamp:1700000101}),mapping:{settings:{conversion:{map:{id:{value:12345}}}}},out:[["lintrk","track",{conversion_id:12345}]]},E={title:"Ecommerce conversion",description:"A completed order fires a LinkedIn lintrk track with conversion_id, value, currency, and event_id for deduplication.",in:(0,w.getEvent)("order complete",{timestamp:1700000102,id:"1700000102abcdef"}),mapping:{settings:{conversion:{map:{id:{value:67890},value:"data.value",currency:{key:"data.currency",value:"EUR"},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:67890,conversion_value:462,currency:"EUR",event_id:"1700000102abcdef"}]]},L={title:"Key page view",description:"A page view fires an explicit lintrk track mapped to a LinkedIn KEY_PAGE_VIEW conversion rule.",in:(0,w.getEvent)("page view",{timestamp:1700000103,id:"1700000103abcdef"}),mapping:{settings:{conversion:{map:{id:{value:11111},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:11111,event_id:"1700000103abcdef"}]]},O={title:"Lead conversion",description:"A demo request fires a LinkedIn lintrk track for a lead conversion with id and event_id only.",in:(0,w.createEvent)({name:"demo request",timestamp:1700000104,id:"1700000104abcdef"}),mapping:{settings:{conversion:{map:{id:{value:44444},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:44444,event_id:"1700000104abcdef"}]]},j={public:!1,in:(0,w.createEvent)({name:"form submit",timestamp:1700000105}),mapping:{silent:!0,settings:{conversion:{map:{id:{value:12345}}}}},out:[]},q={public:!1,description:"A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.",in:(0,w.createEvent)({name:"form submit",timestamp:1700000106}),mapping:{settings:{conversion:{map:{id:"data.nonexistentField"}}}},out:[],outcome:{status:"failed",code:"missing-input"}},S={public:!1,in:(0,w.getEvent)("order complete",{timestamp:1700000107,id:"1700000107abcdef"}),mapping:{settings:{conversion:{map:{id:{value:67890},value:"data.missingTotal",eventId:"id"}}}},out:[["lintrk","track",{conversion_id:67890,event_id:"1700000107abcdef"}]]},A={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.",command:"consent",in:{marketing:!1},out:[]},C={settings:{apiKey:"123456"},config:{loadScript:!0}};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../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":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","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\n .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 .strict();\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 } 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 through `loadVendor`.\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};\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: [] }),\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 { createEvent, 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: createEvent({ name: '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.value',\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: createEvent({\n name: '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: createEvent({ name: '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 and the push fails missing-input.\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 description:\n 'A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.',\n in: createEvent({ name: 'form submit', timestamp: 1700000106 }),\n mapping: {\n settings: {\n conversion: {\n map: {\n id: 'data.nonexistentField',\n },\n },\n },\n },\n out: [],\n outcome: { status: 'failed', code: 'missing-input' },\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\n/**\n * A revocation of the consent the destination requires. The Insight Tag has\n * no vendor consent mode, so the collector's consent gate is the only\n * mechanism and no vendor call is made.\n */\nexport const consentRevoke: LinkedInStepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO;;;ACfV,IAAAC,cAAkB;AAUX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,YAAY,cACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFTM,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAMb,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B;AAAA,IAC5B,QAAQ;AAAA,EACV;AACF;AAQO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B,CAAC,QAAQ;AAAA,IACrC,QAAQ,OAAO,OAAO,MA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AAC;AAAA,EAC9D,SAAS;AAAA,IACP,UAAU;AAAA,MACR,YAAY;AAAA,QACV,KAAK;AAAA,UACH,IAAI;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC;AAAA,EACN,SAAS,EAAE,QAAQ,UAAU,MAAM,gBAAgB;AACrD;AASO,IAAM,uBAA4C;AAAA,EACvD,QAAQ;AAAA,EACR,QAAI,sBAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,YAAY;AAAA,QACV,KAAK;AAAA,UACH,IAAI,EAAE,OAAO,MAAM;AAAA,UACnB,OAAO;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,eAAe;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,gBAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["import_dev","import_dev"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/step.ts","../src/examples/minimal.ts"],"sourcesContent":["export * as schemas from './schemas';\nexport * as examples from './examples';\n","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\n .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 .strict();\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, the same event id the server LinkedIn destination sends, for deduplication) }. A rule whose conversion resolves to no id makes no lintrk call and fails the push with missing-input.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env } 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 through `loadVendor`.\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};\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: [] }),\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 { createEvent, 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: createEvent({ name: '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.value',\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: 462,\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: createEvent({\n name: '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: createEvent({ name: '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 and the push fails missing-input.\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 description:\n 'A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.',\n in: createEvent({ name: 'form submit', timestamp: 1700000106 }),\n mapping: {\n settings: {\n conversion: {\n map: {\n id: 'data.nonexistentField',\n },\n },\n },\n },\n out: [],\n outcome: { status: 'failed', code: 'missing-input' },\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\n/**\n * A revocation of the consent the destination requires. The Insight Tag has\n * no vendor consent mode, so the collector's consent gate is the only\n * mechanism and no vendor call is made.\n */\nexport const consentRevoke: LinkedInStepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings the Insight Tag needs to deliver: the Partner ID, with the\n * Insight Tag script loaded by the destination.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: '123456' },\n config: { loadScript: true },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAC3B,OAAO;AAAA,EACN,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO;;;ACfV,IAAAC,cAAkB;AAUX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,YAAY,cACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFTM,IAAM,eAAW,yBAAY,cAAc;AAC3C,IAAM,cAAU,yBAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AA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 -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,i=(i,n)=>{for(var t in n)e(i,t,{get:n[t],enumerable:!0})},n={};i(n,{MappingSchema:()=>s,SettingsSchema:()=>r,mapping:()=>c,settings:()=>d});import{zodToSchema as t}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.object({apiKey:o.string().min(1).regex(/^\d+$/,'Must be a numeric LinkedIn Partner ID (digits only, e.g. "123456")').describe("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).")}).strict();import{z as a}from"@walkeros/core/dev";var s=a.object({conversion:a.unknown().describe("Resolves to a LinkedIn conversion object with short keys: { id (required number
|
|
1
|
+
var e=Object.defineProperty,i=(i,n)=>{for(var t in n)e(i,t,{get:n[t],enumerable:!0})},n={};i(n,{MappingSchema:()=>s,SettingsSchema:()=>r,mapping:()=>c,settings:()=>d});import{zodToSchema as t}from"@walkeros/core/dev";import{z as o}from"@walkeros/core/dev";var r=o.object({apiKey:o.string().min(1).regex(/^\d+$/,'Must be a numeric LinkedIn Partner ID (digits only, e.g. "123456")').describe("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).")}).strict();import{z as a}from"@walkeros/core/dev";var s=a.object({conversion:a.unknown().describe("Resolves to a LinkedIn conversion object with short keys: { id (required number, the Campaign Manager conversion_id), value? (number), currency? (ISO code), eventId? (string, the same event id the server LinkedIn destination sends, for deduplication) }. A rule whose conversion resolves to no id makes no lintrk call and fails the push with missing-input.").optional()}),d=t(r),c=t(s),m={};i(m,{env:()=>l,minimal:()=>E,step:()=>g});var l={};i(l,{init:()=>p,push:()=>v,simulation:()=>u});var p={window:{_linkedin_partner_id:void 0,_linkedin_data_partner_ids:void 0,lintrk:void 0}},v={window:{_linkedin_partner_id:"123456",_linkedin_data_partner_ids:["123456"],lintrk:Object.assign(()=>{},{q:[]})}},u=["call:window.lintrk"],g={};i(g,{consentRevoke:()=>C,conversionSilenced:()=>y,demoRequestLead:()=>I,missingConversionIdIgnored:()=>L,orderCompleteFullConversion:()=>h,pageViewConversion:()=>w,partialFieldsOmitted:()=>A,simpleConversionId:()=>b,unmappedEventIgnored:()=>f});import{createEvent as k,getEvent as _}from"@walkeros/core";var f={public:!1,in:_("product view",{timestamp:1700000100}),out:[]},b={title:"Simple conversion",description:"A form submit fires a LinkedIn lintrk track with only a conversion_id from Campaign Manager.",in:k({name:"form submit",timestamp:1700000101}),mapping:{settings:{conversion:{map:{id:{value:12345}}}}},out:[["lintrk","track",{conversion_id:12345}]]},h={title:"Ecommerce conversion",description:"A completed order fires a LinkedIn lintrk track with conversion_id, value, currency, and event_id for deduplication.",in:_("order complete",{timestamp:1700000102,id:"1700000102abcdef"}),mapping:{settings:{conversion:{map:{id:{value:67890},value:"data.value",currency:{key:"data.currency",value:"EUR"},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:67890,conversion_value:462,currency:"EUR",event_id:"1700000102abcdef"}]]},w={title:"Key page view",description:"A page view fires an explicit lintrk track mapped to a LinkedIn KEY_PAGE_VIEW conversion rule.",in:_("page view",{timestamp:1700000103,id:"1700000103abcdef"}),mapping:{settings:{conversion:{map:{id:{value:11111},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:11111,event_id:"1700000103abcdef"}]]},I={title:"Lead conversion",description:"A demo request fires a LinkedIn lintrk track for a lead conversion with id and event_id only.",in:k({name:"demo request",timestamp:1700000104,id:"1700000104abcdef"}),mapping:{settings:{conversion:{map:{id:{value:44444},eventId:"id"}}}},out:[["lintrk","track",{conversion_id:44444,event_id:"1700000104abcdef"}]]},y={public:!1,in:k({name:"form submit",timestamp:1700000105}),mapping:{silent:!0,settings:{conversion:{map:{id:{value:12345}}}}},out:[]},L={public:!1,description:"A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.",in:k({name:"form submit",timestamp:1700000106}),mapping:{settings:{conversion:{map:{id:"data.nonexistentField"}}}},out:[],outcome:{status:"failed",code:"missing-input"}},A={public:!1,in:_("order complete",{timestamp:1700000107,id:"1700000107abcdef"}),mapping:{settings:{conversion:{map:{id:{value:67890},value:"data.missingTotal",eventId:"id"}}}},out:[["lintrk","track",{conversion_id:67890,event_id:"1700000107abcdef"}]]},C={public:!1,description:"For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.",command:"consent",in:{marketing:!1},out:[]},E={settings:{apiKey:"123456"},config:{loadScript:!0}};export{m as examples,n as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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\n .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 .strict();\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 } 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 through `loadVendor`.\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};\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: [] }),\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 { createEvent, 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: createEvent({ name: '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.value',\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: createEvent({\n name: '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: createEvent({ name: '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 and the push fails missing-input.\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 description:\n 'A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.',\n in: createEvent({ name: 'form submit', timestamp: 1700000106 }),\n mapping: {\n settings: {\n conversion: {\n map: {\n id: 'data.nonexistentField',\n },\n },\n },\n },\n out: [],\n outcome: { status: 'failed', code: 'missing-input' },\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\n/**\n * A revocation of the consent the destination requires. The Insight Tag has\n * no vendor consent mode, so the collector's consent gate is the only\n * mechanism and no vendor call is made.\n */\nexport const consentRevoke: LinkedInStepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO;;;ACfV,SAAS,KAAAA,UAAS;AAUX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,YAAYA,GACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFTM,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAMb,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B;AAAA,IAC5B,QAAQ;AAAA,EACV;AACF;AAQO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B,CAAC,QAAQ;AAAA,IACrC,QAAQ,OAAO,OAAO,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;AAAA,EACvC;AACF;AAMO,IAAM,aAAa,CAAC,oBAAoB;;;AC1C/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS,aAAa,gBAAgB;AAqB/B,IAAM,uBAA4C;AAAA,EACvD,QAAQ;AAAA,EACR,IAAI,SAAS,gBAAgB,EAAE,WAAW,WAAW,CAAC;AAAA,EACtD,KAAK,CAAC;AACR;AASO,IAAM,qBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aAC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,IACP,UAAU;AAAA,MACR,YAAY;AAAA,QACV,KAAK;AAAA,UACH,IAAI,EAAE,OAAO,MAAM;AAAA,UACnB,OAAO;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,eAAe;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,gBAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;","names":["z"]}
|
|
1
|
+
{"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","../src/examples/minimal.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\n .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 .strict();\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, the same event id the server LinkedIn destination sends, for deduplication) }. A rule whose conversion resolves to no id makes no lintrk call and fails the push with missing-input.',\n )\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env } 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 through `loadVendor`.\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};\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: [] }),\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 { createEvent, 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: createEvent({ name: '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.value',\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: 462,\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: createEvent({\n name: '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: createEvent({ name: '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 and the push fails missing-input.\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 description:\n 'A conversion mapping whose id resolves to nothing makes no lintrk call, so the push fails with missing-input instead of counting as delivered.',\n in: createEvent({ name: 'form submit', timestamp: 1700000106 }),\n mapping: {\n settings: {\n conversion: {\n map: {\n id: 'data.nonexistentField',\n },\n },\n },\n },\n out: [],\n outcome: { status: 'failed', code: 'missing-input' },\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\n/**\n * A revocation of the consent the destination requires. The Insight Tag has\n * no vendor consent mode, so the collector's consent gate is the only\n * mechanism and no vendor call is made.\n */\nexport const consentRevoke: LinkedInStepExample = {\n public: false,\n description:\n 'For a destination with config.consent { marketing: true }, revoking marketing makes no vendor call: the Insight Tag has no consent mode, the collector stops sending.',\n command: 'consent',\n in: { marketing: false },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings the Insight Tag needs to deliver: the Partner ID, with the\n * Insight Tag script loaded by the destination.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { apiKey: '123456' },\n config: { loadScript: true },\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC;AAAA,IACC;AAAA,EACF;AACJ,CAAC,EACA,OAAO;;;ACfV,SAAS,KAAAA,UAAS;AAUX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,YAAYA,GACT,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;AFTM,IAAM,WAAW,YAAY,cAAc;AAC3C,IAAM,UAAU,YAAY,aAAa;;;AGThD;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,OAAO,MAAM;AAAC;AAMb,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B;AAAA,IAC5B,QAAQ;AAAA,EACV;AACF;AAQO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,sBAAsB;AAAA,IACtB,4BAA4B,CAAC,QAAQ;AAAA,IACrC,QAAQ,OAAO,OAAO,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;AAAA,EACvC;AACF;AAMO,IAAM,aAAa,CAAC,oBAAoB;;;AC1C/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,SAAS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N,SAAS,EAAE,QAAQ,UAAU,MAAM,gBAAgB;AACrD;AASO,IAAM,uBAA4C;AAAA,EACvD,QAAQ;AAAA,EACR,IAAI,SAAS,kBAAkB;AAAA,IAC7B,WAAW;AAAA,IACX,IAAI;AAAA,EACN,CAAC;AAAA,EACD,SAAS;AAAA,IACP,UAAU;AAAA,MACR,YAAY;AAAA,QACV,KAAK;AAAA,UACH,IAAI,EAAE,OAAO,MAAM;AAAA,UACnB,OAAO;AAAA,UACP,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,eAAe;AAAA,QACf,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACF;AAOO,IAAM,gBAAqC;AAAA,EAChD,QAAQ;AAAA,EACR,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC;AACR;;;AClRO,IAAM,UAA+B;AAAA,EAC1C,UAAU,EAAE,QAAQ,SAAS;AAAA,EAC7B,QAAQ,EAAE,YAAY,KAAK;AAC7B;","names":["z"]}
|
|
@@ -4,7 +4,7 @@ import { Flow } from '@walkeros/core';
|
|
|
4
4
|
/**
|
|
5
5
|
* LinkedIn Insight Tag runtime surface.
|
|
6
6
|
*
|
|
7
|
-
* The Insight Tag script installs `window.lintrk
|
|
7
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
8
8
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
9
9
|
*
|
|
10
10
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -32,19 +32,14 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Destination-level settings.
|
|
34
34
|
*
|
|
35
|
-
* apiKey
|
|
36
|
-
*
|
|
37
|
-
* include — event sections made available for mapping resolution. Present for
|
|
38
|
-
* consistency with other destinations; has no effect at call time
|
|
39
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
40
|
-
* can reference section-prefixed keys in future custom mapping
|
|
41
|
-
* strategies without a breaking change.
|
|
35
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
36
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
42
37
|
*/
|
|
43
38
|
interface Settings {
|
|
44
39
|
apiKey: string;
|
|
45
40
|
}
|
|
46
41
|
/**
|
|
47
|
-
* Env
|
|
42
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
48
43
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
49
44
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
50
45
|
* a spy to skip the script injection path.
|
|
@@ -193,4 +188,10 @@ declare namespace step {
|
|
|
193
188
|
export { type step_LinkedInStepExample as LinkedInStepExample, step_consentRevoke as consentRevoke, step_conversionSilenced as conversionSilenced, step_demoRequestLead as demoRequestLead, step_missingConversionIdIgnored as missingConversionIdIgnored, step_orderCompleteFullConversion as orderCompleteFullConversion, step_pageViewConversion as pageViewConversion, step_partialFieldsOmitted as partialFieldsOmitted, step_simpleConversionId as simpleConversionId, step_unmappedEventIgnored as unmappedEventIgnored };
|
|
194
189
|
}
|
|
195
190
|
|
|
196
|
-
|
|
191
|
+
/**
|
|
192
|
+
* The settings the Insight Tag needs to deliver: the Partner ID, with the
|
|
193
|
+
* Insight Tag script loaded by the destination.
|
|
194
|
+
*/
|
|
195
|
+
declare const minimal: Flow.MinimalExample;
|
|
196
|
+
|
|
197
|
+
export { env, minimal, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Flow } from '@walkeros/core';
|
|
|
4
4
|
/**
|
|
5
5
|
* LinkedIn Insight Tag runtime surface.
|
|
6
6
|
*
|
|
7
|
-
* The Insight Tag script installs `window.lintrk
|
|
7
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
8
8
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
9
9
|
*
|
|
10
10
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -32,19 +32,14 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Destination-level settings.
|
|
34
34
|
*
|
|
35
|
-
* apiKey
|
|
36
|
-
*
|
|
37
|
-
* include — event sections made available for mapping resolution. Present for
|
|
38
|
-
* consistency with other destinations; has no effect at call time
|
|
39
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
40
|
-
* can reference section-prefixed keys in future custom mapping
|
|
41
|
-
* strategies without a breaking change.
|
|
35
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
36
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
42
37
|
*/
|
|
43
38
|
interface Settings {
|
|
44
39
|
apiKey: string;
|
|
45
40
|
}
|
|
46
41
|
/**
|
|
47
|
-
* Env
|
|
42
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
48
43
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
49
44
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
50
45
|
* a spy to skip the script injection path.
|
|
@@ -193,4 +188,10 @@ declare namespace step {
|
|
|
193
188
|
export { type step_LinkedInStepExample as LinkedInStepExample, step_consentRevoke as consentRevoke, step_conversionSilenced as conversionSilenced, step_demoRequestLead as demoRequestLead, step_missingConversionIdIgnored as missingConversionIdIgnored, step_orderCompleteFullConversion as orderCompleteFullConversion, step_pageViewConversion as pageViewConversion, step_partialFieldsOmitted as partialFieldsOmitted, step_simpleConversionId as simpleConversionId, step_unmappedEventIgnored as unmappedEventIgnored };
|
|
194
189
|
}
|
|
195
190
|
|
|
196
|
-
|
|
191
|
+
/**
|
|
192
|
+
* The settings the Insight Tag needs to deliver: the Partner ID, with the
|
|
193
|
+
* Insight Tag script loaded by the destination.
|
|
194
|
+
*/
|
|
195
|
+
declare const minimal: Flow.MinimalExample;
|
|
196
|
+
|
|
197
|
+
export { env, minimal, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var examples_exports = {};
|
|
22
22
|
__export(examples_exports, {
|
|
23
23
|
env: () => env_exports,
|
|
24
|
+
minimal: () => minimal,
|
|
24
25
|
step: () => step_exports
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(examples_exports);
|
|
@@ -109,7 +110,7 @@ var orderCompleteFullConversion = {
|
|
|
109
110
|
"track",
|
|
110
111
|
{
|
|
111
112
|
conversion_id: 67890,
|
|
112
|
-
conversion_value:
|
|
113
|
+
conversion_value: 462,
|
|
113
114
|
currency: "EUR",
|
|
114
115
|
event_id: "1700000102abcdef"
|
|
115
116
|
}
|
|
@@ -239,8 +240,15 @@ var consentRevoke = {
|
|
|
239
240
|
in: { marketing: false },
|
|
240
241
|
out: []
|
|
241
242
|
};
|
|
243
|
+
|
|
244
|
+
// src/examples/minimal.ts
|
|
245
|
+
var minimal = {
|
|
246
|
+
settings: { apiKey: "123456" },
|
|
247
|
+
config: { loadScript: true }
|
|
248
|
+
};
|
|
242
249
|
// Annotate the CommonJS export names for ESM import in node:
|
|
243
250
|
0 && (module.exports = {
|
|
244
251
|
env,
|
|
252
|
+
minimal,
|
|
245
253
|
step
|
|
246
254
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -88,7 +88,7 @@ var orderCompleteFullConversion = {
|
|
|
88
88
|
"track",
|
|
89
89
|
{
|
|
90
90
|
conversion_id: 67890,
|
|
91
|
-
conversion_value:
|
|
91
|
+
conversion_value: 462,
|
|
92
92
|
currency: "EUR",
|
|
93
93
|
event_id: "1700000102abcdef"
|
|
94
94
|
}
|
|
@@ -218,7 +218,14 @@ var consentRevoke = {
|
|
|
218
218
|
in: { marketing: false },
|
|
219
219
|
out: []
|
|
220
220
|
};
|
|
221
|
+
|
|
222
|
+
// src/examples/minimal.ts
|
|
223
|
+
var minimal = {
|
|
224
|
+
settings: { apiKey: "123456" },
|
|
225
|
+
config: { loadScript: true }
|
|
226
|
+
};
|
|
221
227
|
export {
|
|
222
228
|
env_exports as env,
|
|
229
|
+
minimal,
|
|
223
230
|
step_exports as step
|
|
224
231
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { DestinationWeb } from '@walkeros/web-core';
|
|
|
4
4
|
/**
|
|
5
5
|
* LinkedIn Insight Tag runtime surface.
|
|
6
6
|
*
|
|
7
|
-
* The Insight Tag script installs `window.lintrk
|
|
7
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
8
8
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
9
9
|
*
|
|
10
10
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -32,13 +32,8 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Destination-level settings.
|
|
34
34
|
*
|
|
35
|
-
* apiKey
|
|
36
|
-
*
|
|
37
|
-
* include — event sections made available for mapping resolution. Present for
|
|
38
|
-
* consistency with other destinations; has no effect at call time
|
|
39
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
40
|
-
* can reference section-prefixed keys in future custom mapping
|
|
41
|
-
* strategies without a breaking change.
|
|
35
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
36
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
42
37
|
*/
|
|
43
38
|
interface Settings {
|
|
44
39
|
apiKey: string;
|
|
@@ -47,20 +42,21 @@ type InitSettings = Partial<Settings>;
|
|
|
47
42
|
/**
|
|
48
43
|
* Per-rule mapping settings.
|
|
49
44
|
*
|
|
50
|
-
* conversion
|
|
45
|
+
* conversion: mapping value resolving to an object with short keys:
|
|
51
46
|
* { id (required), value?, currency?, eventId? }
|
|
52
47
|
*
|
|
53
48
|
* `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).
|
|
54
49
|
* Other keys translate 1:1 to the vendor parameter names.
|
|
55
50
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
51
|
+
* A rule without `conversion` makes no call: LinkedIn is an opt-in
|
|
52
|
+
* conversion model. A `conversion` that resolves to no `id` fails the push
|
|
53
|
+
* with `missing-input`.
|
|
58
54
|
*/
|
|
59
55
|
interface Mapping {
|
|
60
56
|
conversion?: Mapping$1.Value;
|
|
61
57
|
}
|
|
62
58
|
/**
|
|
63
|
-
* Env
|
|
59
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
64
60
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
65
61
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
66
62
|
* a spy to skip the script injection path.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DestinationWeb } from '@walkeros/web-core';
|
|
|
4
4
|
/**
|
|
5
5
|
* LinkedIn Insight Tag runtime surface.
|
|
6
6
|
*
|
|
7
|
-
* The Insight Tag script installs `window.lintrk
|
|
7
|
+
* The Insight Tag script installs `window.lintrk`, a single function that
|
|
8
8
|
* accepts exactly one tracked action: `lintrk('track', data)`.
|
|
9
9
|
*
|
|
10
10
|
* Before the script loads, the destination installs a queue-backed shim so
|
|
@@ -32,13 +32,8 @@ declare global {
|
|
|
32
32
|
/**
|
|
33
33
|
* Destination-level settings.
|
|
34
34
|
*
|
|
35
|
-
* apiKey
|
|
36
|
-
*
|
|
37
|
-
* include — event sections made available for mapping resolution. Present for
|
|
38
|
-
* consistency with other destinations; has no effect at call time
|
|
39
|
-
* because `lintrk()` only accepts four fixed fields. Kept so users
|
|
40
|
-
* can reference section-prefixed keys in future custom mapping
|
|
41
|
-
* strategies without a breaking change.
|
|
35
|
+
* apiKey: the LinkedIn Partner ID (numeric string, e.g. "123456"), assigned
|
|
36
|
+
* to `window._linkedin_partner_id` before the script loads.
|
|
42
37
|
*/
|
|
43
38
|
interface Settings {
|
|
44
39
|
apiKey: string;
|
|
@@ -47,20 +42,21 @@ type InitSettings = Partial<Settings>;
|
|
|
47
42
|
/**
|
|
48
43
|
* Per-rule mapping settings.
|
|
49
44
|
*
|
|
50
|
-
* conversion
|
|
45
|
+
* conversion: mapping value resolving to an object with short keys:
|
|
51
46
|
* { id (required), value?, currency?, eventId? }
|
|
52
47
|
*
|
|
53
48
|
* `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).
|
|
54
49
|
* Other keys translate 1:1 to the vendor parameter names.
|
|
55
50
|
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
51
|
+
* A rule without `conversion` makes no call: LinkedIn is an opt-in
|
|
52
|
+
* conversion model. A `conversion` that resolves to no `id` fails the push
|
|
53
|
+
* with `missing-input`.
|
|
58
54
|
*/
|
|
59
55
|
interface Mapping {
|
|
60
56
|
conversion?: Mapping$1.Value;
|
|
61
57
|
}
|
|
62
58
|
/**
|
|
63
|
-
* Env
|
|
59
|
+
* Env: mock surface for tests and dev. The destination mutates
|
|
64
60
|
* `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and
|
|
65
61
|
* installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with
|
|
66
62
|
* a spy to skip the script injection path.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import {\n getMappingValue,\n isNumber,\n isObject,\n isString,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\nimport type { Destination, Lintrk, LintrkTrackData, Mapping } from './types';\n\n// Types export\nexport * as DestinationLinkedIn from './types';\n\n/**\n * LinkedIn Insight Tag web destination.\n *\n * Loads the LinkedIn Insight Tag script from LinkedIn's CDN and forwards\n * explicit conversions via `window.lintrk('track', ...)`. Opt-in: events\n * without `mapping.settings.conversion` produce zero calls.\n *\n * See `/workspaces/developer/docs/research/linkedin-destination-guide.md`.\n */\n\nconst LINKEDIN_SCRIPT_SRC =\n 'https://snap.licdn.com/li.lms-analytics/insight.min.js';\n\n/**\n * Install the LinkedIn `window.lintrk` queue shim. Mirrors the official\n * snippet: any call made before the CDN script loads is pushed to a queue\n * the script processes once it initializes.\n *\n * Idempotent - if `lintrk` is already installed (e.g. another tag installed\n * it), leave the existing function alone.\n */\nfunction installLintrkQueue(env?: DestinationWeb.Env): void {\n const { window } = getEnv(env);\n if (window.lintrk) return;\n const lintrk: Lintrk = Object.assign(\n (...args: unknown[]) => {\n (lintrk.q ||= []).push(args);\n },\n { q: [] },\n );\n window.lintrk = lintrk;\n}\n\nfunction setPartnerGlobals(\n env: DestinationWeb.Env | undefined,\n partnerId: string,\n): void {\n const { window } = getEnv(env);\n window._linkedin_partner_id = partnerId;\n const ids = (window._linkedin_data_partner_ids ||= []);\n if (!ids.includes(partnerId)) ids.push(partnerId);\n}\n\n/**\n * The Insight Tag script `loadVendor` injects with `loadScript`. lintrk\n * replays its own queue, so it is called synchronously and only a failed\n * script is reported.\n */\nfunction vendor(\n config: { loadScript?: boolean; timeout?: number },\n env?: DestinationWeb.Env,\n) {\n return loadVendor(\n config.loadScript ? LINKEDIN_SCRIPT_SRC : undefined,\n () => getEnv(env).window.lintrk,\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n/**\n * Resolve the short-key walkerOS mapping shape into a LintrkTrackData object.\n *\n * Input (already resolved via getMappingValue):\n * { id, value?, currency?, eventId? }\n *\n * Output (vendor API shape):\n * { conversion_id, conversion_value?, currency?, event_id? }\n *\n * Null/falsy guards:\n * - id must resolve to a truthy number → otherwise return undefined (skip call)\n * - other fields are omitted when falsy\n */\nfunction buildLintrkData(resolved: unknown): LintrkTrackData | undefined {\n if (!isObject(resolved)) return undefined;\n\n const { id, value, currency, eventId } = resolved;\n\n // id must be a truthy number (Campaign Manager conversion_id).\n // Accept numeric strings by coercion - users may supply { value: \"12345\" }.\n const numericId = isNumber(id)\n ? id\n : isString(id) && id !== '' && !Number.isNaN(Number(id))\n ? Number(id)\n : undefined;\n if (numericId === undefined || numericId === 0) return undefined;\n\n const data: LintrkTrackData = { conversion_id: numericId };\n\n // conversion_value - accept number or numeric string; omit if falsy/NaN.\n if (isNumber(value)) {\n data.conversion_value = value;\n } else if (isString(value) && value !== '') {\n const n = Number(value);\n if (!Number.isNaN(n)) data.conversion_value = n;\n }\n\n // currency - string only; omit if falsy.\n if (isString(currency) && currency !== '') {\n data.currency = currency;\n }\n\n // event_id - string only; omit if falsy.\n if (isString(eventId) && eventId !== '') {\n data.event_id = eventId;\n }\n\n return data;\n}\n\nexport const destinationLinkedIn: Destination = {\n type: 'linkedin',\n\n config: {},\n\n init({ config, env }) {\n const settings = config.settings;\n if (!settings?.apiKey)\n throw new StepError('LinkedIn needs settings.apiKey', { code: 'config' });\n\n setPartnerGlobals(env, settings.apiKey);\n installLintrkQueue(env);\n\n // Script injection is opt-in via config.loadScript (same default as\n // plausible / meta). Users who already embed the Insight Tag snippet in\n // their HTML should leave loadScript false - the destination only\n // installs the queue shim and mutates _linkedin_partner_id.\n vendor(config, env);\n\n return config;\n },\n\n async push(event, { config, rule, env, collector }) {\n vendor(config, env).check();\n\n const { lintrk } = getEnv(env).window;\n if (!lintrk)\n throw new StepError('LinkedIn Insight Tag not ready: lintrk is missing', {\n code: 'vendor-not-ready',\n });\n\n const mappingSettings: Mapping = rule?.settings || {};\n\n // Opt-in: a rule without a conversion makes no call. Honor rule-level\n // silent (core flag at packages/core/src/types/mapping.ts) the same way.\n if (rule?.silent !== true && mappingSettings.conversion !== undefined) {\n const resolved = await getMappingValue(\n event,\n mappingSettings.conversion,\n { collector },\n );\n\n const data = buildLintrkData(resolved);\n if (!data)\n throw new StepError(\n 'LinkedIn conversion mapping resolved to no conversion id',\n { code: 'missing-input' },\n );\n\n await stepCall(\n () => lintrk('track', data),\n 'transport',\n 'LinkedIn lintrk call failed',\n );\n }\n },\n\n on(type, { config, data, env }) {\n if (type !== 'consent' || !isObject(data)) return;\n\n // LinkedIn has no vendor consent mode. The collector's config.consent gate\n // is the sole mechanism for blocking events. This handler exists for a\n // narrow case: config.loadScript was true BUT marketing consent was\n // initially denied, so init() did not run. When consent later grants\n // marketing, the script is injected; loadVendor injects it once per page.\n if (!config.loadScript) return;\n if (data.marketing !== true) return;\n\n vendor(config, env);\n },\n};\n\nexport default destinationLinkedIn;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\n/**\n * LinkedIn Insight Tag runtime surface.\n *\n * The Insight Tag script installs `window.lintrk` — a single function that\n * accepts exactly one tracked action: `lintrk('track', data)`.\n *\n * Before the script loads, the destination installs a queue-backed shim so\n * calls made during init are buffered and flushed once the script loads.\n * This mirrors the pattern LinkedIn's own snippet uses.\n */\nexport type LintrkAction = 'track';\n\nexport interface LintrkTrackData {\n conversion_id: number;\n conversion_value?: number;\n currency?: string;\n event_id?: string;\n}\n\nexport type Lintrk = ((action: LintrkAction, data: LintrkTrackData) => void) & {\n /** Internal queue populated before the CDN script loads. */\n q?: unknown[];\n};\n\ndeclare global {\n interface Window {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n }\n}\n\n/**\n * Destination-level settings.\n *\n * apiKey — the LinkedIn Partner ID (numeric string, e.g. \"123456\"), assigned\n * to `window._linkedin_partner_id` before the script loads.\n * include — event sections made available for mapping resolution. Present for\n * consistency with other destinations; has no effect at call time\n * because `lintrk()` only accepts four fixed fields. Kept so users\n * can reference section-prefixed keys in future custom mapping\n * strategies without a breaking change.\n */\nexport interface Settings {\n apiKey: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\n/**\n * Per-rule mapping settings.\n *\n * conversion — mapping value resolving to an object with short keys:\n * { id (required), value?, currency?, eventId? }\n *\n * `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).\n * Other keys translate 1:1 to the vendor parameter names.\n *\n * Events without a resolved `conversion.id` are silently ignored — LinkedIn\n * is an opt-in conversion model.\n */\nexport interface Mapping {\n conversion?: WalkerOSMapping.Value;\n}\n\n/**\n * Env — mock surface for tests and dev. The destination mutates\n * `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and\n * installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with\n * a spy to skip the script injection path.\n */\nexport interface Env extends DestinationWeb.Env {\n window: {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface LinkedInDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAOO;AAEP,sBAAmC;;;ACTnC;;;ADyBA,IAAM,sBACJ;AAUF,SAAS,mBAAmB,KAAgC;AAC1D,QAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,MAAI,OAAO,OAAQ;AACnB,QAAM,SAAiB,OAAO;AAAA,IAC5B,IAAI,SAAoB;AACtB,OAAC,OAAO,MAAP,OAAO,IAAM,CAAC,IAAG,KAAK,IAAI;AAAA,IAC7B;AAAA,IACA,EAAE,GAAG,CAAC,EAAE;AAAA,EACV;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,kBACP,KACA,WACM;AACN,QAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,SAAO,uBAAuB;AAC9B,QAAM,MAAO,OAAO,+BAAP,OAAO,6BAA+B,CAAC;AACpD,MAAI,CAAC,IAAI,SAAS,SAAS,EAAG,KAAI,KAAK,SAAS;AAClD;AAOA,SAAS,OACP,QACA,KACA;AACA,aAAO;AAAA,IACL,OAAO,aAAa,sBAAsB;AAAA,I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AAG,EAAE,MAAM;AAE1B,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG,EAAE;AAC/B,QAAI,CAAC;AACH,YAAM,IAAI,sBAAU,qDAAqD;AAAA,QACvE,MAAM;AAAA,MACR,CAAC;AAEH,UAAM,mBAA2B,6BAAM,aAAY,CAAC;AAIpD,SAAI,6BAAM,YAAW,QAAQ,gBAAgB,eAAe,QAAW;AACrE,YAAM,WAAW,UAAM;AAAA,QACrB;AAAA,QACA,gBAAgB;AAAA,QAChB,EAAE,UAAU;AAAA,MACd;AAEA,YAAM,OAAO,gBAAgB,QAAQ;AACrC,UAAI,CAAC;AACH,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,MAAM,gBAAgB;AAAA,QAC1B;AAEF,gBAAM;AAAA,QACJ,MAAM,OAAO,SAAS,IAAI;AAAA,QAC1B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,GAAG,MAAM,EAAE,QAAQ,MAAM,IAAI,GAAG;AAC9B,QAAI,SAAS,aAAa,KAAC,sBAAS,IAAI,EAAG;AAO3C,QAAI,CAAC,OAAO,WAAY;AACxB,QAAI,KAAK,cAAc,KAAM;AAE7B,WAAO,QAAQ,GAAG;AAAA,EACpB;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import {\n getMappingValue,\n isNumber,\n isObject,\n isString,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\nimport type { Destination, Lintrk, LintrkTrackData, Mapping } from './types';\n\n// Types export\nexport * as DestinationLinkedIn from './types';\n\n/**\n * LinkedIn Insight Tag web destination.\n *\n * Loads the LinkedIn Insight Tag script from LinkedIn's CDN and forwards\n * explicit conversions via `window.lintrk('track', ...)`. Opt-in: events\n * without `mapping.settings.conversion` produce zero calls.\n */\n\nconst LINKEDIN_SCRIPT_SRC =\n 'https://snap.licdn.com/li.lms-analytics/insight.min.js';\n\n/**\n * Install the LinkedIn `window.lintrk` queue shim. Mirrors the official\n * snippet: any call made before the CDN script loads is pushed to a queue\n * the script processes once it initializes.\n *\n * Idempotent - if `lintrk` is already installed (e.g. another tag installed\n * it), leave the existing function alone.\n */\nfunction installLintrkQueue(env?: DestinationWeb.Env): void {\n const { window } = getEnv(env);\n if (window.lintrk) return;\n const lintrk: Lintrk = Object.assign(\n (...args: unknown[]) => {\n (lintrk.q ||= []).push(args);\n },\n { q: [] },\n );\n window.lintrk = lintrk;\n}\n\nfunction setPartnerGlobals(\n env: DestinationWeb.Env | undefined,\n partnerId: string,\n): void {\n const { window } = getEnv(env);\n window._linkedin_partner_id = partnerId;\n const ids = (window._linkedin_data_partner_ids ||= []);\n if (!ids.includes(partnerId)) ids.push(partnerId);\n}\n\n/**\n * The Insight Tag script `loadVendor` injects with `loadScript`. lintrk\n * replays its own queue, so it is called synchronously and only a failed\n * script is reported.\n */\nfunction vendor(\n config: { loadScript?: boolean; timeout?: number },\n env?: DestinationWeb.Env,\n) {\n return loadVendor(\n config.loadScript ? LINKEDIN_SCRIPT_SRC : undefined,\n () => getEnv(env).window.lintrk,\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n/**\n * Resolve the short-key walkerOS mapping shape into a LintrkTrackData object.\n *\n * Input (already resolved via getMappingValue):\n * { id, value?, currency?, eventId? }\n *\n * Output (vendor API shape):\n * { conversion_id, conversion_value?, currency?, event_id? }\n *\n * Null/falsy guards:\n * - id must resolve to a truthy number → otherwise return undefined (skip call)\n * - other fields are omitted when falsy\n */\nfunction buildLintrkData(resolved: unknown): LintrkTrackData | undefined {\n if (!isObject(resolved)) return undefined;\n\n const { id, value, currency, eventId } = resolved;\n\n // id must be a truthy number (Campaign Manager conversion_id).\n // Accept numeric strings by coercion - users may supply { value: \"12345\" }.\n const numericId = isNumber(id)\n ? id\n : isString(id) && id !== '' && !Number.isNaN(Number(id))\n ? Number(id)\n : undefined;\n if (numericId === undefined || numericId === 0) return undefined;\n\n const data: LintrkTrackData = { conversion_id: numericId };\n\n // conversion_value - accept number or numeric string; omit if falsy/NaN.\n if (isNumber(value)) {\n data.conversion_value = value;\n } else if (isString(value) && value !== '') {\n const n = Number(value);\n if (!Number.isNaN(n)) data.conversion_value = n;\n }\n\n // currency - string only; omit if falsy.\n if (isString(currency) && currency !== '') {\n data.currency = currency;\n }\n\n // event_id - string only; omit if falsy.\n if (isString(eventId) && eventId !== '') {\n data.event_id = eventId;\n }\n\n return data;\n}\n\nexport const destinationLinkedIn: Destination = {\n type: 'linkedin',\n\n config: {},\n\n init({ config, env }) {\n const settings = config.settings;\n if (!settings?.apiKey)\n throw new StepError('LinkedIn needs settings.apiKey', { code: 'config' });\n\n setPartnerGlobals(env, settings.apiKey);\n installLintrkQueue(env);\n\n // Script injection is opt-in via config.loadScript (same default as\n // plausible / meta). Users who already embed the Insight Tag snippet in\n // their HTML should leave loadScript false - the destination only\n // installs the queue shim and mutates _linkedin_partner_id.\n vendor(config, env);\n\n return config;\n },\n\n async push(event, { config, rule, env, collector }) {\n vendor(config, env).check();\n\n const { lintrk } = getEnv(env).window;\n if (!lintrk)\n throw new StepError('LinkedIn Insight Tag not ready: lintrk is missing', {\n code: 'vendor-not-ready',\n });\n\n const mappingSettings: Mapping = rule?.settings || {};\n\n // Opt-in: a rule without a conversion makes no call. Honor rule-level\n // silent (core flag at packages/core/src/types/mapping.ts) the same way.\n if (rule?.silent !== true && mappingSettings.conversion !== undefined) {\n const resolved = await getMappingValue(\n event,\n mappingSettings.conversion,\n { collector },\n );\n\n const data = buildLintrkData(resolved);\n if (!data)\n throw new StepError(\n 'LinkedIn conversion mapping resolved to no conversion id',\n { code: 'missing-input' },\n );\n\n await stepCall(\n () => lintrk('track', data),\n 'transport',\n 'LinkedIn lintrk call failed',\n );\n }\n },\n\n on(type, { config, data, env }) {\n if (type !== 'consent' || !isObject(data)) return;\n\n // LinkedIn has no vendor consent mode. The collector's config.consent gate\n // is the sole mechanism for blocking events. This handler exists for a\n // narrow case: config.loadScript was true BUT marketing consent was\n // initially denied, so init() did not run. When consent later grants\n // marketing, the script is injected; loadVendor injects it once per page.\n if (!config.loadScript) return;\n if (data.marketing !== true) return;\n\n vendor(config, env);\n },\n};\n\nexport default destinationLinkedIn;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\n/**\n * LinkedIn Insight Tag runtime surface.\n *\n * The Insight Tag script installs `window.lintrk`, a single function that\n * accepts exactly one tracked action: `lintrk('track', data)`.\n *\n * Before the script loads, the destination installs a queue-backed shim so\n * calls made during init are buffered and flushed once the script loads.\n * This mirrors the pattern LinkedIn's own snippet uses.\n */\nexport type LintrkAction = 'track';\n\nexport interface LintrkTrackData {\n conversion_id: number;\n conversion_value?: number;\n currency?: string;\n event_id?: string;\n}\n\nexport type Lintrk = ((action: LintrkAction, data: LintrkTrackData) => void) & {\n /** Internal queue populated before the CDN script loads. */\n q?: unknown[];\n};\n\ndeclare global {\n interface Window {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n }\n}\n\n/**\n * Destination-level settings.\n *\n * apiKey: the LinkedIn Partner ID (numeric string, e.g. \"123456\"), assigned\n * to `window._linkedin_partner_id` before the script loads.\n */\nexport interface Settings {\n apiKey: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\n/**\n * Per-rule mapping settings.\n *\n * conversion: mapping value resolving to an object with short keys:\n * { id (required), value?, currency?, eventId? }\n *\n * `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).\n * Other keys translate 1:1 to the vendor parameter names.\n *\n * A rule without `conversion` makes no call: LinkedIn is an opt-in\n * conversion model. A `conversion` that resolves to no `id` fails the push\n * with `missing-input`.\n */\nexport interface Mapping {\n conversion?: WalkerOSMapping.Value;\n}\n\n/**\n * Env: mock surface for tests and dev. The destination mutates\n * `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and\n * installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with\n * a spy to skip the script injection path.\n */\nexport interface Env extends DestinationWeb.Env {\n window: {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface LinkedInDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAOO;AAEP,sBAAmC;;;ACTnC;;;ADuBA,IAAM,sBACJ;AAUF,SAAS,mBAAmB,KAAgC;AAC1D,QAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,MAAI,OAAO,OAAQ;AACnB,QAAM,SAAiB,OAAO;AAAA,IAC5B,IAAI,SAAoB;AACtB,OAAC,OAAO,MAAP,OAAO,IAAM,CAAC,IAAG,KAAK,IAAI;AAAA,IAC7B;AAAA,IACA,EAAE,GAAG,CAAC,EAAE;AAAA,EACV;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,kBACP,KACA,WACM;AACN,QAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,SAAO,uBAAuB;AAC9B,QAAM,MAAO,OAAO,+BAAP,OAAO,6BAA+B,CAAC;AACpD,MAAI,CAAC,IAAI,SAAS,SAAS,EAAG,KAAI,KAAK,SAAS;AAClD;AAOA,SAAS,OACP,QACA,KACA;AACA,aAAO;AAAA,IACL,OAAO,aAAa,sBAAsB;AAAA,IAC1C,UAAM,wBAAO,GAAG,EAAE,OAAO;AAAA,IACzB,EAAE,SAAS,OAAO,SAAS,cAAU,wBAAO,GAAG,EA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M,IAAI,sBAAU,qDAAqD;AAAA,QACvE,MAAM;AAAA,MACR,CAAC;AAEH,UAAM,mBAA2B,6BAAM,aAAY,CAAC;AAIpD,SAAI,6BAAM,YAAW,QAAQ,gBAAgB,eAAe,QAAW;AACrE,YAAM,WAAW,UAAM;AAAA,QACrB;AAAA,QACA,gBAAgB;AAAA,QAChB,EAAE,UAAU;AAAA,MACd;AAEA,YAAM,OAAO,gBAAgB,QAAQ;AACrC,UAAI,CAAC;AACH,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,MAAM,gBAAgB;AAAA,QAC1B;AAEF,gBAAM;AAAA,QACJ,MAAM,OAAO,SAAS,IAAI;AAAA,QAC1B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,GAAG,MAAM,EAAE,QAAQ,MAAM,IAAI,GAAG;AAC9B,QAAI,SAAS,aAAa,KAAC,sBAAS,IAAI,EAAG;AAO3C,QAAI,CAAC,OAAO,WAAY;AACxB,QAAI,KAAK,cAAc,KAAM;AAE7B,WAAO,QAAQ,GAAG;AAAA,EACpB;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import {\n getMappingValue,\n isNumber,\n isObject,\n isString,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\nimport type { Destination, Lintrk, LintrkTrackData, Mapping } from './types';\n\n// Types export\nexport * as DestinationLinkedIn from './types';\n\n/**\n * LinkedIn Insight Tag web destination.\n *\n * Loads the LinkedIn Insight Tag script from LinkedIn's CDN and forwards\n * explicit conversions via `window.lintrk('track', ...)`. Opt-in: events\n * without `mapping.settings.conversion` produce zero calls.\n *\n * See `/workspaces/developer/docs/research/linkedin-destination-guide.md`.\n */\n\nconst LINKEDIN_SCRIPT_SRC =\n 'https://snap.licdn.com/li.lms-analytics/insight.min.js';\n\n/**\n * Install the LinkedIn `window.lintrk` queue shim. Mirrors the official\n * snippet: any call made before the CDN script loads is pushed to a queue\n * the script processes once it initializes.\n *\n * Idempotent - if `lintrk` is already installed (e.g. another tag installed\n * it), leave the existing function alone.\n */\nfunction installLintrkQueue(env?: DestinationWeb.Env): void {\n const { window } = getEnv(env);\n if (window.lintrk) return;\n const lintrk: Lintrk = Object.assign(\n (...args: unknown[]) => {\n (lintrk.q ||= []).push(args);\n },\n { q: [] },\n );\n window.lintrk = lintrk;\n}\n\nfunction setPartnerGlobals(\n env: DestinationWeb.Env | undefined,\n partnerId: string,\n): void {\n const { window } = getEnv(env);\n window._linkedin_partner_id = partnerId;\n const ids = (window._linkedin_data_partner_ids ||= []);\n if (!ids.includes(partnerId)) ids.push(partnerId);\n}\n\n/**\n * The Insight Tag script `loadVendor` injects with `loadScript`. lintrk\n * replays its own queue, so it is called synchronously and only a failed\n * script is reported.\n */\nfunction vendor(\n config: { loadScript?: boolean; timeout?: number },\n env?: DestinationWeb.Env,\n) {\n return loadVendor(\n config.loadScript ? LINKEDIN_SCRIPT_SRC : undefined,\n () => getEnv(env).window.lintrk,\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n/**\n * Resolve the short-key walkerOS mapping shape into a LintrkTrackData object.\n *\n * Input (already resolved via getMappingValue):\n * { id, value?, currency?, eventId? }\n *\n * Output (vendor API shape):\n * { conversion_id, conversion_value?, currency?, event_id? }\n *\n * Null/falsy guards:\n * - id must resolve to a truthy number → otherwise return undefined (skip call)\n * - other fields are omitted when falsy\n */\nfunction buildLintrkData(resolved: unknown): LintrkTrackData | undefined {\n if (!isObject(resolved)) return undefined;\n\n const { id, value, currency, eventId } = resolved;\n\n // id must be a truthy number (Campaign Manager conversion_id).\n // Accept numeric strings by coercion - users may supply { value: \"12345\" }.\n const numericId = isNumber(id)\n ? id\n : isString(id) && id !== '' && !Number.isNaN(Number(id))\n ? Number(id)\n : undefined;\n if (numericId === undefined || numericId === 0) return undefined;\n\n const data: LintrkTrackData = { conversion_id: numericId };\n\n // conversion_value - accept number or numeric string; omit if falsy/NaN.\n if (isNumber(value)) {\n data.conversion_value = value;\n } else if (isString(value) && value !== '') {\n const n = Number(value);\n if (!Number.isNaN(n)) data.conversion_value = n;\n }\n\n // currency - string only; omit if falsy.\n if (isString(currency) && currency !== '') {\n data.currency = currency;\n }\n\n // event_id - string only; omit if falsy.\n if (isString(eventId) && eventId !== '') {\n data.event_id = eventId;\n }\n\n return data;\n}\n\nexport const destinationLinkedIn: Destination = {\n type: 'linkedin',\n\n config: {},\n\n init({ config, env }) {\n const settings = config.settings;\n if (!settings?.apiKey)\n throw new StepError('LinkedIn needs settings.apiKey', { code: 'config' });\n\n setPartnerGlobals(env, settings.apiKey);\n installLintrkQueue(env);\n\n // Script injection is opt-in via config.loadScript (same default as\n // plausible / meta). Users who already embed the Insight Tag snippet in\n // their HTML should leave loadScript false - the destination only\n // installs the queue shim and mutates _linkedin_partner_id.\n vendor(config, env);\n\n return config;\n },\n\n async push(event, { config, rule, env, collector }) {\n vendor(config, env).check();\n\n const { lintrk } = getEnv(env).window;\n if (!lintrk)\n throw new StepError('LinkedIn Insight Tag not ready: lintrk is missing', {\n code: 'vendor-not-ready',\n });\n\n const mappingSettings: Mapping = rule?.settings || {};\n\n // Opt-in: a rule without a conversion makes no call. Honor rule-level\n // silent (core flag at packages/core/src/types/mapping.ts) the same way.\n if (rule?.silent !== true && mappingSettings.conversion !== undefined) {\n const resolved = await getMappingValue(\n event,\n mappingSettings.conversion,\n { collector },\n );\n\n const data = buildLintrkData(resolved);\n if (!data)\n throw new StepError(\n 'LinkedIn conversion mapping resolved to no conversion id',\n { code: 'missing-input' },\n );\n\n await stepCall(\n () => lintrk('track', data),\n 'transport',\n 'LinkedIn lintrk call failed',\n );\n }\n },\n\n on(type, { config, data, env }) {\n if (type !== 'consent' || !isObject(data)) return;\n\n // LinkedIn has no vendor consent mode. The collector's config.consent gate\n // is the sole mechanism for blocking events. This handler exists for a\n // narrow case: config.loadScript was true BUT marketing consent was\n // initially denied, so init() did not run. When consent later grants\n // marketing, the script is injected; loadVendor injects it once per page.\n if (!config.loadScript) return;\n if (data.marketing !== true) return;\n\n vendor(config, env);\n },\n};\n\nexport default destinationLinkedIn;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\n/**\n * LinkedIn Insight Tag runtime surface.\n *\n * The Insight Tag script installs `window.lintrk` — a single function that\n * accepts exactly one tracked action: `lintrk('track', data)`.\n *\n * Before the script loads, the destination installs a queue-backed shim so\n * calls made during init are buffered and flushed once the script loads.\n * This mirrors the pattern LinkedIn's own snippet uses.\n */\nexport type LintrkAction = 'track';\n\nexport interface LintrkTrackData {\n conversion_id: number;\n conversion_value?: number;\n currency?: string;\n event_id?: string;\n}\n\nexport type Lintrk = ((action: LintrkAction, data: LintrkTrackData) => void) & {\n /** Internal queue populated before the CDN script loads. */\n q?: unknown[];\n};\n\ndeclare global {\n interface Window {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n }\n}\n\n/**\n * Destination-level settings.\n *\n * apiKey — the LinkedIn Partner ID (numeric string, e.g. \"123456\"), assigned\n * to `window._linkedin_partner_id` before the script loads.\n * include — event sections made available for mapping resolution. Present for\n * consistency with other destinations; has no effect at call time\n * because `lintrk()` only accepts four fixed fields. Kept so users\n * can reference section-prefixed keys in future custom mapping\n * strategies without a breaking change.\n */\nexport interface Settings {\n apiKey: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\n/**\n * Per-rule mapping settings.\n *\n * conversion — mapping value resolving to an object with short keys:\n * { id (required), value?, currency?, eventId? }\n *\n * `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).\n * Other keys translate 1:1 to the vendor parameter names.\n *\n * Events without a resolved `conversion.id` are silently ignored — LinkedIn\n * is an opt-in conversion model.\n */\nexport interface Mapping {\n conversion?: WalkerOSMapping.Value;\n}\n\n/**\n * Env — mock surface for tests and dev. The destination mutates\n * `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and\n * installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with\n * a spy to skip the script injection path.\n */\nexport interface Env extends DestinationWeb.Env {\n window: {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface LinkedInDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,QAAQ,kBAAkB;;;ACTnC;;;ADyBA,IAAM,sBACJ;AAUF,SAAS,mBAAmB,KAAgC;AAC1D,QAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,MAAI,OAAO,OAAQ;AACnB,QAAM,SAAiB,OAAO;AAAA,IAC5B,IAAI,SAAoB;AACtB,OAAC,OAAO,MAAP,OAAO,IAAM,CAAC,IAAG,KAAK,IAAI;AAAA,IAC7B;AAAA,IACA,EAAE,GAAG,CAAC,EAAE;AAAA,EACV;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,kBACP,KACA,WACM;AACN,QAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,SAAO,uBAAuB;AAC9B,QAAM,MAAO,OAAO,+BAAP,OAAO,6BAA+B,CAAC;AACpD,MAAI,CAAC,IAAI,SAAS,SAAS,EAAG,KAAI,KAAK,SAAS;AAClD;AAOA,SAAS,OACP,QACA,KACA;AACA,SAAO;AAAA,IACL,OAAO,aAAa,sBAAsB;A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AE,MAAM;AAE1B,UAAM,EAAE,OAAO,IAAI,OAAO,GAAG,EAAE;AAC/B,QAAI,CAAC;AACH,YAAM,IAAI,UAAU,qDAAqD;AAAA,QACvE,MAAM;AAAA,MACR,CAAC;AAEH,UAAM,mBAA2B,6BAAM,aAAY,CAAC;AAIpD,SAAI,6BAAM,YAAW,QAAQ,gBAAgB,eAAe,QAAW;AACrE,YAAM,WAAW,MAAM;AAAA,QACrB;AAAA,QACA,gBAAgB;AAAA,QAChB,EAAE,UAAU;AAAA,MACd;AAEA,YAAM,OAAO,gBAAgB,QAAQ;AACrC,UAAI,CAAC;AACH,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,MAAM,gBAAgB;AAAA,QAC1B;AAEF,YAAM;AAAA,QACJ,MAAM,OAAO,SAAS,IAAI;AAAA,QAC1B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,GAAG,MAAM,EAAE,QAAQ,MAAM,IAAI,GAAG;AAC9B,QAAI,SAAS,aAAa,CAAC,SAAS,IAAI,EAAG;AAO3C,QAAI,CAAC,OAAO,WAAY;AACxB,QAAI,KAAK,cAAc,KAAM;AAE7B,WAAO,QAAQ,GAAG;AAAA,EACpB;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import {\n getMappingValue,\n isNumber,\n isObject,\n isString,\n StepError,\n stepCall,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getEnv, loadVendor } from '@walkeros/web-core';\nimport type { Destination, Lintrk, LintrkTrackData, Mapping } from './types';\n\n// Types export\nexport * as DestinationLinkedIn from './types';\n\n/**\n * LinkedIn Insight Tag web destination.\n *\n * Loads the LinkedIn Insight Tag script from LinkedIn's CDN and forwards\n * explicit conversions via `window.lintrk('track', ...)`. Opt-in: events\n * without `mapping.settings.conversion` produce zero calls.\n */\n\nconst LINKEDIN_SCRIPT_SRC =\n 'https://snap.licdn.com/li.lms-analytics/insight.min.js';\n\n/**\n * Install the LinkedIn `window.lintrk` queue shim. Mirrors the official\n * snippet: any call made before the CDN script loads is pushed to a queue\n * the script processes once it initializes.\n *\n * Idempotent - if `lintrk` is already installed (e.g. another tag installed\n * it), leave the existing function alone.\n */\nfunction installLintrkQueue(env?: DestinationWeb.Env): void {\n const { window } = getEnv(env);\n if (window.lintrk) return;\n const lintrk: Lintrk = Object.assign(\n (...args: unknown[]) => {\n (lintrk.q ||= []).push(args);\n },\n { q: [] },\n );\n window.lintrk = lintrk;\n}\n\nfunction setPartnerGlobals(\n env: DestinationWeb.Env | undefined,\n partnerId: string,\n): void {\n const { window } = getEnv(env);\n window._linkedin_partner_id = partnerId;\n const ids = (window._linkedin_data_partner_ids ||= []);\n if (!ids.includes(partnerId)) ids.push(partnerId);\n}\n\n/**\n * The Insight Tag script `loadVendor` injects with `loadScript`. lintrk\n * replays its own queue, so it is called synchronously and only a failed\n * script is reported.\n */\nfunction vendor(\n config: { loadScript?: boolean; timeout?: number },\n env?: DestinationWeb.Env,\n) {\n return loadVendor(\n config.loadScript ? LINKEDIN_SCRIPT_SRC : undefined,\n () => getEnv(env).window.lintrk,\n { timeout: config.timeout, document: getEnv(env).document },\n );\n}\n\n/**\n * Resolve the short-key walkerOS mapping shape into a LintrkTrackData object.\n *\n * Input (already resolved via getMappingValue):\n * { id, value?, currency?, eventId? }\n *\n * Output (vendor API shape):\n * { conversion_id, conversion_value?, currency?, event_id? }\n *\n * Null/falsy guards:\n * - id must resolve to a truthy number → otherwise return undefined (skip call)\n * - other fields are omitted when falsy\n */\nfunction buildLintrkData(resolved: unknown): LintrkTrackData | undefined {\n if (!isObject(resolved)) return undefined;\n\n const { id, value, currency, eventId } = resolved;\n\n // id must be a truthy number (Campaign Manager conversion_id).\n // Accept numeric strings by coercion - users may supply { value: \"12345\" }.\n const numericId = isNumber(id)\n ? id\n : isString(id) && id !== '' && !Number.isNaN(Number(id))\n ? Number(id)\n : undefined;\n if (numericId === undefined || numericId === 0) return undefined;\n\n const data: LintrkTrackData = { conversion_id: numericId };\n\n // conversion_value - accept number or numeric string; omit if falsy/NaN.\n if (isNumber(value)) {\n data.conversion_value = value;\n } else if (isString(value) && value !== '') {\n const n = Number(value);\n if (!Number.isNaN(n)) data.conversion_value = n;\n }\n\n // currency - string only; omit if falsy.\n if (isString(currency) && currency !== '') {\n data.currency = currency;\n }\n\n // event_id - string only; omit if falsy.\n if (isString(eventId) && eventId !== '') {\n data.event_id = eventId;\n }\n\n return data;\n}\n\nexport const destinationLinkedIn: Destination = {\n type: 'linkedin',\n\n config: {},\n\n init({ config, env }) {\n const settings = config.settings;\n if (!settings?.apiKey)\n throw new StepError('LinkedIn needs settings.apiKey', { code: 'config' });\n\n setPartnerGlobals(env, settings.apiKey);\n installLintrkQueue(env);\n\n // Script injection is opt-in via config.loadScript (same default as\n // plausible / meta). Users who already embed the Insight Tag snippet in\n // their HTML should leave loadScript false - the destination only\n // installs the queue shim and mutates _linkedin_partner_id.\n vendor(config, env);\n\n return config;\n },\n\n async push(event, { config, rule, env, collector }) {\n vendor(config, env).check();\n\n const { lintrk } = getEnv(env).window;\n if (!lintrk)\n throw new StepError('LinkedIn Insight Tag not ready: lintrk is missing', {\n code: 'vendor-not-ready',\n });\n\n const mappingSettings: Mapping = rule?.settings || {};\n\n // Opt-in: a rule without a conversion makes no call. Honor rule-level\n // silent (core flag at packages/core/src/types/mapping.ts) the same way.\n if (rule?.silent !== true && mappingSettings.conversion !== undefined) {\n const resolved = await getMappingValue(\n event,\n mappingSettings.conversion,\n { collector },\n );\n\n const data = buildLintrkData(resolved);\n if (!data)\n throw new StepError(\n 'LinkedIn conversion mapping resolved to no conversion id',\n { code: 'missing-input' },\n );\n\n await stepCall(\n () => lintrk('track', data),\n 'transport',\n 'LinkedIn lintrk call failed',\n );\n }\n },\n\n on(type, { config, data, env }) {\n if (type !== 'consent' || !isObject(data)) return;\n\n // LinkedIn has no vendor consent mode. The collector's config.consent gate\n // is the sole mechanism for blocking events. This handler exists for a\n // narrow case: config.loadScript was true BUT marketing consent was\n // initially denied, so init() did not run. When consent later grants\n // marketing, the script is injected; loadVendor injects it once per page.\n if (!config.loadScript) return;\n if (data.marketing !== true) return;\n\n vendor(config, env);\n },\n};\n\nexport default destinationLinkedIn;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\n/**\n * LinkedIn Insight Tag runtime surface.\n *\n * The Insight Tag script installs `window.lintrk`, a single function that\n * accepts exactly one tracked action: `lintrk('track', data)`.\n *\n * Before the script loads, the destination installs a queue-backed shim so\n * calls made during init are buffered and flushed once the script loads.\n * This mirrors the pattern LinkedIn's own snippet uses.\n */\nexport type LintrkAction = 'track';\n\nexport interface LintrkTrackData {\n conversion_id: number;\n conversion_value?: number;\n currency?: string;\n event_id?: string;\n}\n\nexport type Lintrk = ((action: LintrkAction, data: LintrkTrackData) => void) & {\n /** Internal queue populated before the CDN script loads. */\n q?: unknown[];\n};\n\ndeclare global {\n interface Window {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n }\n}\n\n/**\n * Destination-level settings.\n *\n * apiKey: the LinkedIn Partner ID (numeric string, e.g. \"123456\"), assigned\n * to `window._linkedin_partner_id` before the script loads.\n */\nexport interface Settings {\n apiKey: string;\n}\n\nexport type InitSettings = Partial<Settings>;\n\n/**\n * Per-rule mapping settings.\n *\n * conversion: mapping value resolving to an object with short keys:\n * { id (required), value?, currency?, eventId? }\n *\n * `id` becomes `conversion_id` (number, Campaign Manager conversion rule ID).\n * Other keys translate 1:1 to the vendor parameter names.\n *\n * A rule without `conversion` makes no call: LinkedIn is an opt-in\n * conversion model. A `conversion` that resolves to no `id` fails the push\n * with `missing-input`.\n */\nexport interface Mapping {\n conversion?: WalkerOSMapping.Value;\n}\n\n/**\n * Env: mock surface for tests and dev. The destination mutates\n * `window._linkedin_partner_id` / `window._linkedin_data_partner_ids` and\n * installs `window.lintrk` in init; tests can pre-seed `window.lintrk` with\n * a spy to skip the script injection path.\n */\nexport interface Env extends DestinationWeb.Env {\n window: {\n _linkedin_partner_id?: string;\n _linkedin_data_partner_ids?: string[];\n lintrk?: Lintrk;\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env, InitSettings>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport interface LinkedInDestination extends Destination {\n env?: Env;\n}\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,QAAQ,kBAAkB;;;ACTnC;;;ADuBA,IAAM,sBACJ;AAUF,SAAS,mBAAmB,KAAgC;AAC1D,QAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,MAAI,OAAO,OAAQ;AACnB,QAAM,SAAiB,OAAO;AAAA,IAC5B,IAAI,SAAoB;AACtB,OAAC,OAAO,MAAP,OAAO,IAAM,CAAC,IAAG,KAAK,IAAI;AAAA,IAC7B;AAAA,IACA,EAAE,GAAG,CAAC,EAAE;AAAA,EACV;AACA,SAAO,SAAS;AAClB;AAEA,SAAS,kBACP,KACA,WACM;AACN,QAAM,EAAE,OAAO,IAAI,OAAO,GAAG;AAC7B,SAAO,uBAAuB;AAC9B,QAAM,MAAO,OAAO,+BAAP,OAAO,6BAA+B,CAAC;AACpD,MAAI,CAAC,IAAI,SAAS,SAAS,EAAG,KAAI,KAAK,SAAS;AAClD;AAOA,SAAS,OACP,QACA,KACA;AACA,SAAO;AAAA,IACL,OAAO,aAAa,sBAAsB;AAAA,IAC1C,MAAM,OAAO,GAAG,EAAE,OAAO;AAAA,IACzB,EAAE,SAAS,OAAO,SAAS,UAAU,OAAO,GAAG,EA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U,qDAAqD;AAAA,QACvE,MAAM;AAAA,MACR,CAAC;AAEH,UAAM,mBAA2B,6BAAM,aAAY,CAAC;AAIpD,SAAI,6BAAM,YAAW,QAAQ,gBAAgB,eAAe,QAAW;AACrE,YAAM,WAAW,MAAM;AAAA,QACrB;AAAA,QACA,gBAAgB;AAAA,QAChB,EAAE,UAAU;AAAA,MACd;AAEA,YAAM,OAAO,gBAAgB,QAAQ;AACrC,UAAI,CAAC;AACH,cAAM,IAAI;AAAA,UACR;AAAA,UACA,EAAE,MAAM,gBAAgB;AAAA,QAC1B;AAEF,YAAM;AAAA,QACJ,MAAM,OAAO,SAAS,IAAI;AAAA,QAC1B;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,GAAG,MAAM,EAAE,QAAQ,MAAM,IAAI,GAAG;AAC9B,QAAI,SAAS,aAAa,CAAC,SAAS,IAAI,EAAG;AAO3C,QAAI,CAAC,OAAO,WAAY;AACxB,QAAI,KAAK,cAAc,KAAM;AAE7B,WAAO,QAAQ,GAAG;AAAA,EACpB;AACF;AAEA,IAAO,gBAAQ;","names":[]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-linkedin",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.3-next-1793115089237",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"type": "object",
|
|
17
17
|
"properties": {
|
|
18
18
|
"conversion": {
|
|
19
|
-
"description": "Resolves to a LinkedIn conversion object with short keys: { id (required number
|
|
19
|
+
"description": "Resolves to a LinkedIn conversion object with short keys: { id (required number, the Campaign Manager conversion_id), value? (number), currency? (ISO code), eventId? (string, the same event id the server LinkedIn destination sends, for deduplication) }. A rule whose conversion resolves to no id makes no lintrk call and fails the push with missing-input."
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"additionalProperties": false
|
|
@@ -58,6 +58,14 @@
|
|
|
58
58
|
"call:window.lintrk"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
+
"minimal": {
|
|
62
|
+
"settings": {
|
|
63
|
+
"apiKey": "123456"
|
|
64
|
+
},
|
|
65
|
+
"config": {
|
|
66
|
+
"loadScript": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
61
69
|
"step": {
|
|
62
70
|
"consentRevoke": {
|
|
63
71
|
"public": false,
|
|
@@ -110,7 +118,7 @@
|
|
|
110
118
|
"consent": {
|
|
111
119
|
"functional": true
|
|
112
120
|
},
|
|
113
|
-
"id": "
|
|
121
|
+
"id": "0a60eca539911b21",
|
|
114
122
|
"trigger": "test",
|
|
115
123
|
"entity": "form",
|
|
116
124
|
"action": "submit",
|
|
@@ -259,7 +267,7 @@
|
|
|
259
267
|
"consent": {
|
|
260
268
|
"functional": true
|
|
261
269
|
},
|
|
262
|
-
"id": "
|
|
270
|
+
"id": "57f058bcd4ae4580",
|
|
263
271
|
"trigger": "test",
|
|
264
272
|
"entity": "form",
|
|
265
273
|
"action": "submit",
|
|
@@ -295,9 +303,10 @@
|
|
|
295
303
|
"data": {
|
|
296
304
|
"id": "0rd3r1d",
|
|
297
305
|
"currency": "EUR",
|
|
306
|
+
"value": 462,
|
|
307
|
+
"tax": 73.76,
|
|
298
308
|
"shipping": 5.22,
|
|
299
|
-
"
|
|
300
|
-
"value": 555
|
|
309
|
+
"total": 467.22
|
|
301
310
|
},
|
|
302
311
|
"context": {
|
|
303
312
|
"shopping": [
|
|
@@ -403,7 +412,7 @@
|
|
|
403
412
|
"track",
|
|
404
413
|
{
|
|
405
414
|
"conversion_id": 67890,
|
|
406
|
-
"conversion_value":
|
|
415
|
+
"conversion_value": 462,
|
|
407
416
|
"currency": "EUR",
|
|
408
417
|
"event_id": "1700000102abcdef"
|
|
409
418
|
}
|
|
@@ -494,9 +503,10 @@
|
|
|
494
503
|
"data": {
|
|
495
504
|
"id": "0rd3r1d",
|
|
496
505
|
"currency": "EUR",
|
|
506
|
+
"value": 462,
|
|
507
|
+
"tax": 73.76,
|
|
497
508
|
"shipping": 5.22,
|
|
498
|
-
"
|
|
499
|
-
"value": 555
|
|
509
|
+
"total": 467.22
|
|
500
510
|
},
|
|
501
511
|
"context": {
|
|
502
512
|
"shopping": [
|
|
@@ -646,7 +656,7 @@
|
|
|
646
656
|
"consent": {
|
|
647
657
|
"functional": true
|
|
648
658
|
},
|
|
649
|
-
"id": "
|
|
659
|
+
"id": "0ff335f982bbb29d",
|
|
650
660
|
"trigger": "test",
|
|
651
661
|
"entity": "form",
|
|
652
662
|
"action": "submit",
|
|
@@ -689,7 +699,8 @@
|
|
|
689
699
|
"name": "Everyday Ruck Snack",
|
|
690
700
|
"color": "black",
|
|
691
701
|
"size": "l",
|
|
692
|
-
"price": 420
|
|
702
|
+
"price": 420,
|
|
703
|
+
"currency": "EUR"
|
|
693
704
|
},
|
|
694
705
|
"context": {
|
|
695
706
|
"shopping": [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-linkedin",
|
|
3
3
|
"description": "LinkedIn Insight Tag web destination for walkerOS (conversion tracking, retargeting, demographic insights)",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.3-next-1793115089237",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.8.
|
|
42
|
-
"@walkeros/web-core": "4.8.
|
|
41
|
+
"@walkeros/core": "4.8.3-next-1793115089237",
|
|
42
|
+
"@walkeros/web-core": "4.8.3-next-1793115089237"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@walkeros/collector": "4.8.
|
|
45
|
+
"@walkeros/collector": "4.8.3-next-1793115089237"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|