@walkeros/web-destination-posthog 4.2.0 → 4.2.1-next-1781538735002
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 +8 -0
- package/dist/dev.d.mts +3 -1
- package/dist/dev.d.ts +3 -1
- 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 +3 -1
- package/dist/examples/index.d.ts +3 -1
- package/dist/examples/index.js +2 -1
- package/dist/examples/index.mjs +2 -1
- package/dist/walkerOS.json +17 -11
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @walkeros/web-destination-posthog
|
|
2
2
|
|
|
3
|
+
## 4.2.1-next-1781538735002
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [5cbcd23]
|
|
8
|
+
- @walkeros/core@4.2.1-next-1781538735002
|
|
9
|
+
- @walkeros/web-core@4.2.1-next-1781538735002
|
|
10
|
+
|
|
3
11
|
## 4.2.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/dev.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
2
|
import { z } from '@walkeros/core/dev';
|
|
3
|
-
import { Mapping as Mapping$1, Flow } from '@walkeros/core';
|
|
3
|
+
import { Mapping as Mapping$1, Flow, WalkerOS } from '@walkeros/core';
|
|
4
4
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
5
5
|
import { PostHogConfig, Properties } from 'posthog-js';
|
|
6
6
|
|
|
@@ -151,6 +151,8 @@ declare namespace env {
|
|
|
151
151
|
type PostHogStepExample = Flow.StepExample & {
|
|
152
152
|
settings?: Partial<Settings>;
|
|
153
153
|
configInclude?: string[];
|
|
154
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
155
|
+
before?: WalkerOS.Consent;
|
|
154
156
|
};
|
|
155
157
|
/**
|
|
156
158
|
* Default event forwarding - every walkerOS event becomes
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
2
|
import { z } from '@walkeros/core/dev';
|
|
3
|
-
import { Mapping as Mapping$1, Flow } from '@walkeros/core';
|
|
3
|
+
import { Mapping as Mapping$1, Flow, WalkerOS } from '@walkeros/core';
|
|
4
4
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
5
5
|
import { PostHogConfig, Properties } from 'posthog-js';
|
|
6
6
|
|
|
@@ -151,6 +151,8 @@ declare namespace env {
|
|
|
151
151
|
type PostHogStepExample = Flow.StepExample & {
|
|
152
152
|
settings?: Partial<Settings>;
|
|
153
153
|
configInclude?: string[];
|
|
154
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
155
|
+
before?: WalkerOS.Consent;
|
|
154
156
|
};
|
|
155
157
|
/**
|
|
156
158
|
* Default event forwarding - every walkerOS event becomes
|
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: true (PostHog default).").optional(),capture_exceptions:l.z.boolean().describe("Enable automatic exception capture. Default: false.").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 first push and re-fired when distinctId changes.").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.").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:()=>f,step:()=>k});var f={};n(f,{init:()=>b,push:()=>_,simulation:()=>w});var y=()=>{},v={init:()=>v,capture:y,identify:y,setPersonProperties:y,group:y,reset:y,opt_in_capturing:y,opt_out_capturing:y},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:()=>x,defaultEventForwarding:()=>z,destinationLevelIdentify:()=>E,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>j,orderCompleteWithInclude:()=>R,profileUpdateSetPersonProperties:()=>H,ruleIncludeReplaces:()=>I,userLoginIdentify:()=>A,userLogoutReset:()=>O,wildcardIgnored:()=>D});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",{}]]},D={public:!1,in:(0,P.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"Destination-level include flattens the event data section 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}]]},I={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include 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"}]]},E={title:"Destination identify",description:"Destination-level identify calls posthog.identify with the user id before firing 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",{}]]},A={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:1700000105,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:1700000105,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"]]},j={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}]]},R={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"}]]},x={title:"Consent revoked",description:"A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.",command:"consent",in:{analytics:!1},settings:{},out:[["posthog.opt_out_capturing"]]},$={title:"Consent granted",description:"A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.",command:"consent",in:{analytics:!0},settings:{},out:[["posthog.opt_in_capturing"]]};//# sourceMappingURL=dev.js.map
|
|
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: true (PostHog default).").optional(),capture_exceptions:l.z.boolean().describe("Enable automatic exception capture. Default: false.").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 first push and re-fired when distinctId changes.").optional(),group:l.z.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.").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:()=>f,step:()=>k});var f={};n(f,{init:()=>b,push:()=>_,simulation:()=>w});var y=()=>{},v={init:()=>v,capture:y,identify:y,setPersonProperties:y,group:y,reset:y,opt_in_capturing:y,opt_out_capturing:y},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:()=>x,defaultEventForwarding:()=>z,destinationLevelIdentify:()=>E,destinationLevelInclude:()=>S,groupAssignmentWithProperties:()=>j,orderCompleteWithInclude:()=>R,profileUpdateSetPersonProperties:()=>H,ruleIncludeReplaces:()=>I,userLoginIdentify:()=>A,userLogoutReset:()=>O,wildcardIgnored:()=>D});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",{}]]},D={public:!1,in:(0,P.getEvent)("debug noise",{timestamp:1700000101}),mapping:{ignore:!0},out:[]},S={title:"Include data",description:"Destination-level include flattens the event data section 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}]]},I={title:"Rule include overrides",description:"A per-rule include replaces the destination-level include 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"}]]},E={title:"Destination identify",description:"Destination-level identify calls posthog.identify with the user id before firing 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",{}]]},A={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:1700000105,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:1700000105,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"]]},j={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}]]},R={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"}]]},x={title:"Consent revoked",description:"A walker consent command with analytics denied 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:"A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.",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};\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 in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['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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AClB;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,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,2BAA2B,CAAC;AACrC;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('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,EAC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]}
|
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: true (PostHog default).").optional(),capture_exceptions:i.boolean().describe("Enable automatic exception capture. Default: false.").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 first push and re-fired when distinctId changes.").optional(),group:i.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.").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:()=>j,consentRevokeOptOut:()=>R,defaultEventForwarding:()=>b,destinationLevelIdentify:()=>P,destinationLevelInclude:()=>w,groupAssignmentWithProperties:()=>A,orderCompleteWithInclude:()=>H,profileUpdateSetPersonProperties:()=>I,ruleIncludeReplaces:()=>k,userLoginIdentify:()=>D,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:"Destination-level include flattens the event data section 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:"A per-rule include replaces the destination-level include 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:"Destination-level identify calls posthog.identify with the user id before firing the default capture.",in:_("page view",{timestamp:1700000104}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["posthog.identify","us3r"],["posthog.capture","page view",{}]]},D={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:1700000105,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:1700000105,signup_source:"organic"}]]},I={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"]]},A={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}]]},H={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"}]]},R={title:"Consent revoked",description:"A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.",command:"consent",in:{analytics:!1},settings:{},out:[["posthog.opt_out_capturing"]]},j={title:"Consent granted",description:"A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.",command:"consent",in:{analytics:!0},settings:{},out:[["posthog.opt_in_capturing"]]};export{c as examples,o as schemas};//# sourceMappingURL=dev.mjs.map
|
|
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: true (PostHog default).").optional(),capture_exceptions:i.boolean().describe("Enable automatic exception capture. Default: false.").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 first push and re-fired when distinctId changes.").optional(),group:i.unknown().describe("walkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.").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:()=>j,consentRevokeOptOut:()=>R,defaultEventForwarding:()=>b,destinationLevelIdentify:()=>P,destinationLevelInclude:()=>w,groupAssignmentWithProperties:()=>A,orderCompleteWithInclude:()=>H,profileUpdateSetPersonProperties:()=>I,ruleIncludeReplaces:()=>k,userLoginIdentify:()=>D,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:"Destination-level include flattens the event data section 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:"A per-rule include replaces the destination-level include 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:"Destination-level identify calls posthog.identify with the user id before firing the default capture.",in:_("page view",{timestamp:1700000104}),settings:{identify:{map:{distinctId:"user.id"}}},out:[["posthog.identify","us3r"],["posthog.capture","page view",{}]]},D={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:1700000105,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:1700000105,signup_source:"organic"}]]},I={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"]]},A={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}]]},H={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"}]]},R={title:"Consent revoked",description:"A walker consent command with analytics denied 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"]]},j={title:"Consent granted",description:"A walker consent command with analytics granted calls posthog.opt_in_capturing to resume capture.",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};\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 in: { analytics: false } as WalkerOS.Consent,\n settings: {} as Partial<Settings>,\n out: [['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;AA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F;AAAA,EACF;AACF;AAYO,IAAM,sBAA0C;AAAA,EACrD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,UAAU,CAAC;AAAA,EACX,KAAK,CAAC,CAAC,2BAA2B,CAAC;AACrC;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('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;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B,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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mapping, Flow } from '@walkeros/core';
|
|
1
|
+
import { Mapping, Flow, WalkerOS } from '@walkeros/core';
|
|
2
2
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
3
|
import { PostHogConfig, Properties } from 'posthog-js';
|
|
4
4
|
|
|
@@ -94,6 +94,8 @@ declare namespace env {
|
|
|
94
94
|
type PostHogStepExample = Flow.StepExample & {
|
|
95
95
|
settings?: Partial<Settings>;
|
|
96
96
|
configInclude?: string[];
|
|
97
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
98
|
+
before?: WalkerOS.Consent;
|
|
97
99
|
};
|
|
98
100
|
/**
|
|
99
101
|
* Default event forwarding - every walkerOS event becomes
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mapping, Flow } from '@walkeros/core';
|
|
1
|
+
import { Mapping, Flow, WalkerOS } from '@walkeros/core';
|
|
2
2
|
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
3
|
import { PostHogConfig, Properties } from 'posthog-js';
|
|
4
4
|
|
|
@@ -94,6 +94,8 @@ declare namespace env {
|
|
|
94
94
|
type PostHogStepExample = Flow.StepExample & {
|
|
95
95
|
settings?: Partial<Settings>;
|
|
96
96
|
configInclude?: string[];
|
|
97
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
98
|
+
before?: WalkerOS.Consent;
|
|
97
99
|
};
|
|
98
100
|
/**
|
|
99
101
|
* Default event forwarding - every walkerOS event becomes
|
package/dist/examples/index.js
CHANGED
|
@@ -312,9 +312,10 @@ var consentRevokeOptOut = {
|
|
|
312
312
|
title: "Consent revoked",
|
|
313
313
|
description: "A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.",
|
|
314
314
|
command: "consent",
|
|
315
|
+
before: { analytics: true },
|
|
315
316
|
in: { analytics: false },
|
|
316
317
|
settings: {},
|
|
317
|
-
out: [["posthog.opt_out_capturing"]]
|
|
318
|
+
out: [["posthog.opt_in_capturing"], ["posthog.opt_out_capturing"]]
|
|
318
319
|
};
|
|
319
320
|
var consentGrantOptIn = {
|
|
320
321
|
title: "Consent granted",
|
package/dist/examples/index.mjs
CHANGED
|
@@ -291,9 +291,10 @@ var consentRevokeOptOut = {
|
|
|
291
291
|
title: "Consent revoked",
|
|
292
292
|
description: "A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.",
|
|
293
293
|
command: "consent",
|
|
294
|
+
before: { analytics: true },
|
|
294
295
|
in: { analytics: false },
|
|
295
296
|
settings: {},
|
|
296
|
-
out: [["posthog.opt_out_capturing"]]
|
|
297
|
+
out: [["posthog.opt_in_capturing"], ["posthog.opt_out_capturing"]]
|
|
297
298
|
};
|
|
298
299
|
var consentGrantOptIn = {
|
|
299
300
|
title: "Consent granted",
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-posthog",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1-next-1781538735002",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -230,11 +230,17 @@
|
|
|
230
230
|
"title": "Consent revoked",
|
|
231
231
|
"description": "A walker consent command with analytics denied calls posthog.opt_out_capturing to stop capture and replay.",
|
|
232
232
|
"command": "consent",
|
|
233
|
+
"before": {
|
|
234
|
+
"analytics": true
|
|
235
|
+
},
|
|
233
236
|
"in": {
|
|
234
237
|
"analytics": false
|
|
235
238
|
},
|
|
236
239
|
"settings": {},
|
|
237
240
|
"out": [
|
|
241
|
+
[
|
|
242
|
+
"posthog.opt_in_capturing"
|
|
243
|
+
],
|
|
238
244
|
[
|
|
239
245
|
"posthog.opt_out_capturing"
|
|
240
246
|
]
|
|
@@ -273,7 +279,7 @@
|
|
|
273
279
|
"consent": {
|
|
274
280
|
"functional": true
|
|
275
281
|
},
|
|
276
|
-
"id": "
|
|
282
|
+
"id": "df3cc94f45743afe",
|
|
277
283
|
"trigger": "load",
|
|
278
284
|
"entity": "product",
|
|
279
285
|
"action": "view",
|
|
@@ -333,7 +339,7 @@
|
|
|
333
339
|
"consent": {
|
|
334
340
|
"functional": true
|
|
335
341
|
},
|
|
336
|
-
"id": "
|
|
342
|
+
"id": "ac962ca21178ce3c",
|
|
337
343
|
"trigger": "load",
|
|
338
344
|
"entity": "page",
|
|
339
345
|
"action": "view",
|
|
@@ -396,7 +402,7 @@
|
|
|
396
402
|
"consent": {
|
|
397
403
|
"functional": true
|
|
398
404
|
},
|
|
399
|
-
"id": "
|
|
405
|
+
"id": "3252a9cbc1dfa964",
|
|
400
406
|
"trigger": "load",
|
|
401
407
|
"entity": "product",
|
|
402
408
|
"action": "view",
|
|
@@ -463,7 +469,7 @@
|
|
|
463
469
|
"consent": {
|
|
464
470
|
"functional": true
|
|
465
471
|
},
|
|
466
|
-
"id": "
|
|
472
|
+
"id": "f44a12d85026b643",
|
|
467
473
|
"trigger": "test",
|
|
468
474
|
"entity": "company",
|
|
469
475
|
"action": "update",
|
|
@@ -587,7 +593,7 @@
|
|
|
587
593
|
"consent": {
|
|
588
594
|
"functional": true
|
|
589
595
|
},
|
|
590
|
-
"id": "
|
|
596
|
+
"id": "4fd580ddb8d0a7f1",
|
|
591
597
|
"trigger": "load",
|
|
592
598
|
"entity": "order",
|
|
593
599
|
"action": "complete",
|
|
@@ -656,7 +662,7 @@
|
|
|
656
662
|
"consent": {
|
|
657
663
|
"functional": true
|
|
658
664
|
},
|
|
659
|
-
"id": "
|
|
665
|
+
"id": "44aa6e14a7c22389",
|
|
660
666
|
"trigger": "test",
|
|
661
667
|
"entity": "profile",
|
|
662
668
|
"action": "update",
|
|
@@ -777,7 +783,7 @@
|
|
|
777
783
|
"consent": {
|
|
778
784
|
"functional": true
|
|
779
785
|
},
|
|
780
|
-
"id": "
|
|
786
|
+
"id": "3d9e72e29f71bc25",
|
|
781
787
|
"trigger": "load",
|
|
782
788
|
"entity": "order",
|
|
783
789
|
"action": "complete",
|
|
@@ -846,7 +852,7 @@
|
|
|
846
852
|
"consent": {
|
|
847
853
|
"functional": true
|
|
848
854
|
},
|
|
849
|
-
"id": "
|
|
855
|
+
"id": "70012f5f09cac9f2",
|
|
850
856
|
"trigger": "test",
|
|
851
857
|
"entity": "user",
|
|
852
858
|
"action": "login",
|
|
@@ -939,7 +945,7 @@
|
|
|
939
945
|
"consent": {
|
|
940
946
|
"functional": true
|
|
941
947
|
},
|
|
942
|
-
"id": "
|
|
948
|
+
"id": "e5016605a8731958",
|
|
943
949
|
"trigger": "test",
|
|
944
950
|
"entity": "user",
|
|
945
951
|
"action": "logout",
|
|
@@ -1004,7 +1010,7 @@
|
|
|
1004
1010
|
"consent": {
|
|
1005
1011
|
"functional": true
|
|
1006
1012
|
},
|
|
1007
|
-
"id": "
|
|
1013
|
+
"id": "c4a9e4ab2cecf3c1",
|
|
1008
1014
|
"trigger": "test",
|
|
1009
1015
|
"entity": "debug",
|
|
1010
1016
|
"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.2.
|
|
4
|
+
"version": "4.2.1-next-1781538735002",
|
|
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.2.
|
|
41
|
+
"@walkeros/core": "4.2.1-next-1781538735002",
|
|
42
42
|
"posthog-js": "^1.367.0",
|
|
43
|
-
"@walkeros/web-core": "4.2.
|
|
43
|
+
"@walkeros/web-core": "4.2.1-next-1781538735002"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@walkeros/collector": "4.2.
|
|
46
|
+
"@walkeros/collector": "4.2.1-next-1781538735002"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|