@walkeros/web-destination-heap 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 +7 -3
- package/dist/dev.d.ts +7 -3
- 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 +7 -3
- package/dist/examples/index.d.ts +7 -3
- package/dist/examples/index.js +3 -2
- package/dist/examples/index.mjs +3 -2
- package/dist/walkerOS.json +15 -9
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
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
|
|
|
6
6
|
declare const SettingsSchema: z.ZodObject<{
|
|
@@ -138,6 +138,8 @@ declare namespace env {
|
|
|
138
138
|
*/
|
|
139
139
|
type HeapStepExample = Flow.StepExample & {
|
|
140
140
|
settings?: Partial<Settings>;
|
|
141
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
142
|
+
before?: WalkerOS.Consent;
|
|
141
143
|
};
|
|
142
144
|
/**
|
|
143
145
|
* Default event forwarding - every walkerOS event becomes
|
|
@@ -174,8 +176,10 @@ declare const eventWithUserProperties: HeapStepExample;
|
|
|
174
176
|
*/
|
|
175
177
|
declare const globalEventProperties: HeapStepExample;
|
|
176
178
|
/**
|
|
177
|
-
* Consent revoked
|
|
178
|
-
*
|
|
179
|
+
* Consent granted then revoked: the destination loads under the grant
|
|
180
|
+
* (heap.startTracking), and the later revoke calls heap.stopTracking via the
|
|
181
|
+
* on('consent') handler. A gated destination never loads under denial, so the
|
|
182
|
+
* stop is a real revocation of an already-granted destination.
|
|
179
183
|
*/
|
|
180
184
|
declare const consentRevokeStopTracking: HeapStepExample;
|
|
181
185
|
/**
|
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
|
|
|
6
6
|
declare const SettingsSchema: z.ZodObject<{
|
|
@@ -138,6 +138,8 @@ declare namespace env {
|
|
|
138
138
|
*/
|
|
139
139
|
type HeapStepExample = Flow.StepExample & {
|
|
140
140
|
settings?: Partial<Settings>;
|
|
141
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
142
|
+
before?: WalkerOS.Consent;
|
|
141
143
|
};
|
|
142
144
|
/**
|
|
143
145
|
* Default event forwarding - every walkerOS event becomes
|
|
@@ -174,8 +176,10 @@ declare const eventWithUserProperties: HeapStepExample;
|
|
|
174
176
|
*/
|
|
175
177
|
declare const globalEventProperties: HeapStepExample;
|
|
176
178
|
/**
|
|
177
|
-
* Consent revoked
|
|
178
|
-
*
|
|
179
|
+
* Consent granted then revoked: the destination loads under the grant
|
|
180
|
+
* (heap.startTracking), and the later revoke calls heap.stopTracking via the
|
|
181
|
+
* on('consent') handler. A gated destination never loads under denial, so the
|
|
182
|
+
* stop is a real revocation of an already-granted destination.
|
|
179
183
|
*/
|
|
180
184
|
declare const consentRevokeStopTracking: HeapStepExample;
|
|
181
185
|
/**
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,
|
|
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
|
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 } 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};\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 revoked - on('consent') handler calls heap.stopTracking()\n * when a required consent key is false.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent revoke for analytics calls heap.stopTracking to pause event capture.',\n command: 'consent',\n in: { analytics: false },\n out: [['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;AA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AAS;AAAA,IACP,UAAU;AAAA,MACR,gBAAgB;AAAA,QACd,KAAK;AAAA,UACH,kBAAkB;AAAA,UAClB,qBAAqB;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,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;AAMO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,mBAAmB,CAAC;AAC7B;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"]}
|
|
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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B,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:()=>
|
|
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
|
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 } 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};\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 revoked - on('consent') handler calls heap.stopTracking()\n * when a required consent key is false.\n */\nexport const consentRevokeStopTracking: HeapStepExample = {\n title: 'Consent revoked',\n description:\n 'A walker consent revoke for analytics calls heap.stopTracking to pause event capture.',\n command: 'consent',\n in: { analytics: false },\n out: [['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,EACn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F,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;AAMO,IAAM,4BAA6C;AAAA,EACxD,OAAO;AAAA,EACP,aACE;AAAA,EACF,SAAS;AAAA,EACT,IAAI,EAAE,WAAW,MAAM;AAAA,EACvB,KAAK,CAAC,CAAC,mBAAmB,CAAC;AAC7B;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"]}
|
|
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,S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ClB,qBAAqB;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,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,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"]}
|
|
@@ -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
|
|
|
4
4
|
/** Property value types accepted by Heap SDK methods. */
|
|
@@ -103,6 +103,8 @@ declare namespace env {
|
|
|
103
103
|
*/
|
|
104
104
|
type HeapStepExample = Flow.StepExample & {
|
|
105
105
|
settings?: Partial<Settings>;
|
|
106
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
107
|
+
before?: WalkerOS.Consent;
|
|
106
108
|
};
|
|
107
109
|
/**
|
|
108
110
|
* Default event forwarding - every walkerOS event becomes
|
|
@@ -139,8 +141,10 @@ declare const eventWithUserProperties: HeapStepExample;
|
|
|
139
141
|
*/
|
|
140
142
|
declare const globalEventProperties: HeapStepExample;
|
|
141
143
|
/**
|
|
142
|
-
* Consent revoked
|
|
143
|
-
*
|
|
144
|
+
* Consent granted then revoked: the destination loads under the grant
|
|
145
|
+
* (heap.startTracking), and the later revoke calls heap.stopTracking via the
|
|
146
|
+
* on('consent') handler. A gated destination never loads under denial, so the
|
|
147
|
+
* stop is a real revocation of an already-granted destination.
|
|
144
148
|
*/
|
|
145
149
|
declare const consentRevokeStopTracking: HeapStepExample;
|
|
146
150
|
/**
|
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
|
|
|
4
4
|
/** Property value types accepted by Heap SDK methods. */
|
|
@@ -103,6 +103,8 @@ declare namespace env {
|
|
|
103
103
|
*/
|
|
104
104
|
type HeapStepExample = Flow.StepExample & {
|
|
105
105
|
settings?: Partial<Settings>;
|
|
106
|
+
/** Consent granted before `in` so a gated destination is loaded first. */
|
|
107
|
+
before?: WalkerOS.Consent;
|
|
106
108
|
};
|
|
107
109
|
/**
|
|
108
110
|
* Default event forwarding - every walkerOS event becomes
|
|
@@ -139,8 +141,10 @@ declare const eventWithUserProperties: HeapStepExample;
|
|
|
139
141
|
*/
|
|
140
142
|
declare const globalEventProperties: HeapStepExample;
|
|
141
143
|
/**
|
|
142
|
-
* Consent revoked
|
|
143
|
-
*
|
|
144
|
+
* Consent granted then revoked: the destination loads under the grant
|
|
145
|
+
* (heap.startTracking), and the later revoke calls heap.stopTracking via the
|
|
146
|
+
* on('consent') handler. A gated destination never loads under denial, so the
|
|
147
|
+
* stop is a real revocation of an already-granted destination.
|
|
144
148
|
*/
|
|
145
149
|
declare const consentRevokeStopTracking: HeapStepExample;
|
|
146
150
|
/**
|
package/dist/examples/index.js
CHANGED
|
@@ -212,10 +212,11 @@ var globalEventProperties = {
|
|
|
212
212
|
};
|
|
213
213
|
var consentRevokeStopTracking = {
|
|
214
214
|
title: "Consent revoked",
|
|
215
|
-
description: "
|
|
215
|
+
description: "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
|
|
216
216
|
command: "consent",
|
|
217
|
+
before: { analytics: true },
|
|
217
218
|
in: { analytics: false },
|
|
218
|
-
out: [["heap.stopTracking"]]
|
|
219
|
+
out: [["heap.startTracking"], ["heap.stopTracking"]]
|
|
219
220
|
};
|
|
220
221
|
var consentGrantStartTracking = {
|
|
221
222
|
title: "Consent granted",
|
package/dist/examples/index.mjs
CHANGED
|
@@ -191,10 +191,11 @@ var globalEventProperties = {
|
|
|
191
191
|
};
|
|
192
192
|
var consentRevokeStopTracking = {
|
|
193
193
|
title: "Consent revoked",
|
|
194
|
-
description: "
|
|
194
|
+
description: "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
|
|
195
195
|
command: "consent",
|
|
196
|
+
before: { analytics: true },
|
|
196
197
|
in: { analytics: false },
|
|
197
|
-
out: [["heap.stopTracking"]]
|
|
198
|
+
out: [["heap.startTracking"], ["heap.stopTracking"]]
|
|
198
199
|
};
|
|
199
200
|
var consentGrantStartTracking = {
|
|
200
201
|
title: "Consent granted",
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-heap",
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1-next-1781538735002",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"web"
|
|
@@ -170,12 +170,18 @@
|
|
|
170
170
|
},
|
|
171
171
|
"consentRevokeStopTracking": {
|
|
172
172
|
"title": "Consent revoked",
|
|
173
|
-
"description": "
|
|
173
|
+
"description": "After analytics consent is granted (Heap loads and starts tracking), revoking it calls heap.stopTracking to pause event capture.",
|
|
174
174
|
"command": "consent",
|
|
175
|
+
"before": {
|
|
176
|
+
"analytics": true
|
|
177
|
+
},
|
|
175
178
|
"in": {
|
|
176
179
|
"analytics": false
|
|
177
180
|
},
|
|
178
181
|
"out": [
|
|
182
|
+
[
|
|
183
|
+
"heap.startTracking"
|
|
184
|
+
],
|
|
179
185
|
[
|
|
180
186
|
"heap.stopTracking"
|
|
181
187
|
]
|
|
@@ -214,7 +220,7 @@
|
|
|
214
220
|
"consent": {
|
|
215
221
|
"functional": true
|
|
216
222
|
},
|
|
217
|
-
"id": "
|
|
223
|
+
"id": "808633e9e7944bae",
|
|
218
224
|
"trigger": "load",
|
|
219
225
|
"entity": "product",
|
|
220
226
|
"action": "view",
|
|
@@ -274,7 +280,7 @@
|
|
|
274
280
|
"consent": {
|
|
275
281
|
"functional": true
|
|
276
282
|
},
|
|
277
|
-
"id": "
|
|
283
|
+
"id": "0d0d93aaaa6496e0",
|
|
278
284
|
"trigger": "load",
|
|
279
285
|
"entity": "page",
|
|
280
286
|
"action": "view",
|
|
@@ -380,7 +386,7 @@
|
|
|
380
386
|
"consent": {
|
|
381
387
|
"functional": true
|
|
382
388
|
},
|
|
383
|
-
"id": "
|
|
389
|
+
"id": "fc87c6cd94b2c938",
|
|
384
390
|
"trigger": "load",
|
|
385
391
|
"entity": "order",
|
|
386
392
|
"action": "complete",
|
|
@@ -494,7 +500,7 @@
|
|
|
494
500
|
"consent": {
|
|
495
501
|
"functional": true
|
|
496
502
|
},
|
|
497
|
-
"id": "
|
|
503
|
+
"id": "791c00c97a761ec7",
|
|
498
504
|
"trigger": "load",
|
|
499
505
|
"entity": "order",
|
|
500
506
|
"action": "complete",
|
|
@@ -566,7 +572,7 @@
|
|
|
566
572
|
"consent": {
|
|
567
573
|
"functional": true
|
|
568
574
|
},
|
|
569
|
-
"id": "
|
|
575
|
+
"id": "a6fafe480ee6e2ea",
|
|
570
576
|
"trigger": "load",
|
|
571
577
|
"entity": "page",
|
|
572
578
|
"action": "view",
|
|
@@ -634,7 +640,7 @@
|
|
|
634
640
|
"consent": {
|
|
635
641
|
"functional": true
|
|
636
642
|
},
|
|
637
|
-
"id": "
|
|
643
|
+
"id": "2c4f6c4248c07b97",
|
|
638
644
|
"trigger": "test",
|
|
639
645
|
"entity": "user",
|
|
640
646
|
"action": "login",
|
|
@@ -714,7 +720,7 @@
|
|
|
714
720
|
"consent": {
|
|
715
721
|
"functional": true
|
|
716
722
|
},
|
|
717
|
-
"id": "
|
|
723
|
+
"id": "66be8a828c289026",
|
|
718
724
|
"trigger": "test",
|
|
719
725
|
"entity": "user",
|
|
720
726
|
"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.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,11 +38,11 @@
|
|
|
38
38
|
"update": "npx npm-check-updates -u && npm update"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@walkeros/core": "4.2.
|
|
42
|
-
"@walkeros/web-core": "4.2.
|
|
41
|
+
"@walkeros/core": "4.2.1-next-1781538735002",
|
|
42
|
+
"@walkeros/web-core": "4.2.1-next-1781538735002"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@walkeros/collector": "4.2.
|
|
45
|
+
"@walkeros/collector": "4.2.1-next-1781538735002"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|