@walkeros/web-destination-gtag 0.2.0 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { Destination as Destination$1, Mapping as Mapping$1 } from '@walkeros/core';
1
+ import { Destination as Destination$1, Mapping as Mapping$2, z } from '@walkeros/core';
2
2
  import { DestinationWeb } from '@walkeros/web-core';
3
+ import * as zod_to_json_schema from 'zod-to-json-schema';
3
4
 
4
5
  declare global {
5
6
  interface Window {
@@ -28,13 +29,13 @@ type ConsentMode = false | true | ConsentMapping;
28
29
  interface ConsentMapping {
29
30
  [walkerOSConsentGroup: string]: string | string[];
30
31
  }
31
- type Types = Destination$1.Types<Settings, Mapping, Env>;
32
+ type Types = Destination$1.Types<Settings$1, Mapping$1, Env>;
32
33
  type Destination = DestinationWeb.Destination<Types>;
33
34
  type Config = DestinationWeb.Config<Types>;
34
35
  interface BaseSettings {
35
- data?: Mapping$1.Value | Mapping$1.Values;
36
+ data?: Mapping$2.Value | Mapping$2.Values;
36
37
  }
37
- interface Settings {
38
+ interface Settings$1 {
38
39
  como?: ConsentMode;
39
40
  ga4?: GA4Settings;
40
41
  ads?: AdsSettings;
@@ -61,7 +62,7 @@ interface GTMSettings extends BaseSettings {
61
62
  dataLayer?: string;
62
63
  domain?: string;
63
64
  }
64
- interface Mapping {
65
+ interface Mapping$1 {
65
66
  ga4?: GA4Mapping;
66
67
  ads?: AdsMapping;
67
68
  gtm?: GTMMapping;
@@ -71,34 +72,32 @@ interface GA4Mapping {
71
72
  }
72
73
  interface GTMMapping {
73
74
  }
74
- type Rule = Mapping$1.Rule<Mapping>;
75
- type Rules = Mapping$1.Rules<Rule>;
76
- type Param = Mapping$1.Value;
75
+ type Rule = Mapping$2.Rule<Mapping$1>;
76
+ type Rules = Mapping$2.Rules<Rule>;
77
+ type Param = Mapping$2.Value;
77
78
  type Include = Array<'all' | 'context' | 'data' | 'event' | 'globals' | 'source' | 'user' | 'version'>;
78
79
  type Parameters = Gtag.ControlParams & Gtag.EventParams & Gtag.CustomParams;
79
80
 
80
- type index$1_AdsMapping = AdsMapping;
81
- type index$1_AdsSettings = AdsSettings;
82
- type index$1_BaseSettings = BaseSettings;
83
- type index$1_Config = Config;
84
- type index$1_ConsentMapping = ConsentMapping;
85
- type index$1_ConsentMode = ConsentMode;
86
- type index$1_Destination = Destination;
87
- type index$1_Env = Env;
88
- type index$1_GA4Mapping = GA4Mapping;
89
- type index$1_GA4Settings = GA4Settings;
90
- type index$1_GTMMapping = GTMMapping;
91
- type index$1_GTMSettings = GTMSettings;
92
- type index$1_Include = Include;
93
- type index$1_Mapping = Mapping;
94
- type index$1_Param = Param;
95
- type index$1_Parameters = Parameters;
96
- type index$1_Rule = Rule;
97
- type index$1_Rules = Rules;
98
- type index$1_Settings = Settings;
99
- type index$1_Types = Types;
100
- declare namespace index$1 {
101
- export type { index$1_AdsMapping as AdsMapping, index$1_AdsSettings as AdsSettings, index$1_BaseSettings as BaseSettings, index$1_Config as Config, index$1_ConsentMapping as ConsentMapping, index$1_ConsentMode as ConsentMode, index$1_Destination as Destination, index$1_Env as Env, index$1_GA4Mapping as GA4Mapping, index$1_GA4Settings as GA4Settings, index$1_GTMMapping as GTMMapping, index$1_GTMSettings as GTMSettings, index$1_Include as Include, index$1_Mapping as Mapping, index$1_Param as Param, index$1_Parameters as Parameters, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings, index$1_Types as Types };
81
+ type index$2_AdsMapping = AdsMapping;
82
+ type index$2_AdsSettings = AdsSettings;
83
+ type index$2_BaseSettings = BaseSettings;
84
+ type index$2_Config = Config;
85
+ type index$2_ConsentMapping = ConsentMapping;
86
+ type index$2_ConsentMode = ConsentMode;
87
+ type index$2_Destination = Destination;
88
+ type index$2_Env = Env;
89
+ type index$2_GA4Mapping = GA4Mapping;
90
+ type index$2_GA4Settings = GA4Settings;
91
+ type index$2_GTMMapping = GTMMapping;
92
+ type index$2_GTMSettings = GTMSettings;
93
+ type index$2_Include = Include;
94
+ type index$2_Param = Param;
95
+ type index$2_Parameters = Parameters;
96
+ type index$2_Rule = Rule;
97
+ type index$2_Rules = Rules;
98
+ type index$2_Types = Types;
99
+ declare namespace index$2 {
100
+ export type { index$2_AdsMapping as AdsMapping, index$2_AdsSettings as AdsSettings, index$2_BaseSettings as BaseSettings, index$2_Config as Config, index$2_ConsentMapping as ConsentMapping, index$2_ConsentMode as ConsentMode, index$2_Destination as Destination, index$2_Env as Env, index$2_GA4Mapping as GA4Mapping, index$2_GA4Settings as GA4Settings, index$2_GTMMapping as GTMMapping, index$2_GTMSettings as GTMSettings, index$2_Include as Include, Mapping$1 as Mapping, index$2_Param as Param, index$2_Parameters as Parameters, index$2_Rule as Rule, index$2_Rules as Rules, Settings$1 as Settings, index$2_Types as Types };
102
101
  }
103
102
 
104
103
  declare const init: Env | undefined;
@@ -137,24 +136,344 @@ declare const config: {
137
136
  };
138
137
  };
139
138
 
140
- declare const mapping_adsConversion: typeof adsConversion;
141
- declare const mapping_combinedPurchase: typeof combinedPurchase;
142
- declare const mapping_config: typeof config;
143
- declare const mapping_ga4AddToCart: typeof ga4AddToCart;
144
- declare const mapping_ga4Purchase: typeof ga4Purchase;
145
- declare const mapping_gtmProductView: typeof gtmProductView;
146
- declare namespace mapping {
147
- export { mapping_adsConversion as adsConversion, mapping_combinedPurchase as combinedPurchase, mapping_config as config, mapping_ga4AddToCart as ga4AddToCart, mapping_ga4Purchase as ga4Purchase, mapping_gtmProductView as gtmProductView };
139
+ declare const mapping$1_adsConversion: typeof adsConversion;
140
+ declare const mapping$1_combinedPurchase: typeof combinedPurchase;
141
+ declare const mapping$1_config: typeof config;
142
+ declare const mapping$1_ga4AddToCart: typeof ga4AddToCart;
143
+ declare const mapping$1_ga4Purchase: typeof ga4Purchase;
144
+ declare const mapping$1_gtmProductView: typeof gtmProductView;
145
+ declare namespace mapping$1 {
146
+ export { mapping$1_adsConversion as adsConversion, mapping$1_combinedPurchase as combinedPurchase, mapping$1_config as config, mapping$1_ga4AddToCart as ga4AddToCart, mapping$1_ga4Purchase as ga4Purchase, mapping$1_gtmProductView as gtmProductView };
148
147
  }
149
148
 
150
- declare const index_env: typeof env;
151
- declare const index_events: typeof events;
149
+ declare const index$1_env: typeof env;
150
+ declare const index$1_events: typeof events;
151
+ declare namespace index$1 {
152
+ export { index$1_env as env, index$1_events as events, mapping$1 as mapping };
153
+ }
154
+
155
+ /**
156
+ * Include configuration for GA4
157
+ * Specifies which event properties to include
158
+ */
159
+ declare const IncludeSchema: z.ZodArray<z.ZodEnum<["all", "context", "data", "event", "globals", "source", "user", "version"]>, "many">;
160
+ /**
161
+ * Consent Mode Configuration
162
+ * Can be false (disabled), true (use defaults), or custom mapping
163
+ */
164
+ declare const ConsentModeSchema: z.ZodUnion<[z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>]>;
165
+ declare const GA4SettingsSchema: z.ZodObject<{
166
+ measurementId: z.ZodString;
167
+ debug: z.ZodOptional<z.ZodBoolean>;
168
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<["all", "context", "data", "event", "globals", "source", "user", "version"]>, "many">>;
169
+ pageview: z.ZodOptional<z.ZodBoolean>;
170
+ server_container_url: z.ZodOptional<z.ZodString>;
171
+ snakeCase: z.ZodOptional<z.ZodBoolean>;
172
+ transport_url: z.ZodOptional<z.ZodString>;
173
+ data: z.ZodOptional<z.ZodAny>;
174
+ }, "strip", z.ZodTypeAny, {
175
+ measurementId: string;
176
+ data?: any;
177
+ debug?: boolean | undefined;
178
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
179
+ pageview?: boolean | undefined;
180
+ server_container_url?: string | undefined;
181
+ snakeCase?: boolean | undefined;
182
+ transport_url?: string | undefined;
183
+ }, {
184
+ measurementId: string;
185
+ data?: any;
186
+ debug?: boolean | undefined;
187
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
188
+ pageview?: boolean | undefined;
189
+ server_container_url?: string | undefined;
190
+ snakeCase?: boolean | undefined;
191
+ transport_url?: string | undefined;
192
+ }>;
193
+ /**
194
+ * Google Ads Settings Schema
195
+ * Configuration for Google Ads conversions
196
+ */
197
+ declare const AdsSettingsSchema: z.ZodObject<{
198
+ conversionId: z.ZodString;
199
+ currency: z.ZodOptional<z.ZodString>;
200
+ data: z.ZodOptional<z.ZodAny>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ conversionId: string;
203
+ data?: any;
204
+ currency?: string | undefined;
205
+ }, {
206
+ conversionId: string;
207
+ data?: any;
208
+ currency?: string | undefined;
209
+ }>;
210
+ /**
211
+ * GTM Settings Schema
212
+ * Configuration for Google Tag Manager
213
+ */
214
+ declare const GTMSettingsSchema: z.ZodObject<{
215
+ containerId: z.ZodString;
216
+ dataLayer: z.ZodOptional<z.ZodString>;
217
+ domain: z.ZodOptional<z.ZodString>;
218
+ data: z.ZodOptional<z.ZodAny>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ containerId: string;
221
+ data?: any;
222
+ dataLayer?: string | undefined;
223
+ domain?: string | undefined;
224
+ }, {
225
+ containerId: string;
226
+ data?: any;
227
+ dataLayer?: string | undefined;
228
+ domain?: string | undefined;
229
+ }>;
230
+
231
+ declare const SettingsSchema: z.ZodEffects<z.ZodObject<{
232
+ como: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>]>>;
233
+ ga4: z.ZodOptional<z.ZodObject<{
234
+ measurementId: z.ZodString;
235
+ debug: z.ZodOptional<z.ZodBoolean>;
236
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<["all", "context", "data", "event", "globals", "source", "user", "version"]>, "many">>;
237
+ pageview: z.ZodOptional<z.ZodBoolean>;
238
+ server_container_url: z.ZodOptional<z.ZodString>;
239
+ snakeCase: z.ZodOptional<z.ZodBoolean>;
240
+ transport_url: z.ZodOptional<z.ZodString>;
241
+ data: z.ZodOptional<z.ZodAny>;
242
+ }, "strip", z.ZodTypeAny, {
243
+ measurementId: string;
244
+ data?: any;
245
+ debug?: boolean | undefined;
246
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
247
+ pageview?: boolean | undefined;
248
+ server_container_url?: string | undefined;
249
+ snakeCase?: boolean | undefined;
250
+ transport_url?: string | undefined;
251
+ }, {
252
+ measurementId: string;
253
+ data?: any;
254
+ debug?: boolean | undefined;
255
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
256
+ pageview?: boolean | undefined;
257
+ server_container_url?: string | undefined;
258
+ snakeCase?: boolean | undefined;
259
+ transport_url?: string | undefined;
260
+ }>>;
261
+ ads: z.ZodOptional<z.ZodObject<{
262
+ conversionId: z.ZodString;
263
+ currency: z.ZodOptional<z.ZodString>;
264
+ data: z.ZodOptional<z.ZodAny>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ conversionId: string;
267
+ data?: any;
268
+ currency?: string | undefined;
269
+ }, {
270
+ conversionId: string;
271
+ data?: any;
272
+ currency?: string | undefined;
273
+ }>>;
274
+ gtm: z.ZodOptional<z.ZodObject<{
275
+ containerId: z.ZodString;
276
+ dataLayer: z.ZodOptional<z.ZodString>;
277
+ domain: z.ZodOptional<z.ZodString>;
278
+ data: z.ZodOptional<z.ZodAny>;
279
+ }, "strip", z.ZodTypeAny, {
280
+ containerId: string;
281
+ data?: any;
282
+ dataLayer?: string | undefined;
283
+ domain?: string | undefined;
284
+ }, {
285
+ containerId: string;
286
+ data?: any;
287
+ dataLayer?: string | undefined;
288
+ domain?: string | undefined;
289
+ }>>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ como?: boolean | Record<string, string | string[]> | undefined;
292
+ ga4?: {
293
+ measurementId: string;
294
+ data?: any;
295
+ debug?: boolean | undefined;
296
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
297
+ pageview?: boolean | undefined;
298
+ server_container_url?: string | undefined;
299
+ snakeCase?: boolean | undefined;
300
+ transport_url?: string | undefined;
301
+ } | undefined;
302
+ ads?: {
303
+ conversionId: string;
304
+ data?: any;
305
+ currency?: string | undefined;
306
+ } | undefined;
307
+ gtm?: {
308
+ containerId: string;
309
+ data?: any;
310
+ dataLayer?: string | undefined;
311
+ domain?: string | undefined;
312
+ } | undefined;
313
+ }, {
314
+ como?: boolean | Record<string, string | string[]> | undefined;
315
+ ga4?: {
316
+ measurementId: string;
317
+ data?: any;
318
+ debug?: boolean | undefined;
319
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
320
+ pageview?: boolean | undefined;
321
+ server_container_url?: string | undefined;
322
+ snakeCase?: boolean | undefined;
323
+ transport_url?: string | undefined;
324
+ } | undefined;
325
+ ads?: {
326
+ conversionId: string;
327
+ data?: any;
328
+ currency?: string | undefined;
329
+ } | undefined;
330
+ gtm?: {
331
+ containerId: string;
332
+ data?: any;
333
+ dataLayer?: string | undefined;
334
+ domain?: string | undefined;
335
+ } | undefined;
336
+ }>, {
337
+ como?: boolean | Record<string, string | string[]> | undefined;
338
+ ga4?: {
339
+ measurementId: string;
340
+ data?: any;
341
+ debug?: boolean | undefined;
342
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
343
+ pageview?: boolean | undefined;
344
+ server_container_url?: string | undefined;
345
+ snakeCase?: boolean | undefined;
346
+ transport_url?: string | undefined;
347
+ } | undefined;
348
+ ads?: {
349
+ conversionId: string;
350
+ data?: any;
351
+ currency?: string | undefined;
352
+ } | undefined;
353
+ gtm?: {
354
+ containerId: string;
355
+ data?: any;
356
+ dataLayer?: string | undefined;
357
+ domain?: string | undefined;
358
+ } | undefined;
359
+ }, {
360
+ como?: boolean | Record<string, string | string[]> | undefined;
361
+ ga4?: {
362
+ measurementId: string;
363
+ data?: any;
364
+ debug?: boolean | undefined;
365
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
366
+ pageview?: boolean | undefined;
367
+ server_container_url?: string | undefined;
368
+ snakeCase?: boolean | undefined;
369
+ transport_url?: string | undefined;
370
+ } | undefined;
371
+ ads?: {
372
+ conversionId: string;
373
+ data?: any;
374
+ currency?: string | undefined;
375
+ } | undefined;
376
+ gtm?: {
377
+ containerId: string;
378
+ data?: any;
379
+ dataLayer?: string | undefined;
380
+ domain?: string | undefined;
381
+ } | undefined;
382
+ }>;
383
+ type Settings = z.infer<typeof SettingsSchema>;
384
+
385
+ /**
386
+ * Gtag Mapping Schema
387
+ * Tool-specific event-level mappings
388
+ */
389
+ declare const MappingSchema: z.ZodObject<{
390
+ ga4: z.ZodOptional<z.ZodObject<{
391
+ include: z.ZodOptional<z.ZodArray<z.ZodEnum<["all", "context", "data", "event", "globals", "source", "user", "version"]>, "many">>;
392
+ }, "strip", z.ZodTypeAny, {
393
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
394
+ }, {
395
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
396
+ }>>;
397
+ ads: z.ZodOptional<z.ZodObject<{
398
+ label: z.ZodOptional<z.ZodString>;
399
+ }, "strip", z.ZodTypeAny, {
400
+ label?: string | undefined;
401
+ }, {
402
+ label?: string | undefined;
403
+ }>>;
404
+ gtm: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
405
+ }, "strip", z.ZodTypeAny, {
406
+ ga4?: {
407
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
408
+ } | undefined;
409
+ ads?: {
410
+ label?: string | undefined;
411
+ } | undefined;
412
+ gtm?: {} | undefined;
413
+ }, {
414
+ ga4?: {
415
+ include?: ("data" | "event" | "all" | "context" | "globals" | "source" | "user" | "version")[] | undefined;
416
+ } | undefined;
417
+ ads?: {
418
+ label?: string | undefined;
419
+ } | undefined;
420
+ gtm?: {} | undefined;
421
+ }>;
422
+ /**
423
+ * Type inference from MappingSchema
424
+ */
425
+ type Mapping = z.infer<typeof MappingSchema>;
426
+
427
+ declare const settings: zod_to_json_schema.JsonSchema7Type & {
428
+ $schema?: string | undefined;
429
+ definitions?: {
430
+ [key: string]: zod_to_json_schema.JsonSchema7Type;
431
+ } | undefined;
432
+ };
433
+ declare const mapping: zod_to_json_schema.JsonSchema7Type & {
434
+ $schema?: string | undefined;
435
+ definitions?: {
436
+ [key: string]: zod_to_json_schema.JsonSchema7Type;
437
+ } | undefined;
438
+ };
439
+ declare const ga4: zod_to_json_schema.JsonSchema7Type & {
440
+ $schema?: string | undefined;
441
+ definitions?: {
442
+ [key: string]: zod_to_json_schema.JsonSchema7Type;
443
+ } | undefined;
444
+ };
445
+ declare const ads: zod_to_json_schema.JsonSchema7Type & {
446
+ $schema?: string | undefined;
447
+ definitions?: {
448
+ [key: string]: zod_to_json_schema.JsonSchema7Type;
449
+ } | undefined;
450
+ };
451
+ declare const gtm: zod_to_json_schema.JsonSchema7Type & {
452
+ $schema?: string | undefined;
453
+ definitions?: {
454
+ [key: string]: zod_to_json_schema.JsonSchema7Type;
455
+ } | undefined;
456
+ };
457
+
458
+ declare const index_AdsSettingsSchema: typeof AdsSettingsSchema;
459
+ declare const index_ConsentModeSchema: typeof ConsentModeSchema;
460
+ declare const index_GA4SettingsSchema: typeof GA4SettingsSchema;
461
+ declare const index_GTMSettingsSchema: typeof GTMSettingsSchema;
462
+ declare const index_IncludeSchema: typeof IncludeSchema;
463
+ type index_Mapping = Mapping;
464
+ declare const index_MappingSchema: typeof MappingSchema;
465
+ type index_Settings = Settings;
466
+ declare const index_SettingsSchema: typeof SettingsSchema;
467
+ declare const index_ads: typeof ads;
468
+ declare const index_ga4: typeof ga4;
469
+ declare const index_gtm: typeof gtm;
152
470
  declare const index_mapping: typeof mapping;
471
+ declare const index_settings: typeof settings;
153
472
  declare namespace index {
154
- export { index_env as env, index_events as events, index_mapping as mapping };
473
+ export { index_AdsSettingsSchema as AdsSettingsSchema, index_ConsentModeSchema as ConsentModeSchema, index_GA4SettingsSchema as GA4SettingsSchema, index_GTMSettingsSchema as GTMSettingsSchema, index_IncludeSchema as IncludeSchema, type index_Mapping as Mapping, index_MappingSchema as MappingSchema, type index_Settings as Settings, index_SettingsSchema as SettingsSchema, index_ads as ads, index_ga4 as ga4, index_gtm as gtm, index_mapping as mapping, index_settings as settings };
155
474
  }
156
475
 
157
476
  declare function resetConsentState(): void;
158
477
  declare const destinationGtag: Destination;
159
478
 
160
- export { index$1 as DestinationGtag, destinationGtag as default, destinationGtag, index as examples, resetConsentState };
479
+ export { index$2 as DestinationGtag, destinationGtag as default, destinationGtag, index$1 as examples, resetConsentState, index as schemas };