@walkeros/web-destination-meta 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 +96 -0
- package/dist/dev.d.mts +161 -0
- package/dist/dev.d.ts +161 -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 +73 -0
- package/dist/examples/index.d.ts +73 -0
- package/dist/examples/index.js +308 -0
- package/dist/examples/index.mjs +285 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.mts +53 -0
- package/dist/index.d.ts +53 -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,73 @@
|
|
|
1
|
+
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
_fbq?: facebook.Pixel.Event;
|
|
7
|
+
fbq?: facebook.Pixel.Event;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface Mapping {
|
|
11
|
+
track?: StandardEventNames;
|
|
12
|
+
trackCustom?: string;
|
|
13
|
+
}
|
|
14
|
+
interface Env extends DestinationWeb.Env {
|
|
15
|
+
window: {
|
|
16
|
+
fbq: facebook.Pixel.Event;
|
|
17
|
+
_fbq?: facebook.Pixel.Event;
|
|
18
|
+
};
|
|
19
|
+
document: {
|
|
20
|
+
createElement: (tagName: string) => Element;
|
|
21
|
+
head: {
|
|
22
|
+
appendChild: (node: unknown) => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
27
|
+
type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
|
|
28
|
+
|
|
29
|
+
declare const init: Env | undefined;
|
|
30
|
+
declare const push: Env;
|
|
31
|
+
|
|
32
|
+
declare const env_init: typeof init;
|
|
33
|
+
declare const env_push: typeof push;
|
|
34
|
+
declare namespace env {
|
|
35
|
+
export { env_init as init, env_push as push };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function Purchase$1(): unknown[];
|
|
39
|
+
declare function AddToCart$1(): unknown[];
|
|
40
|
+
declare function InitiateCheckout$1(): unknown[];
|
|
41
|
+
declare function ViewContent$1(): unknown[];
|
|
42
|
+
|
|
43
|
+
declare namespace events {
|
|
44
|
+
export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const Purchase: Rule;
|
|
48
|
+
declare const AddToCart: Rule;
|
|
49
|
+
declare const InitiateCheckout: Rule;
|
|
50
|
+
declare const ViewContent: Rule;
|
|
51
|
+
declare const config: {
|
|
52
|
+
order: {
|
|
53
|
+
complete: Rule;
|
|
54
|
+
};
|
|
55
|
+
product: {
|
|
56
|
+
view: Rule;
|
|
57
|
+
add: Rule;
|
|
58
|
+
};
|
|
59
|
+
cart: {
|
|
60
|
+
view: Rule;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare const mapping_AddToCart: typeof AddToCart;
|
|
65
|
+
declare const mapping_InitiateCheckout: typeof InitiateCheckout;
|
|
66
|
+
declare const mapping_Purchase: typeof Purchase;
|
|
67
|
+
declare const mapping_ViewContent: typeof ViewContent;
|
|
68
|
+
declare const mapping_config: typeof config;
|
|
69
|
+
declare namespace mapping {
|
|
70
|
+
export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { env, events, mapping };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Mapping as Mapping$1 } from '@walkeros/core';
|
|
2
|
+
import { DestinationWeb } from '@walkeros/web-core';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
_fbq?: facebook.Pixel.Event;
|
|
7
|
+
fbq?: facebook.Pixel.Event;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
interface Mapping {
|
|
11
|
+
track?: StandardEventNames;
|
|
12
|
+
trackCustom?: string;
|
|
13
|
+
}
|
|
14
|
+
interface Env extends DestinationWeb.Env {
|
|
15
|
+
window: {
|
|
16
|
+
fbq: facebook.Pixel.Event;
|
|
17
|
+
_fbq?: facebook.Pixel.Event;
|
|
18
|
+
};
|
|
19
|
+
document: {
|
|
20
|
+
createElement: (tagName: string) => Element;
|
|
21
|
+
head: {
|
|
22
|
+
appendChild: (node: unknown) => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
type Rule = Mapping$1.Rule<Mapping>;
|
|
27
|
+
type StandardEventNames = 'PageView' | 'AddPaymentInfo' | 'AddToCart' | 'AddToWishlist' | 'CompleteRegistration' | 'Contact' | 'CustomizeProduct' | 'Donate' | 'FindLocation' | 'InitiateCheckout' | 'Lead' | 'Purchase' | 'Schedule' | 'Search' | 'StartTrial' | 'SubmitApplication' | 'Subscribe' | 'ViewContent' | string;
|
|
28
|
+
|
|
29
|
+
declare const init: Env | undefined;
|
|
30
|
+
declare const push: Env;
|
|
31
|
+
|
|
32
|
+
declare const env_init: typeof init;
|
|
33
|
+
declare const env_push: typeof push;
|
|
34
|
+
declare namespace env {
|
|
35
|
+
export { env_init as init, env_push as push };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare function Purchase$1(): unknown[];
|
|
39
|
+
declare function AddToCart$1(): unknown[];
|
|
40
|
+
declare function InitiateCheckout$1(): unknown[];
|
|
41
|
+
declare function ViewContent$1(): unknown[];
|
|
42
|
+
|
|
43
|
+
declare namespace events {
|
|
44
|
+
export { AddToCart$1 as AddToCart, InitiateCheckout$1 as InitiateCheckout, Purchase$1 as Purchase, ViewContent$1 as ViewContent };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare const Purchase: Rule;
|
|
48
|
+
declare const AddToCart: Rule;
|
|
49
|
+
declare const InitiateCheckout: Rule;
|
|
50
|
+
declare const ViewContent: Rule;
|
|
51
|
+
declare const config: {
|
|
52
|
+
order: {
|
|
53
|
+
complete: Rule;
|
|
54
|
+
};
|
|
55
|
+
product: {
|
|
56
|
+
view: Rule;
|
|
57
|
+
add: Rule;
|
|
58
|
+
};
|
|
59
|
+
cart: {
|
|
60
|
+
view: Rule;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
declare const mapping_AddToCart: typeof AddToCart;
|
|
65
|
+
declare const mapping_InitiateCheckout: typeof InitiateCheckout;
|
|
66
|
+
declare const mapping_Purchase: typeof Purchase;
|
|
67
|
+
declare const mapping_ViewContent: typeof ViewContent;
|
|
68
|
+
declare const mapping_config: typeof config;
|
|
69
|
+
declare namespace mapping {
|
|
70
|
+
export { mapping_AddToCart as AddToCart, mapping_InitiateCheckout as InitiateCheckout, mapping_Purchase as Purchase, mapping_ViewContent as ViewContent, mapping_config as config };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { env, events, mapping };
|
|
@@ -0,0 +1,308 @@
|
|
|
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
|
+
events: () => events_exports,
|
|
25
|
+
mapping: () => mapping_exports
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(examples_exports);
|
|
28
|
+
|
|
29
|
+
// src/examples/env.ts
|
|
30
|
+
var env_exports = {};
|
|
31
|
+
__export(env_exports, {
|
|
32
|
+
init: () => init,
|
|
33
|
+
push: () => push
|
|
34
|
+
});
|
|
35
|
+
var noop = () => {
|
|
36
|
+
};
|
|
37
|
+
var init = {
|
|
38
|
+
// Environment before initialization (fbq not loaded yet)
|
|
39
|
+
window: {
|
|
40
|
+
fbq: void 0,
|
|
41
|
+
_fbq: void 0
|
|
42
|
+
},
|
|
43
|
+
document: {
|
|
44
|
+
createElement: () => ({
|
|
45
|
+
src: "",
|
|
46
|
+
async: false,
|
|
47
|
+
setAttribute: () => {
|
|
48
|
+
},
|
|
49
|
+
removeAttribute: () => {
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
head: { appendChild: () => {
|
|
53
|
+
} }
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var push = {
|
|
57
|
+
// Standard mock environment for testing
|
|
58
|
+
window: {
|
|
59
|
+
fbq: Object.assign(noop, {
|
|
60
|
+
// Add Meta Pixel specific properties
|
|
61
|
+
callMethod: noop,
|
|
62
|
+
queue: [],
|
|
63
|
+
push: noop,
|
|
64
|
+
loaded: true,
|
|
65
|
+
version: "2.0"
|
|
66
|
+
}),
|
|
67
|
+
_fbq: Object.assign(noop, {
|
|
68
|
+
callMethod: noop,
|
|
69
|
+
queue: [],
|
|
70
|
+
push: noop,
|
|
71
|
+
loaded: true,
|
|
72
|
+
version: "2.0"
|
|
73
|
+
})
|
|
74
|
+
},
|
|
75
|
+
document: {
|
|
76
|
+
createElement: () => ({
|
|
77
|
+
src: "",
|
|
78
|
+
async: false,
|
|
79
|
+
setAttribute: () => {
|
|
80
|
+
},
|
|
81
|
+
removeAttribute: () => {
|
|
82
|
+
}
|
|
83
|
+
}),
|
|
84
|
+
head: { appendChild: () => {
|
|
85
|
+
} }
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/examples/events.ts
|
|
90
|
+
var events_exports = {};
|
|
91
|
+
__export(events_exports, {
|
|
92
|
+
AddToCart: () => AddToCart,
|
|
93
|
+
InitiateCheckout: () => InitiateCheckout,
|
|
94
|
+
Purchase: () => Purchase,
|
|
95
|
+
ViewContent: () => ViewContent
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// ../../../core/dist/index.mjs
|
|
99
|
+
var e = Object.defineProperty;
|
|
100
|
+
var c = {};
|
|
101
|
+
((t, n) => {
|
|
102
|
+
for (var r in n) e(t, r, { get: n[r], enumerable: true });
|
|
103
|
+
})(c, { Level: () => a });
|
|
104
|
+
var a = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.INFO = 1] = "INFO", e2[e2.DEBUG = 2] = "DEBUG", e2))(a || {});
|
|
105
|
+
var E = { merge: true, shallow: true, extend: true };
|
|
106
|
+
function S(e2, t = {}, n = {}) {
|
|
107
|
+
n = { ...E, ...n };
|
|
108
|
+
const r = Object.entries(t).reduce((t2, [r2, o]) => {
|
|
109
|
+
const i = e2[r2];
|
|
110
|
+
return n.merge && Array.isArray(i) && Array.isArray(o) ? t2[r2] = o.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || r2 in e2) && (t2[r2] = o), t2;
|
|
111
|
+
}, {});
|
|
112
|
+
return n.shallow ? { ...e2, ...r } : (Object.assign(e2, r), e2);
|
|
113
|
+
}
|
|
114
|
+
function A(e2) {
|
|
115
|
+
return Array.isArray(e2);
|
|
116
|
+
}
|
|
117
|
+
function _(e2) {
|
|
118
|
+
return "object" == typeof e2 && null !== e2 && !A(e2) && "[object Object]" === Object.prototype.toString.call(e2);
|
|
119
|
+
}
|
|
120
|
+
function W(e2 = {}) {
|
|
121
|
+
var _a;
|
|
122
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = e2.group || "gr0up", r = e2.count || 1, o = S({ 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}-${r}`, trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, group: n, count: r, version: { source: "0.5.1-next.0", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, e2, { merge: false });
|
|
123
|
+
if (e2.name) {
|
|
124
|
+
const [t2, n2] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
125
|
+
t2 && n2 && (o.entity = t2, o.action = n2);
|
|
126
|
+
}
|
|
127
|
+
return o;
|
|
128
|
+
}
|
|
129
|
+
function B(e2 = "entity action", t = {}) {
|
|
130
|
+
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), r = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, o = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
131
|
+
return W({ ...{ "cart view": { data: { currency: "EUR", value: 2 * r.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...r.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: r.data.price + o.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...o, 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", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...o, 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": { ...r, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...r, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...r.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 });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/examples/events.ts
|
|
135
|
+
function Purchase() {
|
|
136
|
+
const event = B("order complete");
|
|
137
|
+
return [
|
|
138
|
+
"track",
|
|
139
|
+
"Purchase",
|
|
140
|
+
{
|
|
141
|
+
value: event.data.total,
|
|
142
|
+
currency: "EUR",
|
|
143
|
+
contents: event.nested.filter((item) => item.entity === "product").map((item) => ({ id: item.data.id, quantity: 1 })),
|
|
144
|
+
content_type: "product",
|
|
145
|
+
num_items: 2
|
|
146
|
+
},
|
|
147
|
+
{ eventID: event.id }
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
function AddToCart() {
|
|
151
|
+
const event = B("product add");
|
|
152
|
+
return [
|
|
153
|
+
"track",
|
|
154
|
+
"AddToCart",
|
|
155
|
+
{
|
|
156
|
+
currency: "EUR",
|
|
157
|
+
value: event.data.price,
|
|
158
|
+
contents: [{ id: event.data.id, quantity: 1 }],
|
|
159
|
+
content_type: "product"
|
|
160
|
+
},
|
|
161
|
+
{ eventID: event.id }
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
function InitiateCheckout() {
|
|
165
|
+
const event = B("cart view");
|
|
166
|
+
return [
|
|
167
|
+
"track",
|
|
168
|
+
"InitiateCheckout",
|
|
169
|
+
{
|
|
170
|
+
currency: "EUR",
|
|
171
|
+
value: event.data.value,
|
|
172
|
+
contents: event.nested.filter((entity) => entity.entity === "product").map((entity) => ({
|
|
173
|
+
id: entity.data.id,
|
|
174
|
+
quantity: entity.data.quantity
|
|
175
|
+
})),
|
|
176
|
+
num_items: event.nested.filter((item) => item.entity === "product").length
|
|
177
|
+
},
|
|
178
|
+
{ eventID: event.id }
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
function ViewContent() {
|
|
182
|
+
const event = B("product view");
|
|
183
|
+
return [
|
|
184
|
+
"track",
|
|
185
|
+
"ViewContent",
|
|
186
|
+
{
|
|
187
|
+
currency: "EUR",
|
|
188
|
+
value: event.data.price,
|
|
189
|
+
contents: [{ id: event.data.id, quantity: 1 }],
|
|
190
|
+
content_type: "product"
|
|
191
|
+
},
|
|
192
|
+
{ eventID: event.id }
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/examples/mapping.ts
|
|
197
|
+
var mapping_exports = {};
|
|
198
|
+
__export(mapping_exports, {
|
|
199
|
+
AddToCart: () => AddToCart2,
|
|
200
|
+
InitiateCheckout: () => InitiateCheckout2,
|
|
201
|
+
Purchase: () => Purchase2,
|
|
202
|
+
ViewContent: () => ViewContent2,
|
|
203
|
+
config: () => config
|
|
204
|
+
});
|
|
205
|
+
var Purchase2 = {
|
|
206
|
+
name: "Purchase",
|
|
207
|
+
data: {
|
|
208
|
+
map: {
|
|
209
|
+
value: "data.total",
|
|
210
|
+
currency: { value: "EUR" },
|
|
211
|
+
contents: {
|
|
212
|
+
loop: [
|
|
213
|
+
"nested",
|
|
214
|
+
{
|
|
215
|
+
condition: (entity) => _(entity) && entity.entity === "product",
|
|
216
|
+
map: {
|
|
217
|
+
id: "data.id",
|
|
218
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
content_type: { value: "product" },
|
|
224
|
+
num_items: {
|
|
225
|
+
fn: (event) => event.nested.filter(
|
|
226
|
+
(item) => item.entity === "product"
|
|
227
|
+
).length
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var AddToCart2 = {
|
|
233
|
+
name: "AddToCart",
|
|
234
|
+
data: {
|
|
235
|
+
map: {
|
|
236
|
+
value: "data.price",
|
|
237
|
+
currency: { value: "EUR" },
|
|
238
|
+
contents: {
|
|
239
|
+
set: [
|
|
240
|
+
{
|
|
241
|
+
map: {
|
|
242
|
+
id: "data.id",
|
|
243
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
content_type: { value: "product" }
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
var InitiateCheckout2 = {
|
|
253
|
+
name: "InitiateCheckout",
|
|
254
|
+
data: {
|
|
255
|
+
map: {
|
|
256
|
+
value: "data.value",
|
|
257
|
+
currency: { value: "EUR" },
|
|
258
|
+
contents: {
|
|
259
|
+
loop: [
|
|
260
|
+
"nested",
|
|
261
|
+
{
|
|
262
|
+
condition: (entity) => _(entity) && entity.entity === "product",
|
|
263
|
+
map: {
|
|
264
|
+
id: "data.id",
|
|
265
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
num_items: {
|
|
271
|
+
fn: (event) => event.nested.filter(
|
|
272
|
+
(item) => item.entity === "product"
|
|
273
|
+
).length
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
var ViewContent2 = {
|
|
279
|
+
name: "ViewContent",
|
|
280
|
+
data: {
|
|
281
|
+
map: {
|
|
282
|
+
value: "data.price",
|
|
283
|
+
currency: { value: "EUR" },
|
|
284
|
+
content_type: { value: "product" },
|
|
285
|
+
contents: {
|
|
286
|
+
set: [
|
|
287
|
+
{
|
|
288
|
+
map: {
|
|
289
|
+
id: "data.id",
|
|
290
|
+
quantity: { key: "data.quantity", value: 1 }
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var config = {
|
|
299
|
+
order: { complete: Purchase2 },
|
|
300
|
+
product: { view: ViewContent2, add: AddToCart2 },
|
|
301
|
+
cart: { view: InitiateCheckout2 }
|
|
302
|
+
};
|
|
303
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
304
|
+
0 && (module.exports = {
|
|
305
|
+
env,
|
|
306
|
+
events,
|
|
307
|
+
mapping
|
|
308
|
+
});
|