@walkeros/web-destination-heap 3.4.0-next-1776749829492

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.
@@ -0,0 +1,166 @@
1
+ import { Mapping, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /** Property value types accepted by Heap SDK methods. */
5
+ type HeapPropertyValue = string | number | boolean;
6
+ /** Options accepted by heap.load() as the second argument. */
7
+ interface HeapConfig {
8
+ disableTextCapture?: boolean;
9
+ disablePageviewAutocapture?: boolean;
10
+ disableSessionReplay?: boolean;
11
+ secureCookie?: boolean;
12
+ compressCookies?: boolean;
13
+ clearEventPropertiesOnNewUser?: boolean;
14
+ ingestServer?: string;
15
+ trackingServer?: string;
16
+ eventPropertiesStorageMedium?: string;
17
+ metadataStorageMedium?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ /**
21
+ * Heap SDK surface — the subset of window.heap methods this destination uses.
22
+ * Mirrors the snippet-provided command queue so tests can mock each method.
23
+ */
24
+ interface HeapSDK {
25
+ load: (appId: string, config?: HeapConfig) => void;
26
+ track: (event: string, properties?: Record<string, HeapPropertyValue>) => void;
27
+ identify: (identity: string) => void;
28
+ resetIdentity: () => void;
29
+ addUserProperties: (properties: Record<string, HeapPropertyValue>) => void;
30
+ addEventProperties: (properties: Record<string, HeapPropertyValue>) => void;
31
+ clearEventProperties: () => void;
32
+ startTracking: () => void;
33
+ stopTracking: () => void;
34
+ appid?: string;
35
+ config?: HeapConfig;
36
+ q?: unknown[][];
37
+ }
38
+ /**
39
+ * Settings (destination-level).
40
+ *
41
+ * appId is required (Heap Project Settings → App ID).
42
+ * identify/userProperties resolve every push to keep identity sticky.
43
+ */
44
+ interface Settings {
45
+ /** Heap App ID (required). Find it in Project > Settings > App ID. */
46
+ appId: string;
47
+ /** Disable Heap auto text capture. Default: true. */
48
+ disableTextCapture?: boolean;
49
+ /** Disable Heap automatic pageview tracking. Default: true (walkerOS handles pageviews). */
50
+ disablePageviewAutocapture?: boolean;
51
+ /** Disable Heap session replay. */
52
+ disableSessionReplay?: boolean;
53
+ /** SSL-only cookies. */
54
+ secureCookie?: boolean;
55
+ /** Custom server endpoint (first-party proxy). */
56
+ ingestServer?: string;
57
+ /** Destination-level identity mapping. Resolves to a string for heap.identify(). */
58
+ identify?: Mapping.Value;
59
+ /** Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). */
60
+ userProperties?: Mapping.Value;
61
+ /** Additional heap.load() config passthrough. */
62
+ heapConfig?: HeapConfig;
63
+ }
64
+ /**
65
+ * Env — optional override for the Heap SDK. Production leaves this
66
+ * undefined and the destination creates the snippet's command queue on
67
+ * window.heap. Tests provide a mock via env.window.heap = { ... }.
68
+ */
69
+ interface Env extends DestinationWeb.Env {
70
+ window: {
71
+ heap: HeapSDK;
72
+ };
73
+ }
74
+ declare global {
75
+ interface Window {
76
+ heap?: HeapSDK;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Pre-init env — window.heap is a no-op queue until init wires it.
82
+ */
83
+ declare const init: Env | undefined;
84
+ /**
85
+ * Post-init env — window.heap methods are spy-able no-ops.
86
+ * Tests clone this and replace individual methods with jest.fn() for assertions.
87
+ */
88
+ declare const push: Env;
89
+ /** Simulation tracking paths for CLI --simulate. */
90
+ declare const simulation: string[];
91
+
92
+ declare const env_init: typeof init;
93
+ declare const env_push: typeof push;
94
+ declare const env_simulation: typeof simulation;
95
+ declare namespace env {
96
+ export { env_init as init, env_push as push, env_simulation as simulation };
97
+ }
98
+
99
+ /**
100
+ * Examples may optionally carry destination-level settings overrides.
101
+ * The test runner reads `settings` from the example and merges it on top
102
+ * of the fixed appId when registering the destination.
103
+ */
104
+ type HeapStepExample = Flow.StepExample & {
105
+ settings?: Partial<Settings>;
106
+ };
107
+ /**
108
+ * Default event forwarding — every walkerOS event becomes
109
+ * heap.track(event.name, properties). With no mapping, properties is `{}`.
110
+ */
111
+ declare const defaultEventForwarding: HeapStepExample;
112
+ /**
113
+ * Rename + map event properties via rule.data.map.
114
+ * data resolves to { order_id, total, currency } → heap.track('purchase', props).
115
+ */
116
+ declare const destinationLevelInclude: HeapStepExample;
117
+ /**
118
+ * Destination-level settings.identify — heap.identify() resolves user.id,
119
+ * then the default heap.track() call fires.
120
+ */
121
+ declare const destinationLevelIdentify: HeapStepExample;
122
+ /**
123
+ * Per-event login identify — heap.identify() from data.email + user
124
+ * properties from the same rule. skip: true suppresses the track() call.
125
+ */
126
+ declare const userLoginIdentify: HeapStepExample;
127
+ /**
128
+ * User logout — heap.resetIdentity(). skip: true suppresses the track() call.
129
+ */
130
+ declare const userLogoutReset: HeapStepExample;
131
+ /**
132
+ * Event with user properties from mapping — heap.addUserProperties() fires,
133
+ * then the default heap.track() call.
134
+ */
135
+ declare const eventWithUserProperties: HeapStepExample;
136
+ /**
137
+ * Global event properties — heap.addEventProperties() sets persistent
138
+ * properties on all subsequent events. skip: true on this rule.
139
+ */
140
+ declare const globalEventProperties: HeapStepExample;
141
+ /**
142
+ * Consent revoked — on('consent') handler calls heap.stopTracking()
143
+ * when a required consent key is false.
144
+ */
145
+ declare const consentRevokeStopTracking: HeapStepExample;
146
+ /**
147
+ * Consent granted — on('consent') handler calls heap.startTracking()
148
+ * when all required consent keys are true.
149
+ */
150
+ declare const consentGrantStartTracking: HeapStepExample;
151
+
152
+ type step_HeapStepExample = HeapStepExample;
153
+ declare const step_consentGrantStartTracking: typeof consentGrantStartTracking;
154
+ declare const step_consentRevokeStopTracking: typeof consentRevokeStopTracking;
155
+ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
156
+ declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
157
+ declare const step_destinationLevelInclude: typeof destinationLevelInclude;
158
+ declare const step_eventWithUserProperties: typeof eventWithUserProperties;
159
+ declare const step_globalEventProperties: typeof globalEventProperties;
160
+ declare const step_userLoginIdentify: typeof userLoginIdentify;
161
+ declare const step_userLogoutReset: typeof userLogoutReset;
162
+ declare namespace step {
163
+ export { type step_HeapStepExample as HeapStepExample, step_consentGrantStartTracking as consentGrantStartTracking, step_consentRevokeStopTracking as consentRevokeStopTracking, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_eventWithUserProperties as eventWithUserProperties, step_globalEventProperties as globalEventProperties, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset };
164
+ }
165
+
166
+ export { env, step };
@@ -0,0 +1,166 @@
1
+ import { Mapping, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /** Property value types accepted by Heap SDK methods. */
5
+ type HeapPropertyValue = string | number | boolean;
6
+ /** Options accepted by heap.load() as the second argument. */
7
+ interface HeapConfig {
8
+ disableTextCapture?: boolean;
9
+ disablePageviewAutocapture?: boolean;
10
+ disableSessionReplay?: boolean;
11
+ secureCookie?: boolean;
12
+ compressCookies?: boolean;
13
+ clearEventPropertiesOnNewUser?: boolean;
14
+ ingestServer?: string;
15
+ trackingServer?: string;
16
+ eventPropertiesStorageMedium?: string;
17
+ metadataStorageMedium?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ /**
21
+ * Heap SDK surface — the subset of window.heap methods this destination uses.
22
+ * Mirrors the snippet-provided command queue so tests can mock each method.
23
+ */
24
+ interface HeapSDK {
25
+ load: (appId: string, config?: HeapConfig) => void;
26
+ track: (event: string, properties?: Record<string, HeapPropertyValue>) => void;
27
+ identify: (identity: string) => void;
28
+ resetIdentity: () => void;
29
+ addUserProperties: (properties: Record<string, HeapPropertyValue>) => void;
30
+ addEventProperties: (properties: Record<string, HeapPropertyValue>) => void;
31
+ clearEventProperties: () => void;
32
+ startTracking: () => void;
33
+ stopTracking: () => void;
34
+ appid?: string;
35
+ config?: HeapConfig;
36
+ q?: unknown[][];
37
+ }
38
+ /**
39
+ * Settings (destination-level).
40
+ *
41
+ * appId is required (Heap Project Settings → App ID).
42
+ * identify/userProperties resolve every push to keep identity sticky.
43
+ */
44
+ interface Settings {
45
+ /** Heap App ID (required). Find it in Project > Settings > App ID. */
46
+ appId: string;
47
+ /** Disable Heap auto text capture. Default: true. */
48
+ disableTextCapture?: boolean;
49
+ /** Disable Heap automatic pageview tracking. Default: true (walkerOS handles pageviews). */
50
+ disablePageviewAutocapture?: boolean;
51
+ /** Disable Heap session replay. */
52
+ disableSessionReplay?: boolean;
53
+ /** SSL-only cookies. */
54
+ secureCookie?: boolean;
55
+ /** Custom server endpoint (first-party proxy). */
56
+ ingestServer?: string;
57
+ /** Destination-level identity mapping. Resolves to a string for heap.identify(). */
58
+ identify?: Mapping.Value;
59
+ /** Destination-level user properties mapping. Resolves to object for heap.addUserProperties(). */
60
+ userProperties?: Mapping.Value;
61
+ /** Additional heap.load() config passthrough. */
62
+ heapConfig?: HeapConfig;
63
+ }
64
+ /**
65
+ * Env — optional override for the Heap SDK. Production leaves this
66
+ * undefined and the destination creates the snippet's command queue on
67
+ * window.heap. Tests provide a mock via env.window.heap = { ... }.
68
+ */
69
+ interface Env extends DestinationWeb.Env {
70
+ window: {
71
+ heap: HeapSDK;
72
+ };
73
+ }
74
+ declare global {
75
+ interface Window {
76
+ heap?: HeapSDK;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Pre-init env — window.heap is a no-op queue until init wires it.
82
+ */
83
+ declare const init: Env | undefined;
84
+ /**
85
+ * Post-init env — window.heap methods are spy-able no-ops.
86
+ * Tests clone this and replace individual methods with jest.fn() for assertions.
87
+ */
88
+ declare const push: Env;
89
+ /** Simulation tracking paths for CLI --simulate. */
90
+ declare const simulation: string[];
91
+
92
+ declare const env_init: typeof init;
93
+ declare const env_push: typeof push;
94
+ declare const env_simulation: typeof simulation;
95
+ declare namespace env {
96
+ export { env_init as init, env_push as push, env_simulation as simulation };
97
+ }
98
+
99
+ /**
100
+ * Examples may optionally carry destination-level settings overrides.
101
+ * The test runner reads `settings` from the example and merges it on top
102
+ * of the fixed appId when registering the destination.
103
+ */
104
+ type HeapStepExample = Flow.StepExample & {
105
+ settings?: Partial<Settings>;
106
+ };
107
+ /**
108
+ * Default event forwarding — every walkerOS event becomes
109
+ * heap.track(event.name, properties). With no mapping, properties is `{}`.
110
+ */
111
+ declare const defaultEventForwarding: HeapStepExample;
112
+ /**
113
+ * Rename + map event properties via rule.data.map.
114
+ * data resolves to { order_id, total, currency } → heap.track('purchase', props).
115
+ */
116
+ declare const destinationLevelInclude: HeapStepExample;
117
+ /**
118
+ * Destination-level settings.identify — heap.identify() resolves user.id,
119
+ * then the default heap.track() call fires.
120
+ */
121
+ declare const destinationLevelIdentify: HeapStepExample;
122
+ /**
123
+ * Per-event login identify — heap.identify() from data.email + user
124
+ * properties from the same rule. skip: true suppresses the track() call.
125
+ */
126
+ declare const userLoginIdentify: HeapStepExample;
127
+ /**
128
+ * User logout — heap.resetIdentity(). skip: true suppresses the track() call.
129
+ */
130
+ declare const userLogoutReset: HeapStepExample;
131
+ /**
132
+ * Event with user properties from mapping — heap.addUserProperties() fires,
133
+ * then the default heap.track() call.
134
+ */
135
+ declare const eventWithUserProperties: HeapStepExample;
136
+ /**
137
+ * Global event properties — heap.addEventProperties() sets persistent
138
+ * properties on all subsequent events. skip: true on this rule.
139
+ */
140
+ declare const globalEventProperties: HeapStepExample;
141
+ /**
142
+ * Consent revoked — on('consent') handler calls heap.stopTracking()
143
+ * when a required consent key is false.
144
+ */
145
+ declare const consentRevokeStopTracking: HeapStepExample;
146
+ /**
147
+ * Consent granted — on('consent') handler calls heap.startTracking()
148
+ * when all required consent keys are true.
149
+ */
150
+ declare const consentGrantStartTracking: HeapStepExample;
151
+
152
+ type step_HeapStepExample = HeapStepExample;
153
+ declare const step_consentGrantStartTracking: typeof consentGrantStartTracking;
154
+ declare const step_consentRevokeStopTracking: typeof consentRevokeStopTracking;
155
+ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
156
+ declare const step_destinationLevelIdentify: typeof destinationLevelIdentify;
157
+ declare const step_destinationLevelInclude: typeof destinationLevelInclude;
158
+ declare const step_eventWithUserProperties: typeof eventWithUserProperties;
159
+ declare const step_globalEventProperties: typeof globalEventProperties;
160
+ declare const step_userLoginIdentify: typeof userLoginIdentify;
161
+ declare const step_userLogoutReset: typeof userLogoutReset;
162
+ declare namespace step {
163
+ export { type step_HeapStepExample as HeapStepExample, step_consentGrantStartTracking as consentGrantStartTracking, step_consentRevokeStopTracking as consentRevokeStopTracking, step_defaultEventForwarding as defaultEventForwarding, step_destinationLevelIdentify as destinationLevelIdentify, step_destinationLevelInclude as destinationLevelInclude, step_eventWithUserProperties as eventWithUserProperties, step_globalEventProperties as globalEventProperties, step_userLoginIdentify as userLoginIdentify, step_userLogoutReset as userLogoutReset };
164
+ }
165
+
166
+ export { env, step };
@@ -0,0 +1,244 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/examples/index.ts
21
+ var examples_exports = {};
22
+ __export(examples_exports, {
23
+ env: () => env_exports,
24
+ step: () => step_exports
25
+ });
26
+ module.exports = __toCommonJS(examples_exports);
27
+
28
+ // src/examples/env.ts
29
+ var env_exports = {};
30
+ __export(env_exports, {
31
+ init: () => init,
32
+ push: () => push,
33
+ simulation: () => simulation
34
+ });
35
+ var noop = (() => {
36
+ });
37
+ function createMockHeap() {
38
+ return {
39
+ load: noop,
40
+ track: noop,
41
+ identify: noop,
42
+ resetIdentity: noop,
43
+ addUserProperties: noop,
44
+ addEventProperties: noop,
45
+ clearEventProperties: noop,
46
+ startTracking: noop,
47
+ stopTracking: noop
48
+ };
49
+ }
50
+ var init = {
51
+ window: {
52
+ heap: createMockHeap()
53
+ }
54
+ };
55
+ var push = {
56
+ window: {
57
+ heap: createMockHeap()
58
+ }
59
+ };
60
+ var simulation = [
61
+ "call:window.heap.track",
62
+ "call:window.heap.identify",
63
+ "call:window.heap.resetIdentity",
64
+ "call:window.heap.addUserProperties",
65
+ "call:window.heap.addEventProperties",
66
+ "call:window.heap.clearEventProperties",
67
+ "call:window.heap.startTracking",
68
+ "call:window.heap.stopTracking"
69
+ ];
70
+
71
+ // src/examples/step.ts
72
+ var step_exports = {};
73
+ __export(step_exports, {
74
+ consentGrantStartTracking: () => consentGrantStartTracking,
75
+ consentRevokeStopTracking: () => consentRevokeStopTracking,
76
+ defaultEventForwarding: () => defaultEventForwarding,
77
+ destinationLevelIdentify: () => destinationLevelIdentify,
78
+ destinationLevelInclude: () => destinationLevelInclude,
79
+ eventWithUserProperties: () => eventWithUserProperties,
80
+ globalEventProperties: () => globalEventProperties,
81
+ userLoginIdentify: () => userLoginIdentify,
82
+ userLogoutReset: () => userLogoutReset
83
+ });
84
+
85
+ // ../../../core/dist/index.mjs
86
+ var e = Object.defineProperty;
87
+ var c = {};
88
+ ((t, n) => {
89
+ for (var o in n) e(t, o, { get: n[o], enumerable: true });
90
+ })(c, { Level: () => u });
91
+ var u = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(u || {});
92
+ var W = { merge: true, shallow: true, extend: true };
93
+ function L(e2, t = {}, n = {}) {
94
+ n = { ...W, ...n };
95
+ const o = Object.entries(t).reduce((t2, [o2, r]) => {
96
+ const i = e2[o2];
97
+ return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
98
+ }, {});
99
+ return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
100
+ }
101
+ function fe(e2 = {}) {
102
+ var _a;
103
+ const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", o = e2.count || 1, r = L({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${t}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: o, version: { source: "3.4.0-next-1776749829492", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
104
+ if (e2.name) {
105
+ const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
106
+ t2 && n2 && (r.entity = t2, r.action = n2);
107
+ }
108
+ return r;
109
+ }
110
+ function le(e2 = "entity action", t = {}) {
111
+ const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
112
+ return fe({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
113
+ }
114
+
115
+ // src/examples/step.ts
116
+ var defaultEventForwarding = {
117
+ in: le("product view", { timestamp: 1700000100 }),
118
+ out: [["heap.track", "product view", {}]]
119
+ };
120
+ var destinationLevelInclude = {
121
+ in: le("order complete", { timestamp: 1700000101 }),
122
+ mapping: {
123
+ name: "purchase",
124
+ data: {
125
+ map: {
126
+ order_id: "data.id",
127
+ total: "data.total",
128
+ currency: { key: "data.currency", value: "EUR" }
129
+ }
130
+ }
131
+ },
132
+ out: [
133
+ [
134
+ "heap.track",
135
+ "purchase",
136
+ { order_id: "0rd3r1d", total: 555, currency: "EUR" }
137
+ ]
138
+ ]
139
+ };
140
+ var destinationLevelIdentify = {
141
+ in: le("page view", { timestamp: 1700000102 }),
142
+ settings: {
143
+ identify: "user.id"
144
+ },
145
+ out: [
146
+ ["heap.identify", "us3r"],
147
+ ["heap.track", "page view", {}]
148
+ ]
149
+ };
150
+ var userLoginIdentify = {
151
+ in: le("user login", {
152
+ timestamp: 1700000103,
153
+ data: {
154
+ email: "user@example.com",
155
+ plan: "premium",
156
+ company: "Acme"
157
+ }
158
+ }),
159
+ mapping: {
160
+ skip: true,
161
+ settings: {
162
+ identify: "data.email",
163
+ userProperties: {
164
+ map: {
165
+ plan: "data.plan",
166
+ company: "data.company"
167
+ }
168
+ }
169
+ }
170
+ },
171
+ out: [
172
+ ["heap.identify", "user@example.com"],
173
+ ["heap.addUserProperties", { plan: "premium", company: "Acme" }]
174
+ ]
175
+ };
176
+ var userLogoutReset = {
177
+ in: le("user logout", { timestamp: 1700000104 }),
178
+ mapping: {
179
+ skip: true,
180
+ settings: {
181
+ reset: true
182
+ }
183
+ },
184
+ out: [["heap.resetIdentity"]]
185
+ };
186
+ var eventWithUserProperties = {
187
+ in: le("order complete", {
188
+ timestamp: 1700000105,
189
+ data: {
190
+ id: "0rd3r1d",
191
+ total: 555,
192
+ currency: "EUR"
193
+ }
194
+ }),
195
+ mapping: {
196
+ settings: {
197
+ userProperties: {
198
+ map: {
199
+ last_order_value: "data.total",
200
+ last_order_currency: "data.currency"
201
+ }
202
+ }
203
+ }
204
+ },
205
+ out: [
206
+ [
207
+ "heap.addUserProperties",
208
+ { last_order_value: 555, last_order_currency: "EUR" }
209
+ ],
210
+ ["heap.track", "order complete", {}]
211
+ ]
212
+ };
213
+ var globalEventProperties = {
214
+ in: le("page view", {
215
+ timestamp: 1700000106,
216
+ data: { category: "docs" }
217
+ }),
218
+ mapping: {
219
+ skip: true,
220
+ settings: {
221
+ eventProperties: {
222
+ map: {
223
+ page_category: "data.category"
224
+ }
225
+ }
226
+ }
227
+ },
228
+ out: [["heap.addEventProperties", { page_category: "docs" }]]
229
+ };
230
+ var consentRevokeStopTracking = {
231
+ command: "consent",
232
+ in: { analytics: false },
233
+ out: [["heap.stopTracking"]]
234
+ };
235
+ var consentGrantStartTracking = {
236
+ command: "consent",
237
+ in: { analytics: true },
238
+ out: [["heap.startTracking"]]
239
+ };
240
+ // Annotate the CommonJS export names for ESM import in node:
241
+ 0 && (module.exports = {
242
+ env,
243
+ step
244
+ });