@walkeros/web-destination-heap 4.7.2 → 4.8.0-next-1791496487198
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 +15 -0
- package/README.md +6 -1
- package/dist/dev.d.mts +1 -0
- package/dist/dev.d.ts +1 -0
- 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.js +3 -3
- package/dist/examples/index.mjs +3 -3
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/walkerOS.json +22 -14
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @walkeros/web-destination-heap
|
|
2
2
|
|
|
3
|
+
## 4.8.0-next-1791496487198
|
|
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 [7132619]
|
|
13
|
+
- Updated dependencies [5593d7b]
|
|
14
|
+
- Updated dependencies [421233d]
|
|
15
|
+
- @walkeros/core@4.8.0-next-1791496487198
|
|
16
|
+
- @walkeros/web-core@4.8.0-next-1791496487198
|
|
17
|
+
|
|
3
18
|
## 4.7.2
|
|
4
19
|
|
|
5
20
|
### 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:()=>
|
|
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,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,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). 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,IAA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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;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:()=>
|
|
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;AAA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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,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
|
+
{"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). 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,EAAE,SAAS;AAAA,EACjE,cAAc,EACX,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF,EACC,SAAS;AAAA,EACZ,YAAY,EACT,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC9B;AAAA,IACC;AAAA,EACF,EACC,SAAS;AA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;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"]}
|
package/dist/examples/index.js
CHANGED
|
@@ -112,7 +112,7 @@ var destinationLevelInclude = {
|
|
|
112
112
|
};
|
|
113
113
|
var destinationLevelIdentify = {
|
|
114
114
|
title: "Destination identify",
|
|
115
|
-
description: "
|
|
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: "
|
|
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: "
|
|
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"]]
|
package/dist/examples/index.mjs
CHANGED
|
@@ -91,7 +91,7 @@ var destinationLevelInclude = {
|
|
|
91
91
|
};
|
|
92
92
|
var destinationLevelIdentify = {
|
|
93
93
|
title: "Destination identify",
|
|
94
|
-
description: "
|
|
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: "
|
|
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: "
|
|
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"]]
|
package/dist/index.browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(o,{DestinationHeap:()=>W,default:()=>K,destinationHeap:()=>M});var i=Object.defineProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})};function s(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}c({},{stepId:()=>s});function a(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}c({},{getDestination:()=>a});c({},{Level:()=>f});var u,f=((u=f||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function l(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}c({},{getTransformer:()=>l});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}c({},{getSource:()=>p});function d(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function g(e,t){return await e.get(t)}function y(e){return Array.isArray(e)}function v(e){return void 0!==e}function w(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function h(e){return"object"==typeof e&&null!==e&&!y(e)&&"[object Object]"===Object.prototype.toString.call(e)}function b(e){return"string"==typeof e}function m(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&y(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=m(e,t,n);i.push(r)}return i}if(o=h(o)||y(o)?o[t]:void 0,void 0===o)break}return v(o)?o:n}function P(e){return function(e){return"boolean"==typeof e}(e)||b(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!v(e)||y(e)&&e.every(P)||h(e)&&Object.values(e).every(P)}function O(e){return P(e)?e:void 0}function j(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}c({},{getStore:()=>d,getStoreValue:()=>g});var E=class e extends Error{constructor(t,n){super(t,n),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function R(e,t={},n={}){var r,o;const i=n.consent||(null==(r=n.collector)?void 0:r.consent),c=null!=(o=n.event)?o:{};if(!n.collector)throw new Error("getMappingValue: context.collector is required");const s={event:c,mapping:t,collector:n.collector,logger:n.collector.logger,consent:i},a=y(t)?t:[t];for(const t of a){const r=await j(k,e=>{if(e instanceof E)throw e;n.collector&&n.collector.status.failed++,s.logger.error("mapping processing failed",{event:c,error:e})})(e,t,{...s,mapping:t});if(v(r))return r}}async function k(e,t,n){return(y(t)?t:[t]).reduce(async(t,r)=>{const o=await t;if(o)return o;const i=b(r)?{key:r}:r;if(!Object.keys(i).length)return;const{condition:c,consent:s,fn:a,key:u,loop:f,map:l,set:p,validate:d,value:g}=i,w={...n,mapping:r};if(c&&!await j(c,e=>{if(e instanceof E)throw e;return w.logger.error("mapping condition failed",{event:w.event,error:e}),!1})(e,w))return;if(s&&!function(e,t={},n={}){const r={...t,...n},o={};let i=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}(s,w.consent))return g;let h=v(g)?g:e;if(f){const[t,n]=f,r="this"===t?[e]:await R(e,t,w);h=y(r)?(await Promise.all(r.map(e=>v(e)?R(e,n,w):void 0))).filter(v):void 0}else l?h=await Object.entries(l).reduce(async(t,[n,r])=>{const o=await t,i=await R(e,r,w);return v(i)&&(o[n]=i),o},Promise.resolve({})):p?h=await Promise.all(p.map(t=>k(e,t,w))):u?h=m(e,u,g):a&&(h=await j(a,e=>{if(e instanceof E)throw e;w.logger.error("mapping fn failed",{event:w.event,error:e})})(e,w));d&&!await j(d,e=>{if(e instanceof E)throw e;return w.logger.error("mapping validate failed",{event:w.event,error:e}),!1})(h,w)&&(h=void 0);const P=O(h);return v(P)?P:O(g)},Promise.resolve(void 0))}async function S(e,t={},n={}){var r,o;if(!v(e))return;const i=h(e)&&e.consent||n.consent||(null==(r=n.collector)?void 0:r.consent),c=null!=(o=n.event)?o:h(e)?e:{};return R(e,t,{...n,consent:i,event:c})}var A="observe";function T(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function x(e){return"function"==typeof e}function _(e){return"object"==typeof e&&null!==e}var D=["name","length","prototype","arguments","caller"];function N(e,t){if(-1!==D.indexOf(t))return!1;let n=e;for(;x(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!x(e)||!x(Object.getPrototypeOf(e)))return!1;n=e}return!1}function I(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function $(e,t){let n=e;for(const e of t){if(x(n)){if(!N(n,e))return!0;if(!I(n,e))return!1}else if(w(n)){if(!(e in n))return!0}else if(!_(n)||!(e in n))return!1;n=Reflect.get(n,e)}return x(n)}function C(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[A];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[A];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=T(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),$(e,t)||o.push(r)}const c=new WeakMap,s=new WeakSet;function a(e,t){for(const o of e)if(n)try{n(o,t)}catch(e){}else r.push({fn:o,args:t,ts:Date.now()})}function u(e,t){return 0===t.length||f(e)?e:w(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):x(e)?v(e,[],t):_(e)?p(e,t):e}function f(e){return(_(e)||x(e))&&s.has(e)}function l(e,t){const n=[],r=[];for(const o of e)o.rest[0]===t&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function p(e,t){var n;const r=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),o=null!=(n=c.get(e))?n:new Map;c.set(e,o);const i=o.get(r);if(i)return i;const s=d(e,t);return o.set(r,s),s}function d(e,t){return x(e)?g(e,t):t.some(t=>!I(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=y(e,t,()=>o),o=new Proxy(n,{get:(e,t)=>r.get(t),set:(t,n,r)=>Reflect.set(e,n,r,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},defineProperty:(t,n,r)=>Reflect.defineProperty(e,n,r),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return s.add(o),o}(e,t):g(e,t)}function g(e,t){const n=y(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||I(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return s.add(r),r}function y(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!x(i)&&!_(i))return i;if(f(i))return i;const c=r.get(o);if(c&&c.value===i)return c.out;const{leafs:s,deeper:a}=l(t,o);if(!(s.length>0||a.length>0)&&(!x(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let u=i;return x(i)?u=v(i,s,a,{proxy:n(),target:e}):a.length>0&&(u=p(i,a)),r.set(o,{value:i,out:u}),u}}}function v(e,t,n,r){const o=()=>n.filter(t=>!N(e,t.rest[0])),i=new Map,c=new Proxy(e,{get(e,t){const r=Reflect.get(e,t,e);if("string"!=typeof t||!I(e,t))return r;if(!N(e,t))return r;const{leafs:o,deeper:s}=l(n,t);if(0===o.length&&0===s.length)return r;if(f(r))return r;const a=i.get(t);if(a&&a.value===r)return a.out;let u=r;return x(r)?u=v(r,o,s,{proxy:c,target:e}):_(r)&&s.length>0&&(u=p(r,s)),i.set(t,{value:r,out:u}),u},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){a(t,i);const c=!r||n!==r.proxy&&void 0!==n?n:r.target;return u(Reflect.apply(e,c,i),o())},construct(e,n,r){a(t,n);const i=Reflect.construct(e,n,r===c?e:r),s=u(i,o());return _(s)||x(s)?s:i}});return s.add(c),c}return{env:d(e,i),calls:r,unresolved:o}}(t,n.paths,n.record).env,r=new Set;for(const e of n.paths){const n=T(e)[0];if(void 0===n)continue;const o=t[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,t=>[t,e[t]]);for(const[e,n]of o)t[e]=n}return t}var W={};function q(e){var t;if(null==(t=null==e?void 0:e.window)?void 0:t.heap)return e.window.heap;const{window:n}=C(e);return n.heap}function B(e){const t={};if(!h(e))return t;for(const[n,r]of Object.entries(e))"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(t[n]=r);return t}var M={type:"heap",config:{},init({config:e,env:t}){var n,r,o;const i=e.settings;if(!(null==i?void 0:i.appId))return!1;if(null==(n=null==t?void 0:t.window)?void 0:n.heap)return e;const{window:c,document:s}=C(t),a=c,u=s,f={disableTextCapture:null==(r=i.disableTextCapture)||r,disablePageviewAutocapture:null==(o=i.disablePageviewAutocapture)||o,...void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},...void 0!==i.secureCookie&&{secureCookie:i.secureCookie},...void 0!==i.ingestServer&&{ingestServer:i.ingestServer},...i.heapConfig};if(!a.heap){const e={load:(t,n)=>{e.appid=t,e.config=null!=n?n:{}},track:()=>{},identify:()=>{},resetIdentity:()=>{},addUserProperties:()=>{},addEventProperties:()=>{},clearEventProperties:()=>{},startTracking:()=>{},stopTracking:()=>{},q:[]},t=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"];for(const n of t){const t=(...t)=>{e.q=e.q||[],e.q.push([n,...t])};e[n]=t}a.heap=e}e.loadScript&&function(e,t){const n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://cdn.heapanalytics.com/js/heap-${e}.js`;const r=t.getElementsByTagName("script")[0];r&&r.parentNode?r.parentNode.insertBefore(n,r):t.head.appendChild(n)}(i.appId,u);const l=a.heap;return l.appid||l.load(i.appId,f),e},async push(e,{config:t,data:n,env:r,rule:o,collector:i}){var c,s;const a=q(r);if(!a)return;const u=t.settings||{},f=(null==o?void 0:o.settings)||{};if(void 0!==f.reset){("boolean"==typeof f.reset?f.reset:await S(e,f.reset,{collector:i}))&&a.resetIdentity()}const l=null!=(c=f.identify)?c:u.identify;if(void 0!==l){const t=await S(e,l,{collector:i});b(t)&&t.length>0&&a.identify(t)}const p=null!=(s=f.userProperties)?s:u.userProperties;if(void 0!==p){const t=await S(e,p,{collector:i});h(t)&&a.addUserProperties(B(t))}if(void 0!==f.eventProperties){const t=await S(e,f.eventProperties,{collector:i});h(t)&&a.addEventProperties(B(t))}if(void 0!==f.clearEventProperties){("boolean"==typeof f.clearEventProperties?f.clearEventProperties:await S(e,f.clearEventProperties,{collector:i}))&&a.clearEventProperties()}if(!0!==(null==o?void 0:o.silent)){const t=b(null==o?void 0:o.name)?o.name:e.name,r=B(n);a.track(t,r)}},on(e,t){var n;if("consent"!==e||!t.data)return;const r=q(t.env);if(!r)return;const o=null==(n=t.config)?void 0:n.consent;if(!o||0===Object.keys(o).length)return;const i=t.data;Object.keys(o).every(e=>!0===i[e])?r.startTracking():r.stopTracking()}};var U,K=M;return U=o,((o,i,c,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of n(i))r.call(o,a)||a===c||e(o,a,{get:()=>i[a],enumerable:!(s=t(i,a))||s.enumerable});return o})(e({},"__esModule",{value:!0}),U)})();
|
|
1
|
+
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,o={};((t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})})(o,{DestinationHeap:()=>W,default:()=>K,destinationHeap:()=>M});var i=Object.defineProperty,c=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})};function s(e,t){if("collector"===e)return"collector";if(!t)throw new Error(`stepId(${e}) requires an id`);return`${e}.${t}`}c({},{stepId:()=>s});function a(e,t){const n=e.destinations[t];if(!n)throw new Error(`Destination not found: ${t}`);return n}c({},{getDestination:()=>a});c({},{Level:()=>f});var u,f=((u=f||{})[u.ERROR=0]="ERROR",u[u.WARN=1]="WARN",u[u.INFO=2]="INFO",u[u.DEBUG=3]="DEBUG",u);function l(e,t){const n=e.transformers[t];if(!n)throw new Error(`Transformer not found: ${t}`);return n}c({},{getTransformer:()=>l});function p(e,t){const n=e.sources[t];if(!n)throw new Error(`Source not found: ${t}`);return n}c({},{getSource:()=>p});function d(e,t){const n=e.stores[t];if(!n)throw new Error(`Store not found: ${t}`);return n}async function g(e,t){return await e.get(t)}function v(e){return Array.isArray(e)}function y(e){return void 0!==e}function w(e){return"object"==typeof e&&null!==e&&"then"in e&&"function"==typeof e.then}function h(e){return"object"==typeof e&&null!==e&&!v(e)&&"[object Object]"===Object.prototype.toString.call(e)}function b(e){return"string"==typeof e}function m(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&v(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=m(e,t,n);i.push(r)}return i}if(o=h(o)||v(o)?o[t]:void 0,void 0===o)break}return y(o)?o:n}function P(e){return function(e){return"boolean"==typeof e}(e)||b(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!y(e)||v(e)&&e.every(P)||h(e)&&Object.values(e).every(P)}function O(e){return P(e)?e:void 0}function j(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}c({},{getStore:()=>d,getStoreValue:()=>g});var E=class e extends Error{constructor(t,n){super(t,n),this.name="FatalError",Object.setPrototypeOf(this,e.prototype)}};async function R(e,t={},n){var r;if(!n.collector)throw new Error("getMappingValue: context.collector is required");const o=n.consent||n.collector.consent,i=null!=(r=n.event)?r:{},c={event:i,mapping:t,collector:n.collector,logger:n.collector.logger,consent:o},s=v(t)?t:[t];for(const t of s){const r=await j(k,e=>{if(e instanceof E)throw e;n.collector.status.failed++,c.logger.error("mapping processing failed",{event:i,error:e})})(e,t,{...c,mapping:t});if(y(r))return r}}async function k(e,t,n){return(v(t)?t:[t]).reduce(async(t,r)=>{const o=await t;if(o)return o;const i=b(r)?{key:r}:r;if(!Object.keys(i).length)return;const{condition:c,consent:s,fn:a,key:u,loop:f,map:l,set:p,validate:d,value:g}=i,w={...n,mapping:r};if(c&&!await j(c,e=>{if(e instanceof E)throw e;return w.logger.error("mapping condition failed",{event:w.event,error:e}),!1})(e,w))return;if(s&&!function(e,t={},n={}){const r={...t,...n},o={};let i=!e||0===Object.keys(e).length;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}(s,w.consent))return g;let h=y(g)?g:e;if(f){const[t,n]=f,r="this"===t?[e]:await R(e,t,w);h=v(r)?(await Promise.all(r.map(e=>y(e)?R(e,n,w):void 0))).filter(y):void 0}else l?h=await Object.entries(l).reduce(async(t,[n,r])=>{const o=await t,i=await R(e,r,w);return y(i)&&(o[n]=i),o},Promise.resolve({})):p?h=await Promise.all(p.map(t=>k(e,t,w))):u?h=m(e,u,g):a&&(h=await j(a,e=>{if(e instanceof E)throw e;w.logger.error("mapping fn failed",{event:w.event,error:e})})(e,w));d&&!await j(d,e=>{if(e instanceof E)throw e;return w.logger.error("mapping validate failed",{event:w.event,error:e}),!1})(h,w)&&(h=void 0);const P=O(h);return y(P)?P:O(g)},Promise.resolve(void 0))}async function S(e,t={},n){var r,o;if(!y(e))return;const i=h(e)&&e.consent||(null==n?void 0:n.consent)||(null==(r=null==n?void 0:n.collector)?void 0:r.consent),c=null!=(o=null==n?void 0:n.event)?o:h(e)?e:{};return R(e,t,{...n,consent:i,event:c})}var A="observe";function T(e){const t=(e.startsWith("call:")?e.slice(5):e).split(".");return t.some(e=>""===e)?[]:t}function x(e){return"function"==typeof e}function _(e){return"object"==typeof e&&null!==e}var D=["name","length","prototype","arguments","caller"];function N(e,t){if(-1!==D.indexOf(t))return!1;let n=e;for(;x(n);){if(Object.prototype.hasOwnProperty.call(n,t))return!0;const e=Object.getPrototypeOf(n);if(!x(e)||!x(Object.getPrototypeOf(e)))return!1;n=e}return!1}function I(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!(n&&!n.configurable)||"value"in n&&!0===n.writable}function $(e,t){let n=e;for(const e of t){if(x(n)){if(!N(n,e))return!0;if(!I(n,e))return!1}else if(w(n)){if(!(e in n))return!0}else if(!_(n)||!(e in n))return!1;n=Reflect.get(n,e)}return x(n)}function C(e){const t={window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document,...e},n=e&&e[A];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=typeof e||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;const{paths:t,record:n}=e;return Array.isArray(t)&&t.every(e=>"string"==typeof e)&&"function"==typeof n}(n)){delete t[A];const e=function(e,t,n){const r=[],o=[],i=[];for(const n of t){const t=T(n);if(0===t.length)continue;const r=t.join(".");i.push({rest:t,fn:r}),$(e,t)||o.push(r)}const c=new WeakMap,s=new WeakSet;function a(e,t){for(const o of e)if(n)try{n(o,t)}catch(e){}else r.push({fn:o,args:t,ts:Date.now()})}function u(e,t){return 0===t.length||f(e)?e:w(e)&&!t.some(t=>t.rest[0]in e)?Promise.resolve(e).then(e=>u(e,t)):x(e)?y(e,[],t):_(e)?p(e,t):e}function f(e){return(_(e)||x(e))&&s.has(e)}function l(e,t){const n=[],r=[];for(const o of e)o.rest[0]===t&&(1===o.rest.length?n.includes(o.fn)||n.push(o.fn):r.push({rest:o.rest.slice(1),fn:o.fn}));return{leafs:n,deeper:r}}function p(e,t){var n;const r=t.map(e=>`${e.fn}:${e.rest.join(".")}`).join("|"),o=null!=(n=c.get(e))?n:new Map;c.set(e,o);const i=o.get(r);if(i)return i;const s=d(e,t);return o.set(r,s),s}function d(e,t){return x(e)?g(e,t):t.some(t=>!I(e,t.rest[0]))?function(e,t){const n=Object.create(Object.getPrototypeOf(e)),r=v(e,t,()=>o),o=new Proxy(n,{get:(e,t)=>r.get(t),set:(t,n,r)=>Reflect.set(e,n,r,e),has:(t,n)=>Reflect.has(e,n),ownKeys:()=>Reflect.ownKeys(e),getOwnPropertyDescriptor(t,n){const r=Reflect.getOwnPropertyDescriptor(e,n);return r&&{...r,configurable:!0}},defineProperty:(t,n,r)=>Reflect.defineProperty(e,n,r),deleteProperty:(t,n)=>Reflect.deleteProperty(e,n)});return s.add(o),o}(e,t):g(e,t)}function g(e,t){const n=v(e,t,()=>r),r=new Proxy(e,{get:(e,t)=>"string"!=typeof t||I(e,t)?n.get(t):Reflect.get(e,t,e),set:(e,t,n)=>Reflect.set(e,t,n,e)});return s.add(r),r}function v(e,t,n){const r=new Map;return{get(o){const i=Reflect.get(e,o,e);if("string"!=typeof o)return i;if(!x(i)&&!_(i))return i;if(f(i))return i;const c=r.get(o);if(c&&c.value===i)return c.out;const{leafs:s,deeper:a}=l(t,o);if(!(s.length>0||a.length>0)&&(!x(i)||function(e){if(Array.isArray(e))return!0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return i;let u=i;return x(i)?u=y(i,s,a,{proxy:n(),target:e}):a.length>0&&(u=p(i,a)),r.set(o,{value:i,out:u}),u}}}function y(e,t,n,r){const o=()=>n.filter(t=>!N(e,t.rest[0])),i=new Map,c=new Proxy(e,{get(e,t){const r=Reflect.get(e,t,e);if("string"!=typeof t||!I(e,t))return r;if(!N(e,t))return r;const{leafs:o,deeper:s}=l(n,t);if(0===o.length&&0===s.length)return r;if(f(r))return r;const a=i.get(t);if(a&&a.value===r)return a.out;let u=r;return x(r)?u=y(r,o,s,{proxy:c,target:e}):_(r)&&s.length>0&&(u=p(r,s)),i.set(t,{value:r,out:u}),u},set:(e,t,n)=>Reflect.set(e,t,n,e),apply(e,n,i){a(t,i);const c=!r||n!==r.proxy&&void 0!==n?n:r.target;return u(Reflect.apply(e,c,i),o())},construct(e,n,r){a(t,n);const i=Reflect.construct(e,n,r===c?e:r),s=u(i,o());return _(s)||x(s)?s:i}});return s.add(c),c}return{env:d(e,i),calls:r,unresolved:o}}(t,n.paths,n.record).env,r=new Set;for(const e of n.paths){const n=T(e)[0];if(void 0===n)continue;const o=t[n];null!==o&&"object"==typeof o&&r.add(n)}const o=Array.from(r,t=>[t,e[t]]);for(const[e,n]of o)t[e]=n}return t}var W={};function q(e){var t;if(null==(t=null==e?void 0:e.window)?void 0:t.heap)return e.window.heap;const{window:n}=C(e);return n.heap}function B(e){const t={};if(!h(e))return t;for(const[n,r]of Object.entries(e))"string"!=typeof r&&"number"!=typeof r&&"boolean"!=typeof r||(t[n]=r);return t}var M={type:"heap",config:{},init({config:e,env:t}){var n,r,o;const i=e.settings;if(!(null==i?void 0:i.appId))return!1;if(null==(n=null==t?void 0:t.window)?void 0:n.heap)return e;const{window:c,document:s}=C(t),a=c,u=s,f={disableTextCapture:null==(r=i.disableTextCapture)||r,disablePageviewAutocapture:null==(o=i.disablePageviewAutocapture)||o,...void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},...void 0!==i.secureCookie&&{secureCookie:i.secureCookie},...void 0!==i.ingestServer&&{ingestServer:i.ingestServer},...i.heapConfig};if(!a.heap){const e={load:(t,n)=>{e.appid=t,e.config=null!=n?n:{}},track:()=>{},identify:()=>{},resetIdentity:()=>{},addUserProperties:()=>{},addEventProperties:()=>{},clearEventProperties:()=>{},startTracking:()=>{},stopTracking:()=>{},q:[]},t=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"];for(const n of t){const t=(...t)=>{e.q=e.q||[],e.q.push([n,...t])};e[n]=t}a.heap=e}e.loadScript&&function(e,t){const n=t.createElement("script");n.type="text/javascript",n.async=!0,n.src=`https://cdn.heapanalytics.com/js/heap-${e}.js`;const r=t.getElementsByTagName("script")[0];r&&r.parentNode?r.parentNode.insertBefore(n,r):t.head.appendChild(n)}(i.appId,u);const l=a.heap;return l.appid||l.load(i.appId,f),e},async push(e,{config:t,data:n,env:r,rule:o,collector:i}){var c,s;const a=q(r);if(!a)return;const u=t.settings||{},f=(null==o?void 0:o.settings)||{};if(void 0!==f.reset){("boolean"==typeof f.reset?f.reset:await S(e,f.reset,{collector:i}))&&a.resetIdentity()}const l=null!=(c=f.identify)?c:u.identify;if(void 0!==l){const t=await S(e,l,{collector:i});b(t)&&t.length>0&&a.identify(t)}const p=null!=(s=f.userProperties)?s:u.userProperties;if(void 0!==p){const t=await S(e,p,{collector:i});h(t)&&a.addUserProperties(B(t))}if(void 0!==f.eventProperties){const t=await S(e,f.eventProperties,{collector:i});h(t)&&a.addEventProperties(B(t))}if(void 0!==f.clearEventProperties){("boolean"==typeof f.clearEventProperties?f.clearEventProperties:await S(e,f.clearEventProperties,{collector:i}))&&a.clearEventProperties()}if(!0!==(null==o?void 0:o.silent)){const t=b(null==o?void 0:o.name)?o.name:e.name,r=B(n);a.track(t,r)}},on(e,t){var n;if("consent"!==e||!t.data)return;const r=q(t.env);if(!r)return;const o=null==(n=t.config)?void 0:n.consent;if(!o||0===Object.keys(o).length)return;const i=t.data;Object.keys(o).every(e=>!0===i[e])?r.startTracking():r.stopTracking()}};var U,K=M;return U=o,((o,i,c,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let a of n(i))r.call(o,a)||a===c||e(o,a,{get:()=>i[a],enumerable:!(s=t(i,a))||s.enumerable});return o})(e({},"__esModule",{value:!0}),U)})();
|
package/dist/index.es5.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _call_super(e,t,r){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,r||[],_get_prototype_of(e).constructor):t.apply(e,r))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _construct(e,t,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,e)},_wrap_native_super(e)}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}function _ts_generator(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var r=e.destinations[t];if(!r)throw new Error("Destination not found: ".concat(t));return r},r=function(e,t){var r=e.transformers[t];if(!r)throw new Error("Transformer not found: ".concat(t));return r},n=function(e,t){var r=e.sources[t];if(!r)throw new Error("Source not found: ".concat(t));return r},o=function(e,t){var r=e.stores[t];if(!r)throw new Error("Store not found: ".concat(t));return r},a=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,e.get(t)];case 1:return[2,r.sent()]}})})()},i=function(e){return Array.isArray(e)},u=function(e){return void 0!==e},c=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&"then"in e&&"function"==typeof e.then},l=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!i(e)&&"[object Object]"===Object.prototype.toString.call(e)},s=function(e){return"string"==typeof e},f=function(e){return N(e)?e:void 0},p=function(e,t,r){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),t?[4,t(n)]:[2];case 4:return[4,null==r?void 0:r()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},_=function(e){return _async_to_generator(function(e){var t,r,n,o,a,c,l,s,f,_,y,v,d,b,h,g,w=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(t=w.length>1&&void 0!==w[1]?w[1]:{},a=(r=w.length>2&&void 0!==w[2]?w[2]:{}).consent||(null===(o=r.collector)||void 0===o?void 0:o.consent),c=null!==(n=r.event)&&void 0!==n?n:{},!r.collector)throw new Error("getMappingValue: context.collector is required");l={event:c,mapping:t,collector:r.collector,logger:r.collector.logger,consent:a},s=i(t)?t:[t],f=!0,_=!1,y=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),v=s[Symbol.iterator](),m.label=2;case 2:return(f=(d=v.next()).done)?[3,5]:(b=d.value,[4,p(M,function(e){if(_instanceof(e,C))throw e;r.collector&&r.collector.status.failed++,l.logger.error("mapping processing failed",{event:c,error:e})})(e,b,_object_spread_props(_object_spread({},l),{mapping:b}))]);case 3:if(h=m.sent(),u(h))return[2,h];m.label=4;case 4:return f=!0,[3,2];case 5:return[3,8];case 6:return g=m.sent(),_=!0,y=g,[3,8];case 7:try{f||null==v.return||v.return()}finally{if(_)throw y}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(e){return _async_to_generator(function(e){var t,r,n,o,a,i,c=arguments;return _ts_generator(this,function(s){return t=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2&&void 0!==c[2]?c[2]:{},u(e)?(a=l(e)&&e.consent||r.consent||(null===(o=r.collector)||void 0===o?void 0:o.consent),i=null!==(n=r.event)&&void 0!==n?n:l(e)?e:{},[2,_(e,t,_object_spread_props(_object_spread({},r),{consent:a,event:i}))]):[2]})}).apply(this,arguments)},v=function(e){var t=(e.startsWith(q)?e.slice(5):e).split(".");return t.some(function(e){return""===e})?[]:t},d=function(e){return"function"==typeof e},b=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e},h=function(e,t){if(-1!==G.indexOf(t))return!1;for(var r=e;d(r);){if(Object.prototype.hasOwnProperty.call(r,t))return!0;var n=Object.getPrototypeOf(r);if(!d(n)||!d(Object.getPrototypeOf(n)))return!1;r=n}return!1},g=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},w=function(e,t){var r=e,n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var l=i.value;if(d(r)){if(!h(r,l))return!0;if(!g(r,l))return!1}else if(c(r)){if(!(l in r))return!0}else if(!b(r)||!(l in r))return!1;r=Reflect.get(r,l)}}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return d(r)},m=function(e){var t=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e),r=e&&e[W];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;var t=e.paths,r=e.record;return Array.isArray(t)&&t.every(function(e){return"string"==typeof e})&&"function"==typeof r}(r)){delete t[W];var n=function(e,t,r){var n=[],o=[],a=[],i=!0,u=!1,l=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var p=s.value,_=v(p);if(0!==_.length){var y=_.join(".");a.push({rest:_,fn:y}),w(e,_)||o.push(y)}}}catch(e){u=!0,l=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw l}}var m=new WeakMap,O=new WeakSet;function j(e,t){var o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=u.value;if(r)try{r(l,t)}catch(e){}else n.push({fn:l,args:t,ts:Date.now()})}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}}function P(e,t){return 0===t.length||S(e)?e:c(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return P(e,t)}):d(e)?I(e,[],t):b(e)?k(e,t):e}function S(e){return(b(e)||d(e))&&O.has(e)}function E(e,t){var r=[],n=[],o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=u.value;l.rest[0]===t&&(1===l.rest.length?r.includes(l.fn)||r.push(l.fn):n.push({rest:l.rest.slice(1),fn:l.fn}))}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function k(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=m.get(e))&&void 0!==r?r:new Map;m.set(e,o);var a=o.get(n);if(a)return a;var i=R(e,t);return o.set(n,i),i}function R(e,t){return d(e)?x(e,t):t.some(function(t){return!g(e,t.rest[0])})?function(e,t){var r=Object.create(Object.getPrototypeOf(e)),n=A(e,t,function(){return o}),o=new Proxy(r,{get:function(e,t){return n.get(t)},set:function(t,r,n){return Reflect.set(e,r,n,e)},has:function(t,r){return Reflect.has(e,r)},ownKeys:function(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(t,r){var n=Reflect.getOwnPropertyDescriptor(e,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(t,r,n){return Reflect.defineProperty(e,r,n)},deleteProperty:function(t,r){return Reflect.deleteProperty(e,r)}});return O.add(o),o}(e,t):x(e,t)}function x(e,t){var r=A(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||g(e,t)?r.get(t):Reflect.get(e,t,e)},set:function(e,t,r){return Reflect.set(e,t,r,e)}});return O.add(n),n}function A(e,t,r){var n=new Map;return{get:function(o){var a=Reflect.get(e,o,e);if("string"!=typeof o)return a;if(!d(a)&&!b(a))return a;if(S(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var u=E(t,o),c=u.leafs,l=u.deeper;if(!(c.length>0||l.length>0)&&(!d(a)||function(e){if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return a;var s=a;return d(a)?s=I(a,c,l,{proxy:r(),target:e}):l.length>0&&(s=k(a,l)),n.set(o,{value:a,out:s}),s}}}function I(e,t,r,n){var o=function(){return r.filter(function(t){return!h(e,t.rest[0])})},a=new Map,i=new Proxy(e,{get:function(e,t){var n=Reflect.get(e,t,e);if("string"!=typeof t||!g(e,t))return n;if(!h(e,t))return n;var o=E(r,t),u=o.leafs,c=o.deeper;if(0===u.length&&0===c.length)return n;if(S(n))return n;var l=a.get(t);if(l&&l.value===n)return l.out;var s=n;return d(n)?s=I(n,u,c,{proxy:i,target:e}):b(n)&&c.length>0&&(s=k(n,c)),a.set(t,{value:n,out:s}),s},set:function(e,t,r){return Reflect.set(e,t,r,e)},apply:function(e,r,a){j(t,a);var i=!n||r!==n.proxy&&void 0!==r?r:n.target;return P(Reflect.apply(e,i,a),o())},construct:function(e,r,n){j(t,r);var a=Reflect.construct(e,r,n===i?e:n),u=P(a,o());return b(u)||d(u)?u:a}});return O.add(i),i}return{env:R(e,a),calls:n,unresolved:o}}(t,r.paths,r.record).env,o=new Set,a=!0,i=!1,u=void 0;try{for(var l,s=r.paths[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,p=v(f)[0];if(void 0!==p){var _=t[p];null!==_&&"object"==(void 0===_?"undefined":_type_of(_))&&o.add(p)}}}catch(e){i=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw u}}var y=Array.from(o,function(e){return[e,n[e]]}),m=!0,O=!1,j=void 0;try{for(var P,S=y[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var E=_sliced_to_array(P.value,2),k=E[0],R=E[1];t[k]=R}}catch(e){O=!0,j=e}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return t},O=function(e){var t;return(null==e||null===(t=e.window)||void 0===t?void 0:t.heap)?e.window.heap:m(e).window.heap},j=function(e){var t={};if(!l(e))return t;var r=!0,n=!1,o=void 0;try{for(var a,i=Object.entries(e)[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u=_sliced_to_array(a.value,2),c=u[0],s=u[1];"string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s||(t[c]=s)}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return t},P=Object.defineProperty,S=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,k=Object.prototype.hasOwnProperty,R={};!function(e,t){for(var r in t)P(e,r,{get:t[r],enumerable:!0})}(R,{DestinationHeap:function(){return K},default:function(){return F},destinationHeap:function(){return U}});var x=Object.defineProperty,A=function(e,t){for(var r in t)x(e,r,{get:t[r],enumerable:!0})};A({},{stepId:function(){return e}});A({},{getDestination:function(){return t}});A({},{Level:function(){return T}});var I,T=((I=T||{})[I.ERROR=0]="ERROR",I[I.WARN=1]="WARN",I[I.INFO=2]="INFO",I[I.DEBUG=3]="DEBUG",I);A({},{getTransformer:function(){return r}});A({},{getSource:function(){return n}});function D(e){for(var t=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),n=e,o=0;o<r.length;o++){var a=r[o];if("*"===a&&i(n)){var c=r.slice(o+1).join("."),s=[],f=!0,p=!1,_=void 0;try{for(var y,v=n[Symbol.iterator]();!(f=(y=v.next()).done);f=!0){var d=D(y.value,c,t);s.push(d)}}catch(e){p=!0,_=e}finally{try{f||null==v.return||v.return()}finally{if(p)throw _}}return s}if(void 0===(n=l(n)||i(n)?n[a]:void 0))break}return u(n)?n:t}function N(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||i(e)&&e.every(N)||l(e)&&Object.values(e).every(N)}A({},{getStore:function(){return o},getStoreValue:function(){return a}});var C=function(){function e(t,r){var n;return _class_call_check(this,e),(n=_call_super(this,e,[t,r])).name="FatalError",Object.setPrototypeOf(n,e.prototype),n}return _inherits(e,_wrap_native_super(Error)),e}();function M(e,t,r){return _async_to_generator(function(){return _ts_generator(this,function(n){return[2,(i(t)?t:[t]).reduce(function(t,n){return _async_to_generator(function(){var o,a,c,l,y,v,d,b,h,g,w,m,O,j,P,S,E,k,R,x,A,I,T,N,B;return _ts_generator(this,function(W){switch(W.label){case 0:return[4,t];case 1:return(o=W.sent())?[2,o]:(a=s(n)?{key:n}:n,Object.keys(a).length?(c=a.condition,l=a.consent,y=a.fn,v=a.key,d=a.loop,b=a.map,h=a.set,g=a.validate,w=a.value,m=_object_spread_props(_object_spread({},r),{mapping:n}),(O=c)?[4,p(c,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping condition failed",{event:m.event,error:e}),!1})(e,m)]:[3,3]):[2]);case 2:O=!W.sent(),W.label=3;case 3:return O?[2]:l&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r}(l,m.consent)?[2,w]:(j=u(w)?w:e,d?(P=_sliced_to_array(d,2),S=P[0],E=P[1],"this"!==S?[3,4]:(R=[e],[3,6])):[3,10]);case 4:return[4,_(e,S,m)];case 5:R=W.sent(),W.label=6;case 6:return i(k=R)?[4,Promise.all(k.map(function(e){return u(e)?_(e,E,m):void 0}))]:[3,8];case 7:return x=W.sent().filter(u),[3,9];case 8:x=void 0,W.label=9;case 9:return j=x,[3,21];case 10:return b?[4,Object.entries(b).reduce(function(t,r){var n=_sliced_to_array(r,2),o=n[0],a=n[1];return _async_to_generator(function(){var r,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,t];case 1:return r=i.sent(),[4,_(e,a,m)];case 2:return n=i.sent(),[2,(u(n)&&(r[o]=n),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return j=W.sent(),[3,20];case 12:return h?[4,Promise.all(h.map(function(t){return M(e,t,m)}))]:[3,14];case 13:return A=j=W.sent(),[3,19];case 14:return v?(I=j=D(e,v,w),[3,18]):[3,15];case 15:return(T=y)?[4,p(y,function(e){if(_instanceof(e,C))throw e;m.logger.error("mapping fn failed",{event:m.event,error:e})})(e,m)]:[3,17];case 16:T=j=W.sent(),W.label=17;case 17:I=T,W.label=18;case 18:A=I,W.label=19;case 19:W.label=20;case 20:W.label=21;case 21:return(N=g)?[4,p(g,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping validate failed",{event:m.event,error:e}),!1})(j,m)]:[3,23];case 22:N=!W.sent(),W.label=23;case 23:return N&&(j=void 0),B=f(j),[2,u(B)?B:f(w)]}})})()},Promise.resolve(void 0))]})})()}var B,W="observe",q="call:",G=["name","length","prototype","arguments","caller"],K={},U={type:"heap",config:{},init:function(e){var t,r,n,o=e.config,a=e.env,i=o.settings;if(!(null==i?void 0:i.appId))return!1;if(null==a||null===(n=a.window)||void 0===n?void 0:n.heap)return o;var u=m(a),c=u.window,l=u.document,s=_object_spread({disableTextCapture:null===(t=i.disableTextCapture)||void 0===t||t,disablePageviewAutocapture:null===(r=i.disablePageviewAutocapture)||void 0===r||r},void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},void 0!==i.secureCookie&&{secureCookie:i.secureCookie},void 0!==i.ingestServer&&{ingestServer:i.ingestServer},i.heapConfig);if(!c.heap){var f={load:function(e,t){f.appid=e,f.config=null!=t?t:{}},track:function(){},identify:function(){},resetIdentity:function(){},addUserProperties:function(){},addEventProperties:function(){},clearEventProperties:function(){},startTracking:function(){},stopTracking:function(){},q:[]},p=!0,_=!1,y=void 0;try{for(var v,d=function(){var e=v.value;f[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f.q=f.q||[],f.q.push([e].concat(_to_consumable_array(r)))}},b=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"][Symbol.iterator]();!(p=(v=b.next()).done);p=!0)d()}catch(e){_=!0,y=e}finally{try{p||null==b.return||b.return()}finally{if(_)throw y}}c.heap=f}o.loadScript&&function(e,t){var r=t.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-".concat(e,".js");var n=t.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(r,n):t.head.appendChild(r)}(i.appId,l);var h=c.heap;return h.appid||h.load(i.appId,s),o},push:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,i,u,c,f,p,_,v,d,b,h,g,w,m,P,S;return _ts_generator(this,function(E){switch(E.label){case 0:return r=t.config,n=t.data,o=t.env,a=t.rule,i=t.collector,(f=O(o))?(p=r.settings||{},void 0===(_=(null==a?void 0:a.settings)||{}).reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3])):[2];case 1:return[4,y(e,_.reset,{collector:i})];case 2:v=E.sent(),E.label=3;case 3:v&&f.resetIdentity(),E.label=4;case 4:return void 0===(d=null!==(u=_.identify)&&void 0!==u?u:p.identify)?[3,6]:[4,y(e,d,{collector:i})];case 5:b=E.sent(),s(b)&&b.length>0&&f.identify(b),E.label=6;case 6:return void 0===(h=null!==(c=_.userProperties)&&void 0!==c?c:p.userProperties)?[3,8]:[4,y(e,h,{collector:i})];case 7:g=E.sent(),l(g)&&f.addUserProperties(j(g)),E.label=8;case 8:return void 0===_.eventProperties?[3,10]:[4,y(e,_.eventProperties,{collector:i})];case 9:w=E.sent(),l(w)&&f.addEventProperties(j(w)),E.label=10;case 10:return void 0===_.clearEventProperties?[3,14]:"boolean"!=typeof _.clearEventProperties?[3,11]:(m=_.clearEventProperties,[3,13]);case 11:return[4,y(e,_.clearEventProperties,{collector:i})];case 12:m=E.sent(),E.label=13;case 13:m&&f.clearEventProperties(),E.label=14;case 14:return!0!==(null==a?void 0:a.silent)&&(P=s(null==a?void 0:a.name)?a.name:e.name,S=j(n),f.track(P,S)),[2]}})}).apply(this,arguments)},on:function(e,t){var r;if("consent"===e&&t.data){var n=O(t.env);if(n){var o=null===(r=t.config)||void 0===r?void 0:r.consent;if(o&&0!==Object.keys(o).length){var a=t.data;Object.keys(o).every(function(e){return!0===a[e]})?n.startTracking():n.stopTracking()}}}}},F=U;return B=R,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var u,c=function(){var o=u.value;k.call(e,o)||o===r||P(e,o,{get:function(){return t[o]},enumerable:!(n=S(t,o))||n.enumerable})},l=E(t)[Symbol.iterator]();!(o=(u=l.next()).done);o=!0)c()}catch(e){a=!0,i=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw i}}}return e}(P({},"__esModule",{value:!0}),B)}();
|
|
1
|
+
"use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _call_super(e,t,r){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,r||[],_get_prototype_of(e).constructor):t.apply(e,r))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _construct(e,t,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&_set_prototype_of(o,r.prototype),o},_construct.apply(null,arguments)}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,e)},_wrap_native_super(e)}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}function _ts_generator(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(i,"next",{value:c(0)}),u(i,"throw",{value:c(1)}),u(i,"return",{value:c(2)}),"function"==typeof Symbol&&u(i,Symbol.iterator,{value:function(){return this}}),i;function c(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e,t){if("collector"===e)return"collector";if(!t)throw new Error("stepId(".concat(e,") requires an id"));return"".concat(e,".").concat(t)},t=function(e,t){var r=e.destinations[t];if(!r)throw new Error("Destination not found: ".concat(t));return r},r=function(e,t){var r=e.transformers[t];if(!r)throw new Error("Transformer not found: ".concat(t));return r},n=function(e,t){var r=e.sources[t];if(!r)throw new Error("Source not found: ".concat(t));return r},o=function(e,t){var r=e.stores[t];if(!r)throw new Error("Store not found: ".concat(t));return r},a=function(e,t){return _async_to_generator(function(){return _ts_generator(this,function(r){switch(r.label){case 0:return[4,e.get(t)];case 1:return[2,r.sent()]}})})()},i=function(e){return Array.isArray(e)},u=function(e){return void 0!==e},c=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&"then"in e&&"function"==typeof e.then},l=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!i(e)&&"[object Object]"===Object.prototype.toString.call(e)},s=function(e){return"string"==typeof e},f=function(e){return N(e)?e:void 0},p=function(e,t,r){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),t?[4,t(n)]:[2];case 4:return[4,null==r?void 0:r()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},_=function(e,t){return _async_to_generator(function(e){var t,r,n,o,a,c,l,s,f,_,y,v,d,b,h,g=arguments;return _ts_generator(this,function(w){switch(w.label){case 0:if(t=g.length>1&&void 0!==g[1]?g[1]:{},!(r=g.length>2?g[2]:void 0).collector)throw new Error("getMappingValue: context.collector is required");o=r.consent||r.collector.consent,a=null!==(n=r.event)&&void 0!==n?n:{},c={event:a,mapping:t,collector:r.collector,logger:r.collector.logger,consent:o},l=i(t)?t:[t],s=!0,f=!1,_=void 0,w.label=1;case 1:w.trys.push([1,6,7,8]),y=l[Symbol.iterator](),w.label=2;case 2:return(s=(v=y.next()).done)?[3,5]:(d=v.value,[4,p(M,function(e){if(_instanceof(e,C))throw e;r.collector.status.failed++,c.logger.error("mapping processing failed",{event:a,error:e})})(e,d,_object_spread_props(_object_spread({},c),{mapping:d}))]);case 3:if(b=w.sent(),u(b))return[2,b];w.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return h=w.sent(),f=!0,_=h,[3,8];case 7:try{s||null==y.return||y.return()}finally{if(f)throw _}return[7];case 8:return[2]}})}).apply(this,arguments)},y=function(e,t){return _async_to_generator(function(e){var t,r,n,o,a,i,c=arguments;return _ts_generator(this,function(s){return t=c.length>1&&void 0!==c[1]?c[1]:{},r=c.length>2?c[2]:void 0,u(e)?(a=l(e)&&e.consent||(null==r?void 0:r.consent)||(null==r||null===(o=r.collector)||void 0===o?void 0:o.consent),i=null!==(n=null==r?void 0:r.event)&&void 0!==n?n:l(e)?e:{},[2,_(e,t,_object_spread_props(_object_spread({},r),{consent:a,event:i}))]):[2]})}).apply(this,arguments)},v=function(e){var t=(e.startsWith(q)?e.slice(5):e).split(".");return t.some(function(e){return""===e})?[]:t},d=function(e){return"function"==typeof e},b=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e},h=function(e,t){if(-1!==G.indexOf(t))return!1;for(var r=e;d(r);){if(Object.prototype.hasOwnProperty.call(r,t))return!0;var n=Object.getPrototypeOf(r);if(!d(n)||!d(Object.getPrototypeOf(n)))return!1;r=n}return!1},g=function(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);return!(r&&!r.configurable)||"value"in r&&!0===r.writable},w=function(e,t){var r=e,n=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var l=i.value;if(d(r)){if(!h(r,l))return!0;if(!g(r,l))return!1}else if(c(r)){if(!(l in r))return!0}else if(!b(r)||!(l in r))return!1;r=Reflect.get(r,l)}}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw a}}return d(r)},m=function(e){var t=_object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e),r=e&&e[W];if(("undefined"==typeof __WALKEROS_OBSERVE__||__WALKEROS_OBSERVE__)&&function(e){if("object"!=(void 0===e?"undefined":_type_of(e))||null===e)return!1;if(!("paths"in e)||!("record"in e))return!1;var t=e.paths,r=e.record;return Array.isArray(t)&&t.every(function(e){return"string"==typeof e})&&"function"==typeof r}(r)){delete t[W];var n=function(e,t,r){var n=[],o=[],a=[],i=!0,u=!1,l=void 0;try{for(var s,f=t[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var p=s.value,_=v(p);if(0!==_.length){var y=_.join(".");a.push({rest:_,fn:y}),w(e,_)||o.push(y)}}}catch(e){u=!0,l=e}finally{try{i||null==f.return||f.return()}finally{if(u)throw l}}var m=new WeakMap,O=new WeakSet;function j(e,t){var o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=u.value;if(r)try{r(l,t)}catch(e){}else n.push({fn:l,args:t,ts:Date.now()})}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}}function P(e,t){return 0===t.length||S(e)?e:c(e)&&!t.some(function(t){return t.rest[0]in e})?Promise.resolve(e).then(function(e){return P(e,t)}):d(e)?I(e,[],t):b(e)?k(e,t):e}function S(e){return(b(e)||d(e))&&O.has(e)}function E(e,t){var r=[],n=[],o=!0,a=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var l=u.value;l.rest[0]===t&&(1===l.rest.length?r.includes(l.fn)||r.push(l.fn):n.push({rest:l.rest.slice(1),fn:l.fn}))}}catch(e){a=!0,i=e}finally{try{o||null==c.return||c.return()}finally{if(a)throw i}}return{leafs:r,deeper:n}}function k(e,t){var r,n=t.map(function(e){return"".concat(e.fn,":").concat(e.rest.join("."))}).join("|"),o=null!==(r=m.get(e))&&void 0!==r?r:new Map;m.set(e,o);var a=o.get(n);if(a)return a;var i=R(e,t);return o.set(n,i),i}function R(e,t){return d(e)?x(e,t):t.some(function(t){return!g(e,t.rest[0])})?function(e,t){var r=Object.create(Object.getPrototypeOf(e)),n=A(e,t,function(){return o}),o=new Proxy(r,{get:function(e,t){return n.get(t)},set:function(t,r,n){return Reflect.set(e,r,n,e)},has:function(t,r){return Reflect.has(e,r)},ownKeys:function(){return Reflect.ownKeys(e)},getOwnPropertyDescriptor:function(t,r){var n=Reflect.getOwnPropertyDescriptor(e,r);return n&&_object_spread_props(_object_spread({},n),{configurable:!0})},defineProperty:function(t,r,n){return Reflect.defineProperty(e,r,n)},deleteProperty:function(t,r){return Reflect.deleteProperty(e,r)}});return O.add(o),o}(e,t):x(e,t)}function x(e,t){var r=A(e,t,function(){return n}),n=new Proxy(e,{get:function(e,t){return"string"!=typeof t||g(e,t)?r.get(t):Reflect.get(e,t,e)},set:function(e,t,r){return Reflect.set(e,t,r,e)}});return O.add(n),n}function A(e,t,r){var n=new Map;return{get:function(o){var a=Reflect.get(e,o,e);if("string"!=typeof o)return a;if(!d(a)&&!b(a))return a;if(S(a))return a;var i=n.get(o);if(i&&i.value===a)return i.out;var u=E(t,o),c=u.leafs,l=u.deeper;if(!(c.length>0||l.length>0)&&(!d(a)||function(e){if(Array.isArray(e))return!0;var t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(e)))return a;var s=a;return d(a)?s=I(a,c,l,{proxy:r(),target:e}):l.length>0&&(s=k(a,l)),n.set(o,{value:a,out:s}),s}}}function I(e,t,r,n){var o=function(){return r.filter(function(t){return!h(e,t.rest[0])})},a=new Map,i=new Proxy(e,{get:function(e,t){var n=Reflect.get(e,t,e);if("string"!=typeof t||!g(e,t))return n;if(!h(e,t))return n;var o=E(r,t),u=o.leafs,c=o.deeper;if(0===u.length&&0===c.length)return n;if(S(n))return n;var l=a.get(t);if(l&&l.value===n)return l.out;var s=n;return d(n)?s=I(n,u,c,{proxy:i,target:e}):b(n)&&c.length>0&&(s=k(n,c)),a.set(t,{value:n,out:s}),s},set:function(e,t,r){return Reflect.set(e,t,r,e)},apply:function(e,r,a){j(t,a);var i=!n||r!==n.proxy&&void 0!==r?r:n.target;return P(Reflect.apply(e,i,a),o())},construct:function(e,r,n){j(t,r);var a=Reflect.construct(e,r,n===i?e:n),u=P(a,o());return b(u)||d(u)?u:a}});return O.add(i),i}return{env:R(e,a),calls:n,unresolved:o}}(t,r.paths,r.record).env,o=new Set,a=!0,i=!1,u=void 0;try{for(var l,s=r.paths[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,p=v(f)[0];if(void 0!==p){var _=t[p];null!==_&&"object"==(void 0===_?"undefined":_type_of(_))&&o.add(p)}}}catch(e){i=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(i)throw u}}var y=Array.from(o,function(e){return[e,n[e]]}),m=!0,O=!1,j=void 0;try{for(var P,S=y[Symbol.iterator]();!(m=(P=S.next()).done);m=!0){var E=_sliced_to_array(P.value,2),k=E[0],R=E[1];t[k]=R}}catch(e){O=!0,j=e}finally{try{m||null==S.return||S.return()}finally{if(O)throw j}}}return t},O=function(e){var t;return(null==e||null===(t=e.window)||void 0===t?void 0:t.heap)?e.window.heap:m(e).window.heap},j=function(e){var t={};if(!l(e))return t;var r=!0,n=!1,o=void 0;try{for(var a,i=Object.entries(e)[Symbol.iterator]();!(r=(a=i.next()).done);r=!0){var u=_sliced_to_array(a.value,2),c=u[0],s=u[1];"string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s||(t[c]=s)}}catch(e){n=!0,o=e}finally{try{r||null==i.return||i.return()}finally{if(n)throw o}}return t},P=Object.defineProperty,S=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,k=Object.prototype.hasOwnProperty,R={};!function(e,t){for(var r in t)P(e,r,{get:t[r],enumerable:!0})}(R,{DestinationHeap:function(){return K},default:function(){return F},destinationHeap:function(){return U}});var x=Object.defineProperty,A=function(e,t){for(var r in t)x(e,r,{get:t[r],enumerable:!0})};A({},{stepId:function(){return e}});A({},{getDestination:function(){return t}});A({},{Level:function(){return T}});var I,T=((I=T||{})[I.ERROR=0]="ERROR",I[I.WARN=1]="WARN",I[I.INFO=2]="INFO",I[I.DEBUG=3]="DEBUG",I);A({},{getTransformer:function(){return r}});A({},{getSource:function(){return n}});function D(e){for(var t=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),n=e,o=0;o<r.length;o++){var a=r[o];if("*"===a&&i(n)){var c=r.slice(o+1).join("."),s=[],f=!0,p=!1,_=void 0;try{for(var y,v=n[Symbol.iterator]();!(f=(y=v.next()).done);f=!0){var d=D(y.value,c,t);s.push(d)}}catch(e){p=!0,_=e}finally{try{f||null==v.return||v.return()}finally{if(p)throw _}}return s}if(void 0===(n=l(n)||i(n)?n[a]:void 0))break}return u(n)?n:t}function N(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!u(e)||i(e)&&e.every(N)||l(e)&&Object.values(e).every(N)}A({},{getStore:function(){return o},getStoreValue:function(){return a}});var C=function(){function e(t,r){var n;return _class_call_check(this,e),(n=_call_super(this,e,[t,r])).name="FatalError",Object.setPrototypeOf(n,e.prototype),n}return _inherits(e,_wrap_native_super(Error)),e}();function M(e,t,r){return _async_to_generator(function(){return _ts_generator(this,function(n){return[2,(i(t)?t:[t]).reduce(function(t,n){return _async_to_generator(function(){var o,a,c,l,y,v,d,b,h,g,w,m,O,j,P,S,E,k,R,x,A,I,T,N,B;return _ts_generator(this,function(W){switch(W.label){case 0:return[4,t];case 1:return(o=W.sent())?[2,o]:(a=s(n)?{key:n}:n,Object.keys(a).length?(c=a.condition,l=a.consent,y=a.fn,v=a.key,d=a.loop,b=a.map,h=a.set,g=a.validate,w=a.value,m=_object_spread_props(_object_spread({},r),{mapping:n}),(O=c)?[4,p(c,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping condition failed",{event:m.event,error:e}),!1})(e,m)]:[3,3]):[2]);case 2:O=!W.sent(),W.label=3;case 3:return O?[2]:l&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=!e||0===Object.keys(e).length;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r}(l,m.consent)?[2,w]:(j=u(w)?w:e,d?(P=_sliced_to_array(d,2),S=P[0],E=P[1],"this"!==S?[3,4]:(R=[e],[3,6])):[3,10]);case 4:return[4,_(e,S,m)];case 5:R=W.sent(),W.label=6;case 6:return i(k=R)?[4,Promise.all(k.map(function(e){return u(e)?_(e,E,m):void 0}))]:[3,8];case 7:return x=W.sent().filter(u),[3,9];case 8:x=void 0,W.label=9;case 9:return j=x,[3,21];case 10:return b?[4,Object.entries(b).reduce(function(t,r){var n=_sliced_to_array(r,2),o=n[0],a=n[1];return _async_to_generator(function(){var r,n;return _ts_generator(this,function(i){switch(i.label){case 0:return[4,t];case 1:return r=i.sent(),[4,_(e,a,m)];case 2:return n=i.sent(),[2,(u(n)&&(r[o]=n),r)]}})})()},Promise.resolve({}))]:[3,12];case 11:return j=W.sent(),[3,20];case 12:return h?[4,Promise.all(h.map(function(t){return M(e,t,m)}))]:[3,14];case 13:return A=j=W.sent(),[3,19];case 14:return v?(I=j=D(e,v,w),[3,18]):[3,15];case 15:return(T=y)?[4,p(y,function(e){if(_instanceof(e,C))throw e;m.logger.error("mapping fn failed",{event:m.event,error:e})})(e,m)]:[3,17];case 16:T=j=W.sent(),W.label=17;case 17:I=T,W.label=18;case 18:A=I,W.label=19;case 19:W.label=20;case 20:W.label=21;case 21:return(N=g)?[4,p(g,function(e){if(_instanceof(e,C))throw e;return m.logger.error("mapping validate failed",{event:m.event,error:e}),!1})(j,m)]:[3,23];case 22:N=!W.sent(),W.label=23;case 23:return N&&(j=void 0),B=f(j),[2,u(B)?B:f(w)]}})})()},Promise.resolve(void 0))]})})()}var B,W="observe",q="call:",G=["name","length","prototype","arguments","caller"],K={},U={type:"heap",config:{},init:function(e){var t,r,n,o=e.config,a=e.env,i=o.settings;if(!(null==i?void 0:i.appId))return!1;if(null==a||null===(n=a.window)||void 0===n?void 0:n.heap)return o;var u=m(a),c=u.window,l=u.document,s=_object_spread({disableTextCapture:null===(t=i.disableTextCapture)||void 0===t||t,disablePageviewAutocapture:null===(r=i.disablePageviewAutocapture)||void 0===r||r},void 0!==i.disableSessionReplay&&{disableSessionReplay:i.disableSessionReplay},void 0!==i.secureCookie&&{secureCookie:i.secureCookie},void 0!==i.ingestServer&&{ingestServer:i.ingestServer},i.heapConfig);if(!c.heap){var f={load:function(e,t){f.appid=e,f.config=null!=t?t:{}},track:function(){},identify:function(){},resetIdentity:function(){},addUserProperties:function(){},addEventProperties:function(){},clearEventProperties:function(){},startTracking:function(){},stopTracking:function(){},q:[]},p=!0,_=!1,y=void 0;try{for(var v,d=function(){var e=v.value;f[e]=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];f.q=f.q||[],f.q.push([e].concat(_to_consumable_array(r)))}},b=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","track","startTracking","stopTracking"][Symbol.iterator]();!(p=(v=b.next()).done);p=!0)d()}catch(e){_=!0,y=e}finally{try{p||null==b.return||b.return()}finally{if(_)throw y}}c.heap=f}o.loadScript&&function(e,t){var r=t.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-".concat(e,".js");var n=t.getElementsByTagName("script")[0];n&&n.parentNode?n.parentNode.insertBefore(r,n):t.head.appendChild(r)}(i.appId,l);var h=c.heap;return h.appid||h.load(i.appId,s),o},push:function(e,t){return _async_to_generator(function(e,t){var r,n,o,a,i,u,c,f,p,_,v,d,b,h,g,w,m,P,S;return _ts_generator(this,function(E){switch(E.label){case 0:return r=t.config,n=t.data,o=t.env,a=t.rule,i=t.collector,(f=O(o))?(p=r.settings||{},void 0===(_=(null==a?void 0:a.settings)||{}).reset?[3,4]:"boolean"!=typeof _.reset?[3,1]:(v=_.reset,[3,3])):[2];case 1:return[4,y(e,_.reset,{collector:i})];case 2:v=E.sent(),E.label=3;case 3:v&&f.resetIdentity(),E.label=4;case 4:return void 0===(d=null!==(u=_.identify)&&void 0!==u?u:p.identify)?[3,6]:[4,y(e,d,{collector:i})];case 5:b=E.sent(),s(b)&&b.length>0&&f.identify(b),E.label=6;case 6:return void 0===(h=null!==(c=_.userProperties)&&void 0!==c?c:p.userProperties)?[3,8]:[4,y(e,h,{collector:i})];case 7:g=E.sent(),l(g)&&f.addUserProperties(j(g)),E.label=8;case 8:return void 0===_.eventProperties?[3,10]:[4,y(e,_.eventProperties,{collector:i})];case 9:w=E.sent(),l(w)&&f.addEventProperties(j(w)),E.label=10;case 10:return void 0===_.clearEventProperties?[3,14]:"boolean"!=typeof _.clearEventProperties?[3,11]:(m=_.clearEventProperties,[3,13]);case 11:return[4,y(e,_.clearEventProperties,{collector:i})];case 12:m=E.sent(),E.label=13;case 13:m&&f.clearEventProperties(),E.label=14;case 14:return!0!==(null==a?void 0:a.silent)&&(P=s(null==a?void 0:a.name)?a.name:e.name,S=j(n),f.track(P,S)),[2]}})}).apply(this,arguments)},on:function(e,t){var r;if("consent"===e&&t.data){var n=O(t.env);if(n){var o=null===(r=t.config)||void 0===r?void 0:r.consent;if(o&&0!==Object.keys(o).length){var a=t.data;Object.keys(o).every(function(e){return!0===a[e]})?n.startTracking():n.stopTracking()}}}}},F=U;return B=R,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var u,c=function(){var o=u.value;k.call(e,o)||o===r||P(e,o,{get:function(){return t[o]},enumerable:!(n=S(t,o))||n.enumerable})},l=E(t)[Symbol.iterator]();!(o=(u=l.next()).done);o=!0)c()}catch(e){a=!0,i=e}finally{try{o||null==l.return||l.return()}finally{if(a)throw i}}}return e}(P({},"__esModule",{value:!0}),B)}();
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/web-destination-heap",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.8.0-next-1791496487198",
|
|
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": "
|
|
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": "
|
|
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": "
|
|
232
|
+
"id": "744bf0a5440eb1a0",
|
|
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": "
|
|
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": "
|
|
294
|
+
"id": "cccd8566f476baa3",
|
|
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": "
|
|
402
|
+
"id": "285ab600acedd35b",
|
|
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": "
|
|
518
|
+
"id": "c6d8a73fc4bd4b61",
|
|
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": "
|
|
592
|
+
"id": "9268744ff9bb09c0",
|
|
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": "
|
|
662
|
+
"id": "25b14fd8b2a43f69",
|
|
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": "
|
|
744
|
+
"id": "b92ccd862ae5eb62",
|
|
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.
|
|
4
|
+
"version": "4.8.0-next-1791496487198",
|
|
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.
|
|
42
|
-
"@walkeros/web-core": "4.
|
|
41
|
+
"@walkeros/core": "4.8.0-next-1791496487198",
|
|
42
|
+
"@walkeros/web-core": "4.8.0-next-1791496487198"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@walkeros/collector": "4.
|
|
45
|
+
"@walkeros/collector": "4.8.0-next-1791496487198"
|
|
46
46
|
},
|
|
47
47
|
"repository": {
|
|
48
48
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|