@walkeros/web-source-datalayer 0.0.0-next-20251219153324
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/LICENSE +21 -0
- package/README.md +56 -0
- package/dist/dev.d.mts +36 -0
- package/dist/dev.d.ts +36 -0
- package/dist/dev.js +1 -0
- package/dist/dev.js.map +1 -0
- package/dist/dev.mjs +1 -0
- package/dist/dev.mjs.map +1 -0
- package/dist/examples/index.d.mts +101 -0
- package/dist/examples/index.d.ts +101 -0
- package/dist/examples/index.js +337 -0
- package/dist/examples/index.mjs +311 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +169 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.es5.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,337 @@
|
|
|
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
|
+
Events: () => events_exports,
|
|
24
|
+
Mapping: () => mapping_exports,
|
|
25
|
+
consentOnlyMapping: () => consentOnlyMapping,
|
|
26
|
+
consentUpdateEvent: () => consentUpdate,
|
|
27
|
+
dataLayerExamples: () => config2,
|
|
28
|
+
env: () => env_exports
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(examples_exports);
|
|
31
|
+
|
|
32
|
+
// src/examples/env.ts
|
|
33
|
+
var env_exports = {};
|
|
34
|
+
__export(env_exports, {
|
|
35
|
+
push: () => push
|
|
36
|
+
});
|
|
37
|
+
var noop = () => {
|
|
38
|
+
};
|
|
39
|
+
var createMockElbFn = () => {
|
|
40
|
+
const fn = (() => Promise.resolve({
|
|
41
|
+
ok: true,
|
|
42
|
+
successful: [],
|
|
43
|
+
queued: [],
|
|
44
|
+
failed: []
|
|
45
|
+
}));
|
|
46
|
+
return fn;
|
|
47
|
+
};
|
|
48
|
+
var noopLogger = {
|
|
49
|
+
error: noop,
|
|
50
|
+
info: noop,
|
|
51
|
+
debug: noop,
|
|
52
|
+
throw: (message) => {
|
|
53
|
+
throw typeof message === "string" ? new Error(message) : message;
|
|
54
|
+
},
|
|
55
|
+
scope: () => noopLogger
|
|
56
|
+
};
|
|
57
|
+
var createMockWindow = () => ({
|
|
58
|
+
dataLayer: [],
|
|
59
|
+
addEventListener: noop,
|
|
60
|
+
removeEventListener: noop
|
|
61
|
+
});
|
|
62
|
+
var push = {
|
|
63
|
+
get push() {
|
|
64
|
+
return createMockElbFn();
|
|
65
|
+
},
|
|
66
|
+
get command() {
|
|
67
|
+
return createMockElbFn();
|
|
68
|
+
},
|
|
69
|
+
get elb() {
|
|
70
|
+
return createMockElbFn();
|
|
71
|
+
},
|
|
72
|
+
get window() {
|
|
73
|
+
return createMockWindow();
|
|
74
|
+
},
|
|
75
|
+
logger: noopLogger
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/examples/events.ts
|
|
79
|
+
var events_exports = {};
|
|
80
|
+
__export(events_exports, {
|
|
81
|
+
add_to_cart: () => add_to_cart,
|
|
82
|
+
config: () => config,
|
|
83
|
+
consentDefault: () => consentDefault,
|
|
84
|
+
consentUpdate: () => consentUpdate,
|
|
85
|
+
directDataLayerEvent: () => directDataLayerEvent,
|
|
86
|
+
purchase: () => purchase,
|
|
87
|
+
setCustom: () => setCustom,
|
|
88
|
+
view_item: () => view_item
|
|
89
|
+
});
|
|
90
|
+
function consentUpdate() {
|
|
91
|
+
return [
|
|
92
|
+
"consent",
|
|
93
|
+
"update",
|
|
94
|
+
{
|
|
95
|
+
ad_user_data: "granted",
|
|
96
|
+
ad_personalization: "granted",
|
|
97
|
+
ad_storage: "denied",
|
|
98
|
+
analytics_storage: "granted"
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
function consentDefault() {
|
|
103
|
+
return [
|
|
104
|
+
"consent",
|
|
105
|
+
"default",
|
|
106
|
+
{
|
|
107
|
+
ad_storage: "denied",
|
|
108
|
+
analytics_storage: "denied",
|
|
109
|
+
ad_user_data: "denied",
|
|
110
|
+
ad_personalization: "denied"
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
function purchase() {
|
|
115
|
+
return [
|
|
116
|
+
"event",
|
|
117
|
+
"purchase",
|
|
118
|
+
{
|
|
119
|
+
transaction_id: "T_12345",
|
|
120
|
+
value: 25.42,
|
|
121
|
+
currency: "EUR",
|
|
122
|
+
items: [
|
|
123
|
+
{
|
|
124
|
+
item_id: "SKU_12345",
|
|
125
|
+
item_name: "Product Name",
|
|
126
|
+
item_category: "Category",
|
|
127
|
+
quantity: 1,
|
|
128
|
+
price: 25.42
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
function add_to_cart() {
|
|
135
|
+
return [
|
|
136
|
+
"event",
|
|
137
|
+
"add_to_cart",
|
|
138
|
+
{
|
|
139
|
+
currency: "EUR",
|
|
140
|
+
value: 15.25,
|
|
141
|
+
items: [
|
|
142
|
+
{
|
|
143
|
+
item_id: "SKU_12345",
|
|
144
|
+
item_name: "Product Name",
|
|
145
|
+
item_variant: "red",
|
|
146
|
+
quantity: 1,
|
|
147
|
+
price: 15.25
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
function view_item() {
|
|
154
|
+
return [
|
|
155
|
+
"event",
|
|
156
|
+
"view_item",
|
|
157
|
+
{
|
|
158
|
+
currency: "EUR",
|
|
159
|
+
value: 15.25,
|
|
160
|
+
items: [
|
|
161
|
+
{
|
|
162
|
+
item_id: "SKU_12345",
|
|
163
|
+
item_name: "Product Name",
|
|
164
|
+
item_category: "Category",
|
|
165
|
+
price: 15.25
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
function config() {
|
|
172
|
+
return [
|
|
173
|
+
"config",
|
|
174
|
+
"G-XXXXXXXXXX",
|
|
175
|
+
{
|
|
176
|
+
page_title: "Custom Page Title",
|
|
177
|
+
page_location: "https://example.com/page",
|
|
178
|
+
send_page_view: false
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
function setCustom() {
|
|
183
|
+
return [
|
|
184
|
+
"set",
|
|
185
|
+
{
|
|
186
|
+
currency: "EUR",
|
|
187
|
+
country: "DE"
|
|
188
|
+
}
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
function directDataLayerEvent() {
|
|
192
|
+
return {
|
|
193
|
+
event: "custom_event",
|
|
194
|
+
custom_parameter: "custom_value",
|
|
195
|
+
user_id: "user123"
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// src/examples/mapping.ts
|
|
200
|
+
var mapping_exports = {};
|
|
201
|
+
__export(mapping_exports, {
|
|
202
|
+
add_to_cart: () => add_to_cart2,
|
|
203
|
+
config: () => config2,
|
|
204
|
+
configGA4: () => configGA4,
|
|
205
|
+
consentOnlyMapping: () => consentOnlyMapping,
|
|
206
|
+
consentUpdate: () => consentUpdate2,
|
|
207
|
+
customEvent: () => customEvent,
|
|
208
|
+
purchase: () => purchase2,
|
|
209
|
+
view_item: () => view_item2
|
|
210
|
+
});
|
|
211
|
+
var consentUpdate2 = {
|
|
212
|
+
name: "walker consent",
|
|
213
|
+
settings: {
|
|
214
|
+
command: {
|
|
215
|
+
map: {
|
|
216
|
+
functional: { value: true },
|
|
217
|
+
// Static value - always true for functional
|
|
218
|
+
analytics: {
|
|
219
|
+
key: "analytics_storage",
|
|
220
|
+
fn: (value) => value === "granted"
|
|
221
|
+
},
|
|
222
|
+
marketing: {
|
|
223
|
+
key: "ad_storage",
|
|
224
|
+
fn: (value) => value === "granted"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var purchase2 = {
|
|
231
|
+
name: "order complete",
|
|
232
|
+
data: {
|
|
233
|
+
map: {
|
|
234
|
+
id: "transaction_id",
|
|
235
|
+
total: "value",
|
|
236
|
+
currency: "currency",
|
|
237
|
+
nested: {
|
|
238
|
+
loop: [
|
|
239
|
+
"items",
|
|
240
|
+
{
|
|
241
|
+
map: {
|
|
242
|
+
type: { value: "product" },
|
|
243
|
+
data: {
|
|
244
|
+
map: {
|
|
245
|
+
id: "item_id",
|
|
246
|
+
name: "item_name",
|
|
247
|
+
category: "item_category",
|
|
248
|
+
quantity: "quantity",
|
|
249
|
+
price: "price"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var add_to_cart2 = {
|
|
260
|
+
name: "product add",
|
|
261
|
+
data: {
|
|
262
|
+
map: {
|
|
263
|
+
id: "items.0.item_id",
|
|
264
|
+
name: "items.0.item_name",
|
|
265
|
+
price: "value",
|
|
266
|
+
currency: "currency",
|
|
267
|
+
color: "items.0.item_variant",
|
|
268
|
+
quantity: "items.0.quantity"
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
var view_item2 = {
|
|
273
|
+
name: "product view",
|
|
274
|
+
data: {
|
|
275
|
+
map: {
|
|
276
|
+
id: "items.0.item_id",
|
|
277
|
+
name: "items.0.item_name",
|
|
278
|
+
category: "items.0.item_category",
|
|
279
|
+
price: "items.0.price",
|
|
280
|
+
currency: "currency"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var configGA4 = {
|
|
285
|
+
name: "page view",
|
|
286
|
+
data: {
|
|
287
|
+
map: {
|
|
288
|
+
title: "page_title",
|
|
289
|
+
url: "page_location"
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
var customEvent = {
|
|
294
|
+
// Keep original event name with gtag prefix
|
|
295
|
+
data: {
|
|
296
|
+
map: {
|
|
297
|
+
// Map all properties as-is
|
|
298
|
+
user_id: "user_id",
|
|
299
|
+
custom_parameter: "custom_parameter"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
var config2 = {
|
|
304
|
+
// Consent events
|
|
305
|
+
consent: {
|
|
306
|
+
update: consentUpdate2
|
|
307
|
+
},
|
|
308
|
+
// E-commerce events
|
|
309
|
+
purchase: purchase2,
|
|
310
|
+
add_to_cart: add_to_cart2,
|
|
311
|
+
view_item: view_item2,
|
|
312
|
+
// Config events
|
|
313
|
+
"config G-XXXXXXXXXX": configGA4,
|
|
314
|
+
// Custom events
|
|
315
|
+
custom_event: customEvent,
|
|
316
|
+
// Catch-all for unmapped events
|
|
317
|
+
"*": {
|
|
318
|
+
// Pass through with gtag prefix
|
|
319
|
+
data: {
|
|
320
|
+
// Copy all data as-is
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
var consentOnlyMapping = {
|
|
325
|
+
consent: {
|
|
326
|
+
update: consentUpdate2
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
330
|
+
0 && (module.exports = {
|
|
331
|
+
Events,
|
|
332
|
+
Mapping,
|
|
333
|
+
consentOnlyMapping,
|
|
334
|
+
consentUpdateEvent,
|
|
335
|
+
dataLayerExamples,
|
|
336
|
+
env
|
|
337
|
+
});
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/examples/env.ts
|
|
8
|
+
var env_exports = {};
|
|
9
|
+
__export(env_exports, {
|
|
10
|
+
push: () => push
|
|
11
|
+
});
|
|
12
|
+
var noop = () => {
|
|
13
|
+
};
|
|
14
|
+
var createMockElbFn = () => {
|
|
15
|
+
const fn = (() => Promise.resolve({
|
|
16
|
+
ok: true,
|
|
17
|
+
successful: [],
|
|
18
|
+
queued: [],
|
|
19
|
+
failed: []
|
|
20
|
+
}));
|
|
21
|
+
return fn;
|
|
22
|
+
};
|
|
23
|
+
var noopLogger = {
|
|
24
|
+
error: noop,
|
|
25
|
+
info: noop,
|
|
26
|
+
debug: noop,
|
|
27
|
+
throw: (message) => {
|
|
28
|
+
throw typeof message === "string" ? new Error(message) : message;
|
|
29
|
+
},
|
|
30
|
+
scope: () => noopLogger
|
|
31
|
+
};
|
|
32
|
+
var createMockWindow = () => ({
|
|
33
|
+
dataLayer: [],
|
|
34
|
+
addEventListener: noop,
|
|
35
|
+
removeEventListener: noop
|
|
36
|
+
});
|
|
37
|
+
var push = {
|
|
38
|
+
get push() {
|
|
39
|
+
return createMockElbFn();
|
|
40
|
+
},
|
|
41
|
+
get command() {
|
|
42
|
+
return createMockElbFn();
|
|
43
|
+
},
|
|
44
|
+
get elb() {
|
|
45
|
+
return createMockElbFn();
|
|
46
|
+
},
|
|
47
|
+
get window() {
|
|
48
|
+
return createMockWindow();
|
|
49
|
+
},
|
|
50
|
+
logger: noopLogger
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/examples/events.ts
|
|
54
|
+
var events_exports = {};
|
|
55
|
+
__export(events_exports, {
|
|
56
|
+
add_to_cart: () => add_to_cart,
|
|
57
|
+
config: () => config,
|
|
58
|
+
consentDefault: () => consentDefault,
|
|
59
|
+
consentUpdate: () => consentUpdate,
|
|
60
|
+
directDataLayerEvent: () => directDataLayerEvent,
|
|
61
|
+
purchase: () => purchase,
|
|
62
|
+
setCustom: () => setCustom,
|
|
63
|
+
view_item: () => view_item
|
|
64
|
+
});
|
|
65
|
+
function consentUpdate() {
|
|
66
|
+
return [
|
|
67
|
+
"consent",
|
|
68
|
+
"update",
|
|
69
|
+
{
|
|
70
|
+
ad_user_data: "granted",
|
|
71
|
+
ad_personalization: "granted",
|
|
72
|
+
ad_storage: "denied",
|
|
73
|
+
analytics_storage: "granted"
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
function consentDefault() {
|
|
78
|
+
return [
|
|
79
|
+
"consent",
|
|
80
|
+
"default",
|
|
81
|
+
{
|
|
82
|
+
ad_storage: "denied",
|
|
83
|
+
analytics_storage: "denied",
|
|
84
|
+
ad_user_data: "denied",
|
|
85
|
+
ad_personalization: "denied"
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
function purchase() {
|
|
90
|
+
return [
|
|
91
|
+
"event",
|
|
92
|
+
"purchase",
|
|
93
|
+
{
|
|
94
|
+
transaction_id: "T_12345",
|
|
95
|
+
value: 25.42,
|
|
96
|
+
currency: "EUR",
|
|
97
|
+
items: [
|
|
98
|
+
{
|
|
99
|
+
item_id: "SKU_12345",
|
|
100
|
+
item_name: "Product Name",
|
|
101
|
+
item_category: "Category",
|
|
102
|
+
quantity: 1,
|
|
103
|
+
price: 25.42
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
function add_to_cart() {
|
|
110
|
+
return [
|
|
111
|
+
"event",
|
|
112
|
+
"add_to_cart",
|
|
113
|
+
{
|
|
114
|
+
currency: "EUR",
|
|
115
|
+
value: 15.25,
|
|
116
|
+
items: [
|
|
117
|
+
{
|
|
118
|
+
item_id: "SKU_12345",
|
|
119
|
+
item_name: "Product Name",
|
|
120
|
+
item_variant: "red",
|
|
121
|
+
quantity: 1,
|
|
122
|
+
price: 15.25
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
function view_item() {
|
|
129
|
+
return [
|
|
130
|
+
"event",
|
|
131
|
+
"view_item",
|
|
132
|
+
{
|
|
133
|
+
currency: "EUR",
|
|
134
|
+
value: 15.25,
|
|
135
|
+
items: [
|
|
136
|
+
{
|
|
137
|
+
item_id: "SKU_12345",
|
|
138
|
+
item_name: "Product Name",
|
|
139
|
+
item_category: "Category",
|
|
140
|
+
price: 15.25
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
function config() {
|
|
147
|
+
return [
|
|
148
|
+
"config",
|
|
149
|
+
"G-XXXXXXXXXX",
|
|
150
|
+
{
|
|
151
|
+
page_title: "Custom Page Title",
|
|
152
|
+
page_location: "https://example.com/page",
|
|
153
|
+
send_page_view: false
|
|
154
|
+
}
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
function setCustom() {
|
|
158
|
+
return [
|
|
159
|
+
"set",
|
|
160
|
+
{
|
|
161
|
+
currency: "EUR",
|
|
162
|
+
country: "DE"
|
|
163
|
+
}
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
function directDataLayerEvent() {
|
|
167
|
+
return {
|
|
168
|
+
event: "custom_event",
|
|
169
|
+
custom_parameter: "custom_value",
|
|
170
|
+
user_id: "user123"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// src/examples/mapping.ts
|
|
175
|
+
var mapping_exports = {};
|
|
176
|
+
__export(mapping_exports, {
|
|
177
|
+
add_to_cart: () => add_to_cart2,
|
|
178
|
+
config: () => config2,
|
|
179
|
+
configGA4: () => configGA4,
|
|
180
|
+
consentOnlyMapping: () => consentOnlyMapping,
|
|
181
|
+
consentUpdate: () => consentUpdate2,
|
|
182
|
+
customEvent: () => customEvent,
|
|
183
|
+
purchase: () => purchase2,
|
|
184
|
+
view_item: () => view_item2
|
|
185
|
+
});
|
|
186
|
+
var consentUpdate2 = {
|
|
187
|
+
name: "walker consent",
|
|
188
|
+
settings: {
|
|
189
|
+
command: {
|
|
190
|
+
map: {
|
|
191
|
+
functional: { value: true },
|
|
192
|
+
// Static value - always true for functional
|
|
193
|
+
analytics: {
|
|
194
|
+
key: "analytics_storage",
|
|
195
|
+
fn: (value) => value === "granted"
|
|
196
|
+
},
|
|
197
|
+
marketing: {
|
|
198
|
+
key: "ad_storage",
|
|
199
|
+
fn: (value) => value === "granted"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var purchase2 = {
|
|
206
|
+
name: "order complete",
|
|
207
|
+
data: {
|
|
208
|
+
map: {
|
|
209
|
+
id: "transaction_id",
|
|
210
|
+
total: "value",
|
|
211
|
+
currency: "currency",
|
|
212
|
+
nested: {
|
|
213
|
+
loop: [
|
|
214
|
+
"items",
|
|
215
|
+
{
|
|
216
|
+
map: {
|
|
217
|
+
type: { value: "product" },
|
|
218
|
+
data: {
|
|
219
|
+
map: {
|
|
220
|
+
id: "item_id",
|
|
221
|
+
name: "item_name",
|
|
222
|
+
category: "item_category",
|
|
223
|
+
quantity: "quantity",
|
|
224
|
+
price: "price"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
var add_to_cart2 = {
|
|
235
|
+
name: "product add",
|
|
236
|
+
data: {
|
|
237
|
+
map: {
|
|
238
|
+
id: "items.0.item_id",
|
|
239
|
+
name: "items.0.item_name",
|
|
240
|
+
price: "value",
|
|
241
|
+
currency: "currency",
|
|
242
|
+
color: "items.0.item_variant",
|
|
243
|
+
quantity: "items.0.quantity"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
var view_item2 = {
|
|
248
|
+
name: "product view",
|
|
249
|
+
data: {
|
|
250
|
+
map: {
|
|
251
|
+
id: "items.0.item_id",
|
|
252
|
+
name: "items.0.item_name",
|
|
253
|
+
category: "items.0.item_category",
|
|
254
|
+
price: "items.0.price",
|
|
255
|
+
currency: "currency"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var configGA4 = {
|
|
260
|
+
name: "page view",
|
|
261
|
+
data: {
|
|
262
|
+
map: {
|
|
263
|
+
title: "page_title",
|
|
264
|
+
url: "page_location"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
var customEvent = {
|
|
269
|
+
// Keep original event name with gtag prefix
|
|
270
|
+
data: {
|
|
271
|
+
map: {
|
|
272
|
+
// Map all properties as-is
|
|
273
|
+
user_id: "user_id",
|
|
274
|
+
custom_parameter: "custom_parameter"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
var config2 = {
|
|
279
|
+
// Consent events
|
|
280
|
+
consent: {
|
|
281
|
+
update: consentUpdate2
|
|
282
|
+
},
|
|
283
|
+
// E-commerce events
|
|
284
|
+
purchase: purchase2,
|
|
285
|
+
add_to_cart: add_to_cart2,
|
|
286
|
+
view_item: view_item2,
|
|
287
|
+
// Config events
|
|
288
|
+
"config G-XXXXXXXXXX": configGA4,
|
|
289
|
+
// Custom events
|
|
290
|
+
custom_event: customEvent,
|
|
291
|
+
// Catch-all for unmapped events
|
|
292
|
+
"*": {
|
|
293
|
+
// Pass through with gtag prefix
|
|
294
|
+
data: {
|
|
295
|
+
// Copy all data as-is
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
var consentOnlyMapping = {
|
|
300
|
+
consent: {
|
|
301
|
+
update: consentUpdate2
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
export {
|
|
305
|
+
events_exports as Events,
|
|
306
|
+
mapping_exports as Mapping,
|
|
307
|
+
consentOnlyMapping,
|
|
308
|
+
consentUpdate as consentUpdateEvent,
|
|
309
|
+
config2 as dataLayerExamples,
|
|
310
|
+
env_exports as env
|
|
311
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},i={};a(i,{Events:()=>X,Mapping:()=>k,SourceDataLayer:()=>_,consentOnlyMapping:()=>M,consentUpdateEvent:()=>E,dataLayerExamples:()=>C,default:()=>z,env:()=>g,sourceDataLayer:()=>K});var o=Object.defineProperty;((e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})})({},{Level:()=>c});var u,c=((u=c||{})[u.ERROR=0]="ERROR",u[u.INFO=1]="INFO",u[u.DEBUG=2]="DEBUG",u);function s(e){return Array.isArray(e)}function d(e){return"object"==typeof e&&null!==e&&!s(e)&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return"string"==typeof e}function m(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}var f=!1;function p(e,t={},n){if(t.filter){if(!0===m(()=>t.filter(n),()=>!1)())return}const r=function(e){if(d(e)&&l(e.event)){const{event:t,...n}=e;return{name:t,...n}}if(s(e)&&e.length>=2)return y(e);if(t=e,null!=t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0){return y(Array.from(e))}var t;return null}(n);if(!r)return;const a=`${t.prefix||"dataLayer"} ${r.name}`,{name:i,...o}=r,u={name:a,data:o};m(()=>e(u),()=>{})()}function y(e){const[t,n,r]=e;if(!l(t))return null;let a,i={};switch(t){case"consent":if(!l(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!d(r)||null===r)return null;a=`${t} ${n}`,i={...r};break;case"event":if(!l(n))return null;a=n,d(r)&&(i={...r});break;case"config":if(!l(n))return null;a=`${t} ${n}`,d(r)&&(i={...r});break;case"set":if(l(n))a=`${t} ${n}`,d(r)&&(i={...r});else{if(!d(n))return null;a=`${t} custom`,i={...n}}break;default:return null}return{name:a,...i}}var _={},g={};a(g,{push:()=>h});var v=()=>{},w=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),b={error:v,info:v,debug:v,throw:e=>{throw"string"==typeof e?new Error(e):e},scope:()=>b},h={get push(){return w()},get command(){return w()},get elb(){return w()},get window(){return{dataLayer:[],addEventListener:v,removeEventListener:v}},logger:b},X={};function E(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function O(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function L(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function U(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function j(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function A(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function P(){return["set",{currency:"EUR",country:"DE"}]}function R(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}a(X,{add_to_cart:()=>U,config:()=>A,consentDefault:()=>O,consentUpdate:()=>E,directDataLayerEvent:()=>R,purchase:()=>L,setCustom:()=>P,view_item:()=>j});var k={};a(k,{add_to_cart:()=>N,config:()=>C,configGA4:()=>S,consentOnlyMapping:()=>M,consentUpdate:()=>$,customEvent:()=>x,purchase:()=>q,view_item:()=>G});var D,$={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},q={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},N={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},G={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},S={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},x={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},C={consent:{update:$},purchase:q,add_to_cart:N,view_item:G,"config G-XXXXXXXXXX":S,custom_event:x,"*":{data:{}}},M={consent:{update:$}},K=async(e,t)=>{const{elb:n,window:r}=t,a={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:a};return r&&(function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",a=window[r];if(Array.isArray(a)&&!f){f=!0;try{for(const t of a)p(e,n,t)}finally{f=!1}}}(n,i),function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);const a=window[r];if(!Array.isArray(a))return;const i=a.push.bind(a);a.push=function(...t){if(f)return i(...t);f=!0;try{for(const r of t)p(e,n,r)}finally{f=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=a.name||"dataLayer";r&&r[e]&&Array.isArray(r[e])}}},z=K;return D=i,((a,i,o,u)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of n(i))r.call(a,c)||c===o||e(a,c,{get:()=>i[c],enumerable:!(u=t(i,c))||u.enumerable});return a})(e({},"__esModule",{value:!0}),D)})();
|