@walkeros/web-destination-heap 4.7.2 → 4.8.0-next-1791441510508

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @walkeros/web-destination-heap
2
2
 
3
+ ## 4.8.0-next-1791441510508
4
+
5
+ ### Patch Changes
6
+
7
+ - 5593d7b: The `disablePageviewAutocapture`, `disableSessionReplay` and
8
+ `ingestServer` descriptions now say that the classic Heap SDK loaded by
9
+ `loadScript` ignores them. The settings schema lists `heapConfig` for further
10
+ `heap.load()` options, and the step examples name the destination config they
11
+ rely on and the consent methods the classic SDK lacks.
12
+ - Updated dependencies [5593d7b]
13
+ - @walkeros/core@4.8.0-next-1791441510508
14
+ - @walkeros/web-core@4.8.0-next-1791441510508
15
+
3
16
  ## 4.7.2
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -32,7 +32,12 @@ npm install @walkeros/web-destination-heap
32
32
  "destinations": {
33
33
  "heap": {
34
34
  "package": "@walkeros/web-destination-heap",
35
- "config": {}
35
+ "config": {
36
+ "loadScript": true,
37
+ "settings": {
38
+ "appId": "YOUR_HEAP_APP_ID"
39
+ }
40
+ }
36
41
  }
37
42
  }
38
43
  }
package/dist/dev.d.mts CHANGED
@@ -10,6 +10,7 @@ declare const SettingsSchema: z.ZodObject<{
10
10
  disableSessionReplay: z.ZodOptional<z.ZodBoolean>;
11
11
  secureCookie: z.ZodOptional<z.ZodBoolean>;
12
12
  ingestServer: z.ZodOptional<z.ZodString>;
13
+ heapConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
14
  identify: z.ZodOptional<z.ZodUnknown>;
14
15
  userProperties: z.ZodOptional<z.ZodUnknown>;
15
16
  }, z.core.$strip>;
package/dist/dev.d.ts CHANGED
@@ -10,6 +10,7 @@ declare const SettingsSchema: z.ZodObject<{
10
10
  disableSessionReplay: z.ZodOptional<z.ZodBoolean>;
11
11
  secureCookie: z.ZodOptional<z.ZodBoolean>;
12
12
  ingestServer: z.ZodOptional<z.ZodString>;
13
+ heapConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
14
  identify: z.ZodOptional<z.ZodUnknown>;
14
15
  userProperties: z.ZodOptional<z.ZodUnknown>;
15
16
  }, z.core.$strip>;
