@walkeros/web-destination-posthog 4.7.2 → 4.8.0-next-1791441510508
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 +13 -0
- package/README.md +5 -1
- package/dist/dev.d.mts +2 -2
- package/dist/dev.d.ts +2 -2
- 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 +2 -2
- package/dist/examples/index.d.ts +2 -2
- package/dist/examples/index.js +7 -7
- package/dist/examples/index.mjs +7 -7
- package/dist/walkerOS.json +23 -23
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @walkeros/web-destination-posthog
|
|
2
2
|
|
|
3
|
+
## 4.8.0-next-1791441510508
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5593d7b: The `capture_heatmaps` and `capture_exceptions` descriptions now say
|
|
8
|
+
that, when unset, the PostHog project setting decides. The `identify` and
|
|
9
|
+
`group` descriptions say when the calls repeat. The step examples name the
|
|
10
|
+
destination config they rely on, and the login example uses a millisecond
|
|
11
|
+
timestamp.
|
|
12
|
+
- Updated dependencies [5593d7b]
|
|
13
|
+
- @walkeros/core@4.8.0-next-1791441510508
|
|
14
|
+
- @walkeros/web-core@4.8.0-next-1791441510508
|
|
15
|
+
|
|
3
16
|
## 4.7.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
package/dist/dev.d.mts
CHANGED
|
@@ -166,12 +166,12 @@ declare const defaultEventForwarding: PostHogStepExample;
|
|
|
166
166
|
*/
|
|
167
167
|
declare const wildcardIgnored: PostHogStepExample;
|
|
168
168
|
/**
|
|
169
|
-
* Destination-level
|
|
169
|
+
* Destination-level include (config.include) flattens the walkerOS `data` section
|
|
170
170
|
* into prefixed capture() properties on every push.
|
|
171
171
|
*/
|
|
172
172
|
declare const destinationLevelInclude: PostHogStepExample;
|
|
173
173
|
/**
|
|
174
|
-
* Per-rule
|
|
174
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
175
175
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
176
176
|
* overrides it with `globals` only.
|
|
177
177
|
*/
|
package/dist/dev.d.ts
CHANGED
|
@@ -166,12 +166,12 @@ declare const defaultEventForwarding: PostHogStepExample;
|
|
|
166
166
|
*/
|
|
167
167
|
declare const wildcardIgnored: PostHogStepExample;
|
|
168
168
|
/**
|
|
169
|
-
* Destination-level
|
|
169
|
+
* Destination-level include (config.include) flattens the walkerOS `data` section
|
|
170
170
|
* into prefixed capture() properties on every push.
|
|
171
171
|
*/
|
|
172
172
|
declare const destinationLevelInclude: PostHogStepExample;
|
|
173
173
|
/**
|
|
174
|
-
* Per-rule
|
|
174
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
175
175
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
176
176
|
* overrides it with `globals` only.
|
|
177
177
|
*/
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},s={};n(s,{examples:()=>h,schemas:()=>r}),module.exports=(e=s,((e,n,s,r)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let p of a(n))i.call(e,p)||p===s||t(e,p,{get:()=>n[p],enumerable:!(r=o(n,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};n(r,{MappingSchema:()=>u,SettingsSchema:()=>c,mapping:()=>m,settings:()=>g});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('Your PostHog project API key (starts with "phc_"). Find it in your PostHog project settings under "Project API Key" (like phc_a1b2c3d4e5f6789012345678abcdef12).'),api_host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.").optional(),ui_host:l.z.string().describe("URL of the PostHog UI host, used by toolbar and replay player. Default: null.").optional(),persistence:l.z.enum(["localStorage+cookie","cookie","localStorage","sessionStorage","memory"]).describe('Where to persist user identity. Default: "localStorage+cookie".').optional(),person_profiles:l.z.enum(["always","never","identified_only"]).describe('When to create person profiles. "identified_only" (default) creates profiles only after identify() is called.').optional(),autocapture:l.z.boolean().describe("Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).").optional(),capture_pageview:l.z.union([l.z.boolean(),l.z.literal("history_change")]).describe("Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).").optional(),capture_pageleave:l.z.union([l.z.boolean(),l.z.literal("if_capture_pageview")]).describe("Whether PostHog should auto-capture pageleave events. Default: false.").optional(),capture_heatmaps:l.z.boolean().describe("Enable heatmap data capture. Default:
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,o)=>{for(var a in o)t(e,a,{get:o[a],enumerable:!0})},s={};n(s,{examples:()=>h,schemas:()=>r}),module.exports=(e=s,((e,n,s,r)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let p of a(n))i.call(e,p)||p===s||t(e,p,{get:()=>n[p],enumerable:!(r=o(n,p))||r.enumerable});return e})(t({},"__esModule",{value:!0}),e));var r={};n(r,{MappingSchema:()=>u,SettingsSchema:()=>c,mapping:()=>m,settings:()=>g});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),c=l.z.object({apiKey:l.z.string().min(1).describe('Your PostHog project API key (starts with "phc_"). Find it in your PostHog project settings under "Project API Key" (like phc_a1b2c3d4e5f6789012345678abcdef12).'),api_host:l.z.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.").optional(),ui_host:l.z.string().describe("URL of the PostHog UI host, used by toolbar and replay player. Default: null.").optional(),persistence:l.z.enum(["localStorage+cookie","cookie","localStorage","sessionStorage","memory"]).describe('Where to persist user identity. Default: "localStorage+cookie".').optional(),person_profiles:l.z.enum(["always","never","identified_only"]).describe('When to create person profiles. "identified_only" (default) creates profiles only after identify() is called.').optional(),autocapture:l.z.boolean().describe("Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).").optional(),capture_pageview:l.z.union([l.z.boolean(),l.z.literal("history_change")]).describe("Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).").optional(),capture_pageleave:l.z.union([l.z.boolean(),l.z.literal("if_capture_pageview")]).describe("Whether PostHog should auto-capture pageleave events. Default: false.").optional(),capture_heatmaps:l.z.boolean().describe("Enable heatmap data capture. Default: unset, which follows the heatmaps setting of the PostHog project.").optional(),capture_exceptions:l.z.boolean().describe("Enable automatic exception capture. Default: unset, which follows the exception autocapture setting of the PostHog project.").optional(),disable_surveys:l.z.boolean().describe("Disable PostHog surveys. Default: false.").optional(),disable_session_recording:l.z.boolean().describe("Disable session recording. Default: false.").optional(),advanced_disable_flags:l.z.boolean().describe("Disable feature flag loading. Default: false.").optional(),cookieless_mode:l.z.enum(["always","on_reject"]).describe('"always" never uses cookies/localStorage. "on_reject" falls back to cookieless when consent is rejected.').optional(),debug:l.z.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),session_recording:l.z.unknown().describe("Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.").optional(),bootstrap:l.z.unknown().describe("SSR bootstrap data. { distinctID?, featureFlags? } pre-populates identity and flag values to avoid first-render flicker.").optional(),identify:l.z.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push: posthog.identify fires when distinctId changes, and on every push while $set or $set_once are present.").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push: posthog.group fires when type or key changes, and on every push while properties are present.").optional()}),d=require("@walkeros/core/dev"),u=d.z.object({identify:d.z.unknown().describe("Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).").optional(),group:d.z.unknown().describe("Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).").optional(),reset:d.z.unknown().describe("Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.").optional()}),g=(0,p.zodToSchema)(c),m=(0,p.zodToSchema)(u),h={};n(h,{env:()=>y,step:()=>k});var y={};n(y,{init:()=>b,push:()=>_,simulation:()=>w});var f=()=>{},v={init:()=>v,capture:f,identify:f,setPersonProperties:f,group:f,reset:f,opt_in_capturing:f,opt_out_capturing:f},b={posthog:{...v}},_={posthog:{...v}},w=["call:posthog.init","call:posthog.capture","call:posthog.identify","call:posthog.setPersonProperties","call:posthog.group","call:posthog.reset","call:posthog.opt_in_capturing","call:posthog.opt_out_capturing"],k={};n(k,{consentGrantOptIn:()=>$,consentRevokeOptOut:()=>W,defaultEventForwarding:()=>z,destinationLevelIdentify:()=>j,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>R,orderCompleteWithInclude:()=>A,profileUpdateSetPersonProperties:()=>H,ruleIncludeReplaces:()=>D,userLoginIdentify:()=>E,userLogoutReset:()=>O,wildcardIgnored:()=>I});var P=require("@walkeros/core"),z={title:"Default capture",description:"A walker event becomes a PostHog capture call with the event name and empty properties.",in:(0,P.getEvent)("product view",{timestamp:1700000100}),out:[["posthog.capture","product view",{}]]},I={public:!1,in:(0,P.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.",in:(0,P.getEvent)("product view",{timestamp:1700000102}),configInclude:["data"],out:[["posthog.capture","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},D={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:(0,P.getEvent)("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["posthog.capture","order complete",{globals_pagegroup:"shop"}]]},j={title:"Destination identify",description:"With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.",in:(0,P.getEvent)("page view",{timestamp:1700000104}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["posthog.identify","us3r"],["posthog.capture","page view",{}]]},E={title:"User login identify",description:"A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",in:(0,P.getEvent)("user login",{timestamp:1700000105e3,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium",company:"Acme",source:"organic"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan",company:"data.company"}},$set_once:{map:{first_login:"timestamp",signup_source:"data.source"}}}}}},out:[["posthog.identify","new-user-123",{email:"user@acme.com",plan:"premium",company:"Acme"},{first_login:1700000105e3,signup_source:"organic"}]]},H={title:"Set person properties",description:"A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.",in:(0,P.getEvent)("profile update",{timestamp:1700000106,data:{name:"Jane Doe",avatar_url:"https://example.com/avatar.png"}}),mapping:{settings:{identify:{map:{$set:{map:{name:"data.name",avatar:"data.avatar_url"}}}}}},out:[["posthog.setPersonProperties",{name:"Jane Doe",avatar:"https://example.com/avatar.png"},void 0],["posthog.capture","profile update",{}]]},O={title:"User logout reset",description:"A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.",in:(0,P.getEvent)("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["posthog.reset"]]},R={title:"Group assignment",description:"A company update assigns the user to a PostHog group and sets group properties via posthog.group.",in:(0,P.getEvent)("company update",{timestamp:1700000108,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise",size:50}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan",employee_count:"data.size"}}}}}},out:[["posthog.group","company","company_123",{name:"Acme",plan:"enterprise",employee_count:50}]]},A={title:"Order complete",description:"An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.",in:(0,P.getEvent)("order complete",{timestamp:1700000109}),mapping:{include:["data","globals"]},out:[["posthog.capture","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},W={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["posthog.opt_in_capturing"],["posthog.opt_out_capturing"]]},$={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.",command:"consent",in:{analytics:!0},settings:{},out:[["posthog.opt_in_capturing"]]};//# 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.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your PostHog project API key (starts with \"phc_\"). Find it in your PostHog project settings under \"Project API Key\" (like phc_a1b2c3d4e5f6789012345678abcdef12).',\n ),\n api_host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.',\n )\n .optional(),\n ui_host: z\n .string()\n .describe(\n 'URL of the PostHog UI host, used by toolbar and replay player. Default: null.',\n )\n .optional(),\n persistence: z\n .enum([\n 'localStorage+cookie',\n 'cookie',\n 'localStorage',\n 'sessionStorage',\n 'memory',\n ])\n .describe('Where to persist user identity. Default: \"localStorage+cookie\".')\n .optional(),\n person_profiles: z\n .enum(['always', 'never', 'identified_only'])\n .describe(\n 'When to create person profiles. \"identified_only\" (default) creates profiles only after identify() is called.',\n )\n .optional(),\n autocapture: z\n .boolean()\n .describe(\n \"Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).\",\n )\n .optional(),\n capture_pageview: z\n .union([z.boolean(), z.literal('history_change')])\n .describe(\n 'Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).',\n )\n .optional(),\n capture_pageleave: z\n .union([z.boolean(), z.literal('if_capture_pageview')])\n .describe(\n 'Whether PostHog should auto-capture pageleave events. Default: false.',\n )\n .optional(),\n capture_heatmaps: z\n .boolean()\n .describe('Enable heatmap data capture. Default: true (PostHog default).')\n .optional(),\n capture_exceptions: z\n .boolean()\n .describe('Enable automatic exception capture. Default: false.')\n .optional(),\n disable_surveys: z\n .boolean()\n .describe('Disable PostHog surveys. Default: false.')\n .optional(),\n disable_session_recording: z\n .boolean()\n .describe('Disable session recording. Default: false.')\n .optional(),\n advanced_disable_flags: z\n .boolean()\n .describe('Disable feature flag loading. Default: false.')\n .optional(),\n cookieless_mode: z\n .enum(['always', 'on_reject'])\n .describe(\n '\"always\" never uses cookies/localStorage. \"on_reject\" falls back to cookieless when consent is rejected.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n session_recording: z\n .unknown()\n .describe(\n 'Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.',\n )\n .optional(),\n bootstrap: z\n .unknown()\n .describe(\n 'SSR bootstrap data. { distinctID?, featureFlags? } — pre-populates identity and flag values to avoid first-render flicker.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on first push and re-fired when distinctId changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.',\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, PostHogSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Shared no-op SDK. Tests clone and overwrite individual methods with\n * jest.fn() via the spyEnv() helper in the test runner.\n */\nconst noopSDK: PostHogSDK = {\n init: (() => noopSDK) as PostHogSDK['init'],\n capture: noop,\n identify: noop,\n setPersonProperties: noop,\n group: noop,\n reset: noop,\n opt_in_capturing: noop,\n opt_out_capturing: noop,\n};\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n posthog: { ...noopSDK },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n posthog: { ...noopSDK },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:posthog.init',\n 'call:posthog.capture',\n 'call:posthog.identify',\n 'call:posthog.setPersonProperties',\n 'call:posthog.group',\n 'call:posthog.reset',\n 'call:posthog.opt_in_capturing',\n 'call:posthog.opt_out_capturing',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner reads `settings` from the example and merges them\n * into the base destination settings on top of the fixed apiKey.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * posthog.capture(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['posthog.capture', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: PostHogStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed capture() properties on every push.\n */\nexport const destinationLevelInclude: PostHogStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed PostHog capture properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'posthog.capture',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: PostHogStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push (once the\n * state cache is empty). The destination calls posthog.identify() and\n * tracks the resolved distinctId in runtime state; subsequent pushes\n * with unchanged values do NOT re-fire identify().\n *\n * With NO $set/$set_once keys in the resolved object, posthog.identify\n * is called with just the distinctId.\n */\nexport const destinationLevelIdentify: PostHogStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls posthog.identify with the user id before firing the default capture.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [\n ['posthog.identify', 'us3r'],\n ['posthog.capture', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full PostHog identity vocabulary.\n * This is the \"user login\" pattern: set a new distinctId and enrich\n * person properties. `silent: true` suppresses the default posthog.capture()\n * call because we're running identity side effects only.\n *\n * PostHog identify signature:\n * posthog.identify(distinctId, $set, $set_once)\n */\nexport const userLoginIdentify: PostHogStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n source: 'organic',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n signup_source: 'data.source',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n },\n {\n first_login: 1700000105,\n signup_source: 'organic',\n },\n ],\n ],\n};\n\n/**\n * Person-properties-only update - when the resolved identify object has\n * NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)\n * instead of identify(). This is the \"profile update\" pattern: enrich\n * user properties without changing identity.\n *\n * `silent` defaults to false here - we intentionally ALSO capture a\n * \"profile update\" event so it shows up in PostHog's event stream.\n */\nexport const profileUpdateSetPersonProperties: PostHogStepExample = {\n title: 'Set person properties',\n description:\n 'A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Doe',\n avatar_url: 'https://example.com/avatar.png',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n $set: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.setPersonProperties',\n {\n name: 'Jane Doe',\n avatar: 'https://example.com/avatar.png',\n },\n undefined,\n ],\n ['posthog.capture', 'profile update', {}],\n ],\n};\n\n/**\n * User logout - reset: true fires posthog.reset(), which clears the\n * distinct ID and generates a new anonymous one. `silent: true` because\n * we're only running the reset side effect, no default capture().\n */\nexport const userLogoutReset: PostHogStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['posthog.reset']],\n};\n\n/**\n * Group assignment + group properties. PostHog's group analytics (paid)\n * aggregates events by company / team / project. The destination resolves\n * `settings.group` to { type, key, properties? } and calls\n * posthog.group(type, key, properties). `silent: true` keeps this a\n * pure side-effect rule - no \"company update\" capture().\n */\nexport const groupAssignmentWithProperties: PostHogStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a PostHog group and sets group properties via posthog.group.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n size: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.size',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.group',\n 'company',\n 'company_123',\n {\n name: 'Acme',\n plan: 'enterprise',\n employee_count: 50,\n },\n ],\n ],\n};\n\n/**\n * Order complete - PostHog has no dedicated revenue API. Revenue tracking\n * is just a capture() call with the revenue properties in data. This\n * example pairs `include: [\"data\", \"globals\"]` with a destination-level\n * capture. The order total, shipping, currency, etc. all become\n * data_* properties on the PostHog event.\n */\nexport const orderCompleteWithInclude: PostHogStepExample = {\n title: 'Order complete',\n description:\n 'An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.',\n in: getEvent('order complete', { timestamp: 1700000109 }),\n mapping: {\n include: ['data', 'globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → posthog.opt_out_capturing(). The destination checks\n * the consent key declared in config.consent (here \"analytics\") and\n * toggles accordingly. opt_out_capturing() stops capture, session\n * replay, AND survey rendering.\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing'], ['posthog.opt_out_capturing']],\n};\n\n/**\n * Consent granted → posthog.opt_in_capturing(). Called without arguments\n * by default (the SDK fires its own $opt_in event).\n */\nexport const consentGrantOptIn: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing']],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,aACP,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,KAAK;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACA,SAAS,iEAAiE,EAC1E,SAAS;AAAA,EACZ,iBAAiB,aACd,KAAK,CAAC,UAAU,SAAS,iBAAiB,CAAC,EAC3C;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,aACV,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,kBAAkB,aACf,MAAM,CAAC,aAAE,QAAQ,GAAG,aAAE,QAAQ,gBAAgB,CAAC,CAAC,EAChD;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,mBAAmB,aAChB,MAAM,CAAC,aAAE,QAAQ,GAAG,aAAE,QAAQ,qBAAqB,CAAC,CAAC,EACrD;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,kBAAkB,aACf,QAAQ,EACR,SAAS,+DAA+D,EACxE,SAAS;AAAA,EACZ,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AAY;AAAA,YACV,KAAK;AAAA,cACH,MAAM;AAAA,cACN,MAAM;AAAA,cACN,gBAAgB;AAAA,YAClB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,gBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACF;AASO,IAAM,2BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,kBAAkB,EAAE,WAAW,WAAW,CAAC;AAAA,EACxD,SAAS;AAAA,IACP,SAAS,CAAC,QAAQ,SAAS;AAAA,EAC7B;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,eAAe;AAAA,QACf,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,sBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,GAAG,CAAC,2BAA2B,CAAC;AACnE;AAMO,IAAM,oBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,CAAC;AACpC;","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"],"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.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your PostHog project API key (starts with \"phc_\"). Find it in your PostHog project settings under \"Project API Key\" (like phc_a1b2c3d4e5f6789012345678abcdef12).',\n ),\n api_host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.',\n )\n .optional(),\n ui_host: z\n .string()\n .describe(\n 'URL of the PostHog UI host, used by toolbar and replay player. Default: null.',\n )\n .optional(),\n persistence: z\n .enum([\n 'localStorage+cookie',\n 'cookie',\n 'localStorage',\n 'sessionStorage',\n 'memory',\n ])\n .describe('Where to persist user identity. Default: \"localStorage+cookie\".')\n .optional(),\n person_profiles: z\n .enum(['always', 'never', 'identified_only'])\n .describe(\n 'When to create person profiles. \"identified_only\" (default) creates profiles only after identify() is called.',\n )\n .optional(),\n autocapture: z\n .boolean()\n .describe(\n \"Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).\",\n )\n .optional(),\n capture_pageview: z\n .union([z.boolean(), z.literal('history_change')])\n .describe(\n 'Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).',\n )\n .optional(),\n capture_pageleave: z\n .union([z.boolean(), z.literal('if_capture_pageview')])\n .describe(\n 'Whether PostHog should auto-capture pageleave events. Default: false.',\n )\n .optional(),\n capture_heatmaps: z\n .boolean()\n .describe(\n 'Enable heatmap data capture. Default: unset, which follows the heatmaps setting of the PostHog project.',\n )\n .optional(),\n capture_exceptions: z\n .boolean()\n .describe(\n 'Enable automatic exception capture. Default: unset, which follows the exception autocapture setting of the PostHog project.',\n )\n .optional(),\n disable_surveys: z\n .boolean()\n .describe('Disable PostHog surveys. Default: false.')\n .optional(),\n disable_session_recording: z\n .boolean()\n .describe('Disable session recording. Default: false.')\n .optional(),\n advanced_disable_flags: z\n .boolean()\n .describe('Disable feature flag loading. Default: false.')\n .optional(),\n cookieless_mode: z\n .enum(['always', 'on_reject'])\n .describe(\n '\"always\" never uses cookies/localStorage. \"on_reject\" falls back to cookieless when consent is rejected.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n session_recording: z\n .unknown()\n .describe(\n 'Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.',\n )\n .optional(),\n bootstrap: z\n .unknown()\n .describe(\n 'SSR bootstrap data. { distinctID?, featureFlags? } pre-populates identity and flag values to avoid first-render flicker.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push: posthog.identify fires when distinctId changes, and on every push while $set or $set_once are present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push: posthog.group fires when type or key changes, and on every push while properties are present.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.',\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, PostHogSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Shared no-op SDK. Tests clone and overwrite individual methods with\n * jest.fn() via the spyEnv() helper in the test runner.\n */\nconst noopSDK: PostHogSDK = {\n init: (() => noopSDK) as PostHogSDK['init'],\n capture: noop,\n identify: noop,\n setPersonProperties: noop,\n group: noop,\n reset: noop,\n opt_in_capturing: noop,\n opt_out_capturing: noop,\n};\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n posthog: { ...noopSDK },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n posthog: { ...noopSDK },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:posthog.init',\n 'call:posthog.capture',\n 'call:posthog.identify',\n 'call:posthog.setPersonProperties',\n 'call:posthog.group',\n 'call:posthog.reset',\n 'call:posthog.opt_in_capturing',\n 'call:posthog.opt_out_capturing',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner reads `settings` from the example and merges them\n * into the base destination settings on top of the fixed apiKey.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * posthog.capture(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['posthog.capture', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: PostHogStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data` section\n * into prefixed capture() properties on every push.\n */\nexport const destinationLevelInclude: PostHogStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'posthog.capture',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: PostHogStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.\",\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push (once the\n * state cache is empty). The destination calls posthog.identify() and\n * tracks the resolved distinctId in runtime state; subsequent pushes\n * with unchanged values do NOT re-fire identify().\n *\n * With NO $set/$set_once keys in the resolved object, posthog.identify\n * is called with just the distinctId.\n */\nexport const destinationLevelIdentify: PostHogStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [\n ['posthog.identify', 'us3r'],\n ['posthog.capture', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full PostHog identity vocabulary.\n * This is the \"user login\" pattern: set a new distinctId and enrich\n * person properties. `silent: true` suppresses the default posthog.capture()\n * call because we're running identity side effects only.\n *\n * PostHog identify signature:\n * posthog.identify(distinctId, $set, $set_once)\n */\nexport const userLoginIdentify: PostHogStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.',\n in: getEvent('user login', {\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n source: 'organic',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n signup_source: 'data.source',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n },\n {\n first_login: 1700000105000,\n signup_source: 'organic',\n },\n ],\n ],\n};\n\n/**\n * Person-properties-only update - when the resolved identify object has\n * NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)\n * instead of identify(). This is the \"profile update\" pattern: enrich\n * user properties without changing identity.\n *\n * `silent` defaults to false here - we intentionally ALSO capture a\n * \"profile update\" event so it shows up in PostHog's event stream.\n */\nexport const profileUpdateSetPersonProperties: PostHogStepExample = {\n title: 'Set person properties',\n description:\n 'A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Doe',\n avatar_url: 'https://example.com/avatar.png',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n $set: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.setPersonProperties',\n {\n name: 'Jane Doe',\n avatar: 'https://example.com/avatar.png',\n },\n undefined,\n ],\n ['posthog.capture', 'profile update', {}],\n ],\n};\n\n/**\n * User logout - reset: true fires posthog.reset(), which clears the\n * distinct ID and generates a new anonymous one. `silent: true` because\n * we're only running the reset side effect, no default capture().\n */\nexport const userLogoutReset: PostHogStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['posthog.reset']],\n};\n\n/**\n * Group assignment + group properties. PostHog's group analytics (paid)\n * aggregates events by company / team / project. The destination resolves\n * `settings.group` to { type, key, properties? } and calls\n * posthog.group(type, key, properties). `silent: true` keeps this a\n * pure side-effect rule - no \"company update\" capture().\n */\nexport const groupAssignmentWithProperties: PostHogStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a PostHog group and sets group properties via posthog.group.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n size: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.size',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.group',\n 'company',\n 'company_123',\n {\n name: 'Acme',\n plan: 'enterprise',\n employee_count: 50,\n },\n ],\n ],\n};\n\n/**\n * Order complete - PostHog has no dedicated revenue API. Revenue tracking\n * is just a capture() call with the revenue properties in data. This\n * example pairs `include: [\"data\", \"globals\"]` with a destination-level\n * capture. The order total, shipping, currency, etc. all become\n * data_* properties on the PostHog event.\n */\nexport const orderCompleteWithInclude: PostHogStepExample = {\n title: 'Order complete',\n description:\n 'An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.',\n in: getEvent('order complete', { timestamp: 1700000109 }),\n mapping: {\n include: ['data', 'globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → posthog.opt_out_capturing(). The destination checks\n * the consent key declared in config.consent (here \"analytics\") and\n * toggles accordingly. opt_out_capturing() stops capture, session\n * replay, AND survey rendering.\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing'], ['posthog.opt_out_capturing']],\n};\n\n/**\n * Consent granted → posthog.opt_in_capturing(). Called without arguments\n * by default (the SDK fires its own $opt_in event).\n */\nexport const consentGrantOptIn: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing']],\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,cAA4B;;;ACA5B,iBAAkB;AAEX,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACrC,QAAQ,aACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,aACP,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,aACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aA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,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,sBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,GAAG,CAAC,2BAA2B,CAAC;AACnE;AAMO,IAAM,oBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,CAAC;AACpC;","names":["import_dev","import_dev"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,t=(t,o)=>{for(var a in o)e(t,a,{get:o[a],enumerable:!0})},o={};t(o,{MappingSchema:()=>r,SettingsSchema:()=>s,mapping:()=>l,settings:()=>p});import{zodToSchema as a}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var s=i.object({apiKey:i.string().min(1).describe('Your PostHog project API key (starts with "phc_"). Find it in your PostHog project settings under "Project API Key" (like phc_a1b2c3d4e5f6789012345678abcdef12).'),api_host:i.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.").optional(),ui_host:i.string().describe("URL of the PostHog UI host, used by toolbar and replay player. Default: null.").optional(),persistence:i.enum(["localStorage+cookie","cookie","localStorage","sessionStorage","memory"]).describe('Where to persist user identity. Default: "localStorage+cookie".').optional(),person_profiles:i.enum(["always","never","identified_only"]).describe('When to create person profiles. "identified_only" (default) creates profiles only after identify() is called.').optional(),autocapture:i.boolean().describe("Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).").optional(),capture_pageview:i.union([i.boolean(),i.literal("history_change")]).describe("Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).").optional(),capture_pageleave:i.union([i.boolean(),i.literal("if_capture_pageview")]).describe("Whether PostHog should auto-capture pageleave events. Default: false.").optional(),capture_heatmaps:i.boolean().describe("Enable heatmap data capture. Default:
|
|
1
|
+
var e=Object.defineProperty,t=(t,o)=>{for(var a in o)e(t,a,{get:o[a],enumerable:!0})},o={};t(o,{MappingSchema:()=>r,SettingsSchema:()=>s,mapping:()=>l,settings:()=>p});import{zodToSchema as a}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var s=i.object({apiKey:i.string().min(1).describe('Your PostHog project API key (starts with "phc_"). Find it in your PostHog project settings under "Project API Key" (like phc_a1b2c3d4e5f6789012345678abcdef12).'),api_host:i.string().describe("PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.").optional(),ui_host:i.string().describe("URL of the PostHog UI host, used by toolbar and replay player. Default: null.").optional(),persistence:i.enum(["localStorage+cookie","cookie","localStorage","sessionStorage","memory"]).describe('Where to persist user identity. Default: "localStorage+cookie".').optional(),person_profiles:i.enum(["always","never","identified_only"]).describe('When to create person profiles. "identified_only" (default) creates profiles only after identify() is called.').optional(),autocapture:i.boolean().describe("Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).").optional(),capture_pageview:i.union([i.boolean(),i.literal("history_change")]).describe("Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).").optional(),capture_pageleave:i.union([i.boolean(),i.literal("if_capture_pageview")]).describe("Whether PostHog should auto-capture pageleave events. Default: false.").optional(),capture_heatmaps:i.boolean().describe("Enable heatmap data capture. Default: unset, which follows the heatmaps setting of the PostHog project.").optional(),capture_exceptions:i.boolean().describe("Enable automatic exception capture. Default: unset, which follows the exception autocapture setting of the PostHog project.").optional(),disable_surveys:i.boolean().describe("Disable PostHog surveys. Default: false.").optional(),disable_session_recording:i.boolean().describe("Disable session recording. Default: false.").optional(),advanced_disable_flags:i.boolean().describe("Disable feature flag loading. Default: false.").optional(),cookieless_mode:i.enum(["always","on_reject"]).describe('"always" never uses cookies/localStorage. "on_reject" falls back to cookieless when consent is rejected.').optional(),debug:i.boolean().describe("Enable PostHog SDK debug logging. Default: false.").optional(),session_recording:i.unknown().describe("Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.").optional(),bootstrap:i.unknown().describe("SSR bootstrap data. { distinctID?, featureFlags? } pre-populates identity and flag values to avoid first-render flicker.").optional(),identify:i.unknown().describe("walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push: posthog.identify fires when distinctId changes, and on every push while $set or $set_once are present.").optional(),group:i.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push: posthog.group fires when type or key changes, and on every push while properties are present.").optional()});import{z as n}from"@walkeros/core/dev";var r=n.object({identify:n.unknown().describe("Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).").optional(),group:n.unknown().describe("Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).").optional(),reset:n.unknown().describe("Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.").optional()}),p=a(s),l=a(r),c={};t(c,{env:()=>d,step:()=>y});var d={};t(d,{init:()=>m,push:()=>h,simulation:()=>f});var u=()=>{},g={init:()=>g,capture:u,identify:u,setPersonProperties:u,group:u,reset:u,opt_in_capturing:u,opt_out_capturing:u},m={posthog:{...g}},h={posthog:{...g}},f=["call:posthog.init","call:posthog.capture","call:posthog.identify","call:posthog.setPersonProperties","call:posthog.group","call:posthog.reset","call:posthog.opt_in_capturing","call:posthog.opt_out_capturing"],y={};t(y,{consentGrantOptIn:()=>A,consentRevokeOptOut:()=>j,defaultEventForwarding:()=>b,destinationLevelIdentify:()=>P,destinationLevelInclude:()=>w,groupAssignmentWithProperties:()=>H,orderCompleteWithInclude:()=>R,profileUpdateSetPersonProperties:()=>D,ruleIncludeReplaces:()=>k,userLoginIdentify:()=>I,userLogoutReset:()=>S,wildcardIgnored:()=>v});import{getEvent as _}from"@walkeros/core";var b={title:"Default capture",description:"A walker event becomes a PostHog capture call with the event name and empty properties.",in:_("product view",{timestamp:1700000100}),out:[["posthog.capture","product view",{}]]},v={public:!1,in:_("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},w={title:"Include data",description:"With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.",in:_("product view",{timestamp:1700000102}),configInclude:["data"],out:[["posthog.capture","product view",{data_id:"ers",data_name:"Everyday Ruck Snack",data_color:"black",data_size:"l",data_price:420}]]},k={title:"Rule include overrides",description:"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",in:_("order complete",{timestamp:1700000103}),configInclude:["data"],mapping:{include:["globals"]},out:[["posthog.capture","order complete",{globals_pagegroup:"shop"}]]},P={title:"Destination identify",description:"With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.",in:_("page view",{timestamp:1700000104}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["posthog.identify","us3r"],["posthog.capture","page view",{}]]},I={title:"User login identify",description:"A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",in:_("user login",{timestamp:1700000105e3,data:{user_id:"new-user-123",email:"user@acme.com",plan:"premium",company:"Acme",source:"organic"}}),mapping:{silent:!0,settings:{identify:{map:{distinctId:"data.user_id",$set:{map:{email:"data.email",plan:"data.plan",company:"data.company"}},$set_once:{map:{first_login:"timestamp",signup_source:"data.source"}}}}}},out:[["posthog.identify","new-user-123",{email:"user@acme.com",plan:"premium",company:"Acme"},{first_login:1700000105e3,signup_source:"organic"}]]},D={title:"Set person properties",description:"A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.",in:_("profile update",{timestamp:1700000106,data:{name:"Jane Doe",avatar_url:"https://example.com/avatar.png"}}),mapping:{settings:{identify:{map:{$set:{map:{name:"data.name",avatar:"data.avatar_url"}}}}}},out:[["posthog.setPersonProperties",{name:"Jane Doe",avatar:"https://example.com/avatar.png"},void 0],["posthog.capture","profile update",{}]]},S={title:"User logout reset",description:"A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.",in:_("user logout",{timestamp:1700000107}),mapping:{silent:!0,settings:{reset:!0}},out:[["posthog.reset"]]},H={title:"Group assignment",description:"A company update assigns the user to a PostHog group and sets group properties via posthog.group.",in:_("company update",{timestamp:1700000108,data:{company_id:"company_123",company_name:"Acme",plan:"enterprise",size:50}}),mapping:{silent:!0,settings:{group:{map:{type:{value:"company"},key:"data.company_id",properties:{map:{name:"data.company_name",plan:"data.plan",employee_count:"data.size"}}}}}},out:[["posthog.group","company","company_123",{name:"Acme",plan:"enterprise",employee_count:50}]]},R={title:"Order complete",description:"An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.",in:_("order complete",{timestamp:1700000109}),mapping:{include:["data","globals"]},out:[["posthog.capture","order complete",{data_id:"0rd3r1d",data_currency:"EUR",data_shipping:5.22,data_taxes:73.76,data_total:555,globals_pagegroup:"shop"}]]},j={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.",command:"consent",before:{analytics:!0},in:{analytics:!1},settings:{},out:[["posthog.opt_in_capturing"],["posthog.opt_out_capturing"]]},A={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.",command:"consent",in:{analytics:!0},settings:{},out:[["posthog.opt_in_capturing"]]};export{c as examples,o 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.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your PostHog project API key (starts with \"phc_\"). Find it in your PostHog project settings under \"Project API Key\" (like phc_a1b2c3d4e5f6789012345678abcdef12).',\n ),\n api_host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.',\n )\n .optional(),\n ui_host: z\n .string()\n .describe(\n 'URL of the PostHog UI host, used by toolbar and replay player. Default: null.',\n )\n .optional(),\n persistence: z\n .enum([\n 'localStorage+cookie',\n 'cookie',\n 'localStorage',\n 'sessionStorage',\n 'memory',\n ])\n .describe('Where to persist user identity. Default: \"localStorage+cookie\".')\n .optional(),\n person_profiles: z\n .enum(['always', 'never', 'identified_only'])\n .describe(\n 'When to create person profiles. \"identified_only\" (default) creates profiles only after identify() is called.',\n )\n .optional(),\n autocapture: z\n .boolean()\n .describe(\n \"Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).\",\n )\n .optional(),\n capture_pageview: z\n .union([z.boolean(), z.literal('history_change')])\n .describe(\n 'Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).',\n )\n .optional(),\n capture_pageleave: z\n .union([z.boolean(), z.literal('if_capture_pageview')])\n .describe(\n 'Whether PostHog should auto-capture pageleave events. Default: false.',\n )\n .optional(),\n capture_heatmaps: z\n .boolean()\n .describe('Enable heatmap data capture. Default: true (PostHog default).')\n .optional(),\n capture_exceptions: z\n .boolean()\n .describe('Enable automatic exception capture. Default: false.')\n .optional(),\n disable_surveys: z\n .boolean()\n .describe('Disable PostHog surveys. Default: false.')\n .optional(),\n disable_session_recording: z\n .boolean()\n .describe('Disable session recording. Default: false.')\n .optional(),\n advanced_disable_flags: z\n .boolean()\n .describe('Disable feature flag loading. Default: false.')\n .optional(),\n cookieless_mode: z\n .enum(['always', 'on_reject'])\n .describe(\n '\"always\" never uses cookies/localStorage. \"on_reject\" falls back to cookieless when consent is rejected.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n session_recording: z\n .unknown()\n .describe(\n 'Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.',\n )\n .optional(),\n bootstrap: z\n .unknown()\n .describe(\n 'SSR bootstrap data. { distinctID?, featureFlags? } — pre-populates identity and flag values to avoid first-render flicker.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on first push and re-fired when distinctId changes.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.',\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, PostHogSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Shared no-op SDK. Tests clone and overwrite individual methods with\n * jest.fn() via the spyEnv() helper in the test runner.\n */\nconst noopSDK: PostHogSDK = {\n init: (() => noopSDK) as PostHogSDK['init'],\n capture: noop,\n identify: noop,\n setPersonProperties: noop,\n group: noop,\n reset: noop,\n opt_in_capturing: noop,\n opt_out_capturing: noop,\n};\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n posthog: { ...noopSDK },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n posthog: { ...noopSDK },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:posthog.init',\n 'call:posthog.capture',\n 'call:posthog.identify',\n 'call:posthog.setPersonProperties',\n 'call:posthog.group',\n 'call:posthog.reset',\n 'call:posthog.opt_in_capturing',\n 'call:posthog.opt_out_capturing',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner reads `settings` from the example and merges them\n * into the base destination settings on top of the fixed apiKey.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * posthog.capture(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['posthog.capture', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: PostHogStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level settings.include flattens the walkerOS `data` section\n * into prefixed capture() properties on every push.\n */\nexport const destinationLevelInclude: PostHogStepExample = {\n title: 'Include data',\n description:\n 'Destination-level include flattens the event data section into prefixed PostHog capture properties.',\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'posthog.capture',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule settings.include REPLACES destination-level include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: PostHogStepExample = {\n title: 'Rule include overrides',\n description:\n 'A per-rule include replaces the destination-level include so this event forwards only globals.',\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push (once the\n * state cache is empty). The destination calls posthog.identify() and\n * tracks the resolved distinctId in runtime state; subsequent pushes\n * with unchanged values do NOT re-fire identify().\n *\n * With NO $set/$set_once keys in the resolved object, posthog.identify\n * is called with just the distinctId.\n */\nexport const destinationLevelIdentify: PostHogStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls posthog.identify with the user id before firing the default capture.',\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [\n ['posthog.identify', 'us3r'],\n ['posthog.capture', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full PostHog identity vocabulary.\n * This is the \"user login\" pattern: set a new distinctId and enrich\n * person properties. `silent: true` suppresses the default posthog.capture()\n * call because we're running identity side effects only.\n *\n * PostHog identify signature:\n * posthog.identify(distinctId, $set, $set_once)\n */\nexport const userLoginIdentify: PostHogStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.',\n in: getEvent('user login', {\n timestamp: 1700000105,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n source: 'organic',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n signup_source: 'data.source',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n },\n {\n first_login: 1700000105,\n signup_source: 'organic',\n },\n ],\n ],\n};\n\n/**\n * Person-properties-only update - when the resolved identify object has\n * NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)\n * instead of identify(). This is the \"profile update\" pattern: enrich\n * user properties without changing identity.\n *\n * `silent` defaults to false here - we intentionally ALSO capture a\n * \"profile update\" event so it shows up in PostHog's event stream.\n */\nexport const profileUpdateSetPersonProperties: PostHogStepExample = {\n title: 'Set person properties',\n description:\n 'A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Doe',\n avatar_url: 'https://example.com/avatar.png',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n $set: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.setPersonProperties',\n {\n name: 'Jane Doe',\n avatar: 'https://example.com/avatar.png',\n },\n undefined,\n ],\n ['posthog.capture', 'profile update', {}],\n ],\n};\n\n/**\n * User logout - reset: true fires posthog.reset(), which clears the\n * distinct ID and generates a new anonymous one. `silent: true` because\n * we're only running the reset side effect, no default capture().\n */\nexport const userLogoutReset: PostHogStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['posthog.reset']],\n};\n\n/**\n * Group assignment + group properties. PostHog's group analytics (paid)\n * aggregates events by company / team / project. The destination resolves\n * `settings.group` to { type, key, properties? } and calls\n * posthog.group(type, key, properties). `silent: true` keeps this a\n * pure side-effect rule - no \"company update\" capture().\n */\nexport const groupAssignmentWithProperties: PostHogStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a PostHog group and sets group properties via posthog.group.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n size: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.size',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.group',\n 'company',\n 'company_123',\n {\n name: 'Acme',\n plan: 'enterprise',\n employee_count: 50,\n },\n ],\n ],\n};\n\n/**\n * Order complete - PostHog has no dedicated revenue API. Revenue tracking\n * is just a capture() call with the revenue properties in data. This\n * example pairs `include: [\"data\", \"globals\"]` with a destination-level\n * capture. The order total, shipping, currency, etc. all become\n * data_* properties on the PostHog event.\n */\nexport const orderCompleteWithInclude: PostHogStepExample = {\n title: 'Order complete',\n description:\n 'An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.',\n in: getEvent('order complete', { timestamp: 1700000109 }),\n mapping: {\n include: ['data', 'globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → posthog.opt_out_capturing(). The destination checks\n * the consent key declared in config.consent (here \"analytics\") and\n * toggles accordingly. opt_out_capturing() stops capture, session\n * replay, AND survey rendering.\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing'], ['posthog.opt_out_capturing']],\n};\n\n/**\n * Consent granted → posthog.opt_in_capturing(). Called without arguments\n * by default (the SDK fires its own $opt_in event).\n */\nexport const consentGrantOptIn: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,QAAQ,EACL,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,UAAU,EACP,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,SAAS,EACN,OAAO,EACP;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,EACV,KAAK;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,EACA,SAAS,iEAAiE,EAC1E,SAAS;AAAA,EACZ,iBAAiB,EACd,KAAK,CAAC,UAAU,SAAS,iBAAiB,CAAC,EAC3C;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,aAAa,EACV,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,kBAAkB,EACf,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E;AAMO,IAAM,oBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,CAAC;AACpC;","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"],"sourcesContent":["import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z.object({\n apiKey: z\n .string()\n .min(1)\n .describe(\n 'Your PostHog project API key (starts with \"phc_\"). Find it in your PostHog project settings under \"Project API Key\" (like phc_a1b2c3d4e5f6789012345678abcdef12).',\n ),\n api_host: z\n .string()\n .describe(\n 'PostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.',\n )\n .optional(),\n ui_host: z\n .string()\n .describe(\n 'URL of the PostHog UI host, used by toolbar and replay player. Default: null.',\n )\n .optional(),\n persistence: z\n .enum([\n 'localStorage+cookie',\n 'cookie',\n 'localStorage',\n 'sessionStorage',\n 'memory',\n ])\n .describe('Where to persist user identity. Default: \"localStorage+cookie\".')\n .optional(),\n person_profiles: z\n .enum(['always', 'never', 'identified_only'])\n .describe(\n 'When to create person profiles. \"identified_only\" (default) creates profiles only after identify() is called.',\n )\n .optional(),\n autocapture: z\n .boolean()\n .describe(\n \"Enable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).\",\n )\n .optional(),\n capture_pageview: z\n .union([z.boolean(), z.literal('history_change')])\n .describe(\n 'Whether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).',\n )\n .optional(),\n capture_pageleave: z\n .union([z.boolean(), z.literal('if_capture_pageview')])\n .describe(\n 'Whether PostHog should auto-capture pageleave events. Default: false.',\n )\n .optional(),\n capture_heatmaps: z\n .boolean()\n .describe(\n 'Enable heatmap data capture. Default: unset, which follows the heatmaps setting of the PostHog project.',\n )\n .optional(),\n capture_exceptions: z\n .boolean()\n .describe(\n 'Enable automatic exception capture. Default: unset, which follows the exception autocapture setting of the PostHog project.',\n )\n .optional(),\n disable_surveys: z\n .boolean()\n .describe('Disable PostHog surveys. Default: false.')\n .optional(),\n disable_session_recording: z\n .boolean()\n .describe('Disable session recording. Default: false.')\n .optional(),\n advanced_disable_flags: z\n .boolean()\n .describe('Disable feature flag loading. Default: false.')\n .optional(),\n cookieless_mode: z\n .enum(['always', 'on_reject'])\n .describe(\n '\"always\" never uses cookies/localStorage. \"on_reject\" falls back to cookieless when consent is rejected.',\n )\n .optional(),\n debug: z\n .boolean()\n .describe('Enable PostHog SDK debug logging. Default: false.')\n .optional(),\n session_recording: z\n .unknown()\n .describe(\n 'Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.',\n )\n .optional(),\n bootstrap: z\n .unknown()\n .describe(\n 'SSR bootstrap data. { distinctID?, featureFlags? } pre-populates identity and flag values to avoid first-render flicker.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push: posthog.identify fires when distinctId changes, and on every push while $set or $set_once are present.',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push: posthog.group fires when type or key changes, and on every push while properties are present.',\n )\n .optional(),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\nexport const MappingSchema = z.object({\n identify: z\n .unknown()\n .describe(\n 'Per-event identity mapping. Resolves to an object with any of: distinctId, $set, $set_once. Omitting distinctId routes to setPersonProperties() (no identity change).',\n )\n .optional(),\n group: z\n .unknown()\n .describe(\n 'Group assignment. Resolves to { type, key, properties? } → posthog.group(type, key, properties).',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Logout trigger. Resolves to a truthy value → posthog.reset() (clears distinctId and regenerates an anonymous one). Typically used with silent: true on a user logout rule.',\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, PostHogSDK } from '../types';\n\nconst noop = () => {};\n\n/**\n * Shared no-op SDK. Tests clone and overwrite individual methods with\n * jest.fn() via the spyEnv() helper in the test runner.\n */\nconst noopSDK: PostHogSDK = {\n init: (() => noopSDK) as PostHogSDK['init'],\n capture: noop,\n identify: noop,\n setPersonProperties: noop,\n group: noop,\n reset: noop,\n opt_in_capturing: noop,\n opt_out_capturing: noop,\n};\n\n/**\n * Pre-init env — all methods are no-ops until the test runner wires spies.\n */\nexport const init: Env | undefined = {\n posthog: { ...noopSDK },\n};\n\n/**\n * Post-init env — same shape. The test runner clones this and replaces\n * individual methods with jest.fn() so it can assert on calls.\n */\nexport const push: Env = {\n posthog: { ...noopSDK },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:posthog.init',\n 'call:posthog.capture',\n 'call:posthog.identify',\n 'call:posthog.setPersonProperties',\n 'call:posthog.group',\n 'call:posthog.reset',\n 'call:posthog.opt_in_capturing',\n 'call:posthog.opt_out_capturing',\n];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport type { Settings } from '../types';\n\n/**\n * Examples may optionally carry destination-level settings.\n * The test runner reads `settings` from the example and merges them\n * into the base destination settings on top of the fixed apiKey.\n */\nexport type PostHogStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\n configInclude?: string[];\n /** Consent granted before `in` so a gated destination is loaded first. */\n before?: WalkerOS.Consent;\n};\n\n/**\n * Default event forwarding - every walkerOS event becomes\n * posthog.capture(event.name, properties). With no mapping and no\n * destination-level include, properties is `{}`.\n */\nexport const defaultEventForwarding: PostHogStepExample = {\n title: 'Default capture',\n description:\n 'A walker event becomes a PostHog capture call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['posthog.capture', 'product view', {}]],\n};\n\n/**\n * Wildcard ignore - walkerOS's standard way to drop events. The rule\n * matches but does nothing. The destination fires zero SDK calls.\n */\nexport const wildcardIgnored: PostHogStepExample = {\n public: false,\n in: getEvent('debug noise', { timestamp: 1700000101 }),\n mapping: { ignore: true },\n out: [],\n};\n\n/**\n * Destination-level include (config.include) flattens the walkerOS `data` section\n * into prefixed capture() properties on every push.\n */\nexport const destinationLevelInclude: PostHogStepExample = {\n title: 'Include data',\n description:\n \"With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.\",\n in: getEvent('product view', { timestamp: 1700000102 }),\n configInclude: ['data'],\n out: [\n [\n 'posthog.capture',\n 'product view',\n {\n data_id: 'ers',\n data_name: 'Everyday Ruck Snack',\n data_color: 'black',\n data_size: 'l',\n data_price: 420,\n },\n ],\n ],\n};\n\n/**\n * Per-rule include REPLACES the destination-level config.include for the\n * matched rule. Here destination-level sends `data`, but the rule\n * overrides it with `globals` only.\n */\nexport const ruleIncludeReplaces: PostHogStepExample = {\n title: 'Rule include overrides',\n description:\n \"With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.\",\n in: getEvent('order complete', { timestamp: 1700000103 }),\n configInclude: ['data'],\n mapping: {\n include: ['globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify fires on the first push (once the\n * state cache is empty). The destination calls posthog.identify() and\n * tracks the resolved distinctId in runtime state; subsequent pushes\n * with unchanged values do NOT re-fire identify().\n *\n * With NO $set/$set_once keys in the resolved object, posthog.identify\n * is called with just the distinctId.\n */\nexport const destinationLevelIdentify: PostHogStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.\",\n in: getEvent('page view', { timestamp: 1700000104 }),\n settings: {\n identify: {\n map: {\n distinctId: 'user.id',\n },\n },\n },\n out: [\n ['posthog.identify', 'us3r'],\n ['posthog.capture', 'page view', {}],\n ],\n};\n\n/**\n * Per-event identify with the full PostHog identity vocabulary.\n * This is the \"user login\" pattern: set a new distinctId and enrich\n * person properties. `silent: true` suppresses the default posthog.capture()\n * call because we're running identity side effects only.\n *\n * PostHog identify signature:\n * posthog.identify(distinctId, $set, $set_once)\n */\nexport const userLoginIdentify: PostHogStepExample = {\n title: 'User login identify',\n description:\n 'A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.',\n in: getEvent('user login', {\n timestamp: 1700000105000,\n data: {\n user_id: 'new-user-123',\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n source: 'organic',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: {\n map: {\n distinctId: 'data.user_id',\n $set: {\n map: {\n email: 'data.email',\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n $set_once: {\n map: {\n first_login: 'timestamp',\n signup_source: 'data.source',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.identify',\n 'new-user-123',\n {\n email: 'user@acme.com',\n plan: 'premium',\n company: 'Acme',\n },\n {\n first_login: 1700000105000,\n signup_source: 'organic',\n },\n ],\n ],\n};\n\n/**\n * Person-properties-only update - when the resolved identify object has\n * NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)\n * instead of identify(). This is the \"profile update\" pattern: enrich\n * user properties without changing identity.\n *\n * `silent` defaults to false here - we intentionally ALSO capture a\n * \"profile update\" event so it shows up in PostHog's event stream.\n */\nexport const profileUpdateSetPersonProperties: PostHogStepExample = {\n title: 'Set person properties',\n description:\n 'A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.',\n in: getEvent('profile update', {\n timestamp: 1700000106,\n data: {\n name: 'Jane Doe',\n avatar_url: 'https://example.com/avatar.png',\n },\n }),\n mapping: {\n settings: {\n identify: {\n map: {\n $set: {\n map: {\n name: 'data.name',\n avatar: 'data.avatar_url',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.setPersonProperties',\n {\n name: 'Jane Doe',\n avatar: 'https://example.com/avatar.png',\n },\n undefined,\n ],\n ['posthog.capture', 'profile update', {}],\n ],\n};\n\n/**\n * User logout - reset: true fires posthog.reset(), which clears the\n * distinct ID and generates a new anonymous one. `silent: true` because\n * we're only running the reset side effect, no default capture().\n */\nexport const userLogoutReset: PostHogStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.',\n in: getEvent('user logout', { timestamp: 1700000107 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['posthog.reset']],\n};\n\n/**\n * Group assignment + group properties. PostHog's group analytics (paid)\n * aggregates events by company / team / project. The destination resolves\n * `settings.group` to { type, key, properties? } and calls\n * posthog.group(type, key, properties). `silent: true` keeps this a\n * pure side-effect rule - no \"company update\" capture().\n */\nexport const groupAssignmentWithProperties: PostHogStepExample = {\n title: 'Group assignment',\n description:\n 'A company update assigns the user to a PostHog group and sets group properties via posthog.group.',\n in: getEvent('company update', {\n timestamp: 1700000108,\n data: {\n company_id: 'company_123',\n company_name: 'Acme',\n plan: 'enterprise',\n size: 50,\n },\n }),\n mapping: {\n silent: true,\n settings: {\n group: {\n map: {\n type: { value: 'company' },\n key: 'data.company_id',\n properties: {\n map: {\n name: 'data.company_name',\n plan: 'data.plan',\n employee_count: 'data.size',\n },\n },\n },\n },\n },\n },\n out: [\n [\n 'posthog.group',\n 'company',\n 'company_123',\n {\n name: 'Acme',\n plan: 'enterprise',\n employee_count: 50,\n },\n ],\n ],\n};\n\n/**\n * Order complete - PostHog has no dedicated revenue API. Revenue tracking\n * is just a capture() call with the revenue properties in data. This\n * example pairs `include: [\"data\", \"globals\"]` with a destination-level\n * capture. The order total, shipping, currency, etc. all become\n * data_* properties on the PostHog event.\n */\nexport const orderCompleteWithInclude: PostHogStepExample = {\n title: 'Order complete',\n description:\n 'An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.',\n in: getEvent('order complete', { timestamp: 1700000109 }),\n mapping: {\n include: ['data', 'globals'],\n },\n out: [\n [\n 'posthog.capture',\n 'order complete',\n {\n data_id: '0rd3r1d',\n data_currency: 'EUR',\n data_shipping: 5.22,\n data_taxes: 73.76,\n data_total: 555,\n globals_pagegroup: 'shop',\n },\n ],\n ],\n};\n\n/**\n * Consent revoked → posthog.opt_out_capturing(). The destination checks\n * the consent key declared in config.consent (here \"analytics\") and\n * toggles accordingly. opt_out_capturing() stops capture, session\n * replay, AND survey rendering.\n *\n * Uses the canonical StepExample.command='consent' pattern: the test\n * runner dispatches via elb('walker consent', in) instead of pushing\n * an event.\n */\nexport const consentRevokeOptOut: PostHogStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing'], ['posthog.opt_out_capturing']],\n};\n\n/**\n * Consent granted → posthog.opt_in_capturing(). Called without arguments\n * by default (the SDK fires its own $opt_in event).\n */\nexport const consentGrantOptIn: PostHogStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.',\n command: 'consent',\n in: { analytics: true } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['posthog.opt_in_capturing']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,Q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EAAE,WAAW,WAAW,CAAC;AAAA,EACxD,SAAS;AAAA,IACP,SAAS,CAAC,QAAQ,SAAS;AAAA,EAC7B;AAAA,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,eAAe;AAAA,QACf,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,mBAAmB;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;AAYO,IAAM,sBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,GAAG,CAAC,2BAA2B,CAAC;AACnE;AAMO,IAAM,oBAAwC;AAAA,EACnD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,0BAA0B,CAAC;AACpC;","names":["z"]}
|
|
@@ -109,12 +109,12 @@ declare const defaultEventForwarding: PostHogStepExample;
|
|
|
109
109
|
*/
|
|
110
110
|
declare const wildcardIgnored: PostHogStepExample;
|
|
111
111
|
/**
|
|
112
|
-
* Destination-level
|
|
112
|
+
* Destination-level include (config.include) flattens the walkerOS `data` section
|
|
113
113
|
* into prefixed capture() properties on every push.
|
|
114
114
|
*/
|
|
115
115
|
declare const destinationLevelInclude: PostHogStepExample;
|
|
116
116
|
/**
|
|
117
|
-
* Per-rule
|
|
117
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
118
118
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
119
119
|
* overrides it with `globals` only.
|
|
120
120
|
*/
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -109,12 +109,12 @@ declare const defaultEventForwarding: PostHogStepExample;
|
|
|
109
109
|
*/
|
|
110
110
|
declare const wildcardIgnored: PostHogStepExample;
|
|
111
111
|
/**
|
|
112
|
-
* Destination-level
|
|
112
|
+
* Destination-level include (config.include) flattens the walkerOS `data` section
|
|
113
113
|
* into prefixed capture() properties on every push.
|
|
114
114
|
*/
|
|
115
115
|
declare const destinationLevelInclude: PostHogStepExample;
|
|
116
116
|
/**
|
|
117
|
-
* Per-rule
|
|
117
|
+
* Per-rule include REPLACES the destination-level config.include for the
|
|
118
118
|
* matched rule. Here destination-level sends `data`, but the rule
|
|
119
119
|
* overrides it with `globals` only.
|
|
120
120
|
*/
|
package/dist/examples/index.js
CHANGED
|
@@ -92,7 +92,7 @@ var wildcardIgnored = {
|
|
|
92
92
|
};
|
|
93
93
|
var destinationLevelInclude = {
|
|
94
94
|
title: "Include data",
|
|
95
|
-
description: "
|
|
95
|
+
description: "With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.",
|
|
96
96
|
in: (0, import_core.getEvent)("product view", { timestamp: 1700000102 }),
|
|
97
97
|
configInclude: ["data"],
|
|
98
98
|
out: [
|
|
@@ -111,7 +111,7 @@ var destinationLevelInclude = {
|
|
|
111
111
|
};
|
|
112
112
|
var ruleIncludeReplaces = {
|
|
113
113
|
title: "Rule include overrides",
|
|
114
|
-
description: "
|
|
114
|
+
description: "With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",
|
|
115
115
|
in: (0, import_core.getEvent)("order complete", { timestamp: 1700000103 }),
|
|
116
116
|
configInclude: ["data"],
|
|
117
117
|
mapping: {
|
|
@@ -129,7 +129,7 @@ var ruleIncludeReplaces = {
|
|
|
129
129
|
};
|
|
130
130
|
var destinationLevelIdentify = {
|
|
131
131
|
title: "Destination identify",
|
|
132
|
-
description: "
|
|
132
|
+
description: "With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.",
|
|
133
133
|
in: (0, import_core.getEvent)("page view", { timestamp: 1700000104 }),
|
|
134
134
|
settings: {
|
|
135
135
|
identify: {
|
|
@@ -147,7 +147,7 @@ var userLoginIdentify = {
|
|
|
147
147
|
title: "User login identify",
|
|
148
148
|
description: "A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",
|
|
149
149
|
in: (0, import_core.getEvent)("user login", {
|
|
150
|
-
timestamp:
|
|
150
|
+
timestamp: 1700000105e3,
|
|
151
151
|
data: {
|
|
152
152
|
user_id: "new-user-123",
|
|
153
153
|
email: "user@acme.com",
|
|
@@ -189,7 +189,7 @@ var userLoginIdentify = {
|
|
|
189
189
|
company: "Acme"
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
|
-
first_login:
|
|
192
|
+
first_login: 1700000105e3,
|
|
193
193
|
signup_source: "organic"
|
|
194
194
|
}
|
|
195
195
|
]
|
|
@@ -310,7 +310,7 @@ var orderCompleteWithInclude = {
|
|
|
310
310
|
};
|
|
311
311
|
var consentRevokeOptOut = {
|
|
312
312
|
title: "Consent revoked",
|
|
313
|
-
description: "
|
|
313
|
+
description: "With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.",
|
|
314
314
|
command: "consent",
|
|
315
315
|
before: { analytics: true },
|
|
316
316
|
in: { analytics: false },
|
|
@@ -319,7 +319,7 @@ var consentRevokeOptOut = {
|
|
|
319
319
|
};
|
|
320
320
|
var consentGrantOptIn = {
|
|
321
321
|
title: "Consent granted",
|
|
322
|
-
description: "
|
|
322
|
+
description: "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.",
|
|
323
323
|
command: "consent",
|
|
324
324
|
in: { analytics: true },
|
|
325
325
|
settings: {},
|
package/dist/examples/index.mjs
CHANGED
|
@@ -71,7 +71,7 @@ var wildcardIgnored = {
|
|
|
71
71
|
};
|
|
72
72
|
var destinationLevelInclude = {
|
|
73
73
|
title: "Include data",
|
|
74
|
-
description: "
|
|
74
|
+
description: "With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.",
|
|
75
75
|
in: getEvent("product view", { timestamp: 1700000102 }),
|
|
76
76
|
configInclude: ["data"],
|
|
77
77
|
out: [
|
|
@@ -90,7 +90,7 @@ var destinationLevelInclude = {
|
|
|
90
90
|
};
|
|
91
91
|
var ruleIncludeReplaces = {
|
|
92
92
|
title: "Rule include overrides",
|
|
93
|
-
description: "
|
|
93
|
+
description: "With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",
|
|
94
94
|
in: getEvent("order complete", { timestamp: 1700000103 }),
|
|
95
95
|
configInclude: ["data"],
|
|
96
96
|
mapping: {
|
|
@@ -108,7 +108,7 @@ var ruleIncludeReplaces = {
|
|
|
108
108
|
};
|
|
109
109
|
var destinationLevelIdentify = {
|
|
110
110
|
title: "Destination identify",
|
|
111
|
-
description: "
|
|
111
|
+
description: "With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.",
|
|
112
112
|
in: getEvent("page view", { timestamp: 1700000104 }),
|
|
113
113
|
settings: {
|
|
114
114
|
identify: {
|
|
@@ -126,7 +126,7 @@ var userLoginIdentify = {
|
|
|
126
126
|
title: "User login identify",
|
|
127
127
|
description: "A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",
|
|
128
128
|
in: getEvent("user login", {
|
|
129
|
-
timestamp:
|
|
129
|
+
timestamp: 1700000105e3,
|
|
130
130
|
data: {
|
|
131
131
|
user_id: "new-user-123",
|
|
132
132
|
email: "user@acme.com",
|
|
@@ -168,7 +168,7 @@ var userLoginIdentify = {
|
|
|
168
168
|
company: "Acme"
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
|
-
first_login:
|
|
171
|
+
first_login: 1700000105e3,
|
|
172
172
|
signup_source: "organic"
|
|
173
173
|
}
|
|
174
174
|
]
|
|
@@ -289,7 +289,7 @@ var orderCompleteWithInclude = {
|
|
|
289
289
|
};
|
|
290
290
|
var consentRevokeOptOut = {
|
|
291
291
|
title: "Consent revoked",
|
|
292
|
-
description: "
|
|
292
|
+
description: "With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.",
|
|
293
293
|
command: "consent",
|
|
294
294
|
before: { analytics: true },
|
|
295
295
|
in: { analytics: false },
|
|
@@ -298,7 +298,7 @@ var consentRevokeOptOut = {
|
|
|
298
298
|
};
|
|
299
299
|
var consentGrantOptIn = {
|
|
300
300
|
title: "Consent granted",
|
|
301
|
-
description: "
|
|
301
|
+
description: "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.",
|
|
302
302
|
command: "consent",
|
|
303
303
|
in: { analytics: true },
|
|
304
304
|
settings: {},
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-posthog",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0-next-1791441510508",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
},
|
|
95
95
|
"capture_heatmaps": {
|
|
96
96
|
"type": "boolean",
|
|
97
|
-
"description": "Enable heatmap data capture. Default:
|
|
97
|
+
"description": "Enable heatmap data capture. Default: unset, which follows the heatmaps setting of the PostHog project."
|
|
98
98
|
},
|
|
99
99
|
"capture_exceptions": {
|
|
100
100
|
"type": "boolean",
|
|
101
|
-
"description": "Enable automatic exception capture. Default:
|
|
101
|
+
"description": "Enable automatic exception capture. Default: unset, which follows the exception autocapture setting of the PostHog project."
|
|
102
102
|
},
|
|
103
103
|
"disable_surveys": {
|
|
104
104
|
"type": "boolean",
|
|
@@ -128,13 +128,13 @@
|
|
|
128
128
|
"description": "Session Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list."
|
|
129
129
|
},
|
|
130
130
|
"bootstrap": {
|
|
131
|
-
"description": "SSR bootstrap data. { distinctID?, featureFlags? }
|
|
131
|
+
"description": "SSR bootstrap data. { distinctID?, featureFlags? } pre-populates identity and flag values to avoid first-render flicker."
|
|
132
132
|
},
|
|
133
133
|
"identify": {
|
|
134
|
-
"description": "walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on
|
|
134
|
+
"description": "walkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on every push: posthog.identify fires when distinctId changes, and on every push while $set or $set_once are present."
|
|
135
135
|
},
|
|
136
136
|
"group": {
|
|
137
|
-
"description": "walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on
|
|
137
|
+
"description": "walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on every push: posthog.group fires when type or key changes, and on every push while properties are present."
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"required": [
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"step": {
|
|
216
216
|
"consentGrantOptIn": {
|
|
217
217
|
"title": "Consent granted",
|
|
218
|
-
"description": "
|
|
218
|
+
"description": "With consent: { analytics: true } in the destination config, a walker consent command that grants analytics calls posthog.opt_in_capturing.",
|
|
219
219
|
"command": "consent",
|
|
220
220
|
"in": {
|
|
221
221
|
"analytics": true
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
},
|
|
230
230
|
"consentRevokeOptOut": {
|
|
231
231
|
"title": "Consent revoked",
|
|
232
|
-
"description": "
|
|
232
|
+
"description": "With consent: { analytics: true } in the destination config, a walker consent command that denies analytics calls posthog.opt_out_capturing to stop capture and replay.",
|
|
233
233
|
"command": "consent",
|
|
234
234
|
"before": {
|
|
235
235
|
"analytics": true
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
"consent": {
|
|
281
281
|
"functional": true
|
|
282
282
|
},
|
|
283
|
-
"id": "
|
|
283
|
+
"id": "b5d6f39fc1aa6bdc",
|
|
284
284
|
"trigger": "load",
|
|
285
285
|
"entity": "product",
|
|
286
286
|
"action": "view",
|
|
@@ -303,7 +303,7 @@
|
|
|
303
303
|
},
|
|
304
304
|
"destinationLevelIdentify": {
|
|
305
305
|
"title": "Destination identify",
|
|
306
|
-
"description": "
|
|
306
|
+
"description": "With settings.identify mapping distinctId to 'user.id', the destination calls posthog.identify before the default capture.",
|
|
307
307
|
"in": {
|
|
308
308
|
"name": "page view",
|
|
309
309
|
"data": {
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
"consent": {
|
|
343
343
|
"functional": true
|
|
344
344
|
},
|
|
345
|
-
"id": "
|
|
345
|
+
"id": "fcbaf69d02ac8341",
|
|
346
346
|
"trigger": "load",
|
|
347
347
|
"entity": "page",
|
|
348
348
|
"action": "view",
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
},
|
|
377
377
|
"destinationLevelInclude": {
|
|
378
378
|
"title": "Include data",
|
|
379
|
-
"description": "
|
|
379
|
+
"description": "With include: ['data'] in the destination config, the event data section is flattened into prefixed PostHog capture properties.",
|
|
380
380
|
"in": {
|
|
381
381
|
"name": "product view",
|
|
382
382
|
"data": {
|
|
@@ -407,7 +407,7 @@
|
|
|
407
407
|
"consent": {
|
|
408
408
|
"functional": true
|
|
409
409
|
},
|
|
410
|
-
"id": "
|
|
410
|
+
"id": "6c8e5ead39e54c55",
|
|
411
411
|
"trigger": "load",
|
|
412
412
|
"entity": "product",
|
|
413
413
|
"action": "view",
|
|
@@ -476,7 +476,7 @@
|
|
|
476
476
|
"consent": {
|
|
477
477
|
"functional": true
|
|
478
478
|
},
|
|
479
|
-
"id": "
|
|
479
|
+
"id": "e10f35ab8add2af6",
|
|
480
480
|
"trigger": "test",
|
|
481
481
|
"entity": "company",
|
|
482
482
|
"action": "update",
|
|
@@ -602,7 +602,7 @@
|
|
|
602
602
|
"consent": {
|
|
603
603
|
"functional": true
|
|
604
604
|
},
|
|
605
|
-
"id": "
|
|
605
|
+
"id": "9043b2ba42628b1e",
|
|
606
606
|
"trigger": "load",
|
|
607
607
|
"entity": "order",
|
|
608
608
|
"action": "complete",
|
|
@@ -673,7 +673,7 @@
|
|
|
673
673
|
"consent": {
|
|
674
674
|
"functional": true
|
|
675
675
|
},
|
|
676
|
-
"id": "
|
|
676
|
+
"id": "c3fa9f54ff88910c",
|
|
677
677
|
"trigger": "test",
|
|
678
678
|
"entity": "profile",
|
|
679
679
|
"action": "update",
|
|
@@ -718,7 +718,7 @@
|
|
|
718
718
|
},
|
|
719
719
|
"ruleIncludeReplaces": {
|
|
720
720
|
"title": "Rule include overrides",
|
|
721
|
-
"description": "
|
|
721
|
+
"description": "With include: ['data'] in the destination config, the rule's include: ['globals'] replaces it, so this event forwards only globals.",
|
|
722
722
|
"in": {
|
|
723
723
|
"name": "order complete",
|
|
724
724
|
"data": {
|
|
@@ -796,7 +796,7 @@
|
|
|
796
796
|
"consent": {
|
|
797
797
|
"functional": true
|
|
798
798
|
},
|
|
799
|
-
"id": "
|
|
799
|
+
"id": "19f8714e05893af6",
|
|
800
800
|
"trigger": "load",
|
|
801
801
|
"entity": "order",
|
|
802
802
|
"action": "complete",
|
|
@@ -867,11 +867,11 @@
|
|
|
867
867
|
"consent": {
|
|
868
868
|
"functional": true
|
|
869
869
|
},
|
|
870
|
-
"id": "
|
|
870
|
+
"id": "b1ba7ed3c8b21c5d",
|
|
871
871
|
"trigger": "test",
|
|
872
872
|
"entity": "user",
|
|
873
873
|
"action": "login",
|
|
874
|
-
"timestamp":
|
|
874
|
+
"timestamp": 1700000105000,
|
|
875
875
|
"timing": 3.14,
|
|
876
876
|
"source": {
|
|
877
877
|
"count": 1,
|
|
@@ -913,7 +913,7 @@
|
|
|
913
913
|
"company": "Acme"
|
|
914
914
|
},
|
|
915
915
|
{
|
|
916
|
-
"first_login":
|
|
916
|
+
"first_login": 1700000105000,
|
|
917
917
|
"signup_source": "organic"
|
|
918
918
|
}
|
|
919
919
|
]
|
|
@@ -962,7 +962,7 @@
|
|
|
962
962
|
"consent": {
|
|
963
963
|
"functional": true
|
|
964
964
|
},
|
|
965
|
-
"id": "
|
|
965
|
+
"id": "58989066874c4717",
|
|
966
966
|
"trigger": "test",
|
|
967
967
|
"entity": "user",
|
|
968
968
|
"action": "logout",
|
|
@@ -1029,7 +1029,7 @@
|
|
|
1029
1029
|
"consent": {
|
|
1030
1030
|
"functional": true
|
|
1031
1031
|
},
|
|
1032
|
-
"id": "
|
|
1032
|
+
"id": "61bb5dcb618957ba",
|
|
1033
1033
|
"trigger": "test",
|
|
1034
1034
|
"entity": "debug",
|
|
1035
1035
|
"action": "noise",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/web-destination-posthog",
|
|
3
3
|
"description": "PostHog web destination for walkerOS (product analytics, session replay, feature flags, surveys)",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0-next-1791441510508",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.
|
|
41
|
+
"@walkeros/core": "4.8.0-next-1791441510508",
|
|
42
42
|
"posthog-js": "^1.367.0",
|
|
43
|
-
"@walkeros/web-core": "4.
|
|
43
|
+
"@walkeros/web-core": "4.8.0-next-1791441510508"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@walkeros/collector": "4.
|
|
46
|
+
"@walkeros/collector": "4.8.0-next-1791441510508"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|