@aranova/tracking-react 0.24.1 → 0.25.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.
@@ -0,0 +1,1365 @@
1
+ import * as src from 'src';
2
+ import { z } from 'zod';
3
+ import { F as FormSubmitConfig, j as FormSubmitMetadata } from './phone-utils-BVzSNBf1.js';
4
+
5
+ /**
6
+ * Metadata for a manually fired `cta_click` event.
7
+ *
8
+ * Use this for non-phone calls to action such as directions, appointment
9
+ * buttons, downloads, or external booking links.
10
+ */
11
+ declare const ctaClickMetadataSchema: z.ZodObject<{
12
+ cta_name: z.ZodString;
13
+ page: z.ZodObject<{
14
+ path: z.ZodString;
15
+ }, "strict", z.ZodTypeAny, {
16
+ path: string;
17
+ }, {
18
+ path: string;
19
+ }>;
20
+ section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ page: {
26
+ path: string;
27
+ };
28
+ cta_name: string;
29
+ section?: string | null | undefined;
30
+ href?: string | null | undefined;
31
+ destination_url?: string | null | undefined;
32
+ element?: string | null | undefined;
33
+ }, {
34
+ page: {
35
+ path: string;
36
+ };
37
+ cta_name: string;
38
+ section?: string | null | undefined;
39
+ href?: string | null | undefined;
40
+ destination_url?: string | null | undefined;
41
+ element?: string | null | undefined;
42
+ }>;
43
+ type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
44
+ /**
45
+ * Registration config for `cta_click`.
46
+ *
47
+ * The event stays manually fireable; `autoCapture` additionally attaches a
48
+ * delegated click listener that fires it for any element matching `selector`
49
+ * (default `[data-aranova-cta]`) — tag your CTAs, get analytics for free.
50
+ */
51
+ declare const ctaClickConfigSchema: z.ZodObject<{
52
+ autoCapture: z.ZodOptional<z.ZodObject<{
53
+ selector: z.ZodOptional<z.ZodString>;
54
+ }, "strict", z.ZodTypeAny, {
55
+ selector?: string | undefined;
56
+ }, {
57
+ selector?: string | undefined;
58
+ }>>;
59
+ }, "strict", z.ZodTypeAny, {
60
+ autoCapture?: {
61
+ selector?: string | undefined;
62
+ } | undefined;
63
+ }, {
64
+ autoCapture?: {
65
+ selector?: string | undefined;
66
+ } | undefined;
67
+ }>;
68
+ type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
69
+
70
+ /**
71
+ * Registered trigger names reported by the SDK heartbeat.
72
+ */
73
+ declare const sdkHeartbeatTriggersSchema: z.ZodObject<{
74
+ automatic: z.ZodArray<z.ZodString, "many">;
75
+ manual: z.ZodArray<z.ZodString, "many">;
76
+ }, "strict", z.ZodTypeAny, {
77
+ automatic: string[];
78
+ manual: string[];
79
+ }, {
80
+ automatic: string[];
81
+ manual: string[];
82
+ }>;
83
+ /**
84
+ * Metadata for the SDK-internal `sdk_heartbeat` event.
85
+ *
86
+ * The SDK fires this once per new session so the dashboard can show which SDK
87
+ * version, install surface, and trigger registry a client site is running.
88
+ * Consumers do not manually register or fire this event.
89
+ */
90
+ declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
91
+ sdk_version: z.ZodString;
92
+ package_name: z.ZodNullable<z.ZodString>;
93
+ surface: z.ZodEnum<["next", "react", "script"]>;
94
+ triggers: z.ZodObject<{
95
+ automatic: z.ZodArray<z.ZodString, "many">;
96
+ manual: z.ZodArray<z.ZodString, "many">;
97
+ }, "strict", z.ZodTypeAny, {
98
+ automatic: string[];
99
+ manual: string[];
100
+ }, {
101
+ automatic: string[];
102
+ manual: string[];
103
+ }>;
104
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
105
+ configured_gtag_ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
106
+ }, "strict", z.ZodTypeAny, {
107
+ sdk_version: string;
108
+ package_name: string | null;
109
+ surface: "next" | "react" | "script";
110
+ triggers: {
111
+ automatic: string[];
112
+ manual: string[];
113
+ };
114
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
115
+ configured_gtag_ids?: Record<string, string> | null | undefined;
116
+ }, {
117
+ sdk_version: string;
118
+ package_name: string | null;
119
+ surface: "next" | "react" | "script";
120
+ triggers: {
121
+ automatic: string[];
122
+ manual: string[];
123
+ };
124
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
125
+ configured_gtag_ids?: Record<string, string> | null | undefined;
126
+ }>;
127
+ type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
128
+ /**
129
+ * Internal registration config for `sdk_heartbeat`.
130
+ *
131
+ * This event has no consumer-facing options.
132
+ */
133
+ declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
134
+ type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
135
+
136
+ /**
137
+ * Metadata for the automatic `form_start` event.
138
+ *
139
+ * The SDK emits this once per form when the visitor first focuses a field.
140
+ */
141
+ declare const formStartMetadataSchema: z.ZodObject<{
142
+ form: z.ZodObject<{
143
+ id: z.ZodString;
144
+ action: z.ZodNullable<z.ZodString>;
145
+ }, "strict", z.ZodTypeAny, {
146
+ id: string;
147
+ action: string | null;
148
+ }, {
149
+ id: string;
150
+ action: string | null;
151
+ }>;
152
+ page: z.ZodObject<{
153
+ path: z.ZodString;
154
+ }, "strict", z.ZodTypeAny, {
155
+ path: string;
156
+ }, {
157
+ path: string;
158
+ }>;
159
+ }, "strict", z.ZodTypeAny, {
160
+ form: {
161
+ id: string;
162
+ action: string | null;
163
+ };
164
+ page: {
165
+ path: string;
166
+ };
167
+ }, {
168
+ form: {
169
+ id: string;
170
+ action: string | null;
171
+ };
172
+ page: {
173
+ path: string;
174
+ };
175
+ }>;
176
+ type FormStartMetadata = z.infer<typeof formStartMetadataSchema>;
177
+ /**
178
+ * Registration config for automatic `form_start`.
179
+ *
180
+ * Use `selector` to narrow which forms can trigger the event. When omitted,
181
+ * the SDK observes all `<form>` elements.
182
+ */
183
+ declare const formStartConfigSchema: z.ZodObject<{
184
+ selector: z.ZodOptional<z.ZodString>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ selector?: string | undefined;
187
+ }, {
188
+ selector?: string | undefined;
189
+ }>;
190
+ type FormStartConfig = z.infer<typeof formStartConfigSchema>;
191
+
192
+ /**
193
+ * Metadata for the automatic `multi_page_session` event.
194
+ *
195
+ * Fired when the visitor reaches the configured distinct-page threshold in a
196
+ * single tracking session.
197
+ */
198
+ declare const multiPageSessionMetadataSchema: z.ZodObject<{
199
+ page_count: z.ZodNumber;
200
+ page: z.ZodObject<{
201
+ path: z.ZodString;
202
+ }, "strict", z.ZodTypeAny, {
203
+ path: string;
204
+ }, {
205
+ path: string;
206
+ }>;
207
+ }, "strict", z.ZodTypeAny, {
208
+ page: {
209
+ path: string;
210
+ };
211
+ page_count: number;
212
+ }, {
213
+ page: {
214
+ path: string;
215
+ };
216
+ page_count: number;
217
+ }>;
218
+ type MultiPageSessionMetadata = z.infer<typeof multiPageSessionMetadataSchema>;
219
+ /**
220
+ * Registration config for automatic `multi_page_session`.
221
+ */
222
+ declare const multiPageSessionConfigSchema: z.ZodObject<{
223
+ pageThreshold: z.ZodNumber;
224
+ }, "strict", z.ZodTypeAny, {
225
+ pageThreshold: number;
226
+ }, {
227
+ pageThreshold: number;
228
+ }>;
229
+ type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
230
+
231
+ /**
232
+ * Metadata for the automatic `page_exit` event.
233
+ *
234
+ * Fired when the user leaves a page (SPA navigation away, tab hidden, or
235
+ * pagehide). `dwell_ms` is the ACTIVE (visible) time spent on the page segment
236
+ * being closed — hidden time never counts, matching `time_on_site` semantics.
237
+ * A page revisited after being hidden emits another `page_exit` for the next
238
+ * visible segment, so summing `dwell_ms` per page/session yields total active
239
+ * dwell without double counting.
240
+ */
241
+ declare const pageExitMetadataSchema: z.ZodObject<{
242
+ dwell_ms: z.ZodNumber;
243
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
244
+ scroll_baseline_percent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
245
+ page: z.ZodObject<{
246
+ path: z.ZodString;
247
+ }, "strict", z.ZodTypeAny, {
248
+ path: string;
249
+ }, {
250
+ path: string;
251
+ }>;
252
+ }, "strict", z.ZodTypeAny, {
253
+ page: {
254
+ path: string;
255
+ };
256
+ dwell_ms: number;
257
+ max_scroll_percent: number | null;
258
+ scroll_baseline_percent?: number | null | undefined;
259
+ }, {
260
+ page: {
261
+ path: string;
262
+ };
263
+ dwell_ms: number;
264
+ max_scroll_percent: number | null;
265
+ scroll_baseline_percent?: number | null | undefined;
266
+ }>;
267
+ type PageExitMetadata = z.infer<typeof pageExitMetadataSchema>;
268
+ /**
269
+ * Registration config for automatic `page_exit`.
270
+ *
271
+ * SDK-internal: attached unconditionally (like `sdk_heartbeat`), so there are
272
+ * no registration options.
273
+ */
274
+ declare const pageExitConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
275
+ type PageExitConfig = z.infer<typeof pageExitConfigSchema>;
276
+
277
+ /**
278
+ * Metadata for the automatic `page_view` event.
279
+ *
280
+ * The SDK emits this on initial load, SPA route changes, and bfcache restores.
281
+ * Consumers do not call `trackEvent('page_view', ...)`; registering
282
+ * `automatic: { page_view: {} }` enables the SDK-owned trigger.
283
+ */
284
+ declare const pageViewMetadataSchema: z.ZodObject<{
285
+ page: z.ZodObject<{
286
+ title: z.ZodNullable<z.ZodString>;
287
+ path: z.ZodString;
288
+ search: z.ZodString;
289
+ hash: z.ZodString;
290
+ }, "strict", z.ZodTypeAny, {
291
+ path: string;
292
+ search: string;
293
+ title: string | null;
294
+ hash: string;
295
+ }, {
296
+ path: string;
297
+ search: string;
298
+ title: string | null;
299
+ hash: string;
300
+ }>;
301
+ referrer: z.ZodNullable<z.ZodString>;
302
+ viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
303
+ w: z.ZodNumber;
304
+ h: z.ZodNumber;
305
+ }, "strict", z.ZodTypeAny, {
306
+ w: number;
307
+ h: number;
308
+ }, {
309
+ w: number;
310
+ h: number;
311
+ }>>>;
312
+ }, "strict", z.ZodTypeAny, {
313
+ page: {
314
+ path: string;
315
+ search: string;
316
+ title: string | null;
317
+ hash: string;
318
+ };
319
+ referrer: string | null;
320
+ viewport?: {
321
+ w: number;
322
+ h: number;
323
+ } | null | undefined;
324
+ }, {
325
+ page: {
326
+ path: string;
327
+ search: string;
328
+ title: string | null;
329
+ hash: string;
330
+ };
331
+ referrer: string | null;
332
+ viewport?: {
333
+ w: number;
334
+ h: number;
335
+ } | null | undefined;
336
+ }>;
337
+ type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
338
+ /**
339
+ * Registration config for automatic `page_view`.
340
+ *
341
+ * `page_view` is required in every trigger registry and currently has no
342
+ * options. Use `{ page_view: {} }`.
343
+ */
344
+ declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
345
+ type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
346
+
347
+ /**
348
+ * Metadata for a manually fired `phone_click` event.
349
+ *
350
+ * `phone_number` should be the business phone number from the clicked `tel:`
351
+ * link, not a visitor-entered phone number. `section` can distinguish header,
352
+ * footer, hero, or contact-page links.
353
+ */
354
+ declare const phoneClickMetadataSchema: z.ZodObject<{
355
+ phone_number: z.ZodString;
356
+ page: z.ZodObject<{
357
+ path: z.ZodString;
358
+ }, "strict", z.ZodTypeAny, {
359
+ path: string;
360
+ }, {
361
+ path: string;
362
+ }>;
363
+ section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
+ }, "strict", z.ZodTypeAny, {
365
+ page: {
366
+ path: string;
367
+ };
368
+ phone_number: string;
369
+ section?: string | null | undefined;
370
+ }, {
371
+ page: {
372
+ path: string;
373
+ };
374
+ phone_number: string;
375
+ section?: string | null | undefined;
376
+ }>;
377
+ type PhoneClickMetadata = z.infer<typeof phoneClickMetadataSchema>;
378
+ /**
379
+ * Registration config for `phone_click`.
380
+ *
381
+ * The event stays manually fireable; `autoCapture` additionally attaches a
382
+ * delegated click listener that fires it for any `tel:` link matching
383
+ * `selector` (default `a[href^="tel:"]`) — link your phone number, get the
384
+ * analytics event (and, for a linked phone-click goal, the conversion) for free.
385
+ */
386
+ declare const phoneClickConfigSchema: z.ZodObject<{
387
+ autoCapture: z.ZodOptional<z.ZodObject<{
388
+ selector: z.ZodOptional<z.ZodString>;
389
+ }, "strict", z.ZodTypeAny, {
390
+ selector?: string | undefined;
391
+ }, {
392
+ selector?: string | undefined;
393
+ }>>;
394
+ }, "strict", z.ZodTypeAny, {
395
+ autoCapture?: {
396
+ selector?: string | undefined;
397
+ } | undefined;
398
+ }, {
399
+ autoCapture?: {
400
+ selector?: string | undefined;
401
+ } | undefined;
402
+ }>;
403
+ type PhoneClickConfig = z.infer<typeof phoneClickConfigSchema>;
404
+
405
+ /**
406
+ * Metadata for the automatic `scroll_depth` event.
407
+ *
408
+ * Fired once per configured threshold per page.
409
+ */
410
+ declare const scrollDepthMetadataSchema: z.ZodObject<{
411
+ depth_percent: z.ZodNumber;
412
+ page: z.ZodObject<{
413
+ path: z.ZodString;
414
+ }, "strict", z.ZodTypeAny, {
415
+ path: string;
416
+ }, {
417
+ path: string;
418
+ }>;
419
+ }, "strict", z.ZodTypeAny, {
420
+ page: {
421
+ path: string;
422
+ };
423
+ depth_percent: number;
424
+ }, {
425
+ page: {
426
+ path: string;
427
+ };
428
+ depth_percent: number;
429
+ }>;
430
+ type ScrollDepthMetadata = z.infer<typeof scrollDepthMetadataSchema>;
431
+ /**
432
+ * Registration config for automatic `scroll_depth`.
433
+ *
434
+ * `thresholds` are integer percentages from 1 to 100.
435
+ */
436
+ declare const scrollDepthConfigSchema: z.ZodObject<{
437
+ thresholds: z.ZodArray<z.ZodNumber, "many">;
438
+ }, "strict", z.ZodTypeAny, {
439
+ thresholds: number[];
440
+ }, {
441
+ thresholds: number[];
442
+ }>;
443
+ type ScrollDepthConfig = z.infer<typeof scrollDepthConfigSchema>;
444
+
445
+ declare const PAGE_IDENTITY_MAX_LENGTH = 64;
446
+ declare const PAGE_IDENTITY_PATTERN: RegExp;
447
+ /** Common page identities offered as presets by operator tooling. */
448
+ declare const SPECIFIC_PAGE_NAMES: readonly ["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"];
449
+ declare const pageIdentitySchema: z.ZodString;
450
+ type PageIdentity = z.infer<typeof pageIdentitySchema>;
451
+ /** @deprecated Use PageIdentity. Kept as a compatibility alias for existing consumers. */
452
+ type SpecificPageName = PageIdentity;
453
+ /** @deprecated Use pageIdentitySchema. Kept for source compatibility. */
454
+ declare const specificPageNameSchema: z.ZodString;
455
+ /**
456
+ * Metadata for the automatic `specific_page_visit` event.
457
+ *
458
+ * The SDK emits this when the current pathname matches one of the configured
459
+ * named page patterns.
460
+ */
461
+ declare const specificPageVisitMetadataSchema: z.ZodObject<{
462
+ page_name: z.ZodString;
463
+ page: z.ZodObject<{
464
+ path: z.ZodString;
465
+ }, "strict", z.ZodTypeAny, {
466
+ path: string;
467
+ }, {
468
+ path: string;
469
+ }>;
470
+ }, "strict", z.ZodTypeAny, {
471
+ page: {
472
+ path: string;
473
+ };
474
+ page_name: string;
475
+ }, {
476
+ page: {
477
+ path: string;
478
+ };
479
+ page_name: string;
480
+ }>;
481
+ type SpecificPageVisitMetadata = z.infer<typeof specificPageVisitMetadataSchema>;
482
+ /**
483
+ * Registration config for automatic `specific_page_visit`.
484
+ *
485
+ * Each page entry pairs a stable, validated identity with a `RegExp` that
486
+ * matches the pathname. The identity can use a preset above or a client-specific
487
+ * lowercase snake-case slug.
488
+ */
489
+ declare const specificPageVisitConfigSchema: z.ZodObject<{
490
+ pages: z.ZodArray<z.ZodObject<{
491
+ name: z.ZodString;
492
+ pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
493
+ }, "strict", z.ZodTypeAny, {
494
+ name: string;
495
+ pathPattern: RegExp;
496
+ }, {
497
+ name: string;
498
+ pathPattern: RegExp;
499
+ }>, "many">;
500
+ }, "strict", z.ZodTypeAny, {
501
+ pages: {
502
+ name: string;
503
+ pathPattern: RegExp;
504
+ }[];
505
+ }, {
506
+ pages: {
507
+ name: string;
508
+ pathPattern: RegExp;
509
+ }[];
510
+ }>;
511
+ type SpecificPageVisitConfig = z.infer<typeof specificPageVisitConfigSchema>;
512
+
513
+ /**
514
+ * Metadata for the automatic `time_on_site` event.
515
+ *
516
+ * The SDK starts a visibility-aware timer and fires once when visible
517
+ * engagement crosses the configured threshold.
518
+ */
519
+ declare const timeOnSiteMetadataSchema: z.ZodObject<{
520
+ duration_ms: z.ZodNumber;
521
+ page: z.ZodObject<{
522
+ path: z.ZodString;
523
+ }, "strict", z.ZodTypeAny, {
524
+ path: string;
525
+ }, {
526
+ path: string;
527
+ }>;
528
+ }, "strict", z.ZodTypeAny, {
529
+ page: {
530
+ path: string;
531
+ };
532
+ duration_ms: number;
533
+ }, {
534
+ page: {
535
+ path: string;
536
+ };
537
+ duration_ms: number;
538
+ }>;
539
+ type TimeOnSiteMetadata = z.infer<typeof timeOnSiteMetadataSchema>;
540
+ /**
541
+ * Registration config for automatic `time_on_site`.
542
+ */
543
+ declare const timeOnSiteConfigSchema: z.ZodObject<{
544
+ thresholdSeconds: z.ZodNumber;
545
+ }, "strict", z.ZodTypeAny, {
546
+ thresholdSeconds: number;
547
+ }, {
548
+ thresholdSeconds: number;
549
+ }>;
550
+ type TimeOnSiteConfig = z.infer<typeof timeOnSiteConfigSchema>;
551
+
552
+ type EventOutcomeRole = "lead" | "engagement" | "navigation" | "diagnostic";
553
+ type EventCategory = "page" | "engagement" | "lead" | "commerce" | "system";
554
+ type EventClientVisibility = "simple" | "detailed" | "hidden";
555
+ interface EventSemantics {
556
+ label: string;
557
+ category: EventCategory;
558
+ outcomeRole: EventOutcomeRole;
559
+ clientVisibility: EventClientVisibility;
560
+ }
561
+ /**
562
+ * Lightweight runtime event metadata. This module intentionally imports no
563
+ * Zod schemas so dashboards and framework adapters can consume it without
564
+ * pulling the validation registry into their bundles.
565
+ */
566
+ declare const EVENT_SEMANTICS: {
567
+ readonly page_view: {
568
+ readonly label: "Page view";
569
+ readonly category: "page";
570
+ readonly outcomeRole: "navigation";
571
+ readonly clientVisibility: "simple";
572
+ };
573
+ readonly time_on_site: {
574
+ readonly label: "Time on site";
575
+ readonly category: "engagement";
576
+ readonly outcomeRole: "engagement";
577
+ readonly clientVisibility: "detailed";
578
+ };
579
+ readonly specific_page_visit: {
580
+ readonly label: "Key page visit";
581
+ readonly category: "engagement";
582
+ readonly outcomeRole: "engagement";
583
+ readonly clientVisibility: "detailed";
584
+ };
585
+ readonly scroll_depth: {
586
+ readonly label: "Scroll depth";
587
+ readonly category: "engagement";
588
+ readonly outcomeRole: "engagement";
589
+ readonly clientVisibility: "detailed";
590
+ };
591
+ readonly multi_page_session: {
592
+ readonly label: "Multi-page session";
593
+ readonly category: "engagement";
594
+ readonly outcomeRole: "engagement";
595
+ readonly clientVisibility: "detailed";
596
+ };
597
+ readonly form_start: {
598
+ readonly label: "Form started";
599
+ readonly category: "engagement";
600
+ readonly outcomeRole: "engagement";
601
+ readonly clientVisibility: "simple";
602
+ };
603
+ readonly sdk_heartbeat: {
604
+ readonly label: "SDK heartbeat";
605
+ readonly category: "system";
606
+ readonly outcomeRole: "diagnostic";
607
+ readonly clientVisibility: "hidden";
608
+ };
609
+ readonly page_exit: {
610
+ readonly label: "Page exit";
611
+ readonly category: "engagement";
612
+ readonly outcomeRole: "diagnostic";
613
+ readonly clientVisibility: "detailed";
614
+ };
615
+ readonly form_submit: {
616
+ readonly label: "Form submitted";
617
+ readonly category: "lead";
618
+ readonly outcomeRole: "lead";
619
+ readonly clientVisibility: "simple";
620
+ };
621
+ readonly phone_click: {
622
+ readonly label: "Phone click";
623
+ readonly category: "lead";
624
+ readonly outcomeRole: "lead";
625
+ readonly clientVisibility: "simple";
626
+ };
627
+ readonly cta_click: {
628
+ readonly label: "CTA click";
629
+ readonly category: "engagement";
630
+ readonly outcomeRole: "engagement";
631
+ readonly clientVisibility: "simple";
632
+ };
633
+ };
634
+ type EventName = keyof typeof EVENT_SEMANTICS;
635
+ declare function getEventSemantics(eventName: string): EventSemantics | null;
636
+
637
+ type EventKind = "automatic" | "manual";
638
+ declare const EVENT_REGISTRY: {
639
+ readonly page_view: {
640
+ readonly kind: "automatic";
641
+ readonly semantics: {
642
+ readonly label: "Page view";
643
+ readonly category: "page";
644
+ readonly outcomeRole: "navigation";
645
+ readonly clientVisibility: "simple";
646
+ };
647
+ readonly metadataSchema: z.ZodObject<{
648
+ page: z.ZodObject<{
649
+ title: z.ZodNullable<z.ZodString>;
650
+ path: z.ZodString;
651
+ search: z.ZodString;
652
+ hash: z.ZodString;
653
+ }, "strict", z.ZodTypeAny, {
654
+ path: string;
655
+ search: string;
656
+ title: string | null;
657
+ hash: string;
658
+ }, {
659
+ path: string;
660
+ search: string;
661
+ title: string | null;
662
+ hash: string;
663
+ }>;
664
+ referrer: z.ZodNullable<z.ZodString>;
665
+ viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
666
+ w: z.ZodNumber;
667
+ h: z.ZodNumber;
668
+ }, "strict", z.ZodTypeAny, {
669
+ w: number;
670
+ h: number;
671
+ }, {
672
+ w: number;
673
+ h: number;
674
+ }>>>;
675
+ }, "strict", z.ZodTypeAny, {
676
+ page: {
677
+ path: string;
678
+ search: string;
679
+ title: string | null;
680
+ hash: string;
681
+ };
682
+ referrer: string | null;
683
+ viewport?: {
684
+ w: number;
685
+ h: number;
686
+ } | null | undefined;
687
+ }, {
688
+ page: {
689
+ path: string;
690
+ search: string;
691
+ title: string | null;
692
+ hash: string;
693
+ };
694
+ referrer: string | null;
695
+ viewport?: {
696
+ w: number;
697
+ h: number;
698
+ } | null | undefined;
699
+ }>;
700
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
701
+ };
702
+ readonly time_on_site: {
703
+ readonly kind: "automatic";
704
+ readonly semantics: {
705
+ readonly label: "Time on site";
706
+ readonly category: "engagement";
707
+ readonly outcomeRole: "engagement";
708
+ readonly clientVisibility: "detailed";
709
+ };
710
+ readonly metadataSchema: z.ZodObject<{
711
+ duration_ms: z.ZodNumber;
712
+ page: z.ZodObject<{
713
+ path: z.ZodString;
714
+ }, "strict", z.ZodTypeAny, {
715
+ path: string;
716
+ }, {
717
+ path: string;
718
+ }>;
719
+ }, "strict", z.ZodTypeAny, {
720
+ page: {
721
+ path: string;
722
+ };
723
+ duration_ms: number;
724
+ }, {
725
+ page: {
726
+ path: string;
727
+ };
728
+ duration_ms: number;
729
+ }>;
730
+ readonly configSchema: z.ZodObject<{
731
+ thresholdSeconds: z.ZodNumber;
732
+ }, "strict", z.ZodTypeAny, {
733
+ thresholdSeconds: number;
734
+ }, {
735
+ thresholdSeconds: number;
736
+ }>;
737
+ };
738
+ readonly specific_page_visit: {
739
+ readonly kind: "automatic";
740
+ readonly semantics: {
741
+ readonly label: "Key page visit";
742
+ readonly category: "engagement";
743
+ readonly outcomeRole: "engagement";
744
+ readonly clientVisibility: "detailed";
745
+ };
746
+ readonly metadataSchema: z.ZodObject<{
747
+ page_name: z.ZodString;
748
+ page: z.ZodObject<{
749
+ path: z.ZodString;
750
+ }, "strict", z.ZodTypeAny, {
751
+ path: string;
752
+ }, {
753
+ path: string;
754
+ }>;
755
+ }, "strict", z.ZodTypeAny, {
756
+ page: {
757
+ path: string;
758
+ };
759
+ page_name: string;
760
+ }, {
761
+ page: {
762
+ path: string;
763
+ };
764
+ page_name: string;
765
+ }>;
766
+ readonly configSchema: z.ZodObject<{
767
+ pages: z.ZodArray<z.ZodObject<{
768
+ name: z.ZodString;
769
+ pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
770
+ }, "strict", z.ZodTypeAny, {
771
+ name: string;
772
+ pathPattern: RegExp;
773
+ }, {
774
+ name: string;
775
+ pathPattern: RegExp;
776
+ }>, "many">;
777
+ }, "strict", z.ZodTypeAny, {
778
+ pages: {
779
+ name: string;
780
+ pathPattern: RegExp;
781
+ }[];
782
+ }, {
783
+ pages: {
784
+ name: string;
785
+ pathPattern: RegExp;
786
+ }[];
787
+ }>;
788
+ };
789
+ readonly scroll_depth: {
790
+ readonly kind: "automatic";
791
+ readonly semantics: {
792
+ readonly label: "Scroll depth";
793
+ readonly category: "engagement";
794
+ readonly outcomeRole: "engagement";
795
+ readonly clientVisibility: "detailed";
796
+ };
797
+ readonly metadataSchema: z.ZodObject<{
798
+ depth_percent: z.ZodNumber;
799
+ page: z.ZodObject<{
800
+ path: z.ZodString;
801
+ }, "strict", z.ZodTypeAny, {
802
+ path: string;
803
+ }, {
804
+ path: string;
805
+ }>;
806
+ }, "strict", z.ZodTypeAny, {
807
+ page: {
808
+ path: string;
809
+ };
810
+ depth_percent: number;
811
+ }, {
812
+ page: {
813
+ path: string;
814
+ };
815
+ depth_percent: number;
816
+ }>;
817
+ readonly configSchema: z.ZodObject<{
818
+ thresholds: z.ZodArray<z.ZodNumber, "many">;
819
+ }, "strict", z.ZodTypeAny, {
820
+ thresholds: number[];
821
+ }, {
822
+ thresholds: number[];
823
+ }>;
824
+ };
825
+ readonly multi_page_session: {
826
+ readonly kind: "automatic";
827
+ readonly semantics: {
828
+ readonly label: "Multi-page session";
829
+ readonly category: "engagement";
830
+ readonly outcomeRole: "engagement";
831
+ readonly clientVisibility: "detailed";
832
+ };
833
+ readonly metadataSchema: z.ZodObject<{
834
+ page_count: z.ZodNumber;
835
+ page: z.ZodObject<{
836
+ path: z.ZodString;
837
+ }, "strict", z.ZodTypeAny, {
838
+ path: string;
839
+ }, {
840
+ path: string;
841
+ }>;
842
+ }, "strict", z.ZodTypeAny, {
843
+ page: {
844
+ path: string;
845
+ };
846
+ page_count: number;
847
+ }, {
848
+ page: {
849
+ path: string;
850
+ };
851
+ page_count: number;
852
+ }>;
853
+ readonly configSchema: z.ZodObject<{
854
+ pageThreshold: z.ZodNumber;
855
+ }, "strict", z.ZodTypeAny, {
856
+ pageThreshold: number;
857
+ }, {
858
+ pageThreshold: number;
859
+ }>;
860
+ };
861
+ readonly form_start: {
862
+ readonly kind: "automatic";
863
+ readonly semantics: {
864
+ readonly label: "Form started";
865
+ readonly category: "engagement";
866
+ readonly outcomeRole: "engagement";
867
+ readonly clientVisibility: "simple";
868
+ };
869
+ readonly metadataSchema: z.ZodObject<{
870
+ form: z.ZodObject<{
871
+ id: z.ZodString;
872
+ action: z.ZodNullable<z.ZodString>;
873
+ }, "strict", z.ZodTypeAny, {
874
+ id: string;
875
+ action: string | null;
876
+ }, {
877
+ id: string;
878
+ action: string | null;
879
+ }>;
880
+ page: z.ZodObject<{
881
+ path: z.ZodString;
882
+ }, "strict", z.ZodTypeAny, {
883
+ path: string;
884
+ }, {
885
+ path: string;
886
+ }>;
887
+ }, "strict", z.ZodTypeAny, {
888
+ form: {
889
+ id: string;
890
+ action: string | null;
891
+ };
892
+ page: {
893
+ path: string;
894
+ };
895
+ }, {
896
+ form: {
897
+ id: string;
898
+ action: string | null;
899
+ };
900
+ page: {
901
+ path: string;
902
+ };
903
+ }>;
904
+ readonly configSchema: z.ZodObject<{
905
+ selector: z.ZodOptional<z.ZodString>;
906
+ }, "strict", z.ZodTypeAny, {
907
+ selector?: string | undefined;
908
+ }, {
909
+ selector?: string | undefined;
910
+ }>;
911
+ };
912
+ readonly sdk_heartbeat: {
913
+ readonly kind: "automatic";
914
+ readonly semantics: {
915
+ readonly label: "SDK heartbeat";
916
+ readonly category: "system";
917
+ readonly outcomeRole: "diagnostic";
918
+ readonly clientVisibility: "hidden";
919
+ };
920
+ readonly metadataSchema: z.ZodObject<{
921
+ sdk_version: z.ZodString;
922
+ package_name: z.ZodNullable<z.ZodString>;
923
+ surface: z.ZodEnum<["next", "react", "script"]>;
924
+ triggers: z.ZodObject<{
925
+ automatic: z.ZodArray<z.ZodString, "many">;
926
+ manual: z.ZodArray<z.ZodString, "many">;
927
+ }, "strict", z.ZodTypeAny, {
928
+ automatic: string[];
929
+ manual: string[];
930
+ }, {
931
+ automatic: string[];
932
+ manual: string[];
933
+ }>;
934
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
935
+ configured_gtag_ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
936
+ }, "strict", z.ZodTypeAny, {
937
+ sdk_version: string;
938
+ package_name: string | null;
939
+ surface: "next" | "react" | "script";
940
+ triggers: {
941
+ automatic: string[];
942
+ manual: string[];
943
+ };
944
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
945
+ configured_gtag_ids?: Record<string, string> | null | undefined;
946
+ }, {
947
+ sdk_version: string;
948
+ package_name: string | null;
949
+ surface: "next" | "react" | "script";
950
+ triggers: {
951
+ automatic: string[];
952
+ manual: string[];
953
+ };
954
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
955
+ configured_gtag_ids?: Record<string, string> | null | undefined;
956
+ }>;
957
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
958
+ };
959
+ readonly page_exit: {
960
+ readonly kind: "automatic";
961
+ readonly semantics: {
962
+ readonly label: "Page exit";
963
+ readonly category: "engagement";
964
+ readonly outcomeRole: "diagnostic";
965
+ readonly clientVisibility: "detailed";
966
+ };
967
+ readonly metadataSchema: z.ZodObject<{
968
+ dwell_ms: z.ZodNumber;
969
+ max_scroll_percent: z.ZodNullable<z.ZodNumber>;
970
+ scroll_baseline_percent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
971
+ page: z.ZodObject<{
972
+ path: z.ZodString;
973
+ }, "strict", z.ZodTypeAny, {
974
+ path: string;
975
+ }, {
976
+ path: string;
977
+ }>;
978
+ }, "strict", z.ZodTypeAny, {
979
+ page: {
980
+ path: string;
981
+ };
982
+ dwell_ms: number;
983
+ max_scroll_percent: number | null;
984
+ scroll_baseline_percent?: number | null | undefined;
985
+ }, {
986
+ page: {
987
+ path: string;
988
+ };
989
+ dwell_ms: number;
990
+ max_scroll_percent: number | null;
991
+ scroll_baseline_percent?: number | null | undefined;
992
+ }>;
993
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
994
+ };
995
+ readonly form_submit: {
996
+ readonly kind: "manual";
997
+ readonly semantics: {
998
+ readonly label: "Form submitted";
999
+ readonly category: "lead";
1000
+ readonly outcomeRole: "lead";
1001
+ readonly clientVisibility: "simple";
1002
+ };
1003
+ readonly metadataSchema: z.ZodObject<{
1004
+ form: z.ZodObject<{
1005
+ id: z.ZodString;
1006
+ action: z.ZodNullable<z.ZodString>;
1007
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1008
+ name: z.ZodString;
1009
+ type: z.ZodString;
1010
+ label: z.ZodNullable<z.ZodString>;
1011
+ value: z.ZodType<src.JsonValue, z.ZodTypeDef, src.JsonValue>;
1012
+ }, "strict", z.ZodTypeAny, {
1013
+ value: src.JsonValue;
1014
+ type: string;
1015
+ name: string;
1016
+ label: string | null;
1017
+ }, {
1018
+ value: src.JsonValue;
1019
+ type: string;
1020
+ name: string;
1021
+ label: string | null;
1022
+ }>, "many">>;
1023
+ }, "strict", z.ZodTypeAny, {
1024
+ id: string;
1025
+ action: string | null;
1026
+ fields?: {
1027
+ value: src.JsonValue;
1028
+ type: string;
1029
+ name: string;
1030
+ label: string | null;
1031
+ }[] | undefined;
1032
+ }, {
1033
+ id: string;
1034
+ action: string | null;
1035
+ fields?: {
1036
+ value: src.JsonValue;
1037
+ type: string;
1038
+ name: string;
1039
+ label: string | null;
1040
+ }[] | undefined;
1041
+ }>;
1042
+ page: z.ZodObject<{
1043
+ path: z.ZodString;
1044
+ }, "strict", z.ZodTypeAny, {
1045
+ path: string;
1046
+ }, {
1047
+ path: string;
1048
+ }>;
1049
+ }, "strict", z.ZodTypeAny, {
1050
+ form: {
1051
+ id: string;
1052
+ action: string | null;
1053
+ fields?: {
1054
+ value: src.JsonValue;
1055
+ type: string;
1056
+ name: string;
1057
+ label: string | null;
1058
+ }[] | undefined;
1059
+ };
1060
+ page: {
1061
+ path: string;
1062
+ };
1063
+ }, {
1064
+ form: {
1065
+ id: string;
1066
+ action: string | null;
1067
+ fields?: {
1068
+ value: src.JsonValue;
1069
+ type: string;
1070
+ name: string;
1071
+ label: string | null;
1072
+ }[] | undefined;
1073
+ };
1074
+ page: {
1075
+ path: string;
1076
+ };
1077
+ }>;
1078
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
1079
+ };
1080
+ readonly phone_click: {
1081
+ readonly kind: "manual";
1082
+ readonly semantics: {
1083
+ readonly label: "Phone click";
1084
+ readonly category: "lead";
1085
+ readonly outcomeRole: "lead";
1086
+ readonly clientVisibility: "simple";
1087
+ };
1088
+ readonly metadataSchema: z.ZodObject<{
1089
+ phone_number: z.ZodString;
1090
+ page: z.ZodObject<{
1091
+ path: z.ZodString;
1092
+ }, "strict", z.ZodTypeAny, {
1093
+ path: string;
1094
+ }, {
1095
+ path: string;
1096
+ }>;
1097
+ section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1098
+ }, "strict", z.ZodTypeAny, {
1099
+ page: {
1100
+ path: string;
1101
+ };
1102
+ phone_number: string;
1103
+ section?: string | null | undefined;
1104
+ }, {
1105
+ page: {
1106
+ path: string;
1107
+ };
1108
+ phone_number: string;
1109
+ section?: string | null | undefined;
1110
+ }>;
1111
+ readonly configSchema: z.ZodObject<{
1112
+ autoCapture: z.ZodOptional<z.ZodObject<{
1113
+ selector: z.ZodOptional<z.ZodString>;
1114
+ }, "strict", z.ZodTypeAny, {
1115
+ selector?: string | undefined;
1116
+ }, {
1117
+ selector?: string | undefined;
1118
+ }>>;
1119
+ }, "strict", z.ZodTypeAny, {
1120
+ autoCapture?: {
1121
+ selector?: string | undefined;
1122
+ } | undefined;
1123
+ }, {
1124
+ autoCapture?: {
1125
+ selector?: string | undefined;
1126
+ } | undefined;
1127
+ }>;
1128
+ };
1129
+ readonly cta_click: {
1130
+ readonly kind: "manual";
1131
+ readonly semantics: {
1132
+ readonly label: "CTA click";
1133
+ readonly category: "engagement";
1134
+ readonly outcomeRole: "engagement";
1135
+ readonly clientVisibility: "simple";
1136
+ };
1137
+ readonly metadataSchema: z.ZodObject<{
1138
+ cta_name: z.ZodString;
1139
+ page: z.ZodObject<{
1140
+ path: z.ZodString;
1141
+ }, "strict", z.ZodTypeAny, {
1142
+ path: string;
1143
+ }, {
1144
+ path: string;
1145
+ }>;
1146
+ section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1147
+ destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1148
+ href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1149
+ element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1150
+ }, "strict", z.ZodTypeAny, {
1151
+ page: {
1152
+ path: string;
1153
+ };
1154
+ cta_name: string;
1155
+ section?: string | null | undefined;
1156
+ href?: string | null | undefined;
1157
+ destination_url?: string | null | undefined;
1158
+ element?: string | null | undefined;
1159
+ }, {
1160
+ page: {
1161
+ path: string;
1162
+ };
1163
+ cta_name: string;
1164
+ section?: string | null | undefined;
1165
+ href?: string | null | undefined;
1166
+ destination_url?: string | null | undefined;
1167
+ element?: string | null | undefined;
1168
+ }>;
1169
+ readonly configSchema: z.ZodObject<{
1170
+ autoCapture: z.ZodOptional<z.ZodObject<{
1171
+ selector: z.ZodOptional<z.ZodString>;
1172
+ }, "strict", z.ZodTypeAny, {
1173
+ selector?: string | undefined;
1174
+ }, {
1175
+ selector?: string | undefined;
1176
+ }>>;
1177
+ }, "strict", z.ZodTypeAny, {
1178
+ autoCapture?: {
1179
+ selector?: string | undefined;
1180
+ } | undefined;
1181
+ }, {
1182
+ autoCapture?: {
1183
+ selector?: string | undefined;
1184
+ } | undefined;
1185
+ }>;
1186
+ };
1187
+ };
1188
+ /**
1189
+ * Event names that are fired by the SDK when their configured signal occurs.
1190
+ *
1191
+ * Automatic events are not accepted by the typed `trackEvent()` API.
1192
+ */
1193
+ type AutomaticEventName = {
1194
+ [K in EventName]: (typeof EVENT_REGISTRY)[K]["kind"] extends "automatic" ? K : never;
1195
+ }[EventName];
1196
+ /**
1197
+ * Event names that consumer code can fire manually after registering them.
1198
+ */
1199
+ type ManualEventName = {
1200
+ [K in EventName]: (typeof EVENT_REGISTRY)[K]["kind"] extends "manual" ? K : never;
1201
+ }[EventName];
1202
+ type MetadataByName = {
1203
+ page_view: PageViewMetadata;
1204
+ time_on_site: TimeOnSiteMetadata;
1205
+ specific_page_visit: SpecificPageVisitMetadata;
1206
+ scroll_depth: ScrollDepthMetadata;
1207
+ multi_page_session: MultiPageSessionMetadata;
1208
+ form_start: FormStartMetadata;
1209
+ sdk_heartbeat: SdkHeartbeatMetadata;
1210
+ page_exit: PageExitMetadata;
1211
+ form_submit: FormSubmitMetadata;
1212
+ phone_click: PhoneClickMetadata;
1213
+ cta_click: CtaClickMetadata;
1214
+ };
1215
+ type ConfigByName = {
1216
+ page_view: PageViewConfig;
1217
+ time_on_site: TimeOnSiteConfig;
1218
+ specific_page_visit: SpecificPageVisitConfig;
1219
+ scroll_depth: ScrollDepthConfig;
1220
+ multi_page_session: MultiPageSessionConfig;
1221
+ form_start: FormStartConfig;
1222
+ sdk_heartbeat: SdkHeartbeatConfig;
1223
+ page_exit: PageExitConfig;
1224
+ form_submit: FormSubmitConfig;
1225
+ phone_click: PhoneClickConfig;
1226
+ cta_click: CtaClickConfig;
1227
+ };
1228
+ /**
1229
+ * Metadata payload type for a specific tracking event.
1230
+ *
1231
+ * @example
1232
+ * ```ts
1233
+ * type SubmitMetadata = EventMetadata<'form_submit'>;
1234
+ * ```
1235
+ */
1236
+ type EventMetadata<K extends EventName> = MetadataByName[K];
1237
+ /**
1238
+ * Trigger registration config type for a specific tracking event.
1239
+ */
1240
+ type EventConfig<K extends EventName> = ConfigByName[K];
1241
+ /**
1242
+ * Runtime list of automatic event names.
1243
+ */
1244
+ declare const ALL_AUTOMATIC_EVENT_NAMES: readonly AutomaticEventName[];
1245
+ /**
1246
+ * Runtime list of manual event names.
1247
+ */
1248
+ declare const ALL_MANUAL_EVENT_NAMES: readonly ManualEventName[];
1249
+ /**
1250
+ * Events that represent a lead/outcome in first-party tracking projections.
1251
+ */
1252
+ declare const ALL_LEAD_EVENT_NAMES: readonly EventName[];
1253
+ /**
1254
+ * Trigger registry passed to `createTracking({ triggers })`.
1255
+ *
1256
+ * `automatic.page_view` is required because every install should capture page
1257
+ * views. Other automatic events are opt-in. Manual events must be registered
1258
+ * here before the typed client accepts `trackEvent()` calls for them.
1259
+ *
1260
+ * @example
1261
+ * ```ts
1262
+ * createTracking({
1263
+ * apiKey,
1264
+ * endpoint,
1265
+ * triggers: {
1266
+ * automatic: {
1267
+ * page_view: {},
1268
+ * time_on_site: { thresholdSeconds: 60 },
1269
+ * },
1270
+ * manual: {
1271
+ * form_submit: {},
1272
+ * phone_click: {},
1273
+ * },
1274
+ * },
1275
+ * });
1276
+ * ```
1277
+ */
1278
+ type TriggerRegistryConfig = {
1279
+ automatic: {
1280
+ page_view: EventConfig<"page_view">;
1281
+ } & Partial<{
1282
+ time_on_site: EventConfig<"time_on_site">;
1283
+ specific_page_visit: EventConfig<"specific_page_visit">;
1284
+ scroll_depth: EventConfig<"scroll_depth">;
1285
+ multi_page_session: EventConfig<"multi_page_session">;
1286
+ form_start: EventConfig<"form_start">;
1287
+ }>;
1288
+ manual?: Partial<{
1289
+ form_submit: EventConfig<"form_submit">;
1290
+ phone_click: EventConfig<"phone_click">;
1291
+ cta_click: EventConfig<"cta_click">;
1292
+ }>;
1293
+ };
1294
+ /**
1295
+ * Manual event names registered in a concrete trigger registry.
1296
+ *
1297
+ * Used by `TypedTrackingClient` so `trackEvent()` only accepts events the
1298
+ * consumer explicitly enabled.
1299
+ */
1300
+ type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry["manual"]>, ManualEventName>;
1301
+ /**
1302
+ * Automatic event names registered in a concrete trigger registry.
1303
+ */
1304
+ type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry["automatic"], AutomaticEventName>;
1305
+ /**
1306
+ * Discriminated union of valid manual tracking calls for a registry.
1307
+ */
1308
+ type TrackableEvent<TRegistry extends TriggerRegistryConfig> = {
1309
+ [K in RegisteredManualEvents<TRegistry>]: {
1310
+ eventType: K;
1311
+ metadata: EventMetadata<K>;
1312
+ };
1313
+ }[RegisteredManualEvents<TRegistry>];
1314
+ declare function getEventDefinition(name: EventName): {
1315
+ kind: EventKind;
1316
+ semantics: EventSemantics;
1317
+ metadataSchema: z.ZodTypeAny;
1318
+ configSchema: z.ZodTypeAny;
1319
+ };
1320
+
1321
+ interface TypedTrackEventOptions {
1322
+ /**
1323
+ * Override the page URL associated with this event.
1324
+ *
1325
+ * Omit this for normal browser usage; the SDK captures `window.location.href`.
1326
+ */
1327
+ pageUrl?: string | null;
1328
+ /**
1329
+ * Override the event timestamp.
1330
+ *
1331
+ * Defaults to the time the event is queued. Accepts a `Date` or ISO string.
1332
+ */
1333
+ occurredAt?: Date | string | null;
1334
+ }
1335
+ /**
1336
+ * Typed tracking client returned by `useTracking()`.
1337
+ *
1338
+ * The accepted event names and metadata shapes are narrowed from the concrete
1339
+ * trigger registry supplied to `createTracking()`.
1340
+ */
1341
+ interface TypedTrackingClient<TRegistry extends TriggerRegistryConfig> {
1342
+ /**
1343
+ * Fire a manually-registered event. The event name must be present in
1344
+ * the registry's `manual` map and the metadata must match that event's
1345
+ * canonical Zod-derived shape.
1346
+ */
1347
+ trackEvent<K extends RegisteredManualEvents<TRegistry>>(eventType: K, metadata: EventMetadata<K>, options?: TypedTrackEventOptions): void;
1348
+ /**
1349
+ * Immediately flush queued events to the ingest endpoint.
1350
+ *
1351
+ * Normal consumers rarely need this because the SDK flushes on a debounce,
1352
+ * when the queue reaches the batch threshold, and on `pagehide`.
1353
+ */
1354
+ flush(): Promise<void>;
1355
+ /**
1356
+ * Return the current rolling session id.
1357
+ */
1358
+ getSessionId(): string;
1359
+ /**
1360
+ * Return the persistent visitor id for this browser profile.
1361
+ */
1362
+ getVisitorId(): string;
1363
+ }
1364
+
1365
+ export { multiPageSessionMetadataSchema as $, ALL_AUTOMATIC_EVENT_NAMES as A, type ScrollDepthMetadata as B, type CtaClickConfig as C, type SdkHeartbeatConfig as D, EVENT_REGISTRY as E, type FormStartConfig as F, type SdkHeartbeatMetadata as G, type SpecificPageName as H, type SpecificPageVisitConfig as I, type SpecificPageVisitMetadata as J, type TimeOnSiteMetadata as K, type TrackableEvent as L, type ManualEventName as M, type TriggerRegistryConfig as N, type TypedTrackEventOptions as O, PAGE_IDENTITY_MAX_LENGTH as P, type TypedTrackingClient as Q, type RegisteredAutomaticEvents as R, SPECIFIC_PAGE_NAMES as S, type TimeOnSiteConfig as T, ctaClickConfigSchema as U, ctaClickMetadataSchema as V, formStartConfigSchema as W, formStartMetadataSchema as X, getEventDefinition as Y, getEventSemantics as Z, multiPageSessionConfigSchema as _, ALL_LEAD_EVENT_NAMES as a, pageExitConfigSchema as a0, pageExitMetadataSchema as a1, pageIdentitySchema as a2, pageViewConfigSchema as a3, pageViewMetadataSchema as a4, phoneClickConfigSchema as a5, phoneClickMetadataSchema as a6, scrollDepthConfigSchema as a7, scrollDepthMetadataSchema as a8, sdkHeartbeatConfigSchema as a9, sdkHeartbeatMetadataSchema as aa, sdkHeartbeatTriggersSchema as ab, specificPageNameSchema as ac, specificPageVisitConfigSchema as ad, specificPageVisitMetadataSchema as ae, timeOnSiteConfigSchema as af, timeOnSiteMetadataSchema as ag, ALL_MANUAL_EVENT_NAMES as b, type AutomaticEventName as c, type CtaClickMetadata as d, EVENT_SEMANTICS as e, type EventCategory as f, type EventClientVisibility as g, type EventConfig as h, type EventKind as i, type EventMetadata as j, type EventName as k, type EventOutcomeRole as l, type EventSemantics as m, type FormStartMetadata as n, type MultiPageSessionConfig as o, type MultiPageSessionMetadata as p, PAGE_IDENTITY_PATTERN as q, type PageExitConfig as r, type PageExitMetadata as s, type PageIdentity as t, type PageViewConfig as u, type PageViewMetadata as v, type PhoneClickConfig as w, type PhoneClickMetadata as x, type RegisteredManualEvents as y, type ScrollDepthConfig as z };