package/dist/dev.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},o={};n(o,{examples:()=>v,schemas:()=>s}),module.exports=(e=o,((e,n,o,s)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let p of r(n))i.call(e,p)||p===o||t(e,p,{get:()=>n[p],enumerable:!(s=a(n,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};n(s,{MappingSchema:()=>u,SettingsSchema:()=>d,mapping:()=>g,settings:()=>m});var p=require("@walkeros/core/dev"),l=require("@walkeros/core/dev"),d=l.z.object({appId:l.z.string().min(1).describe("Heap App ID. Find it in your Heap project under Settings > App ID."),disableTextCapture:l.z.boolean().describe("Disable Heap auto text capture. Default: true.").optional(),disablePageviewAutocapture:l.z.boolean().describe("Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews).").optional(),disableSessionReplay:l.z.boolean().describe("Disable Heap session replay.").optional(),secureCookie:l.z.boolean().describe("SSL-only cookies.").optional(),ingestServer:l.z.string().url().describe("Custom server endpoint for proxying Heap data.").optional(),identify:l.z.unknown().describe('Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { "key": "user.id" }.').optional(),userProperties:l.z.unknown().describe('Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { "map": { "plan": "data.plan" } }.').optional()}),c=require("@walkeros/core/dev"),u=c.z.object({identify:c.z.unknown().describe('Per-event identity. Resolves to a string for heap.identify(). Example: { "key": "data.email" }.').optional(),reset:c.z.unknown().describe("Reset Heap identity on this event. Set to true to call heap.resetIdentity().").optional(),userProperties:c.z.unknown().describe("Per-event user properties. Resolves to object for heap.addUserProperties().").optional(),eventProperties:c.z.unknown().describe("Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).").optional(),clearEventProperties:c.z.unknown().describe("Clear all persistent event properties. Set to true to call heap.clearEventProperties().").optional()}),m=(0,p.zodToSchema)(d),g=(0,p.zodToSchema)(u),v={};n(v,{env:()=>h,step:()=>P});var h={};n(h,{init:()=>k,push:()=>f,simulation:()=>b});var y=()=>{};function w(){return{load:y,track:y,identify:y,resetIdentity:y,addUserProperties:y,addEventProperties:y,clearEventProperties:y,startTracking:y,stopTracking:y}}var k={window:{heap:w()}},f={window:{heap:w()}},b=["call:window.heap.track","call:window.heap.identify","call:window.heap.resetIdentity","call:window.heap.addUserProperties","call:window.heap.addEventProperties","call:window.heap.clearEventProperties","call:window.heap.startTracking","call:window.heap.stopTracking"],P={};n(P,{consentGrantStartTracking:()=>D,consentRevokeStopTracking:()=>A,defaultEventForwarding:()=>z,destinationLevelIdentify:()=>U,destinationLevelInclude:()=>S,eventWithUserProperties:()=>R,globalEventProperties:()=>T,userLoginIdentify:()=>_,userLogoutReset:()=>H});var E=require("@walkeros/core"),z={title:"Default track",description:"A walker event becomes a Heap track call with the event name and empty properties.",in:(0,E.getEvent)("product view",{timestamp:1700000100}),out:[["heap.track","product view",{}]]},S={title:"Renamed purchase",description:"An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.",in:(0,E.getEvent)("order complete",{timestamp:1700000101}),mapping:{name:"purchase",data:{map:{order_id:"data.id",total:"data.total",currency:{key:"data.currency",value:"EUR"}}}},out:[["heap.track","purchase",{order_id:"0rd3r1d",total:555,currency:"EUR"}]]},U={title:"Destination identify",description:"Destination-level identify calls heap.identify with the user id before firing the default track.",in:(0,E.getEvent)("page view",{timestamp:1700000102}),settings:{identify:"user.id"},out:[["heap.identify","us3r"],["heap.track","page view",{}]]},_={title:"User login identify",description:"A user login identifies the Heap user by email and adds user properties while skipping the track.",in:(0,E.getEvent)("user login",{timestamp:1700000103,data:{email:"user@example.com",plan:"premium",company:"Acme"}}),mapping:{silent:!0,settings:{identify:"data.email",userProperties:{map:{plan:"data.plan",company:"data.company"}}}},out:[["heap.identify","user@example.com"],["heap.addUserProperties",{plan:"premium",company:"Acme"}]]},H={title:"User logout reset",description:"A user logout calls heap.resetIdentity to clear the identified user from the Heap client.",in:(0,E.getEvent)("user logout",{timestamp:1700000104}),mapping:{silent:!0,settings:{reset:!0}},out:[["heap.resetIdentity"]]},R={title:"User properties on event",description:"An order fires Heap addUserProperties with last-order fields and then tracks the event.",in:(0,E.getEvent)("order complete",{timestamp:1700000105,data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{settings:{userProperties:{map:{last_order_value:"data.total",last_order_currency:"data.currency"}}}},out:[["heap.addUserProperties",{last_order_value:555,last_order_currency:"EUR"}],["heap.track","order complete",{}]]},T={title:"Global event properties",description:"A page view sets persistent Heap event properties so all subsequent events include the page category.",in:(0,E.getEvent)("page view",{timestamp:1700000106,data:{category:"docs"}}),mapping:{silent:!0,settings:{eventProperties:{map:{page_category:"data.category"}}}},out:[["heap.addEventProperties",{page_category:"docs"}]]},A={title:"Consent revoked",description:"After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",command:"consent",before:{analytics:!0},in:{analytics:!1},out:[["heap.startTracking"],["heap.stopTracking"]]},D={title:"Consent granted",description:"A walker consent grant for analytics calls heap.startTracking to resume event capture.",command:"consent",in:{analytics:!0},out:[["heap.startTracking"]]};//# sourceMappingURL=dev.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},o={};n(o,{examples:()=>m,schemas:()=>s}),module.exports=(e=o,((e,n,o,s)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let p of r(n))i.call(e,p)||p===o||t(e,p,{get:()=>n[p],enumerable:!(s=a(n,p))||s.enumerable});return e})(t({},"__esModule",{value:!0}),e));var s={};n(s,{MappingSchema:()=>u,SettingsSchema:()=>l,mapping:()=>g,settings:()=>h});var p=require("@walkeros/core/dev"),d=require("@walkeros/core/dev"),l=d.z.object({appId:d.z.string().min(1).describe("Heap App ID. Find it in your Heap project under Settings > App ID."),disableTextCapture:d.z.boolean().describe("Disable Heap auto text capture. Default: true.").optional(),disablePageviewAutocapture:d.z.boolean().describe("Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews). Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),disableSessionReplay:d.z.boolean().describe("Disable Heap session replay. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),secureCookie:d.z.boolean().describe("SSL-only cookies.").optional(),ingestServer:d.z.string().url().describe("Custom server endpoint for proxying Heap data. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),heapConfig:d.z.record(d.z.string(),d.z.unknown()).describe('Additional heap.load() options, merged over the options above. Example: { "trackingServer": "https://heap.example.com" }.').optional(),identify:d.z.unknown().describe('Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { "key": "user.id" }.').optional(),userProperties:d.z.unknown().describe('Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { "map": { "plan": "data.plan" } }.').optional()}),c=require("@walkeros/core/dev"),u=c.z.object({identify:c.z.unknown().describe('Per-event identity. Resolves to a string for heap.identify(). Example: { "key": "data.email" }.').optional(),reset:c.z.unknown().describe("Reset Heap identity on this event. Set to true to call heap.resetIdentity().").optional(),userProperties:c.z.unknown().describe("Per-event user properties. Resolves to object for heap.addUserProperties().").optional(),eventProperties:c.z.unknown().describe("Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).").optional(),clearEventProperties:c.z.unknown().describe("Clear all persistent event properties. Set to true to call heap.clearEventProperties().").optional()}),h=(0,p.zodToSchema)(l),g=(0,p.zodToSchema)(u),m={};n(m,{env:()=>v,step:()=>P});var v={};n(v,{init:()=>k,push:()=>f,simulation:()=>b});var y=()=>{};function w(){return{load:y,track:y,identify:y,resetIdentity:y,addUserProperties:y,addEventProperties:y,clearEventProperties:y,startTracking:y,stopTracking:y}}var k={window:{heap:w()}},f={window:{heap:w()}},b=["call:window.heap.track","call:window.heap.identify","call:window.heap.resetIdentity","call:window.heap.addUserProperties","call:window.heap.addEventProperties","call:window.heap.clearEventProperties","call:window.heap.startTracking","call:window.heap.stopTracking"],P={};n(P,{consentGrantStartTracking:()=>x,consentRevokeStopTracking:()=>R,defaultEventForwarding:()=>S,destinationLevelIdentify:()=>H,destinationLevelInclude:()=>z,eventWithUserProperties:()=>U,globalEventProperties:()=>_,userLoginIdentify:()=>D,userLogoutReset:()=>T});var E=require("@walkeros/core"),S={title:"Default track",description:"A walker event becomes a Heap track call with the event name and empty properties.",in:(0,E.getEvent)("product view",{timestamp:1700000100}),out:[["heap.track","product view",{}]]},z={title:"Renamed purchase",description:"An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.",in:(0,E.getEvent)("order complete",{timestamp:1700000101}),mapping:{name:"purchase",data:{map:{order_id:"data.id",total:"data.total",currency:{key:"data.currency",value:"EUR"}}}},out:[["heap.track","purchase",{order_id:"0rd3r1d",total:555,currency:"EUR"}]]},H={title:"Destination identify",description:"With settings.identify set to 'user.id', the destination calls heap.identify before the default track.",in:(0,E.getEvent)("page view",{timestamp:1700000102}),settings:{identify:"user.id"},out:[["heap.identify","us3r"],["heap.track","page view",{}]]},D={title:"User login identify",description:"A user login identifies the Heap user by email and adds user properties while skipping the track.",in:(0,E.getEvent)("user login",{timestamp:1700000103,data:{email:"user@example.com",plan:"premium",company:"Acme"}}),mapping:{silent:!0,settings:{identify:"data.email",userProperties:{map:{plan:"data.plan",company:"data.company"}}}},out:[["heap.identify","user@example.com"],["heap.addUserProperties",{plan:"premium",company:"Acme"}]]},T={title:"User logout reset",description:"A user logout calls heap.resetIdentity to clear the identified user from the Heap client.",in:(0,E.getEvent)("user logout",{timestamp:1700000104}),mapping:{silent:!0,settings:{reset:!0}},out:[["heap.resetIdentity"]]},U={title:"User properties on event",description:"An order fires Heap addUserProperties with last-order fields and then tracks the event.",in:(0,E.getEvent)("order complete",{timestamp:1700000105,data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{settings:{userProperties:{map:{last_order_value:"data.total",last_order_currency:"data.currency"}}}},out:[["heap.addUserProperties",{last_order_value:555,last_order_currency:"EUR"}],["heap.track","order complete",{}]]},_={title:"Global event properties",description:"A page view sets persistent Heap event properties so all subsequent events include the page category.",in:(0,E.getEvent)("page view",{timestamp:1700000106,data:{category:"docs"}}),mapping:{silent:!0,settings:{eventProperties:{map:{page_category:"data.category"}}}},out:[["heap.addEventProperties",{page_category:"docs"}]]},R={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.",command:"consent",before:{analytics:!0},in:{analytics:!1},out:[["heap.startTracking"],["heap.stopTracking"]]},x={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.",command:"consent",in:{analytics:!0},out:[["heap.startTracking"]]};//# 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 appId: z\n .string()\n .min(1)\n .describe(\n 'Heap App ID. Find it in your Heap project under Settings > App ID.',\n ),\n disableTextCapture: z\n .boolean()\n .describe('Disable Heap auto text capture. Default: true.')\n .optional(),\n disablePageviewAutocapture: z\n .boolean()\n .describe(\n 'Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews).',\n )\n .optional(),\n disableSessionReplay: z\n .boolean()\n .describe('Disable Heap session replay.')\n .optional(),\n secureCookie: z.boolean().describe('SSL-only cookies.').optional(),\n ingestServer: z\n .string()\n .url()\n .describe('Custom server endpoint for proxying Heap data.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { \"key\": \"user.id\" }.',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { \"map\": { \"plan\": \"data.plan\" } }.',\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. Resolves to a string for heap.identify(). Example: { \"key\": \"data.email\" }.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Reset Heap identity on this event. Set to true to call heap.resetIdentity().',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Per-event user properties. Resolves to object for heap.addUserProperties().',\n )\n .optional(),\n eventProperties: z\n .unknown()\n .describe(\n 'Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).',\n )\n .optional(),\n clearEventProperties: z\n .unknown()\n .describe(\n 'Clear all persistent event properties. Set to true to call heap.clearEventProperties().',\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, HeapSDK } from '../types';\n\n/**\n * Example environment configurations for the Heap destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves env undefined — the destination uses the real\n * window.heap command queue it creates during init.\n */\n\n// Narrow helper type aliases so the noop casts don't use `as any`.\ntype HeapLoad = HeapSDK['load'];\ntype HeapTrack = HeapSDK['track'];\ntype HeapIdentify = HeapSDK['identify'];\ntype HeapAddUserProperties = HeapSDK['addUserProperties'];\ntype HeapAddEventProperties = HeapSDK['addEventProperties'];\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nfunction createMockHeap(): HeapSDK {\n return {\n load: noop as HeapLoad,\n track: noop as HeapTrack,\n identify: noop as HeapIdentify,\n resetIdentity: noop,\n addUserProperties: noop as HeapAddUserProperties,\n addEventProperties: noop as HeapAddEventProperties,\n clearEventProperties: noop,\n startTracking: noop,\n stopTracking: noop,\n };\n}\n\n/**\n * Pre-init env — window.heap is a no-op queue until init wires it.\n */\nexport const init: Env | undefined = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/**\n * Post-init env — window.heap methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:window.heap.track',\n 'call:window.heap.identify',\n 'call:window.heap.resetIdentity',\n 'call:window.heap.addUserProperties',\n 'call:window.heap.addEventProperties',\n 'call:window.heap.clearEventProperties',\n 'call:window.heap.startTracking',\n 'call:window.heap.stopTracking',\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 overrides.\n * The test runner reads `settings` from the example and merges it on top\n * of the fixed appId when registering the destination.\n */\nexport type HeapStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\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 * heap.track(event.name, properties). With no mapping, properties is `{}`.\n */\nexport const defaultEventForwarding: HeapStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Heap track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['heap.track', 'product view', {}]],\n};\n\n/**\n * Rename + map event properties via rule.data.map.\n * data resolves to { order_id, total, currency } → heap.track('purchase', props).\n */\nexport const destinationLevelInclude: HeapStepExample = {\n title: 'Renamed purchase',\n description:\n 'An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n total: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n out: [\n [\n 'heap.track',\n 'purchase',\n { order_id: '0rd3r1d', total: 555, currency: 'EUR' },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify - heap.identify() resolves user.id,\n * then the default heap.track() call fires.\n */\nexport const destinationLevelIdentify: HeapStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls heap.identify with the user id before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000102 }),\n settings: {\n identify: 'user.id',\n },\n out: [\n ['heap.identify', 'us3r'],\n ['heap.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event login identify - heap.identify() from data.email + user\n * properties from the same rule. silent: true suppresses the track() call.\n */\nexport const userLoginIdentify: HeapStepExample = {\n title: 'User login identify',\n description:\n 'A user login identifies the Heap user by email and adds user properties while skipping the track.',\n in: getEvent('user login', {\n timestamp: 1700000103,\n data: {\n email: 'user@example.com',\n plan: 'premium',\n company: 'Acme',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: 'data.email',\n userProperties: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n },\n },\n out: [\n ['heap.identify', 'user@example.com'],\n ['heap.addUserProperties', { plan: 'premium', company: 'Acme' }],\n ],\n};\n\n/**\n * User logout - heap.resetIdentity(). silent: true suppresses the track() call.\n */\nexport const userLogoutReset: HeapStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls heap.resetIdentity to clear the identified user from the Heap client.',\n in: getEvent('user logout', { timestamp: 1700000104 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['heap.resetIdentity']],\n};\n\n/**\n * Event with user properties from mapping - heap.addUserProperties() fires,\n * then the default heap.track() call.\n */\nexport const eventWithUserProperties: HeapStepExample = {\n title: 'User properties on event',\n description:\n 'An order fires Heap addUserProperties with last-order fields and then tracks the event.',\n in: getEvent('order complete', {\n timestamp: 1700000105,\n data: {\n id: '0rd3r1d',\n total: 555,\n currency: 'EUR',\n },\n }),\n mapping: {\n settings: {\n userProperties: {\n map: {\n last_order_value: 'data.total',\n last_order_currency: 'data.currency',\n },\n },\n },\n },\n out: [\n [\n 'heap.addUserProperties',\n { last_order_value: 555, last_order_currency: 'EUR' },\n ],\n ['heap.track', 'order complete', {}],\n ],\n};\n\n/**\n * Global event properties - heap.addEventProperties() sets persistent\n * properties on all subsequent events. silent: true on this rule.\n */\nexport const globalEventProperties: HeapStepExample = {\n title: 'Global event properties',\n description:\n 'A page view sets persistent Heap event properties so all subsequent events include the page category.',\n in: getEvent('page view', {\n timestamp: 1700000106,\n data: { category: 'docs' },\n }),\n mapping: {\n silent: true,\n settings: {\n eventProperties: {\n map: {\n page_category: 'data.category',\n },\n },\n },\n },\n out: [['heap.addEventProperties', { page_category: 'docs' }]],\n};\n\n/**\n * Consent granted then revoked: the destination loads under the grant\n * (heap.startTracking), and the later revoke calls heap.stopTracking via the\n * on('consent') handler. A gated destination never loads under denial, so the\n * stop is a real revocation of an already-granted destination.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false },\n out: [['heap.startTracking'], ['heap.stopTracking']],\n};\n\n/**\n * Consent granted - on('consent') handler calls heap.startTracking()\n * when all required consent keys are true.\n */\nexport const consentGrantStartTracking: HeapStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent grant for analytics calls heap.startTracking to resume event capture.',\n command: 'consent',\n in: { analytics: true },\n out: [['heap.startTracking']],\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,OAAO,aACJ,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,oBAAoB,aACjB,QAAQ,EACR,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,4BAA4B,aACzB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,sBAAsB,aACnB,QAAQ,EACR,SAAS,8BAA8B,EACvC,SAAS;AAAA,EACZ,cAAc,aAAE,QAAQ,EAAE,SAAS,mBAAmB,EAAE,SAAS;AAAA,EACjE,cAAc,aACX,OAAO,EACP,IAAI,EACJ,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,UAAU,aACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,aACb,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACzCD,IAAAC,cAAkB;AAEX,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,UAAU,cACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAO,cACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,cACb,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiB,cAC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I,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC,CAAC,oBAAoB,CAAC;AAC9B;","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 appId: z\n .string()\n .min(1)\n .describe(\n 'Heap App ID. Find it in your Heap project under Settings > App ID.',\n ),\n disableTextCapture: z\n .boolean()\n .describe('Disable Heap auto text capture. Default: true.')\n .optional(),\n disablePageviewAutocapture: z\n .boolean()\n .describe(\n 'Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews). Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n disableSessionReplay: z\n .boolean()\n .describe(\n 'Disable Heap session replay. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n secureCookie: z.boolean().describe('SSL-only cookies.').optional(),\n ingestServer: z\n .string()\n .url()\n .describe(\n 'Custom server endpoint for proxying Heap data. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n heapConfig: z\n .record(z.string(), z.unknown())\n .describe(\n 'Additional heap.load() options, merged over the options above. Example: { \"trackingServer\": \"https://heap.example.com\" }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { \"key\": \"user.id\" }.',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { \"map\": { \"plan\": \"data.plan\" } }.',\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. Resolves to a string for heap.identify(). Example: { \"key\": \"data.email\" }.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Reset Heap identity on this event. Set to true to call heap.resetIdentity().',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Per-event user properties. Resolves to object for heap.addUserProperties().',\n )\n .optional(),\n eventProperties: z\n .unknown()\n .describe(\n 'Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).',\n )\n .optional(),\n clearEventProperties: z\n .unknown()\n .describe(\n 'Clear all persistent event properties. Set to true to call heap.clearEventProperties().',\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, HeapSDK } from '../types';\n\n/**\n * Example environment configurations for the Heap destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves env undefined — the destination uses the real\n * window.heap command queue it creates during init.\n */\n\n// Narrow helper type aliases so the noop casts don't use `as any`.\ntype HeapLoad = HeapSDK['load'];\ntype HeapTrack = HeapSDK['track'];\ntype HeapIdentify = HeapSDK['identify'];\ntype HeapAddUserProperties = HeapSDK['addUserProperties'];\ntype HeapAddEventProperties = HeapSDK['addEventProperties'];\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nfunction createMockHeap(): HeapSDK {\n return {\n load: noop as HeapLoad,\n track: noop as HeapTrack,\n identify: noop as HeapIdentify,\n resetIdentity: noop,\n addUserProperties: noop as HeapAddUserProperties,\n addEventProperties: noop as HeapAddEventProperties,\n clearEventProperties: noop,\n startTracking: noop,\n stopTracking: noop,\n };\n}\n\n/**\n * Pre-init env — window.heap is a no-op queue until init wires it.\n */\nexport const init: Env | undefined = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/**\n * Post-init env — window.heap methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:window.heap.track',\n 'call:window.heap.identify',\n 'call:window.heap.resetIdentity',\n 'call:window.heap.addUserProperties',\n 'call:window.heap.addEventProperties',\n 'call:window.heap.clearEventProperties',\n 'call:window.heap.startTracking',\n 'call:window.heap.stopTracking',\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 overrides.\n * The test runner reads `settings` from the example and merges it on top\n * of the fixed appId when registering the destination.\n */\nexport type HeapStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\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 * heap.track(event.name, properties). With no mapping, properties is `{}`.\n */\nexport const defaultEventForwarding: HeapStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Heap track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['heap.track', 'product view', {}]],\n};\n\n/**\n * Rename + map event properties via rule.data.map.\n * data resolves to { order_id, total, currency } → heap.track('purchase', props).\n */\nexport const destinationLevelInclude: HeapStepExample = {\n title: 'Renamed purchase',\n description:\n 'An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n total: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n out: [\n [\n 'heap.track',\n 'purchase',\n { order_id: '0rd3r1d', total: 555, currency: 'EUR' },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify - heap.identify() resolves user.id,\n * then the default heap.track() call fires.\n */\nexport const destinationLevelIdentify: HeapStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify set to 'user.id', the destination calls heap.identify before the default track.\",\n in: getEvent('page view', { timestamp: 1700000102 }),\n settings: {\n identify: 'user.id',\n },\n out: [\n ['heap.identify', 'us3r'],\n ['heap.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event login identify - heap.identify() from data.email + user\n * properties from the same rule. silent: true suppresses the track() call.\n */\nexport const userLoginIdentify: HeapStepExample = {\n title: 'User login identify',\n description:\n 'A user login identifies the Heap user by email and adds user properties while skipping the track.',\n in: getEvent('user login', {\n timestamp: 1700000103,\n data: {\n email: 'user@example.com',\n plan: 'premium',\n company: 'Acme',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: 'data.email',\n userProperties: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n },\n },\n out: [\n ['heap.identify', 'user@example.com'],\n ['heap.addUserProperties', { plan: 'premium', company: 'Acme' }],\n ],\n};\n\n/**\n * User logout - heap.resetIdentity(). silent: true suppresses the track() call.\n */\nexport const userLogoutReset: HeapStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls heap.resetIdentity to clear the identified user from the Heap client.',\n in: getEvent('user logout', { timestamp: 1700000104 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['heap.resetIdentity']],\n};\n\n/**\n * Event with user properties from mapping - heap.addUserProperties() fires,\n * then the default heap.track() call.\n */\nexport const eventWithUserProperties: HeapStepExample = {\n title: 'User properties on event',\n description:\n 'An order fires Heap addUserProperties with last-order fields and then tracks the event.',\n in: getEvent('order complete', {\n timestamp: 1700000105,\n data: {\n id: '0rd3r1d',\n total: 555,\n currency: 'EUR',\n },\n }),\n mapping: {\n settings: {\n userProperties: {\n map: {\n last_order_value: 'data.total',\n last_order_currency: 'data.currency',\n },\n },\n },\n },\n out: [\n [\n 'heap.addUserProperties',\n { last_order_value: 555, last_order_currency: 'EUR' },\n ],\n ['heap.track', 'order complete', {}],\n ],\n};\n\n/**\n * Global event properties - heap.addEventProperties() sets persistent\n * properties on all subsequent events. silent: true on this rule.\n */\nexport const globalEventProperties: HeapStepExample = {\n title: 'Global event properties',\n description:\n 'A page view sets persistent Heap event properties so all subsequent events include the page category.',\n in: getEvent('page view', {\n timestamp: 1700000106,\n data: { category: 'docs' },\n }),\n mapping: {\n silent: true,\n settings: {\n eventProperties: {\n map: {\n page_category: 'data.category',\n },\n },\n },\n },\n out: [['heap.addEventProperties', { page_category: 'docs' }]],\n};\n\n/**\n * Consent granted then revoked: the destination loads under the grant\n * (heap.startTracking), and the later revoke calls heap.stopTracking via the\n * on('consent') handler. A gated destination never loads under denial, so the\n * stop is a real revocation of an already-granted destination.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false },\n out: [['heap.startTracking'], ['heap.stopTracking']],\n};\n\n/**\n * Consent granted - on('consent') handler calls heap.startTracking()\n * when all required consent keys are true.\n */\nexport const consentGrantStartTracking: HeapStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.',\n command: 'consent',\n in: { analytics: true },\n out: [['heap.startTracking']],\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,OAAO,aACJ,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,oBAAoB,aACjB,QAAQ,EACR,SAAS,gDAAgD,E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A,EACA,KAAK;AAAA,IACH;AAAA,MACE;AAAA,MACA,EAAE,kBAAkB,KAAK,qBAAqB,MAAM;AAAA,IACtD;AAAA,IACA,CAAC,cAAc,kBAAkB,CAAC,CAAC;AAAA,EACrC;AACF;AAMO,IAAM,wBAAyC;AAAA,EACpD,OAAO;AAAA,EACP,aACE;AAAA,EACF,QAAI,sBAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,UAAU,OAAO;AAAA,EAC3B,CAAC;AAAA,EACD,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,MACR,iBAAiB;AAAA,QACf,KAAK;AAAA,UACH,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,2BAA2B,EAAE,eAAe,OAAO,CAAC,CAAC;AAC9D;AAQO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,oBAAoB,GAAG,CAAC,mBAAmB,CAAC;AACrD;AAMO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC,CAAC,oBAAoB,CAAC;AAC9B;","names":["import_dev","import_dev"]}
package/dist/dev.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>n,mapping:()=>d,settings:()=>p});import{zodToSchema as r}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var n=i.object({appId:i.string().min(1).describe("Heap App ID. Find it in your Heap project under Settings > App ID."),disableTextCapture:i.boolean().describe("Disable Heap auto text capture. Default: true.").optional(),disablePageviewAutocapture:i.boolean().describe("Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews).").optional(),disableSessionReplay:i.boolean().describe("Disable Heap session replay.").optional(),secureCookie:i.boolean().describe("SSL-only cookies.").optional(),ingestServer:i.string().url().describe("Custom server endpoint for proxying Heap data.").optional(),identify:i.unknown().describe('Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { "key": "user.id" }.').optional(),userProperties:i.unknown().describe('Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { "map": { "plan": "data.plan" } }.').optional()});import{z as o}from"@walkeros/core/dev";var s=o.object({identify:o.unknown().describe('Per-event identity. Resolves to a string for heap.identify(). Example: { "key": "data.email" }.').optional(),reset:o.unknown().describe("Reset Heap identity on this event. Set to true to call heap.resetIdentity().").optional(),userProperties:o.unknown().describe("Per-event user properties. Resolves to object for heap.addUserProperties().").optional(),eventProperties:o.unknown().describe("Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).").optional(),clearEventProperties:o.unknown().describe("Clear all persistent event properties. Set to true to call heap.clearEventProperties().").optional()}),p=r(n),d=r(s),l={};t(l,{env:()=>c,step:()=>y});var c={};t(c,{init:()=>g,push:()=>v,simulation:()=>h});var u=()=>{};function m(){return{load:u,track:u,identify:u,resetIdentity:u,addUserProperties:u,addEventProperties:u,clearEventProperties:u,startTracking:u,stopTracking:u}}var g={window:{heap:m()}},v={window:{heap:m()}},h=["call:window.heap.track","call:window.heap.identify","call:window.heap.resetIdentity","call:window.heap.addUserProperties","call:window.heap.addEventProperties","call:window.heap.clearEventProperties","call:window.heap.startTracking","call:window.heap.stopTracking"],y={};t(y,{consentGrantStartTracking:()=>A,consentRevokeStopTracking:()=>R,defaultEventForwarding:()=>w,destinationLevelIdentify:()=>b,destinationLevelInclude:()=>f,eventWithUserProperties:()=>U,globalEventProperties:()=>H,userLoginIdentify:()=>P,userLogoutReset:()=>E});import{getEvent as k}from"@walkeros/core";var w={title:"Default track",description:"A walker event becomes a Heap track call with the event name and empty properties.",in:k("product view",{timestamp:1700000100}),out:[["heap.track","product view",{}]]},f={title:"Renamed purchase",description:"An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.",in:k("order complete",{timestamp:1700000101}),mapping:{name:"purchase",data:{map:{order_id:"data.id",total:"data.total",currency:{key:"data.currency",value:"EUR"}}}},out:[["heap.track","purchase",{order_id:"0rd3r1d",total:555,currency:"EUR"}]]},b={title:"Destination identify",description:"Destination-level identify calls heap.identify with the user id before firing the default track.",in:k("page view",{timestamp:1700000102}),settings:{identify:"user.id"},out:[["heap.identify","us3r"],["heap.track","page view",{}]]},P={title:"User login identify",description:"A user login identifies the Heap user by email and adds user properties while skipping the track.",in:k("user login",{timestamp:1700000103,data:{email:"user@example.com",plan:"premium",company:"Acme"}}),mapping:{silent:!0,settings:{identify:"data.email",userProperties:{map:{plan:"data.plan",company:"data.company"}}}},out:[["heap.identify","user@example.com"],["heap.addUserProperties",{plan:"premium",company:"Acme"}]]},E={title:"User logout reset",description:"A user logout calls heap.resetIdentity to clear the identified user from the Heap client.",in:k("user logout",{timestamp:1700000104}),mapping:{silent:!0,settings:{reset:!0}},out:[["heap.resetIdentity"]]},U={title:"User properties on event",description:"An order fires Heap addUserProperties with last-order fields and then tracks the event.",in:k("order complete",{timestamp:1700000105,data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{settings:{userProperties:{map:{last_order_value:"data.total",last_order_currency:"data.currency"}}}},out:[["heap.addUserProperties",{last_order_value:555,last_order_currency:"EUR"}],["heap.track","order complete",{}]]},H={title:"Global event properties",description:"A page view sets persistent Heap event properties so all subsequent events include the page category.",in:k("page view",{timestamp:1700000106,data:{category:"docs"}}),mapping:{silent:!0,settings:{eventProperties:{map:{page_category:"data.category"}}}},out:[["heap.addEventProperties",{page_category:"docs"}]]},R={title:"Consent revoked",description:"After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",command:"consent",before:{analytics:!0},in:{analytics:!1},out:[["heap.startTracking"],["heap.stopTracking"]]},A={title:"Consent granted",description:"A walker consent grant for analytics calls heap.startTracking to resume event capture.",command:"consent",in:{analytics:!0},out:[["heap.startTracking"]]};export{l as examples,a as schemas};//# sourceMappingURL=dev.mjs.map
1
+ var e=Object.defineProperty,t=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},a={};t(a,{MappingSchema:()=>s,SettingsSchema:()=>o,mapping:()=>d,settings:()=>p});import{zodToSchema as r}from"@walkeros/core/dev";import{z as i}from"@walkeros/core/dev";var o=i.object({appId:i.string().min(1).describe("Heap App ID. Find it in your Heap project under Settings > App ID."),disableTextCapture:i.boolean().describe("Disable Heap auto text capture. Default: true.").optional(),disablePageviewAutocapture:i.boolean().describe("Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews). Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),disableSessionReplay:i.boolean().describe("Disable Heap session replay. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),secureCookie:i.boolean().describe("SSL-only cookies.").optional(),ingestServer:i.string().url().describe("Custom server endpoint for proxying Heap data. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.").optional(),heapConfig:i.record(i.string(),i.unknown()).describe('Additional heap.load() options, merged over the options above. Example: { "trackingServer": "https://heap.example.com" }.').optional(),identify:i.unknown().describe('Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { "key": "user.id" }.').optional(),userProperties:i.unknown().describe('Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { "map": { "plan": "data.plan" } }.').optional()});import{z as n}from"@walkeros/core/dev";var s=n.object({identify:n.unknown().describe('Per-event identity. Resolves to a string for heap.identify(). Example: { "key": "data.email" }.').optional(),reset:n.unknown().describe("Reset Heap identity on this event. Set to true to call heap.resetIdentity().").optional(),userProperties:n.unknown().describe("Per-event user properties. Resolves to object for heap.addUserProperties().").optional(),eventProperties:n.unknown().describe("Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).").optional(),clearEventProperties:n.unknown().describe("Clear all persistent event properties. Set to true to call heap.clearEventProperties().").optional()}),p=r(o),d=r(s),l={};t(l,{env:()=>c,step:()=>y});var c={};t(c,{init:()=>m,push:()=>g,simulation:()=>v});var u=()=>{};function h(){return{load:u,track:u,identify:u,resetIdentity:u,addUserProperties:u,addEventProperties:u,clearEventProperties:u,startTracking:u,stopTracking:u}}var m={window:{heap:h()}},g={window:{heap:h()}},v=["call:window.heap.track","call:window.heap.identify","call:window.heap.resetIdentity","call:window.heap.addUserProperties","call:window.heap.addEventProperties","call:window.heap.clearEventProperties","call:window.heap.startTracking","call:window.heap.stopTracking"],y={};t(y,{consentGrantStartTracking:()=>U,consentRevokeStopTracking:()=>D,defaultEventForwarding:()=>w,destinationLevelIdentify:()=>b,destinationLevelInclude:()=>f,eventWithUserProperties:()=>E,globalEventProperties:()=>H,userLoginIdentify:()=>P,userLogoutReset:()=>S});import{getEvent as k}from"@walkeros/core";var w={title:"Default track",description:"A walker event becomes a Heap track call with the event name and empty properties.",in:k("product view",{timestamp:1700000100}),out:[["heap.track","product view",{}]]},f={title:"Renamed purchase",description:"An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.",in:k("order complete",{timestamp:1700000101}),mapping:{name:"purchase",data:{map:{order_id:"data.id",total:"data.total",currency:{key:"data.currency",value:"EUR"}}}},out:[["heap.track","purchase",{order_id:"0rd3r1d",total:555,currency:"EUR"}]]},b={title:"Destination identify",description:"With settings.identify set to 'user.id', the destination calls heap.identify before the default track.",in:k("page view",{timestamp:1700000102}),settings:{identify:"user.id"},out:[["heap.identify","us3r"],["heap.track","page view",{}]]},P={title:"User login identify",description:"A user login identifies the Heap user by email and adds user properties while skipping the track.",in:k("user login",{timestamp:1700000103,data:{email:"user@example.com",plan:"premium",company:"Acme"}}),mapping:{silent:!0,settings:{identify:"data.email",userProperties:{map:{plan:"data.plan",company:"data.company"}}}},out:[["heap.identify","user@example.com"],["heap.addUserProperties",{plan:"premium",company:"Acme"}]]},S={title:"User logout reset",description:"A user logout calls heap.resetIdentity to clear the identified user from the Heap client.",in:k("user logout",{timestamp:1700000104}),mapping:{silent:!0,settings:{reset:!0}},out:[["heap.resetIdentity"]]},E={title:"User properties on event",description:"An order fires Heap addUserProperties with last-order fields and then tracks the event.",in:k("order complete",{timestamp:1700000105,data:{id:"0rd3r1d",total:555,currency:"EUR"}}),mapping:{settings:{userProperties:{map:{last_order_value:"data.total",last_order_currency:"data.currency"}}}},out:[["heap.addUserProperties",{last_order_value:555,last_order_currency:"EUR"}],["heap.track","order complete",{}]]},H={title:"Global event properties",description:"A page view sets persistent Heap event properties so all subsequent events include the page category.",in:k("page view",{timestamp:1700000106,data:{category:"docs"}}),mapping:{silent:!0,settings:{eventProperties:{map:{page_category:"data.category"}}}},out:[["heap.addEventProperties",{page_category:"docs"}]]},D={title:"Consent revoked",description:"With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.",command:"consent",before:{analytics:!0},in:{analytics:!1},out:[["heap.startTracking"],["heap.stopTracking"]]},U={title:"Consent granted",description:"With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.",command:"consent",in:{analytics:!0},out:[["heap.startTracking"]]};export{l as examples,a 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 appId: z\n .string()\n .min(1)\n .describe(\n 'Heap App ID. Find it in your Heap project under Settings > App ID.',\n ),\n disableTextCapture: z\n .boolean()\n .describe('Disable Heap auto text capture. Default: true.')\n .optional(),\n disablePageviewAutocapture: z\n .boolean()\n .describe(\n 'Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews).',\n )\n .optional(),\n disableSessionReplay: z\n .boolean()\n .describe('Disable Heap session replay.')\n .optional(),\n secureCookie: z.boolean().describe('SSL-only cookies.').optional(),\n ingestServer: z\n .string()\n .url()\n .describe('Custom server endpoint for proxying Heap data.')\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { \"key\": \"user.id\" }.',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { \"map\": { \"plan\": \"data.plan\" } }.',\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. Resolves to a string for heap.identify(). Example: { \"key\": \"data.email\" }.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Reset Heap identity on this event. Set to true to call heap.resetIdentity().',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Per-event user properties. Resolves to object for heap.addUserProperties().',\n )\n .optional(),\n eventProperties: z\n .unknown()\n .describe(\n 'Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).',\n )\n .optional(),\n clearEventProperties: z\n .unknown()\n .describe(\n 'Clear all persistent event properties. Set to true to call heap.clearEventProperties().',\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, HeapSDK } from '../types';\n\n/**\n * Example environment configurations for the Heap destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves env undefined — the destination uses the real\n * window.heap command queue it creates during init.\n */\n\n// Narrow helper type aliases so the noop casts don't use `as any`.\ntype HeapLoad = HeapSDK['load'];\ntype HeapTrack = HeapSDK['track'];\ntype HeapIdentify = HeapSDK['identify'];\ntype HeapAddUserProperties = HeapSDK['addUserProperties'];\ntype HeapAddEventProperties = HeapSDK['addEventProperties'];\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nfunction createMockHeap(): HeapSDK {\n return {\n load: noop as HeapLoad,\n track: noop as HeapTrack,\n identify: noop as HeapIdentify,\n resetIdentity: noop,\n addUserProperties: noop as HeapAddUserProperties,\n addEventProperties: noop as HeapAddEventProperties,\n clearEventProperties: noop,\n startTracking: noop,\n stopTracking: noop,\n };\n}\n\n/**\n * Pre-init env — window.heap is a no-op queue until init wires it.\n */\nexport const init: Env | undefined = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/**\n * Post-init env — window.heap methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:window.heap.track',\n 'call:window.heap.identify',\n 'call:window.heap.resetIdentity',\n 'call:window.heap.addUserProperties',\n 'call:window.heap.addEventProperties',\n 'call:window.heap.clearEventProperties',\n 'call:window.heap.startTracking',\n 'call:window.heap.stopTracking',\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 overrides.\n * The test runner reads `settings` from the example and merges it on top\n * of the fixed appId when registering the destination.\n */\nexport type HeapStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\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 * heap.track(event.name, properties). With no mapping, properties is `{}`.\n */\nexport const defaultEventForwarding: HeapStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Heap track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['heap.track', 'product view', {}]],\n};\n\n/**\n * Rename + map event properties via rule.data.map.\n * data resolves to { order_id, total, currency } → heap.track('purchase', props).\n */\nexport const destinationLevelInclude: HeapStepExample = {\n title: 'Renamed purchase',\n description:\n 'An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n total: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n out: [\n [\n 'heap.track',\n 'purchase',\n { order_id: '0rd3r1d', total: 555, currency: 'EUR' },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify - heap.identify() resolves user.id,\n * then the default heap.track() call fires.\n */\nexport const destinationLevelIdentify: HeapStepExample = {\n title: 'Destination identify',\n description:\n 'Destination-level identify calls heap.identify with the user id before firing the default track.',\n in: getEvent('page view', { timestamp: 1700000102 }),\n settings: {\n identify: 'user.id',\n },\n out: [\n ['heap.identify', 'us3r'],\n ['heap.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event login identify - heap.identify() from data.email + user\n * properties from the same rule. silent: true suppresses the track() call.\n */\nexport const userLoginIdentify: HeapStepExample = {\n title: 'User login identify',\n description:\n 'A user login identifies the Heap user by email and adds user properties while skipping the track.',\n in: getEvent('user login', {\n timestamp: 1700000103,\n data: {\n email: 'user@example.com',\n plan: 'premium',\n company: 'Acme',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: 'data.email',\n userProperties: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n },\n },\n out: [\n ['heap.identify', 'user@example.com'],\n ['heap.addUserProperties', { plan: 'premium', company: 'Acme' }],\n ],\n};\n\n/**\n * User logout - heap.resetIdentity(). silent: true suppresses the track() call.\n */\nexport const userLogoutReset: HeapStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls heap.resetIdentity to clear the identified user from the Heap client.',\n in: getEvent('user logout', { timestamp: 1700000104 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['heap.resetIdentity']],\n};\n\n/**\n * Event with user properties from mapping - heap.addUserProperties() fires,\n * then the default heap.track() call.\n */\nexport const eventWithUserProperties: HeapStepExample = {\n title: 'User properties on event',\n description:\n 'An order fires Heap addUserProperties with last-order fields and then tracks the event.',\n in: getEvent('order complete', {\n timestamp: 1700000105,\n data: {\n id: '0rd3r1d',\n total: 555,\n currency: 'EUR',\n },\n }),\n mapping: {\n settings: {\n userProperties: {\n map: {\n last_order_value: 'data.total',\n last_order_currency: 'data.currency',\n },\n },\n },\n },\n out: [\n [\n 'heap.addUserProperties',\n { last_order_value: 555, last_order_currency: 'EUR' },\n ],\n ['heap.track', 'order complete', {}],\n ],\n};\n\n/**\n * Global event properties - heap.addEventProperties() sets persistent\n * properties on all subsequent events. silent: true on this rule.\n */\nexport const globalEventProperties: HeapStepExample = {\n title: 'Global event properties',\n description:\n 'A page view sets persistent Heap event properties so all subsequent events include the page category.',\n in: getEvent('page view', {\n timestamp: 1700000106,\n data: { category: 'docs' },\n }),\n mapping: {\n silent: true,\n settings: {\n eventProperties: {\n map: {\n page_category: 'data.category',\n },\n },\n },\n },\n out: [['heap.addEventProperties', { page_category: 'docs' }]],\n};\n\n/**\n * Consent granted then revoked: the destination loads under the grant\n * (heap.startTracking), and the later revoke calls heap.stopTracking via the\n * on('consent') handler. A gated destination never loads under denial, so the\n * stop is a real revocation of an already-granted destination.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false },\n out: [['heap.startTracking'], ['heap.stopTracking']],\n};\n\n/**\n * Consent granted - on('consent') handler calls heap.startTracking()\n * when all required consent keys are true.\n */\nexport const consentGrantStartTracking: HeapStepExample = {\n title: 'Consent granted',\n description:\n 'A walker consent grant for analytics calls heap.startTracking to resume event capture.',\n command: 'consent',\n in: { analytics: true },\n out: [['heap.startTracking']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,OAAO,EACJ,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,oBAAoB,EACjB,QAAQ,EACR,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,4BAA4B,EACzB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,sBAAsB,EACnB,QAAQ,EACR,SAAS,8BAA8B,EACvC,SAAS;AAAA,EACZ,cAAc,EAAE,QAAQ,EAAE,SAAS,mBAAmB,EAAE,SAAS;AAAA,EACjE,cAAc,EACX,OAAO,EACP,IAAI,EACJ,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,UAAU,EACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgB,EACb,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AACd,CAAC;;;ACzCD,SAAS,KAAAA,UAAS;AAEX,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,UAAUA,GACP,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,OAAOA,GACJ,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,gBAAgBA,GACb,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,iBAAiBA,GACd,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,sBAAsBA,GACnB,QAAQ,EACR;AAAA,IACC;AA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/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 appId: z\n .string()\n .min(1)\n .describe(\n 'Heap App ID. Find it in your Heap project under Settings > App ID.',\n ),\n disableTextCapture: z\n .boolean()\n .describe('Disable Heap auto text capture. Default: true.')\n .optional(),\n disablePageviewAutocapture: z\n .boolean()\n .describe(\n 'Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews). Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n disableSessionReplay: z\n .boolean()\n .describe(\n 'Disable Heap session replay. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n secureCookie: z.boolean().describe('SSL-only cookies.').optional(),\n ingestServer: z\n .string()\n .url()\n .describe(\n 'Custom server endpoint for proxying Heap data. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it.',\n )\n .optional(),\n heapConfig: z\n .record(z.string(), z.unknown())\n .describe(\n 'Additional heap.load() options, merged over the options above. Example: { \"trackingServer\": \"https://heap.example.com\" }.',\n )\n .optional(),\n identify: z\n .unknown()\n .describe(\n 'Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { \"key\": \"user.id\" }.',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). Example: { \"map\": { \"plan\": \"data.plan\" } }.',\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. Resolves to a string for heap.identify(). Example: { \"key\": \"data.email\" }.',\n )\n .optional(),\n reset: z\n .unknown()\n .describe(\n 'Reset Heap identity on this event. Set to true to call heap.resetIdentity().',\n )\n .optional(),\n userProperties: z\n .unknown()\n .describe(\n 'Per-event user properties. Resolves to object for heap.addUserProperties().',\n )\n .optional(),\n eventProperties: z\n .unknown()\n .describe(\n 'Per-event persistent event properties. Resolves to object for heap.addEventProperties() (persisted across page loads).',\n )\n .optional(),\n clearEventProperties: z\n .unknown()\n .describe(\n 'Clear all persistent event properties. Set to true to call heap.clearEventProperties().',\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, HeapSDK } from '../types';\n\n/**\n * Example environment configurations for the Heap destination.\n *\n * Tests clone `push` and replace individual methods with jest spies.\n * Production leaves env undefined — the destination uses the real\n * window.heap command queue it creates during init.\n */\n\n// Narrow helper type aliases so the noop casts don't use `as any`.\ntype HeapLoad = HeapSDK['load'];\ntype HeapTrack = HeapSDK['track'];\ntype HeapIdentify = HeapSDK['identify'];\ntype HeapAddUserProperties = HeapSDK['addUserProperties'];\ntype HeapAddEventProperties = HeapSDK['addEventProperties'];\n\nconst noop = (() => {}) as (...args: unknown[]) => void;\n\nfunction createMockHeap(): HeapSDK {\n return {\n load: noop as HeapLoad,\n track: noop as HeapTrack,\n identify: noop as HeapIdentify,\n resetIdentity: noop,\n addUserProperties: noop as HeapAddUserProperties,\n addEventProperties: noop as HeapAddEventProperties,\n clearEventProperties: noop,\n startTracking: noop,\n stopTracking: noop,\n };\n}\n\n/**\n * Pre-init env — window.heap is a no-op queue until init wires it.\n */\nexport const init: Env | undefined = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/**\n * Post-init env — window.heap methods are spy-able no-ops.\n * Tests clone this and replace individual methods with jest.fn() for assertions.\n */\nexport const push: Env = {\n window: {\n heap: createMockHeap(),\n },\n};\n\n/** Simulation tracking paths for CLI --simulate. */\nexport const simulation = [\n 'call:window.heap.track',\n 'call:window.heap.identify',\n 'call:window.heap.resetIdentity',\n 'call:window.heap.addUserProperties',\n 'call:window.heap.addEventProperties',\n 'call:window.heap.clearEventProperties',\n 'call:window.heap.startTracking',\n 'call:window.heap.stopTracking',\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 overrides.\n * The test runner reads `settings` from the example and merges it on top\n * of the fixed appId when registering the destination.\n */\nexport type HeapStepExample = Flow.StepExample & {\n settings?: Partial<Settings>;\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 * heap.track(event.name, properties). With no mapping, properties is `{}`.\n */\nexport const defaultEventForwarding: HeapStepExample = {\n title: 'Default track',\n description:\n 'A walker event becomes a Heap track call with the event name and empty properties.',\n in: getEvent('product view', { timestamp: 1700000100 }),\n out: [['heap.track', 'product view', {}]],\n};\n\n/**\n * Rename + map event properties via rule.data.map.\n * data resolves to { order_id, total, currency } → heap.track('purchase', props).\n */\nexport const destinationLevelInclude: HeapStepExample = {\n title: 'Renamed purchase',\n description:\n 'An order complete is renamed to purchase and mapped to Heap track properties such as order_id, total, and currency.',\n in: getEvent('order complete', { timestamp: 1700000101 }),\n mapping: {\n name: 'purchase',\n data: {\n map: {\n order_id: 'data.id',\n total: 'data.total',\n currency: { key: 'data.currency', value: 'EUR' },\n },\n },\n },\n out: [\n [\n 'heap.track',\n 'purchase',\n { order_id: '0rd3r1d', total: 555, currency: 'EUR' },\n ],\n ],\n};\n\n/**\n * Destination-level settings.identify - heap.identify() resolves user.id,\n * then the default heap.track() call fires.\n */\nexport const destinationLevelIdentify: HeapStepExample = {\n title: 'Destination identify',\n description:\n \"With settings.identify set to 'user.id', the destination calls heap.identify before the default track.\",\n in: getEvent('page view', { timestamp: 1700000102 }),\n settings: {\n identify: 'user.id',\n },\n out: [\n ['heap.identify', 'us3r'],\n ['heap.track', 'page view', {}],\n ],\n};\n\n/**\n * Per-event login identify - heap.identify() from data.email + user\n * properties from the same rule. silent: true suppresses the track() call.\n */\nexport const userLoginIdentify: HeapStepExample = {\n title: 'User login identify',\n description:\n 'A user login identifies the Heap user by email and adds user properties while skipping the track.',\n in: getEvent('user login', {\n timestamp: 1700000103,\n data: {\n email: 'user@example.com',\n plan: 'premium',\n company: 'Acme',\n },\n }),\n mapping: {\n silent: true,\n settings: {\n identify: 'data.email',\n userProperties: {\n map: {\n plan: 'data.plan',\n company: 'data.company',\n },\n },\n },\n },\n out: [\n ['heap.identify', 'user@example.com'],\n ['heap.addUserProperties', { plan: 'premium', company: 'Acme' }],\n ],\n};\n\n/**\n * User logout - heap.resetIdentity(). silent: true suppresses the track() call.\n */\nexport const userLogoutReset: HeapStepExample = {\n title: 'User logout reset',\n description:\n 'A user logout calls heap.resetIdentity to clear the identified user from the Heap client.',\n in: getEvent('user logout', { timestamp: 1700000104 }),\n mapping: {\n silent: true,\n settings: {\n reset: true,\n },\n },\n out: [['heap.resetIdentity']],\n};\n\n/**\n * Event with user properties from mapping - heap.addUserProperties() fires,\n * then the default heap.track() call.\n */\nexport const eventWithUserProperties: HeapStepExample = {\n title: 'User properties on event',\n description:\n 'An order fires Heap addUserProperties with last-order fields and then tracks the event.',\n in: getEvent('order complete', {\n timestamp: 1700000105,\n data: {\n id: '0rd3r1d',\n total: 555,\n currency: 'EUR',\n },\n }),\n mapping: {\n settings: {\n userProperties: {\n map: {\n last_order_value: 'data.total',\n last_order_currency: 'data.currency',\n },\n },\n },\n },\n out: [\n [\n 'heap.addUserProperties',\n { last_order_value: 555, last_order_currency: 'EUR' },\n ],\n ['heap.track', 'order complete', {}],\n ],\n};\n\n/**\n * Global event properties - heap.addEventProperties() sets persistent\n * properties on all subsequent events. silent: true on this rule.\n */\nexport const globalEventProperties: HeapStepExample = {\n title: 'Global event properties',\n description:\n 'A page view sets persistent Heap event properties so all subsequent events include the page category.',\n in: getEvent('page view', {\n timestamp: 1700000106,\n data: { category: 'docs' },\n }),\n mapping: {\n silent: true,\n settings: {\n eventProperties: {\n map: {\n page_category: 'data.category',\n },\n },\n },\n },\n out: [['heap.addEventProperties', { page_category: 'docs' }]],\n};\n\n/**\n * Consent granted then revoked: the destination loads under the grant\n * (heap.startTracking), and the later revoke calls heap.stopTracking via the\n * on('consent') handler. A gated destination never loads under denial, so the\n * stop is a real revocation of an already-granted destination.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.',\n command: 'consent',\n before: { analytics: true },\n in: { analytics: false },\n out: [['heap.startTracking'], ['heap.stopTracking']],\n};\n\n/**\n * Consent granted - on('consent') handler calls heap.startTracking()\n * when all required consent keys are true.\n */\nexport const consentGrantStartTracking: HeapStepExample = {\n title: 'Consent granted',\n description:\n 'With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.',\n command: 'consent',\n in: { analytics: true },\n out: [['heap.startTracking']],\n};\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAEX,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACrC,OAAO,EACJ,OAAO,EACP,IAAI,CAAC,EACL;AAAA,IACC;AAAA,EACF;AAAA,EACF,oBAAoB,EACjB,QAAQ,EACR,SAAS,gDAAgD,EACzD,SAAS;AAAA,EACZ,4BAA4B,EACzB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,sBAAsB,EACnB,QAAQ,EACR;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,cAAc,EAAE,QAAQ,EAAE,SAAS,mBAAmB,EAA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P,aACE;AAAA,EACF,IAAI,SAAS,aAAa;AAAA,IACxB,WAAW;AAAA,IACX,MAAM,EAAE,UAAU,OAAO;AAAA,EAC3B,CAAC;AAAA,EACD,SAAS;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,MACR,iBAAiB;AAAA,QACf,KAAK;AAAA,UACH,eAAe;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,KAAK,CAAC,CAAC,2BAA2B,EAAE,eAAe,OAAO,CAAC,CAAC;AAC9D;AAQO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,QAAQ,EAAE,WAAW,KAAK;AAAA,EAC1B,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,oBAAoB,GAAG,CAAC,mBAAmB,CAAC;AACrD;AAMO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,KAAK;AAAA,EACtB,KAAK,CAAC,CAAC,oBAAoB,CAAC;AAC9B;","names":["z"]}
@@ -112,7 +112,7 @@ var destinationLevelInclude = {
112
112
  };
113
113
  var destinationLevelIdentify = {
114
114
  title: "Destination identify",
115
- description: "Destination-level identify calls heap.identify with the user id before firing the default track.",
115
+ description: "With settings.identify set to 'user.id', the destination calls heap.identify before the default track.",
116
116
  in: (0, import_core.getEvent)("page view", { timestamp: 1700000102 }),
117
117
  settings: {
118
118
  identify: "user.id"
@@ -212,7 +212,7 @@ var globalEventProperties = {
212
212
  };
213
213
  var consentRevokeStopTracking = {
214
214
  title: "Consent revoked",
215
- description: "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
215
+ description: "With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.",
216
216
  command: "consent",
217
217
  before: { analytics: true },
218
218
  in: { analytics: false },
@@ -220,7 +220,7 @@ var consentRevokeStopTracking = {
220
220
  };
221
221
  var consentGrantStartTracking = {
222
222
  title: "Consent granted",
223
- description: "A walker consent grant for analytics calls heap.startTracking to resume event capture.",
223
+ description: "With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.",
224
224
  command: "consent",
225
225
  in: { analytics: true },
226
226
  out: [["heap.startTracking"]]
@@ -91,7 +91,7 @@ var destinationLevelInclude = {
91
91
  };
92
92
  var destinationLevelIdentify = {
93
93
  title: "Destination identify",
94
- description: "Destination-level identify calls heap.identify with the user id before firing the default track.",
94
+ description: "With settings.identify set to 'user.id', the destination calls heap.identify before the default track.",
95
95
  in: getEvent("page view", { timestamp: 1700000102 }),
96
96
  settings: {
97
97
  identify: "user.id"
@@ -191,7 +191,7 @@ var globalEventProperties = {
191
191
  };
192
192
  var consentRevokeStopTracking = {
193
193
  title: "Consent revoked",
194
- description: "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
194
+ description: "With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.",
195
195
  command: "consent",
196
196
  before: { analytics: true },
197
197
  in: { analytics: false },
@@ -199,7 +199,7 @@ var consentRevokeStopTracking = {
199
199
  };
200
200
  var consentGrantStartTracking = {
201
201
  title: "Consent granted",
202
- description: "A walker consent grant for analytics calls heap.startTracking to resume event capture.",
202
+ description: "With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.",
203
203
  command: "consent",
204
204
  in: { analytics: true },
205
205
  out: [["heap.startTracking"]]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$meta": {
3
3
  "package": "@walkeros/web-destination-heap",
4
- "version": "4.7.2",
4
+ "version": "4.8.0-next-1791441510508",
5
5
  "type": "destination",
6
6
  "platform": [
7
7
  "web"
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "disablePageviewAutocapture": {
50
50
  "type": "boolean",
51
- "description": "Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews)."
51
+ "description": "Disable Heap automatic pageview tracking. Default: true (walkerOS sources handle pageviews). Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it."
52
52
  },
53
53
  "disableSessionReplay": {
54
54
  "type": "boolean",
55
- "description": "Disable Heap session replay."
55
+ "description": "Disable Heap session replay. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it."
56
56
  },
57
57
  "secureCookie": {
58
58
  "type": "boolean",
@@ -61,7 +61,15 @@
61
61
  "ingestServer": {
62
62
  "type": "string",
63
63
  "format": "uri",
64
- "description": "Custom server endpoint for proxying Heap data."
64
+ "description": "Custom server endpoint for proxying Heap data. Passed to heap.load(); the classic Heap SDK that loadScript loads ignores it."
65
+ },
66
+ "heapConfig": {
67
+ "type": "object",
68
+ "propertyNames": {
69
+ "type": "string"
70
+ },
71
+ "additionalProperties": {},
72
+ "description": "Additional heap.load() options, merged over the options above. Example: { \"trackingServer\": \"https://heap.example.com\" }."
65
73
  },
66
74
  "identify": {
67
75
  "description": "Destination-level identity mapping. Resolves to a string for heap.identify(). Example: { \"key\": \"user.id\" }."
@@ -158,7 +166,7 @@
158
166
  "step": {
159
167
  "consentGrantStartTracking": {
160
168
  "title": "Consent granted",
161
- "description": "A walker consent grant for analytics calls heap.startTracking to resume event capture.",
169
+ "description": "With consent: { analytics: true } in the destination config, a walker consent grant for analytics calls heap.startTracking.",
162
170
  "command": "consent",
163
171
  "in": {
164
172
  "analytics": true
@@ -171,7 +179,7 @@
171
179
  },
172
180
  "consentRevokeStopTracking": {
173
181
  "title": "Consent revoked",
174
- "description": "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
182
+ "description": "With consent: { analytics: true } in the destination config, the destination calls heap.startTracking once analytics is granted and heap.stopTracking when it is revoked. The classic Heap SDK that loadScript loads has neither method.",
175
183
  "command": "consent",
176
184
  "before": {
177
185
  "analytics": true
@@ -221,7 +229,7 @@
221
229
  "consent": {
222
230
  "functional": true
223
231
  },
224
- "id": "6a89ab2937722712",
232
+ "id": "3f9ae3bf95801f2e",
225
233
  "trigger": "load",
226
234
  "entity": "product",
227
235
  "action": "view",
@@ -244,7 +252,7 @@
244
252
  },
245
253
  "destinationLevelIdentify": {
246
254
  "title": "Destination identify",
247
- "description": "Destination-level identify calls heap.identify with the user id before firing the default track.",
255
+ "description": "With settings.identify set to 'user.id', the destination calls heap.identify before the default track.",
248
256
  "in": {
249
257
  "name": "page view",
250
258
  "data": {
@@ -283,7 +291,7 @@
283
291
  "consent": {
284
292
  "functional": true
285
293
  },
286
- "id": "2723eb8d0dd951a6",
294
+ "id": "adacae52ebbb249f",
287
295
  "trigger": "load",
288
296
  "entity": "page",
289
297
  "action": "view",
@@ -391,7 +399,7 @@
391
399
  "consent": {
392
400
  "functional": true
393
401
  },
394
- "id": "63bd2150279dc982",
402
+ "id": "bb388cbc77da8601",
395
403
  "trigger": "load",
396
404
  "entity": "order",
397
405
  "action": "complete",
@@ -507,7 +515,7 @@
507
515
  "consent": {
508
516
  "functional": true
509
517
  },
510
- "id": "d0b6efcde79e245e",
518
+ "id": "eaf5e568f07c6c34",
511
519
  "trigger": "load",
512
520
  "entity": "order",
513
521
  "action": "complete",
@@ -581,7 +589,7 @@
581
589
  "consent": {
582
590
  "functional": true
583
591
  },
584
- "id": "f31ee54839a37f6e",
592
+ "id": "9459b630e666ec12",
585
593
  "trigger": "load",
586
594
  "entity": "page",
587
595
  "action": "view",
@@ -651,7 +659,7 @@
651
659
  "consent": {
652
660
  "functional": true
653
661
  },
654
- "id": "06d49bb98fcdcaf4",
662
+ "id": "a1e687a2f2c4ba55",
655
663
  "trigger": "test",
656
664
  "entity": "user",
657
665
  "action": "login",
@@ -733,7 +741,7 @@
733
741
  "consent": {
734
742
  "functional": true
735
743
  },
736
- "id": "d9c9a338c7fb7964",
744
+ "id": "f5d058352c29ad7c",
737
745
  "trigger": "test",
738
746
  "entity": "user",
739
747
  "action": "logout",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/web-destination-heap",
3
3
  "description": "Heap web destination for walkerOS (product analytics, auto-capture)",
4
- "version": "4.7.2",
4
+ "version": "4.8.0-next-1791441510508",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -38,11 +38,11 @@
38
38
  "update": "npx npm-check-updates -u && npm update"
39
39
  },
40
40
  "dependencies": {
41
- "@walkeros/core": "4.7.2",
42
- "@walkeros/web-core": "4.7.2"
41
+ "@walkeros/core": "4.8.0-next-1791441510508",
42
+ "@walkeros/web-core": "4.8.0-next-1791441510508"
43
43
  },
44
44
  "devDependencies": {
45
- "@walkeros/collector": "4.7.2"
45
+ "@walkeros/collector": "4.8.0-next-1791441510508"
46
46
  },
47
47
  "repository": {
48
48
  "url": "git+https://github.com/elbwalker/walkerOS.git",