@walkeros/server-destination-datamanager 2.0.0 → 2.1.0

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.
@@ -20,301 +20,80 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/examples/index.ts
21
21
  var examples_exports = {};
22
22
  __export(examples_exports, {
23
- auth: () => auth_exports,
24
- basic: () => basic_exports,
25
- mapping: () => mapping_exports
23
+ step: () => step_exports
26
24
  });
27
25
  module.exports = __toCommonJS(examples_exports);
28
26
 
29
- // src/examples/auth.ts
30
- var auth_exports = {};
31
- __export(auth_exports, {
32
- awsLambda: () => awsLambda,
33
- customScopes: () => customScopes,
34
- dockerKubernetes: () => dockerKubernetes,
35
- gcpCloudFunctions: () => gcpCloudFunctions,
36
- localDevelopment: () => localDevelopment
27
+ // src/examples/step.ts
28
+ var step_exports = {};
29
+ __export(step_exports, {
30
+ lead: () => lead,
31
+ purchase: () => purchase
37
32
  });
38
- var awsLambda = {
39
- settings: {
40
- credentials: {
41
- client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
42
- private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
43
- },
44
- destinations: [
45
- {
46
- operatingAccount: {
47
- accountId: "123-456-7890",
48
- accountType: "GOOGLE_ADS"
49
- },
50
- productDestinationId: "AW-CONVERSION-123"
51
- }
52
- ]
53
- }
54
- };
55
- var gcpCloudFunctions = {
56
- settings: {
57
- // No auth config needed - ADC works automatically on GCP!
58
- destinations: [
59
- {
60
- operatingAccount: {
61
- accountId: "123-456-7890",
62
- accountType: "GOOGLE_ADS"
63
- },
64
- productDestinationId: "AW-CONVERSION-123"
65
- }
66
- ]
67
- }
68
- };
69
- var localDevelopment = {
70
- settings: {
71
- keyFilename: "./service-account.json",
72
- destinations: [
73
- {
74
- operatingAccount: {
75
- accountId: "123-456-7890",
76
- accountType: "GOOGLE_ADS"
77
- },
78
- productDestinationId: "AW-CONVERSION-123"
79
- }
80
- ]
81
- }
82
- };
83
- var dockerKubernetes = {
84
- settings: {
85
- // No explicit config - ADC uses GOOGLE_APPLICATION_CREDENTIALS env var
86
- destinations: [
87
- {
88
- operatingAccount: {
89
- accountId: "123-456-7890",
90
- accountType: "GOOGLE_ADS"
91
- },
92
- productDestinationId: "AW-CONVERSION-123"
93
- }
94
- ]
95
- }
96
- };
97
- var customScopes = {
98
- settings: {
99
- credentials: {
100
- client_email: process.env.GOOGLE_CLIENT_EMAIL || "",
101
- private_key: (process.env.GOOGLE_PRIVATE_KEY || "").replace(/\\n/g, "\n")
102
- },
103
- scopes: ["https://www.googleapis.com/auth/datamanager"],
104
- destinations: [
105
- {
106
- operatingAccount: {
107
- accountId: "123-456-7890",
108
- accountType: "GOOGLE_ADS"
109
- },
110
- productDestinationId: "AW-CONVERSION-123"
111
- }
112
- ]
113
- }
114
- };
115
-
116
- // src/examples/basic.ts
117
- var basic_exports = {};
118
- __export(basic_exports, {
119
- complete: () => complete,
120
- debug: () => debug,
121
- ga4: () => ga4,
122
- minimal: () => minimal
123
- });
124
- var minimal = {
125
- settings: {
126
- credentials: {
127
- client_email: "service-account@project.iam.gserviceaccount.com",
128
- private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
129
- },
130
- destinations: [
131
- {
132
- operatingAccount: {
133
- accountId: "123-456-7890",
134
- accountType: "GOOGLE_ADS"
135
- },
136
- productDestinationId: "AW-CONVERSION-123"
137
- }
138
- ]
139
- }
140
- };
141
- var complete = {
142
- settings: {
143
- credentials: {
144
- client_email: "service-account@project.iam.gserviceaccount.com",
145
- private_key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
146
- },
147
- destinations: [
148
- {
149
- operatingAccount: {
150
- accountId: "123-456-7890",
151
- accountType: "GOOGLE_ADS"
152
- },
153
- productDestinationId: "AW-CONVERSION-123"
154
- },
155
- {
156
- operatingAccount: {
157
- accountId: "987654321",
158
- accountType: "GOOGLE_ANALYTICS_PROPERTY"
159
- },
160
- productDestinationId: "G-XXXXXXXXXX"
161
- }
162
- ],
163
- batchSize: 100,
164
- batchInterval: 5e3,
165
- validateOnly: false,
166
- consent: {
167
- adUserData: "CONSENT_GRANTED",
168
- adPersonalization: "CONSENT_GRANTED"
169
- },
170
- // Guided helpers (apply to all events)
171
- userData: {
172
- email: "user.id",
173
- phone: "data.phone",
174
- firstName: "data.firstName",
175
- lastName: "data.lastName"
176
- },
177
- userId: "user.id",
178
- clientId: "user.device",
179
- sessionAttributes: "context.sessionAttributes"
180
- }
181
- };
182
- var ga4 = {
183
- settings: {
184
- destinations: [
185
- {
186
- operatingAccount: {
187
- accountId: "123456789",
188
- accountType: "GOOGLE_ANALYTICS_PROPERTY"
189
- },
190
- productDestinationId: "G-XXXXXXXXXX"
33
+ var import_core = require("@walkeros/core");
34
+ var purchase = {
35
+ in: (0, import_core.getEvent)("order complete", {
36
+ timestamp: 1700001200,
37
+ data: { id: "ORD-600", total: 149.99, currency: "EUR" },
38
+ user: { id: "user-abc", email: "buyer@example.com" },
39
+ source: { type: "server", id: "", previous_id: "" }
40
+ }),
41
+ mapping: {
42
+ name: "purchase",
43
+ data: {
44
+ map: {
45
+ transactionId: "data.id",
46
+ conversionValue: "data.total",
47
+ currency: { key: "data.currency", value: "USD" },
48
+ eventName: { value: "purchase" },
49
+ userId: "user.id",
50
+ email: "user.id"
191
51
  }
192
- ]
193
- }
194
- };
195
- var debug = {
196
- settings: {
197
- keyFilename: "./service-account.json",
198
- destinations: [
52
+ }
53
+ },
54
+ out: {
55
+ events: [
199
56
  {
200
- operatingAccount: {
201
- accountId: "123-456-7890",
202
- accountType: "GOOGLE_ADS"
203
- },
204
- productDestinationId: "AW-CONVERSION-123"
57
+ transactionId: "ORD-600",
58
+ eventName: "purchase",
59
+ eventSource: "WEB",
60
+ conversionValue: 149.99,
61
+ currency: "EUR",
62
+ userId: "user-abc",
63
+ email: "buyer@example.com"
205
64
  }
206
65
  ]
207
66
  }
208
67
  };
209
-
210
- // src/examples/mapping.ts
211
- var mapping_exports = {};
212
- __export(mapping_exports, {
213
- Lead: () => Lead,
214
- PageView: () => PageView,
215
- Purchase: () => Purchase,
216
- mapping: () => mapping,
217
- userDataMapping: () => userDataMapping
218
- });
219
- var import_core = require("@walkeros/core");
220
- var Purchase = {
221
- name: "purchase",
222
- data: {
223
- map: {
224
- // Required fields
225
- transactionId: "data.id",
226
- conversionValue: "data.total",
227
- currency: { key: "data.currency", value: "USD" },
228
- eventName: { value: "purchase" },
229
- // User identification
230
- userId: "user.id",
231
- email: "user.id",
232
- // Will be hashed automatically
233
- // Attribution identifiers (captured by browser source from URL)
234
- gclid: "context.gclid",
235
- // Google Click ID
236
- gbraid: "context.gbraid",
237
- // iOS attribution
238
- wbraid: "context.wbraid",
239
- // Web-to-app
240
- // Shopping cart data
241
- cartData: {
242
- map: {
243
- items: {
244
- loop: [
245
- "nested",
246
- {
247
- condition: (entity) => (0, import_core.isObject)(entity) && entity.entity === "product",
248
- map: {
249
- merchantProductId: "data.id",
250
- price: "data.price",
251
- quantity: { key: "data.quantity", value: 1 }
252
- }
253
- }
254
- ]
255
- }
256
- }
68
+ var lead = {
69
+ in: (0, import_core.getEvent)("form submit", {
70
+ timestamp: 1700001201,
71
+ data: { type: "demo-request" },
72
+ user: { email: "prospect@example.com" },
73
+ source: { type: "server", id: "", previous_id: "" }
74
+ }),
75
+ mapping: {
76
+ name: "generate_lead",
77
+ data: {
78
+ map: {
79
+ eventName: { value: "generate_lead" },
80
+ conversionValue: { value: 10 },
81
+ currency: { value: "USD" }
257
82
  }
258
83
  }
259
- }
260
- };
261
- var Lead = {
262
- name: "generate_lead",
263
- data: {
264
- map: {
265
- eventName: { value: "generate_lead" },
266
- conversionValue: { value: 10 },
267
- currency: { value: "USD" }
268
- }
269
- }
270
- };
271
- var PageView = {
272
- name: "page_view",
273
- data: {
274
- map: {
275
- eventName: { value: "page_view" }
276
- }
277
- }
278
- };
279
- var mapping = {
280
- order: {
281
- complete: Purchase
282
84
  },
283
- lead: {
284
- submit: Lead
285
- },
286
- page: {
287
- view: PageView
288
- }
289
- };
290
- var userDataMapping = {
291
- settings: {
292
- keyFilename: "./service-account.json",
293
- destinations: [
85
+ out: {
86
+ events: [
294
87
  {
295
- operatingAccount: {
296
- accountId: "123-456-7890",
297
- accountType: "GOOGLE_ADS"
298
- },
299
- productDestinationId: "AW-CONVERSION-123"
88
+ transactionId: "1700001201-gr0up-1",
89
+ eventName: "generate_lead",
90
+ eventSource: "WEB",
91
+ email: "prospect@example.com"
300
92
  }
301
93
  ]
302
- },
303
- data: {
304
- map: {
305
- email: "user.id",
306
- phone: "data.phone",
307
- firstName: "data.firstName",
308
- lastName: "data.lastName",
309
- regionCode: "data.country",
310
- postalCode: "data.zip"
311
- }
312
- },
313
- mapping
94
+ }
314
95
  };
315
96
  // Annotate the CommonJS export names for ESM import in node:
316
97
  0 && (module.exports = {
317
- auth,
318
- basic,
319
- mapping
98
+ step
320
99
  });