@walkeros/web-destination-optimizely 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,152 @@
1
+ import { Mapping, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /**
5
+ * Destination-level settings.
6
+ */
7
+ interface Settings {
8
+ /** Optimizely Feature Experimentation SDK key. Required. */
9
+ sdkKey: string;
10
+ /** walkerOS mapping value to resolve userId for experiment bucketing. */
11
+ userId?: Mapping.Value;
12
+ /** User attributes for audience targeting, applied to every event. */
13
+ attributes?: Mapping.Value;
14
+ /** Polling interval for datafile updates in ms. Default: 60000. */
15
+ updateInterval?: number;
16
+ /** Auto-update datafile via polling. Default: true. */
17
+ autoUpdate?: boolean;
18
+ /** Batch event processor: events per batch. Default: 10. */
19
+ batchSize?: number;
20
+ /** Batch event processor: flush interval in ms. Default: 1000. */
21
+ flushInterval?: number;
22
+ /** Skip ODP manager initialization. Default: true. */
23
+ skipOdp?: boolean;
24
+ /** Runtime state -- not user-facing. Mutated by init/push. */
25
+ _state?: RuntimeState;
26
+ }
27
+ interface RuntimeState {
28
+ /** The Optimizely client instance (typed as OptimizelyClient). */
29
+ client?: OptimizelyClient;
30
+ /** Cached user context. Recreated when userId changes. */
31
+ userContext?: OptimizelyUserContext;
32
+ /** Last resolved userId to detect identity changes. */
33
+ lastUserId?: string;
34
+ }
35
+ /**
36
+ * OptimizelyClient -- the subset of the Optimizely SDK client the destination
37
+ * actually uses. Tests provide a mock via env.optimizely.
38
+ */
39
+ interface OptimizelyClient {
40
+ onReady: () => Promise<{
41
+ success: boolean;
42
+ }>;
43
+ createUserContext: (userId: string, attributes?: Record<string, unknown>) => OptimizelyUserContext | null;
44
+ close: () => void;
45
+ }
46
+ /**
47
+ * OptimizelyUserContext -- user context methods the destination calls.
48
+ */
49
+ interface OptimizelyUserContext {
50
+ trackEvent: (eventKey: string, eventTags?: Record<string, unknown>) => void;
51
+ setAttribute: (key: string, value: unknown) => void;
52
+ }
53
+ /**
54
+ * OptimizelySDK -- factory functions the destination imports from the SDK.
55
+ * Tests provide this via env.optimizely to avoid importing the real SDK.
56
+ */
57
+ interface OptimizelySDK {
58
+ createInstance: (config: Record<string, unknown>) => OptimizelyClient;
59
+ createPollingProjectConfigManager: (config: Record<string, unknown>) => unknown;
60
+ createBatchEventProcessor: (config: Record<string, unknown>) => unknown;
61
+ }
62
+ /**
63
+ * Env -- optional SDK override. Production leaves env.optimizely undefined
64
+ * and the destination falls back to the real @optimizely/optimizely-sdk
65
+ * import. Tests provide a mock via env.optimizely.
66
+ */
67
+ interface Env extends DestinationWeb.Env {
68
+ optimizely?: OptimizelySDK;
69
+ }
70
+
71
+ /**
72
+ * Pre-init env -- all methods are no-ops until the test runner wires spies.
73
+ */
74
+ declare const init: Env | undefined;
75
+ /**
76
+ * Post-init env -- same shape. The test runner clones this and replaces
77
+ * individual methods with jest.fn() so it can assert on calls.
78
+ */
79
+ declare const push: Env;
80
+ /** Simulation tracking paths for CLI --simulate. */
81
+ declare const simulation: string[];
82
+
83
+ declare const env_init: typeof init;
84
+ declare const env_push: typeof push;
85
+ declare const env_simulation: typeof simulation;
86
+ declare namespace env {
87
+ export { env_init as init, env_push as push, env_simulation as simulation };
88
+ }
89
+
90
+ /**
91
+ * Extended step example that may carry destination-level settings overrides.
92
+ */
93
+ type OptimizelyStepExample = Flow.StepExample & {
94
+ settings?: Partial<Settings>;
95
+ };
96
+ /**
97
+ * Default event forwarding -- every walkerOS event becomes
98
+ * userContext.trackEvent(event.name). No mapping, no eventTags.
99
+ */
100
+ declare const defaultEventForwarding: OptimizelyStepExample;
101
+ /**
102
+ * Mapped event name -- mapping.name renames the event key for Optimizely.
103
+ * The eventKey must match an event created in the Optimizely project.
104
+ */
105
+ declare const mappedEventName: OptimizelyStepExample;
106
+ /**
107
+ * Revenue tracking -- mapping.settings.revenue resolves to an integer
108
+ * (cents). Passed as eventTags.revenue. The value is a pass-through;
109
+ * the user must provide cents (e.g. 55500 = $555.00).
110
+ */
111
+ declare const orderCompleteRevenue: OptimizelyStepExample;
112
+ /**
113
+ * Per-event attributes -- mapping.settings.attributes resolves to
114
+ * key-value pairs that are applied via setAttribute() before trackEvent().
115
+ */
116
+ declare const signupWithAttributes: OptimizelyStepExample;
117
+ /**
118
+ * Wildcard ignore -- walkerOS's standard way to drop events. The rule
119
+ * matches but does nothing. The destination fires zero SDK calls.
120
+ */
121
+ declare const wildcardIgnored: OptimizelyStepExample;
122
+ /**
123
+ * Skip track with attributes only -- fires setAttribute calls but no
124
+ * trackEvent. Useful for enriching user context without a conversion.
125
+ */
126
+ declare const attributesOnlySkipTrack: OptimizelyStepExample;
127
+ /**
128
+ * Consent revoked -- the destination closes the Optimizely client,
129
+ * flushing queued events and stopping datafile polling.
130
+ */
131
+ declare const consentRevoked: OptimizelyStepExample;
132
+ /**
133
+ * Consent granted -- no immediate SDK action needed. The destination
134
+ * re-initializes on the next push (walkerOS queues events until consent
135
+ * is granted, then re-inits). No calls expected.
136
+ */
137
+ declare const consentGranted: OptimizelyStepExample;
138
+
139
+ type step_OptimizelyStepExample = OptimizelyStepExample;
140
+ declare const step_attributesOnlySkipTrack: typeof attributesOnlySkipTrack;
141
+ declare const step_consentGranted: typeof consentGranted;
142
+ declare const step_consentRevoked: typeof consentRevoked;
143
+ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
144
+ declare const step_mappedEventName: typeof mappedEventName;
145
+ declare const step_orderCompleteRevenue: typeof orderCompleteRevenue;
146
+ declare const step_signupWithAttributes: typeof signupWithAttributes;
147
+ declare const step_wildcardIgnored: typeof wildcardIgnored;
148
+ declare namespace step {
149
+ export { type step_OptimizelyStepExample as OptimizelyStepExample, step_attributesOnlySkipTrack as attributesOnlySkipTrack, step_consentGranted as consentGranted, step_consentRevoked as consentRevoked, step_defaultEventForwarding as defaultEventForwarding, step_mappedEventName as mappedEventName, step_orderCompleteRevenue as orderCompleteRevenue, step_signupWithAttributes as signupWithAttributes, step_wildcardIgnored as wildcardIgnored };
150
+ }
151
+
152
+ export { env, step };
@@ -0,0 +1,152 @@
1
+ import { Mapping, Flow } from '@walkeros/core';
2
+ import { DestinationWeb } from '@walkeros/web-core';
3
+
4
+ /**
5
+ * Destination-level settings.
6
+ */
7
+ interface Settings {
8
+ /** Optimizely Feature Experimentation SDK key. Required. */
9
+ sdkKey: string;
10
+ /** walkerOS mapping value to resolve userId for experiment bucketing. */
11
+ userId?: Mapping.Value;
12
+ /** User attributes for audience targeting, applied to every event. */
13
+ attributes?: Mapping.Value;
14
+ /** Polling interval for datafile updates in ms. Default: 60000. */
15
+ updateInterval?: number;
16
+ /** Auto-update datafile via polling. Default: true. */
17
+ autoUpdate?: boolean;
18
+ /** Batch event processor: events per batch. Default: 10. */
19
+ batchSize?: number;
20
+ /** Batch event processor: flush interval in ms. Default: 1000. */
21
+ flushInterval?: number;
22
+ /** Skip ODP manager initialization. Default: true. */
23
+ skipOdp?: boolean;
24
+ /** Runtime state -- not user-facing. Mutated by init/push. */
25
+ _state?: RuntimeState;
26
+ }
27
+ interface RuntimeState {
28
+ /** The Optimizely client instance (typed as OptimizelyClient). */
29
+ client?: OptimizelyClient;
30
+ /** Cached user context. Recreated when userId changes. */
31
+ userContext?: OptimizelyUserContext;
32
+ /** Last resolved userId to detect identity changes. */
33
+ lastUserId?: string;
34
+ }
35
+ /**
36
+ * OptimizelyClient -- the subset of the Optimizely SDK client the destination
37
+ * actually uses. Tests provide a mock via env.optimizely.
38
+ */
39
+ interface OptimizelyClient {
40
+ onReady: () => Promise<{
41
+ success: boolean;
42
+ }>;
43
+ createUserContext: (userId: string, attributes?: Record<string, unknown>) => OptimizelyUserContext | null;
44
+ close: () => void;
45
+ }
46
+ /**
47
+ * OptimizelyUserContext -- user context methods the destination calls.
48
+ */
49
+ interface OptimizelyUserContext {
50
+ trackEvent: (eventKey: string, eventTags?: Record<string, unknown>) => void;
51
+ setAttribute: (key: string, value: unknown) => void;
52
+ }
53
+ /**
54
+ * OptimizelySDK -- factory functions the destination imports from the SDK.
55
+ * Tests provide this via env.optimizely to avoid importing the real SDK.
56
+ */
57
+ interface OptimizelySDK {
58
+ createInstance: (config: Record<string, unknown>) => OptimizelyClient;
59
+ createPollingProjectConfigManager: (config: Record<string, unknown>) => unknown;
60
+ createBatchEventProcessor: (config: Record<string, unknown>) => unknown;
61
+ }
62
+ /**
63
+ * Env -- optional SDK override. Production leaves env.optimizely undefined
64
+ * and the destination falls back to the real @optimizely/optimizely-sdk
65
+ * import. Tests provide a mock via env.optimizely.
66
+ */
67
+ interface Env extends DestinationWeb.Env {
68
+ optimizely?: OptimizelySDK;
69
+ }
70
+
71
+ /**
72
+ * Pre-init env -- all methods are no-ops until the test runner wires spies.
73
+ */
74
+ declare const init: Env | undefined;
75
+ /**
76
+ * Post-init env -- same shape. The test runner clones this and replaces
77
+ * individual methods with jest.fn() so it can assert on calls.
78
+ */
79
+ declare const push: Env;
80
+ /** Simulation tracking paths for CLI --simulate. */
81
+ declare const simulation: string[];
82
+
83
+ declare const env_init: typeof init;
84
+ declare const env_push: typeof push;
85
+ declare const env_simulation: typeof simulation;
86
+ declare namespace env {
87
+ export { env_init as init, env_push as push, env_simulation as simulation };
88
+ }
89
+
90
+ /**
91
+ * Extended step example that may carry destination-level settings overrides.
92
+ */
93
+ type OptimizelyStepExample = Flow.StepExample & {
94
+ settings?: Partial<Settings>;
95
+ };
96
+ /**
97
+ * Default event forwarding -- every walkerOS event becomes
98
+ * userContext.trackEvent(event.name). No mapping, no eventTags.
99
+ */
100
+ declare const defaultEventForwarding: OptimizelyStepExample;
101
+ /**
102
+ * Mapped event name -- mapping.name renames the event key for Optimizely.
103
+ * The eventKey must match an event created in the Optimizely project.
104
+ */
105
+ declare const mappedEventName: OptimizelyStepExample;
106
+ /**
107
+ * Revenue tracking -- mapping.settings.revenue resolves to an integer
108
+ * (cents). Passed as eventTags.revenue. The value is a pass-through;
109
+ * the user must provide cents (e.g. 55500 = $555.00).
110
+ */
111
+ declare const orderCompleteRevenue: OptimizelyStepExample;
112
+ /**
113
+ * Per-event attributes -- mapping.settings.attributes resolves to
114
+ * key-value pairs that are applied via setAttribute() before trackEvent().
115
+ */
116
+ declare const signupWithAttributes: OptimizelyStepExample;
117
+ /**
118
+ * Wildcard ignore -- walkerOS's standard way to drop events. The rule
119
+ * matches but does nothing. The destination fires zero SDK calls.
120
+ */
121
+ declare const wildcardIgnored: OptimizelyStepExample;
122
+ /**
123
+ * Skip track with attributes only -- fires setAttribute calls but no
124
+ * trackEvent. Useful for enriching user context without a conversion.
125
+ */
126
+ declare const attributesOnlySkipTrack: OptimizelyStepExample;
127
+ /**
128
+ * Consent revoked -- the destination closes the Optimizely client,
129
+ * flushing queued events and stopping datafile polling.
130
+ */
131
+ declare const consentRevoked: OptimizelyStepExample;
132
+ /**
133
+ * Consent granted -- no immediate SDK action needed. The destination
134
+ * re-initializes on the next push (walkerOS queues events until consent
135
+ * is granted, then re-inits). No calls expected.
136
+ */
137
+ declare const consentGranted: OptimizelyStepExample;
138
+
139
+ type step_OptimizelyStepExample = OptimizelyStepExample;
140
+ declare const step_attributesOnlySkipTrack: typeof attributesOnlySkipTrack;
141
+ declare const step_consentGranted: typeof consentGranted;
142
+ declare const step_consentRevoked: typeof consentRevoked;
143
+ declare const step_defaultEventForwarding: typeof defaultEventForwarding;
144
+ declare const step_mappedEventName: typeof mappedEventName;
145
+ declare const step_orderCompleteRevenue: typeof orderCompleteRevenue;
146
+ declare const step_signupWithAttributes: typeof signupWithAttributes;
147
+ declare const step_wildcardIgnored: typeof wildcardIgnored;
148
+ declare namespace step {
149
+ export { type step_OptimizelyStepExample as OptimizelyStepExample, step_attributesOnlySkipTrack as attributesOnlySkipTrack, step_consentGranted as consentGranted, step_consentRevoked as consentRevoked, step_defaultEventForwarding as defaultEventForwarding, step_mappedEventName as mappedEventName, step_orderCompleteRevenue as orderCompleteRevenue, step_signupWithAttributes as signupWithAttributes, step_wildcardIgnored as wildcardIgnored };
150
+ }
151
+
152
+ export { env, step };
@@ -0,0 +1,228 @@
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 createMockUserContext() {
38
+ return {
39
+ trackEvent: noop,
40
+ setAttribute: noop
41
+ };
42
+ }
43
+ function createMockClient() {
44
+ return {
45
+ onReady: (() => Promise.resolve({ success: true })),
46
+ createUserContext: (() => createMockUserContext()),
47
+ close: noop
48
+ };
49
+ }
50
+ function createMockSDK() {
51
+ return {
52
+ createInstance: (() => createMockClient()),
53
+ createPollingProjectConfigManager: (() => ({})),
54
+ createBatchEventProcessor: (() => ({}))
55
+ };
56
+ }
57
+ var init = {
58
+ optimizely: createMockSDK()
59
+ };
60
+ var push = {
61
+ optimizely: createMockSDK()
62
+ };
63
+ var simulation = [
64
+ "call:optimizely.createInstance",
65
+ "call:optimizely.client.onReady",
66
+ "call:optimizely.client.createUserContext",
67
+ "call:optimizely.userContext.trackEvent",
68
+ "call:optimizely.userContext.setAttribute",
69
+ "call:optimizely.client.close"
70
+ ];
71
+
72
+ // src/examples/step.ts
73
+ var step_exports = {};
74
+ __export(step_exports, {
75
+ attributesOnlySkipTrack: () => attributesOnlySkipTrack,
76
+ consentGranted: () => consentGranted,
77
+ consentRevoked: () => consentRevoked,
78
+ defaultEventForwarding: () => defaultEventForwarding,
79
+ mappedEventName: () => mappedEventName,
80
+ orderCompleteRevenue: () => orderCompleteRevenue,
81
+ signupWithAttributes: () => signupWithAttributes,
82
+ wildcardIgnored: () => wildcardIgnored
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("page view", { timestamp: 1700000100 }),
118
+ out: [["optimizely.trackEvent", "page view", {}]]
119
+ };
120
+ var mappedEventName = {
121
+ in: le("product view", { timestamp: 1700000101 }),
122
+ mapping: {
123
+ name: "product_viewed"
124
+ },
125
+ out: [["optimizely.trackEvent", "product_viewed", {}]]
126
+ };
127
+ var orderCompleteRevenue = {
128
+ in: le("order complete", {
129
+ timestamp: 1700000102,
130
+ data: {
131
+ revenue_cents: 55500,
132
+ total: 555,
133
+ currency: "EUR",
134
+ item_count: 3
135
+ }
136
+ }),
137
+ mapping: {
138
+ name: "purchase",
139
+ settings: {
140
+ revenue: "data.revenue_cents",
141
+ value: "data.total",
142
+ eventTags: {
143
+ map: {
144
+ currency: "data.currency",
145
+ item_count: "data.item_count"
146
+ }
147
+ }
148
+ }
149
+ },
150
+ out: [
151
+ [
152
+ "optimizely.trackEvent",
153
+ "purchase",
154
+ { revenue: 55500, value: 555, currency: "EUR", item_count: 3 }
155
+ ]
156
+ ]
157
+ };
158
+ var signupWithAttributes = {
159
+ in: le("user signup", {
160
+ timestamp: 1700000103,
161
+ data: {
162
+ method: "google",
163
+ source: "referral"
164
+ }
165
+ }),
166
+ mapping: {
167
+ name: "signup",
168
+ settings: {
169
+ attributes: {
170
+ map: {
171
+ signup_method: "data.method",
172
+ referral_source: "data.source"
173
+ }
174
+ }
175
+ }
176
+ },
177
+ out: [
178
+ ["optimizely.setAttribute", "signup_method", "google"],
179
+ ["optimizely.setAttribute", "referral_source", "referral"],
180
+ ["optimizely.trackEvent", "signup", {}]
181
+ ]
182
+ };
183
+ var wildcardIgnored = {
184
+ in: le("debug noise", { timestamp: 1700000104 }),
185
+ mapping: { ignore: true },
186
+ out: []
187
+ };
188
+ var attributesOnlySkipTrack = {
189
+ in: le("profile update", {
190
+ timestamp: 1700000105,
191
+ data: {
192
+ plan: "premium",
193
+ country: "DE"
194
+ }
195
+ }),
196
+ mapping: {
197
+ skip: true,
198
+ settings: {
199
+ attributes: {
200
+ map: {
201
+ plan: "data.plan",
202
+ country: "data.country"
203
+ }
204
+ }
205
+ }
206
+ },
207
+ out: [
208
+ ["optimizely.setAttribute", "plan", "premium"],
209
+ ["optimizely.setAttribute", "country", "DE"]
210
+ ]
211
+ };
212
+ var consentRevoked = {
213
+ command: "consent",
214
+ in: { analytics: false },
215
+ settings: {},
216
+ out: [["optimizely.close"]]
217
+ };
218
+ var consentGranted = {
219
+ command: "consent",
220
+ in: { analytics: true },
221
+ settings: {},
222
+ out: []
223
+ };
224
+ // Annotate the CommonJS export names for ESM import in node:
225
+ 0 && (module.exports = {
226
+ env,
227
+ step
228
+ });