@aranova/tracking-react 0.24.0 → 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.
package/dist/index.d.mts CHANGED
@@ -1,61 +1,12 @@
1
- import * as react from 'react';
2
- import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
3
- import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload, F as FormSubmitConfig, f as FormSubmitMetadata, G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, C as ConsentState, g as ConsentChoiceState, h as ConsentSource, P as PhoneConfig, i as ParsedPhone, j as PhoneDisplayFormat } from './phone-utils-FTQnybMz.mjs';
4
- export { k as ConsentChoice, D as DEFAULT_DECLINE_TTL_DAYS, l as DEFAULT_PHONE_COUNTRY, J as JsonValue, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-FTQnybMz.mjs';
5
- import { T as TrackingConfigReference, C as ConversionConfig } from './sales-BwWnvl8L.mjs';
6
- export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, d as ConversionConfigStore, e as ConversionUserData, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, E as SaleItem, F as SaleItemInput, H as SaleKeysetSortField, I as SaleListPage, J as SaleListQuery, K as SaleListQueryV2, L as SaleService, M as SaleServiceInput, O as SaleSortField, Q as SaleSortOrder, R as SaleSummary, U as SaleSummaryPrevious, V as SaleSummaryQuery, W as SaleSummaryQueryV2, X as SaleSummaryV2, Y as SaleUpdateInput, Z as SalesBusinessClient, _ as SalesCategoryBreakdown, $ as SalesClient, a0 as SalesClientConfig, a1 as SalesCustomersClient, a2 as SalesServiceBreakdown, a3 as SalesTransportConfig, a4 as SalesTrendPoint, a5 as SummaryCurrencyDelta, a6 as SummaryDeltas, a7 as SummaryWindow, a8 as SupportedCurrency, a9 as TRACKING_RANGES, aa as TrackingOverviewRange, ab as clearStashedUserData, ac as createSalesClient, ad as fetchServices, ae as formatDateInTz, af as formatMoney, ag as fromMinor, ah as getTrackingConfigRuntime, ai as resolveConversionConfig, aj as resolveTrackingConfigUrl, ak as saleCreateSchema, al as saleItemSchema, am as saleServiceSchema, an as saleUpdateSchema, ao as salesRequest, ap as stashUserData, aq as toMinor } from './sales-BwWnvl8L.mjs';
7
- import * as src from 'src';
8
- import { z } from 'zod';
9
- import { CountryCode } from 'libphonenumber-js';
1
+ export { AdPlatformTracking, AdPlatformTrackingProps, ConsentBanner, ConsentBannerProps, CreateTrackingOptions, CreateTrackingResult, GoogleAdsTracking, GoogleAdsTrackingProps, PhoneField, PhoneFieldApi, PhoneFieldProps, PhoneInputProps, TrackingProviderProps, UseConsentResult, UseCookiePreferencesOptions, UseCookiePreferencesResult, UsePhoneFieldOptions, createTracking, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams } from '@aranova/tracking-react/client';
2
+ import { T as TrackingParams, a as TrackingInstallSurface, b as TrackingEnvironment, c as TrackingClientContext, d as TrackingEventCreatePayload, e as TrackingSessionUpsertPayload } from './phone-utils-BVzSNBf1.mjs';
3
+ export { C as ConsentChoice, f as ConsentChoiceState, g as ConsentSource, h as ConsentState, D as DEFAULT_DECLINE_TTL_DAYS, i as DEFAULT_PHONE_COUNTRY, F as FormSubmitConfig, j as FormSubmitMetadata, G as GtagEnvironmentMap, J as JsonValue, M as MetaPixelEnvironmentMap, P as ParsedPhone, k as PhoneConfig, l as PhoneDisplayFormat, S as SetConsentOptions, m as TrackedField, n as TrackingInitConfig, o as formSubmitConfigSchema, p as formSubmitMetadataSchema, q as formatPhone, r as formatPhoneAsTyped, s as getConsentChoice, t as getConsentState, u as jsonValueSchema, v as onConsentChange, w as optIn, x as optOut, y as parsePhone, z as phoneField, A as resetConsent, B as setConsentState, E as toE164 } from './phone-utils-BVzSNBf1.mjs';
4
+ export { A as AranovaApiError, B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, C as CompareTo, c as ConversionUserData, d as CurrencyRevenue, e as CustomerCurrencyDelta, f as CustomerCurrencyTotal, g as CustomerGetOptions, h as CustomerGetResult, i as CustomerKpis, j as CustomerKpisDeltas, k as CustomerKpisPrevious, l as CustomerListPage, m as CustomerListQuery, n as CustomerProfile, o as CustomerSegment, p as CustomerSegmentCount, q as CustomerSortField, r as CustomerSummary, s as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, t as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, u as Sale, v as SaleCursorPage, w as SaleFilters, x as SaleInput, y as SaleItem, z as SaleItemInput, E as SaleKeysetSortField, F as SaleListPage, H as SaleListQuery, I as SaleListQueryV2, J as SaleService, K as SaleServiceInput, L as SaleSortField, M as SaleSortOrder, O as SaleSummary, Q as SaleSummaryPrevious, R as SaleSummaryQuery, T as SaleSummaryQueryV2, U as SaleSummaryV2, V as SaleUpdateInput, W as SalesBusinessClient, X as SalesCategoryBreakdown, Y as SalesClient, Z as SalesClientConfig, _ as SalesCustomersClient, $ as SalesServiceBreakdown, a0 as SalesTransportConfig, a1 as SalesTrendPoint, a2 as SummaryCurrencyDelta, a3 as SummaryDeltas, a4 as SummaryWindow, a5 as SupportedCurrency, a6 as TRACKING_RANGES, a7 as TrackingOverviewRange, a8 as clearStashedUserData, a9 as createSalesClient, aa as fetchServices, ab as formatDateInTz, ac as formatMoney, ad as fromMinor, ae as saleCreateSchema, af as saleItemSchema, ag as saleServiceSchema, ah as saleUpdateSchema, ai as salesRequest, aj as stashUserData, ak as toMinor } from './sales-C3B0BOBQ.mjs';
5
+ export { C as ConversionConfig, a as ConversionConfigStore, T as TrackingConfigReference, g as getTrackingConfigRuntime, r as resolveConversionConfig, b as resolveTrackingConfigUrl } from './tracking-config-runtime-BnUlS_Ae.mjs';
6
+ export { A as ALL_AUTOMATIC_EVENT_NAMES, a as ALL_LEAD_EVENT_NAMES, b as ALL_MANUAL_EVENT_NAMES, c as AutomaticEventName, C as CtaClickConfig, d as CtaClickMetadata, E as EVENT_REGISTRY, e as EVENT_SEMANTICS, f as EventCategory, g as EventClientVisibility, h as EventConfig, i as EventKind, j as EventMetadata, k as EventName, l as EventOutcomeRole, m as EventSemantics, F as FormStartConfig, n as FormStartMetadata, M as ManualEventName, o as MultiPageSessionConfig, p as MultiPageSessionMetadata, P as PAGE_IDENTITY_MAX_LENGTH, q as PAGE_IDENTITY_PATTERN, r as PageExitConfig, s as PageExitMetadata, t as PageIdentity, u as PageViewConfig, v as PageViewMetadata, w as PhoneClickConfig, x as PhoneClickMetadata, R as RegisteredAutomaticEvents, y as RegisteredManualEvents, S as SPECIFIC_PAGE_NAMES, z as ScrollDepthConfig, B as ScrollDepthMetadata, D as SdkHeartbeatConfig, G as SdkHeartbeatMetadata, H as SpecificPageName, I as SpecificPageVisitConfig, J as SpecificPageVisitMetadata, T as TimeOnSiteConfig, K as TimeOnSiteMetadata, L as TrackableEvent, N as TriggerRegistryConfig, O as TypedTrackEventOptions, Q as TypedTrackingClient, U as ctaClickConfigSchema, V as ctaClickMetadataSchema, W as formStartConfigSchema, X as formStartMetadataSchema, Y as getEventDefinition, Z as getEventSemantics, _ as multiPageSessionConfigSchema, $ as multiPageSessionMetadataSchema, a0 as pageExitConfigSchema, a1 as pageExitMetadataSchema, a2 as pageIdentitySchema, a3 as pageViewConfigSchema, a4 as pageViewMetadataSchema, a5 as phoneClickConfigSchema, a6 as phoneClickMetadataSchema, a7 as scrollDepthConfigSchema, a8 as scrollDepthMetadataSchema, a9 as sdkHeartbeatConfigSchema, aa as sdkHeartbeatMetadataSchema, ab as sdkHeartbeatTriggersSchema, ac as specificPageNameSchema, ad as specificPageVisitConfigSchema, ae as specificPageVisitMetadataSchema, af as timeOnSiteConfigSchema, ag as timeOnSiteMetadataSchema } from './ingest-typed-BioxtBJD.mjs';
10
7
  export { CountryCode } from 'libphonenumber-js';
11
-
12
- /**
13
- * Legacy opt-in-era consent banner.
14
- *
15
- * @deprecated PERMANENTLY INERT since consent v2 (opt-out model): it renders
16
- * only while consent is `pending`, and the effective state is never `pending`
17
- * anymore, so this component always returns `null`. Tracking is on by default;
18
- * replace the banner with a footer "cookie preferences" control built on
19
- * {@link useCookiePreferences} (see the package README). Kept exported so
20
- * existing integrations keep compiling; scheduled for removal.
21
- */
22
- interface ConsentBannerProps {
23
- /** Body text. Defaults to the standard cookies-for-ad-performance message. */
24
- message?: ReactNode;
25
- /** Optional bold title above the body text. */
26
- title?: ReactNode;
27
- /** Label for the accept button. Default: `"Accept"`. */
28
- acceptLabel?: string;
29
- /** Label for the decline button. Default: `"Decline"`. */
30
- declineLabel?: string;
31
- /** Optional link inline with the message (e.g. to a privacy policy). */
32
- policyHref?: string;
33
- /** Visible text for {@link policyHref}. Default: `"Learn more"`. */
34
- policyLabel?: string;
35
- /**
36
- * Fires after the consent state is persisted + propagated to gtag. Useful
37
- * for emitting your own analytics event on the choice.
38
- */
39
- onAccept?: () => void;
40
- onDecline?: () => void;
41
- /** Where the banner docks. Default: `"bottom"`. */
42
- position?: "top" | "bottom";
43
- /**
44
- * Visual theme. `"auto"` follows `prefers-color-scheme`. Default: `"light"`.
45
- */
46
- theme?: "light" | "dark" | "auto";
47
- /** Class added to the outer wrapper for additional styling hooks. */
48
- className?: string;
49
- /** Inline style overrides applied to the outer wrapper after the defaults. */
50
- style?: CSSProperties;
51
- }
52
- /**
53
- * @deprecated Permanently inert since consent v2 — always renders `null`
54
- * because the effective consent state is never `pending`. Use a footer
55
- * control built on {@link useCookiePreferences} instead. See
56
- * {@link ConsentBannerProps} for details.
57
- */
58
- declare function ConsentBanner({ message, title, acceptLabel, declineLabel, policyHref, policyLabel, onAccept, onDecline, position, theme, className, style, }?: ConsentBannerProps): ReactNode;
8
+ import 'zod';
9
+ import 'src';
59
10
 
60
11
  /**
61
12
  * Attribution query/cookie keys captured by the SDK.
@@ -110,1322 +61,6 @@ declare function createTrackingSessionUpsertPayload(trackingParams: TrackingPara
110
61
  */
111
62
  declare function createTrackingEventCreatePayload(trackingParams: TrackingParams, input: TrackingEventInput, context: TrackingClientContext): TrackingEventCreatePayload;
112
63
 
113
- /**
114
- * Metadata for a manually fired `cta_click` event.
115
- *
116
- * Use this for non-phone calls to action such as directions, appointment
117
- * buttons, downloads, or external booking links.
118
- */
119
- declare const ctaClickMetadataSchema: z.ZodObject<{
120
- cta_name: z.ZodString;
121
- page: z.ZodObject<{
122
- path: z.ZodString;
123
- }, "strict", z.ZodTypeAny, {
124
- path: string;
125
- }, {
126
- path: string;
127
- }>;
128
- section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
129
- destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
- href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
- element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
- }, "strict", z.ZodTypeAny, {
133
- page: {
134
- path: string;
135
- };
136
- cta_name: string;
137
- section?: string | null | undefined;
138
- href?: string | null | undefined;
139
- destination_url?: string | null | undefined;
140
- element?: string | null | undefined;
141
- }, {
142
- page: {
143
- path: string;
144
- };
145
- cta_name: string;
146
- section?: string | null | undefined;
147
- href?: string | null | undefined;
148
- destination_url?: string | null | undefined;
149
- element?: string | null | undefined;
150
- }>;
151
- type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
152
- /**
153
- * Registration config for `cta_click`.
154
- *
155
- * The event stays manually fireable; `autoCapture` additionally attaches a
156
- * delegated click listener that fires it for any element matching `selector`
157
- * (default `[data-aranova-cta]`) — tag your CTAs, get analytics for free.
158
- */
159
- declare const ctaClickConfigSchema: z.ZodObject<{
160
- autoCapture: z.ZodOptional<z.ZodObject<{
161
- selector: z.ZodOptional<z.ZodString>;
162
- }, "strict", z.ZodTypeAny, {
163
- selector?: string | undefined;
164
- }, {
165
- selector?: string | undefined;
166
- }>>;
167
- }, "strict", z.ZodTypeAny, {
168
- autoCapture?: {
169
- selector?: string | undefined;
170
- } | undefined;
171
- }, {
172
- autoCapture?: {
173
- selector?: string | undefined;
174
- } | undefined;
175
- }>;
176
- type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
177
-
178
- /**
179
- * Registered trigger names reported by the SDK heartbeat.
180
- */
181
- declare const sdkHeartbeatTriggersSchema: z.ZodObject<{
182
- automatic: z.ZodArray<z.ZodString, "many">;
183
- manual: z.ZodArray<z.ZodString, "many">;
184
- }, "strict", z.ZodTypeAny, {
185
- automatic: string[];
186
- manual: string[];
187
- }, {
188
- automatic: string[];
189
- manual: string[];
190
- }>;
191
- /**
192
- * Metadata for the SDK-internal `sdk_heartbeat` event.
193
- *
194
- * The SDK fires this once per new session so the dashboard can show which SDK
195
- * version, install surface, and trigger registry a client site is running.
196
- * Consumers do not manually register or fire this event.
197
- */
198
- declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
199
- sdk_version: z.ZodString;
200
- package_name: z.ZodNullable<z.ZodString>;
201
- surface: z.ZodEnum<["next", "react", "script"]>;
202
- triggers: z.ZodObject<{
203
- automatic: z.ZodArray<z.ZodString, "many">;
204
- manual: z.ZodArray<z.ZodString, "many">;
205
- }, "strict", z.ZodTypeAny, {
206
- automatic: string[];
207
- manual: string[];
208
- }, {
209
- automatic: string[];
210
- manual: string[];
211
- }>;
212
- trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
213
- configured_gtag_ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
214
- }, "strict", z.ZodTypeAny, {
215
- sdk_version: string;
216
- package_name: string | null;
217
- surface: "next" | "react" | "script";
218
- triggers: {
219
- automatic: string[];
220
- manual: string[];
221
- };
222
- trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
223
- configured_gtag_ids?: Record<string, string> | null | undefined;
224
- }, {
225
- sdk_version: string;
226
- package_name: string | null;
227
- surface: "next" | "react" | "script";
228
- triggers: {
229
- automatic: string[];
230
- manual: string[];
231
- };
232
- trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
233
- configured_gtag_ids?: Record<string, string> | null | undefined;
234
- }>;
235
- type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
236
- /**
237
- * Internal registration config for `sdk_heartbeat`.
238
- *
239
- * This event has no consumer-facing options.
240
- */
241
- declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
242
- type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
243
-
244
- /**
245
- * Metadata for the automatic `form_start` event.
246
- *
247
- * The SDK emits this once per form when the visitor first focuses a field.
248
- */
249
- declare const formStartMetadataSchema: z.ZodObject<{
250
- form: z.ZodObject<{
251
- id: z.ZodString;
252
- action: z.ZodNullable<z.ZodString>;
253
- }, "strict", z.ZodTypeAny, {
254
- id: string;
255
- action: string | null;
256
- }, {
257
- id: string;
258
- action: string | null;
259
- }>;
260
- page: z.ZodObject<{
261
- path: z.ZodString;
262
- }, "strict", z.ZodTypeAny, {
263
- path: string;
264
- }, {
265
- path: string;
266
- }>;
267
- }, "strict", z.ZodTypeAny, {
268
- form: {
269
- id: string;
270
- action: string | null;
271
- };
272
- page: {
273
- path: string;
274
- };
275
- }, {
276
- form: {
277
- id: string;
278
- action: string | null;
279
- };
280
- page: {
281
- path: string;
282
- };
283
- }>;
284
- type FormStartMetadata = z.infer<typeof formStartMetadataSchema>;
285
- /**
286
- * Registration config for automatic `form_start`.
287
- *
288
- * Use `selector` to narrow which forms can trigger the event. When omitted,
289
- * the SDK observes all `<form>` elements.
290
- */
291
- declare const formStartConfigSchema: z.ZodObject<{
292
- selector: z.ZodOptional<z.ZodString>;
293
- }, "strict", z.ZodTypeAny, {
294
- selector?: string | undefined;
295
- }, {
296
- selector?: string | undefined;
297
- }>;
298
- type FormStartConfig = z.infer<typeof formStartConfigSchema>;
299
-
300
- /**
301
- * Metadata for the automatic `multi_page_session` event.
302
- *
303
- * Fired when the visitor reaches the configured distinct-page threshold in a
304
- * single tracking session.
305
- */
306
- declare const multiPageSessionMetadataSchema: z.ZodObject<{
307
- page_count: z.ZodNumber;
308
- page: z.ZodObject<{
309
- path: z.ZodString;
310
- }, "strict", z.ZodTypeAny, {
311
- path: string;
312
- }, {
313
- path: string;
314
- }>;
315
- }, "strict", z.ZodTypeAny, {
316
- page: {
317
- path: string;
318
- };
319
- page_count: number;
320
- }, {
321
- page: {
322
- path: string;
323
- };
324
- page_count: number;
325
- }>;
326
- type MultiPageSessionMetadata = z.infer<typeof multiPageSessionMetadataSchema>;
327
- /**
328
- * Registration config for automatic `multi_page_session`.
329
- */
330
- declare const multiPageSessionConfigSchema: z.ZodObject<{
331
- pageThreshold: z.ZodNumber;
332
- }, "strict", z.ZodTypeAny, {
333
- pageThreshold: number;
334
- }, {
335
- pageThreshold: number;
336
- }>;
337
- type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
338
-
339
- /**
340
- * Metadata for the automatic `page_exit` event.
341
- *
342
- * Fired when the user leaves a page (SPA navigation away, tab hidden, or
343
- * pagehide). `dwell_ms` is the ACTIVE (visible) time spent on the page segment
344
- * being closed — hidden time never counts, matching `time_on_site` semantics.
345
- * A page revisited after being hidden emits another `page_exit` for the next
346
- * visible segment, so summing `dwell_ms` per page/session yields total active
347
- * dwell without double counting.
348
- */
349
- declare const pageExitMetadataSchema: z.ZodObject<{
350
- dwell_ms: z.ZodNumber;
351
- max_scroll_percent: z.ZodNullable<z.ZodNumber>;
352
- scroll_baseline_percent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
353
- page: z.ZodObject<{
354
- path: z.ZodString;
355
- }, "strict", z.ZodTypeAny, {
356
- path: string;
357
- }, {
358
- path: string;
359
- }>;
360
- }, "strict", z.ZodTypeAny, {
361
- page: {
362
- path: string;
363
- };
364
- dwell_ms: number;
365
- max_scroll_percent: number | null;
366
- scroll_baseline_percent?: number | null | undefined;
367
- }, {
368
- page: {
369
- path: string;
370
- };
371
- dwell_ms: number;
372
- max_scroll_percent: number | null;
373
- scroll_baseline_percent?: number | null | undefined;
374
- }>;
375
- type PageExitMetadata = z.infer<typeof pageExitMetadataSchema>;
376
- /**
377
- * Registration config for automatic `page_exit`.
378
- *
379
- * SDK-internal: attached unconditionally (like `sdk_heartbeat`), so there are
380
- * no registration options.
381
- */
382
- declare const pageExitConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
383
- type PageExitConfig = z.infer<typeof pageExitConfigSchema>;
384
-
385
- /**
386
- * Metadata for the automatic `page_view` event.
387
- *
388
- * The SDK emits this on initial load, SPA route changes, and bfcache restores.
389
- * Consumers do not call `trackEvent('page_view', ...)`; registering
390
- * `automatic: { page_view: {} }` enables the SDK-owned trigger.
391
- */
392
- declare const pageViewMetadataSchema: z.ZodObject<{
393
- page: z.ZodObject<{
394
- title: z.ZodNullable<z.ZodString>;
395
- path: z.ZodString;
396
- search: z.ZodString;
397
- hash: z.ZodString;
398
- }, "strict", z.ZodTypeAny, {
399
- path: string;
400
- search: string;
401
- title: string | null;
402
- hash: string;
403
- }, {
404
- path: string;
405
- search: string;
406
- title: string | null;
407
- hash: string;
408
- }>;
409
- referrer: z.ZodNullable<z.ZodString>;
410
- viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
411
- w: z.ZodNumber;
412
- h: z.ZodNumber;
413
- }, "strict", z.ZodTypeAny, {
414
- w: number;
415
- h: number;
416
- }, {
417
- w: number;
418
- h: number;
419
- }>>>;
420
- }, "strict", z.ZodTypeAny, {
421
- page: {
422
- path: string;
423
- search: string;
424
- title: string | null;
425
- hash: string;
426
- };
427
- referrer: string | null;
428
- viewport?: {
429
- w: number;
430
- h: number;
431
- } | null | undefined;
432
- }, {
433
- page: {
434
- path: string;
435
- search: string;
436
- title: string | null;
437
- hash: string;
438
- };
439
- referrer: string | null;
440
- viewport?: {
441
- w: number;
442
- h: number;
443
- } | null | undefined;
444
- }>;
445
- type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
446
- /**
447
- * Registration config for automatic `page_view`.
448
- *
449
- * `page_view` is required in every trigger registry and currently has no
450
- * options. Use `{ page_view: {} }`.
451
- */
452
- declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
453
- type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
454
-
455
- /**
456
- * Metadata for a manually fired `phone_click` event.
457
- *
458
- * `phone_number` should be the business phone number from the clicked `tel:`
459
- * link, not a visitor-entered phone number. `section` can distinguish header,
460
- * footer, hero, or contact-page links.
461
- */
462
- declare const phoneClickMetadataSchema: z.ZodObject<{
463
- phone_number: z.ZodString;
464
- page: z.ZodObject<{
465
- path: z.ZodString;
466
- }, "strict", z.ZodTypeAny, {
467
- path: string;
468
- }, {
469
- path: string;
470
- }>;
471
- section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
472
- }, "strict", z.ZodTypeAny, {
473
- page: {
474
- path: string;
475
- };
476
- phone_number: string;
477
- section?: string | null | undefined;
478
- }, {
479
- page: {
480
- path: string;
481
- };
482
- phone_number: string;
483
- section?: string | null | undefined;
484
- }>;
485
- type PhoneClickMetadata = z.infer<typeof phoneClickMetadataSchema>;
486
- /**
487
- * Registration config for `phone_click`.
488
- *
489
- * The event stays manually fireable; `autoCapture` additionally attaches a
490
- * delegated click listener that fires it for any `tel:` link matching
491
- * `selector` (default `a[href^="tel:"]`) — link your phone number, get the
492
- * analytics event (and, for a linked phone-click goal, the conversion) for free.
493
- */
494
- declare const phoneClickConfigSchema: z.ZodObject<{
495
- autoCapture: z.ZodOptional<z.ZodObject<{
496
- selector: z.ZodOptional<z.ZodString>;
497
- }, "strict", z.ZodTypeAny, {
498
- selector?: string | undefined;
499
- }, {
500
- selector?: string | undefined;
501
- }>>;
502
- }, "strict", z.ZodTypeAny, {
503
- autoCapture?: {
504
- selector?: string | undefined;
505
- } | undefined;
506
- }, {
507
- autoCapture?: {
508
- selector?: string | undefined;
509
- } | undefined;
510
- }>;
511
- type PhoneClickConfig = z.infer<typeof phoneClickConfigSchema>;
512
-
513
- /**
514
- * Metadata for the automatic `scroll_depth` event.
515
- *
516
- * Fired once per configured threshold per page.
517
- */
518
- declare const scrollDepthMetadataSchema: z.ZodObject<{
519
- depth_percent: z.ZodNumber;
520
- page: z.ZodObject<{
521
- path: z.ZodString;
522
- }, "strict", z.ZodTypeAny, {
523
- path: string;
524
- }, {
525
- path: string;
526
- }>;
527
- }, "strict", z.ZodTypeAny, {
528
- page: {
529
- path: string;
530
- };
531
- depth_percent: number;
532
- }, {
533
- page: {
534
- path: string;
535
- };
536
- depth_percent: number;
537
- }>;
538
- type ScrollDepthMetadata = z.infer<typeof scrollDepthMetadataSchema>;
539
- /**
540
- * Registration config for automatic `scroll_depth`.
541
- *
542
- * `thresholds` are integer percentages from 1 to 100.
543
- */
544
- declare const scrollDepthConfigSchema: z.ZodObject<{
545
- thresholds: z.ZodArray<z.ZodNumber, "many">;
546
- }, "strict", z.ZodTypeAny, {
547
- thresholds: number[];
548
- }, {
549
- thresholds: number[];
550
- }>;
551
- type ScrollDepthConfig = z.infer<typeof scrollDepthConfigSchema>;
552
-
553
- declare const PAGE_IDENTITY_MAX_LENGTH = 64;
554
- declare const PAGE_IDENTITY_PATTERN: RegExp;
555
- /** Common page identities offered as presets by operator tooling. */
556
- declare const SPECIFIC_PAGE_NAMES: readonly ["contact_page", "about_page", "services_page", "booking_page", "location_page", "pricing_page", "faq_page", "testimonials_page"];
557
- declare const pageIdentitySchema: z.ZodString;
558
- type PageIdentity = z.infer<typeof pageIdentitySchema>;
559
- /** @deprecated Use PageIdentity. Kept as a compatibility alias for existing consumers. */
560
- type SpecificPageName = PageIdentity;
561
- /** @deprecated Use pageIdentitySchema. Kept for source compatibility. */
562
- declare const specificPageNameSchema: z.ZodString;
563
- /**
564
- * Metadata for the automatic `specific_page_visit` event.
565
- *
566
- * The SDK emits this when the current pathname matches one of the configured
567
- * named page patterns.
568
- */
569
- declare const specificPageVisitMetadataSchema: z.ZodObject<{
570
- page_name: z.ZodString;
571
- page: z.ZodObject<{
572
- path: z.ZodString;
573
- }, "strict", z.ZodTypeAny, {
574
- path: string;
575
- }, {
576
- path: string;
577
- }>;
578
- }, "strict", z.ZodTypeAny, {
579
- page: {
580
- path: string;
581
- };
582
- page_name: string;
583
- }, {
584
- page: {
585
- path: string;
586
- };
587
- page_name: string;
588
- }>;
589
- type SpecificPageVisitMetadata = z.infer<typeof specificPageVisitMetadataSchema>;
590
- /**
591
- * Registration config for automatic `specific_page_visit`.
592
- *
593
- * Each page entry pairs a stable, validated identity with a `RegExp` that
594
- * matches the pathname. The identity can use a preset above or a client-specific
595
- * lowercase snake-case slug.
596
- */
597
- declare const specificPageVisitConfigSchema: z.ZodObject<{
598
- pages: z.ZodArray<z.ZodObject<{
599
- name: z.ZodString;
600
- pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
601
- }, "strict", z.ZodTypeAny, {
602
- name: string;
603
- pathPattern: RegExp;
604
- }, {
605
- name: string;
606
- pathPattern: RegExp;
607
- }>, "many">;
608
- }, "strict", z.ZodTypeAny, {
609
- pages: {
610
- name: string;
611
- pathPattern: RegExp;
612
- }[];
613
- }, {
614
- pages: {
615
- name: string;
616
- pathPattern: RegExp;
617
- }[];
618
- }>;
619
- type SpecificPageVisitConfig = z.infer<typeof specificPageVisitConfigSchema>;
620
-
621
- /**
622
- * Metadata for the automatic `time_on_site` event.
623
- *
624
- * The SDK starts a visibility-aware timer and fires once when visible
625
- * engagement crosses the configured threshold.
626
- */
627
- declare const timeOnSiteMetadataSchema: z.ZodObject<{
628
- duration_ms: z.ZodNumber;
629
- page: z.ZodObject<{
630
- path: z.ZodString;
631
- }, "strict", z.ZodTypeAny, {
632
- path: string;
633
- }, {
634
- path: string;
635
- }>;
636
- }, "strict", z.ZodTypeAny, {
637
- page: {
638
- path: string;
639
- };
640
- duration_ms: number;
641
- }, {
642
- page: {
643
- path: string;
644
- };
645
- duration_ms: number;
646
- }>;
647
- type TimeOnSiteMetadata = z.infer<typeof timeOnSiteMetadataSchema>;
648
- /**
649
- * Registration config for automatic `time_on_site`.
650
- */
651
- declare const timeOnSiteConfigSchema: z.ZodObject<{
652
- thresholdSeconds: z.ZodNumber;
653
- }, "strict", z.ZodTypeAny, {
654
- thresholdSeconds: number;
655
- }, {
656
- thresholdSeconds: number;
657
- }>;
658
- type TimeOnSiteConfig = z.infer<typeof timeOnSiteConfigSchema>;
659
-
660
- type EventOutcomeRole = "lead" | "engagement" | "navigation" | "diagnostic";
661
- type EventCategory = "page" | "engagement" | "lead" | "commerce" | "system";
662
- type EventClientVisibility = "simple" | "detailed" | "hidden";
663
- interface EventSemantics {
664
- label: string;
665
- category: EventCategory;
666
- outcomeRole: EventOutcomeRole;
667
- clientVisibility: EventClientVisibility;
668
- }
669
- /**
670
- * Lightweight runtime event metadata. This module intentionally imports no
671
- * Zod schemas so dashboards and framework adapters can consume it without
672
- * pulling the validation registry into their bundles.
673
- */
674
- declare const EVENT_SEMANTICS: {
675
- readonly page_view: {
676
- readonly label: "Page view";
677
- readonly category: "page";
678
- readonly outcomeRole: "navigation";
679
- readonly clientVisibility: "simple";
680
- };
681
- readonly time_on_site: {
682
- readonly label: "Time on site";
683
- readonly category: "engagement";
684
- readonly outcomeRole: "engagement";
685
- readonly clientVisibility: "detailed";
686
- };
687
- readonly specific_page_visit: {
688
- readonly label: "Key page visit";
689
- readonly category: "engagement";
690
- readonly outcomeRole: "engagement";
691
- readonly clientVisibility: "detailed";
692
- };
693
- readonly scroll_depth: {
694
- readonly label: "Scroll depth";
695
- readonly category: "engagement";
696
- readonly outcomeRole: "engagement";
697
- readonly clientVisibility: "detailed";
698
- };
699
- readonly multi_page_session: {
700
- readonly label: "Multi-page session";
701
- readonly category: "engagement";
702
- readonly outcomeRole: "engagement";
703
- readonly clientVisibility: "detailed";
704
- };
705
- readonly form_start: {
706
- readonly label: "Form started";
707
- readonly category: "engagement";
708
- readonly outcomeRole: "engagement";
709
- readonly clientVisibility: "simple";
710
- };
711
- readonly sdk_heartbeat: {
712
- readonly label: "SDK heartbeat";
713
- readonly category: "system";
714
- readonly outcomeRole: "diagnostic";
715
- readonly clientVisibility: "hidden";
716
- };
717
- readonly page_exit: {
718
- readonly label: "Page exit";
719
- readonly category: "engagement";
720
- readonly outcomeRole: "diagnostic";
721
- readonly clientVisibility: "detailed";
722
- };
723
- readonly form_submit: {
724
- readonly label: "Form submitted";
725
- readonly category: "lead";
726
- readonly outcomeRole: "lead";
727
- readonly clientVisibility: "simple";
728
- };
729
- readonly phone_click: {
730
- readonly label: "Phone click";
731
- readonly category: "lead";
732
- readonly outcomeRole: "lead";
733
- readonly clientVisibility: "simple";
734
- };
735
- readonly cta_click: {
736
- readonly label: "CTA click";
737
- readonly category: "engagement";
738
- readonly outcomeRole: "engagement";
739
- readonly clientVisibility: "simple";
740
- };
741
- };
742
- type EventName = keyof typeof EVENT_SEMANTICS;
743
- declare function getEventSemantics(eventName: string): EventSemantics | null;
744
-
745
- type EventKind = "automatic" | "manual";
746
- declare const EVENT_REGISTRY: {
747
- readonly page_view: {
748
- readonly kind: "automatic";
749
- readonly semantics: {
750
- readonly label: "Page view";
751
- readonly category: "page";
752
- readonly outcomeRole: "navigation";
753
- readonly clientVisibility: "simple";
754
- };
755
- readonly metadataSchema: z.ZodObject<{
756
- page: z.ZodObject<{
757
- title: z.ZodNullable<z.ZodString>;
758
- path: z.ZodString;
759
- search: z.ZodString;
760
- hash: z.ZodString;
761
- }, "strict", z.ZodTypeAny, {
762
- path: string;
763
- search: string;
764
- title: string | null;
765
- hash: string;
766
- }, {
767
- path: string;
768
- search: string;
769
- title: string | null;
770
- hash: string;
771
- }>;
772
- referrer: z.ZodNullable<z.ZodString>;
773
- viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
774
- w: z.ZodNumber;
775
- h: z.ZodNumber;
776
- }, "strict", z.ZodTypeAny, {
777
- w: number;
778
- h: number;
779
- }, {
780
- w: number;
781
- h: number;
782
- }>>>;
783
- }, "strict", z.ZodTypeAny, {
784
- page: {
785
- path: string;
786
- search: string;
787
- title: string | null;
788
- hash: string;
789
- };
790
- referrer: string | null;
791
- viewport?: {
792
- w: number;
793
- h: number;
794
- } | null | undefined;
795
- }, {
796
- page: {
797
- path: string;
798
- search: string;
799
- title: string | null;
800
- hash: string;
801
- };
802
- referrer: string | null;
803
- viewport?: {
804
- w: number;
805
- h: number;
806
- } | null | undefined;
807
- }>;
808
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
809
- };
810
- readonly time_on_site: {
811
- readonly kind: "automatic";
812
- readonly semantics: {
813
- readonly label: "Time on site";
814
- readonly category: "engagement";
815
- readonly outcomeRole: "engagement";
816
- readonly clientVisibility: "detailed";
817
- };
818
- readonly metadataSchema: z.ZodObject<{
819
- duration_ms: z.ZodNumber;
820
- page: z.ZodObject<{
821
- path: z.ZodString;
822
- }, "strict", z.ZodTypeAny, {
823
- path: string;
824
- }, {
825
- path: string;
826
- }>;
827
- }, "strict", z.ZodTypeAny, {
828
- page: {
829
- path: string;
830
- };
831
- duration_ms: number;
832
- }, {
833
- page: {
834
- path: string;
835
- };
836
- duration_ms: number;
837
- }>;
838
- readonly configSchema: z.ZodObject<{
839
- thresholdSeconds: z.ZodNumber;
840
- }, "strict", z.ZodTypeAny, {
841
- thresholdSeconds: number;
842
- }, {
843
- thresholdSeconds: number;
844
- }>;
845
- };
846
- readonly specific_page_visit: {
847
- readonly kind: "automatic";
848
- readonly semantics: {
849
- readonly label: "Key page visit";
850
- readonly category: "engagement";
851
- readonly outcomeRole: "engagement";
852
- readonly clientVisibility: "detailed";
853
- };
854
- readonly metadataSchema: z.ZodObject<{
855
- page_name: z.ZodString;
856
- page: z.ZodObject<{
857
- path: z.ZodString;
858
- }, "strict", z.ZodTypeAny, {
859
- path: string;
860
- }, {
861
- path: string;
862
- }>;
863
- }, "strict", z.ZodTypeAny, {
864
- page: {
865
- path: string;
866
- };
867
- page_name: string;
868
- }, {
869
- page: {
870
- path: string;
871
- };
872
- page_name: string;
873
- }>;
874
- readonly configSchema: z.ZodObject<{
875
- pages: z.ZodArray<z.ZodObject<{
876
- name: z.ZodString;
877
- pathPattern: z.ZodType<RegExp, z.ZodTypeDef, RegExp>;
878
- }, "strict", z.ZodTypeAny, {
879
- name: string;
880
- pathPattern: RegExp;
881
- }, {
882
- name: string;
883
- pathPattern: RegExp;
884
- }>, "many">;
885
- }, "strict", z.ZodTypeAny, {
886
- pages: {
887
- name: string;
888
- pathPattern: RegExp;
889
- }[];
890
- }, {
891
- pages: {
892
- name: string;
893
- pathPattern: RegExp;
894
- }[];
895
- }>;
896
- };
897
- readonly scroll_depth: {
898
- readonly kind: "automatic";
899
- readonly semantics: {
900
- readonly label: "Scroll depth";
901
- readonly category: "engagement";
902
- readonly outcomeRole: "engagement";
903
- readonly clientVisibility: "detailed";
904
- };
905
- readonly metadataSchema: z.ZodObject<{
906
- depth_percent: z.ZodNumber;
907
- page: z.ZodObject<{
908
- path: z.ZodString;
909
- }, "strict", z.ZodTypeAny, {
910
- path: string;
911
- }, {
912
- path: string;
913
- }>;
914
- }, "strict", z.ZodTypeAny, {
915
- page: {
916
- path: string;
917
- };
918
- depth_percent: number;
919
- }, {
920
- page: {
921
- path: string;
922
- };
923
- depth_percent: number;
924
- }>;
925
- readonly configSchema: z.ZodObject<{
926
- thresholds: z.ZodArray<z.ZodNumber, "many">;
927
- }, "strict", z.ZodTypeAny, {
928
- thresholds: number[];
929
- }, {
930
- thresholds: number[];
931
- }>;
932
- };
933
- readonly multi_page_session: {
934
- readonly kind: "automatic";
935
- readonly semantics: {
936
- readonly label: "Multi-page session";
937
- readonly category: "engagement";
938
- readonly outcomeRole: "engagement";
939
- readonly clientVisibility: "detailed";
940
- };
941
- readonly metadataSchema: z.ZodObject<{
942
- page_count: z.ZodNumber;
943
- page: z.ZodObject<{
944
- path: z.ZodString;
945
- }, "strict", z.ZodTypeAny, {
946
- path: string;
947
- }, {
948
- path: string;
949
- }>;
950
- }, "strict", z.ZodTypeAny, {
951
- page: {
952
- path: string;
953
- };
954
- page_count: number;
955
- }, {
956
- page: {
957
- path: string;
958
- };
959
- page_count: number;
960
- }>;
961
- readonly configSchema: z.ZodObject<{
962
- pageThreshold: z.ZodNumber;
963
- }, "strict", z.ZodTypeAny, {
964
- pageThreshold: number;
965
- }, {
966
- pageThreshold: number;
967
- }>;
968
- };
969
- readonly form_start: {
970
- readonly kind: "automatic";
971
- readonly semantics: {
972
- readonly label: "Form started";
973
- readonly category: "engagement";
974
- readonly outcomeRole: "engagement";
975
- readonly clientVisibility: "simple";
976
- };
977
- readonly metadataSchema: z.ZodObject<{
978
- form: z.ZodObject<{
979
- id: z.ZodString;
980
- action: z.ZodNullable<z.ZodString>;
981
- }, "strict", z.ZodTypeAny, {
982
- id: string;
983
- action: string | null;
984
- }, {
985
- id: string;
986
- action: string | null;
987
- }>;
988
- page: z.ZodObject<{
989
- path: z.ZodString;
990
- }, "strict", z.ZodTypeAny, {
991
- path: string;
992
- }, {
993
- path: string;
994
- }>;
995
- }, "strict", z.ZodTypeAny, {
996
- form: {
997
- id: string;
998
- action: string | null;
999
- };
1000
- page: {
1001
- path: string;
1002
- };
1003
- }, {
1004
- form: {
1005
- id: string;
1006
- action: string | null;
1007
- };
1008
- page: {
1009
- path: string;
1010
- };
1011
- }>;
1012
- readonly configSchema: z.ZodObject<{
1013
- selector: z.ZodOptional<z.ZodString>;
1014
- }, "strict", z.ZodTypeAny, {
1015
- selector?: string | undefined;
1016
- }, {
1017
- selector?: string | undefined;
1018
- }>;
1019
- };
1020
- readonly sdk_heartbeat: {
1021
- readonly kind: "automatic";
1022
- readonly semantics: {
1023
- readonly label: "SDK heartbeat";
1024
- readonly category: "system";
1025
- readonly outcomeRole: "diagnostic";
1026
- readonly clientVisibility: "hidden";
1027
- };
1028
- readonly metadataSchema: z.ZodObject<{
1029
- sdk_version: z.ZodString;
1030
- package_name: z.ZodNullable<z.ZodString>;
1031
- surface: z.ZodEnum<["next", "react", "script"]>;
1032
- triggers: z.ZodObject<{
1033
- automatic: z.ZodArray<z.ZodString, "many">;
1034
- manual: z.ZodArray<z.ZodString, "many">;
1035
- }, "strict", z.ZodTypeAny, {
1036
- automatic: string[];
1037
- manual: string[];
1038
- }, {
1039
- automatic: string[];
1040
- manual: string[];
1041
- }>;
1042
- trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
1043
- configured_gtag_ids: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
1044
- }, "strict", z.ZodTypeAny, {
1045
- sdk_version: string;
1046
- package_name: string | null;
1047
- surface: "next" | "react" | "script";
1048
- triggers: {
1049
- automatic: string[];
1050
- manual: string[];
1051
- };
1052
- trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
1053
- configured_gtag_ids?: Record<string, string> | null | undefined;
1054
- }, {
1055
- sdk_version: string;
1056
- package_name: string | null;
1057
- surface: "next" | "react" | "script";
1058
- triggers: {
1059
- automatic: string[];
1060
- manual: string[];
1061
- };
1062
- trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
1063
- configured_gtag_ids?: Record<string, string> | null | undefined;
1064
- }>;
1065
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
1066
- };
1067
- readonly page_exit: {
1068
- readonly kind: "automatic";
1069
- readonly semantics: {
1070
- readonly label: "Page exit";
1071
- readonly category: "engagement";
1072
- readonly outcomeRole: "diagnostic";
1073
- readonly clientVisibility: "detailed";
1074
- };
1075
- readonly metadataSchema: z.ZodObject<{
1076
- dwell_ms: z.ZodNumber;
1077
- max_scroll_percent: z.ZodNullable<z.ZodNumber>;
1078
- scroll_baseline_percent: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1079
- page: z.ZodObject<{
1080
- path: z.ZodString;
1081
- }, "strict", z.ZodTypeAny, {
1082
- path: string;
1083
- }, {
1084
- path: string;
1085
- }>;
1086
- }, "strict", z.ZodTypeAny, {
1087
- page: {
1088
- path: string;
1089
- };
1090
- dwell_ms: number;
1091
- max_scroll_percent: number | null;
1092
- scroll_baseline_percent?: number | null | undefined;
1093
- }, {
1094
- page: {
1095
- path: string;
1096
- };
1097
- dwell_ms: number;
1098
- max_scroll_percent: number | null;
1099
- scroll_baseline_percent?: number | null | undefined;
1100
- }>;
1101
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
1102
- };
1103
- readonly form_submit: {
1104
- readonly kind: "manual";
1105
- readonly semantics: {
1106
- readonly label: "Form submitted";
1107
- readonly category: "lead";
1108
- readonly outcomeRole: "lead";
1109
- readonly clientVisibility: "simple";
1110
- };
1111
- readonly metadataSchema: z.ZodObject<{
1112
- form: z.ZodObject<{
1113
- id: z.ZodString;
1114
- action: z.ZodNullable<z.ZodString>;
1115
- fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
1116
- name: z.ZodString;
1117
- type: z.ZodString;
1118
- label: z.ZodNullable<z.ZodString>;
1119
- value: z.ZodType<src.JsonValue, z.ZodTypeDef, src.JsonValue>;
1120
- }, "strict", z.ZodTypeAny, {
1121
- value: src.JsonValue;
1122
- type: string;
1123
- name: string;
1124
- label: string | null;
1125
- }, {
1126
- value: src.JsonValue;
1127
- type: string;
1128
- name: string;
1129
- label: string | null;
1130
- }>, "many">>;
1131
- }, "strict", z.ZodTypeAny, {
1132
- id: string;
1133
- action: string | null;
1134
- fields?: {
1135
- value: src.JsonValue;
1136
- type: string;
1137
- name: string;
1138
- label: string | null;
1139
- }[] | undefined;
1140
- }, {
1141
- id: string;
1142
- action: string | null;
1143
- fields?: {
1144
- value: src.JsonValue;
1145
- type: string;
1146
- name: string;
1147
- label: string | null;
1148
- }[] | undefined;
1149
- }>;
1150
- page: z.ZodObject<{
1151
- path: z.ZodString;
1152
- }, "strict", z.ZodTypeAny, {
1153
- path: string;
1154
- }, {
1155
- path: string;
1156
- }>;
1157
- }, "strict", z.ZodTypeAny, {
1158
- form: {
1159
- id: string;
1160
- action: string | null;
1161
- fields?: {
1162
- value: src.JsonValue;
1163
- type: string;
1164
- name: string;
1165
- label: string | null;
1166
- }[] | undefined;
1167
- };
1168
- page: {
1169
- path: string;
1170
- };
1171
- }, {
1172
- form: {
1173
- id: string;
1174
- action: string | null;
1175
- fields?: {
1176
- value: src.JsonValue;
1177
- type: string;
1178
- name: string;
1179
- label: string | null;
1180
- }[] | undefined;
1181
- };
1182
- page: {
1183
- path: string;
1184
- };
1185
- }>;
1186
- readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
1187
- };
1188
- readonly phone_click: {
1189
- readonly kind: "manual";
1190
- readonly semantics: {
1191
- readonly label: "Phone click";
1192
- readonly category: "lead";
1193
- readonly outcomeRole: "lead";
1194
- readonly clientVisibility: "simple";
1195
- };
1196
- readonly metadataSchema: z.ZodObject<{
1197
- phone_number: z.ZodString;
1198
- page: z.ZodObject<{
1199
- path: z.ZodString;
1200
- }, "strict", z.ZodTypeAny, {
1201
- path: string;
1202
- }, {
1203
- path: string;
1204
- }>;
1205
- section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1206
- }, "strict", z.ZodTypeAny, {
1207
- page: {
1208
- path: string;
1209
- };
1210
- phone_number: string;
1211
- section?: string | null | undefined;
1212
- }, {
1213
- page: {
1214
- path: string;
1215
- };
1216
- phone_number: string;
1217
- section?: string | null | undefined;
1218
- }>;
1219
- readonly configSchema: z.ZodObject<{
1220
- autoCapture: z.ZodOptional<z.ZodObject<{
1221
- selector: z.ZodOptional<z.ZodString>;
1222
- }, "strict", z.ZodTypeAny, {
1223
- selector?: string | undefined;
1224
- }, {
1225
- selector?: string | undefined;
1226
- }>>;
1227
- }, "strict", z.ZodTypeAny, {
1228
- autoCapture?: {
1229
- selector?: string | undefined;
1230
- } | undefined;
1231
- }, {
1232
- autoCapture?: {
1233
- selector?: string | undefined;
1234
- } | undefined;
1235
- }>;
1236
- };
1237
- readonly cta_click: {
1238
- readonly kind: "manual";
1239
- readonly semantics: {
1240
- readonly label: "CTA click";
1241
- readonly category: "engagement";
1242
- readonly outcomeRole: "engagement";
1243
- readonly clientVisibility: "simple";
1244
- };
1245
- readonly metadataSchema: z.ZodObject<{
1246
- cta_name: z.ZodString;
1247
- page: z.ZodObject<{
1248
- path: z.ZodString;
1249
- }, "strict", z.ZodTypeAny, {
1250
- path: string;
1251
- }, {
1252
- path: string;
1253
- }>;
1254
- section: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1255
- destination_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1256
- href: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1257
- element: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1258
- }, "strict", z.ZodTypeAny, {
1259
- page: {
1260
- path: string;
1261
- };
1262
- cta_name: string;
1263
- section?: string | null | undefined;
1264
- href?: string | null | undefined;
1265
- destination_url?: string | null | undefined;
1266
- element?: string | null | undefined;
1267
- }, {
1268
- page: {
1269
- path: string;
1270
- };
1271
- cta_name: string;
1272
- section?: string | null | undefined;
1273
- href?: string | null | undefined;
1274
- destination_url?: string | null | undefined;
1275
- element?: string | null | undefined;
1276
- }>;
1277
- readonly configSchema: z.ZodObject<{
1278
- autoCapture: z.ZodOptional<z.ZodObject<{
1279
- selector: z.ZodOptional<z.ZodString>;
1280
- }, "strict", z.ZodTypeAny, {
1281
- selector?: string | undefined;
1282
- }, {
1283
- selector?: string | undefined;
1284
- }>>;
1285
- }, "strict", z.ZodTypeAny, {
1286
- autoCapture?: {
1287
- selector?: string | undefined;
1288
- } | undefined;
1289
- }, {
1290
- autoCapture?: {
1291
- selector?: string | undefined;
1292
- } | undefined;
1293
- }>;
1294
- };
1295
- };
1296
- /**
1297
- * Event names that are fired by the SDK when their configured signal occurs.
1298
- *
1299
- * Automatic events are not accepted by the typed `trackEvent()` API.
1300
- */
1301
- type AutomaticEventName = {
1302
- [K in EventName]: (typeof EVENT_REGISTRY)[K]["kind"] extends "automatic" ? K : never;
1303
- }[EventName];
1304
- /**
1305
- * Event names that consumer code can fire manually after registering them.
1306
- */
1307
- type ManualEventName = {
1308
- [K in EventName]: (typeof EVENT_REGISTRY)[K]["kind"] extends "manual" ? K : never;
1309
- }[EventName];
1310
- type MetadataByName = {
1311
- page_view: PageViewMetadata;
1312
- time_on_site: TimeOnSiteMetadata;
1313
- specific_page_visit: SpecificPageVisitMetadata;
1314
- scroll_depth: ScrollDepthMetadata;
1315
- multi_page_session: MultiPageSessionMetadata;
1316
- form_start: FormStartMetadata;
1317
- sdk_heartbeat: SdkHeartbeatMetadata;
1318
- page_exit: PageExitMetadata;
1319
- form_submit: FormSubmitMetadata;
1320
- phone_click: PhoneClickMetadata;
1321
- cta_click: CtaClickMetadata;
1322
- };
1323
- type ConfigByName = {
1324
- page_view: PageViewConfig;
1325
- time_on_site: TimeOnSiteConfig;
1326
- specific_page_visit: SpecificPageVisitConfig;
1327
- scroll_depth: ScrollDepthConfig;
1328
- multi_page_session: MultiPageSessionConfig;
1329
- form_start: FormStartConfig;
1330
- sdk_heartbeat: SdkHeartbeatConfig;
1331
- page_exit: PageExitConfig;
1332
- form_submit: FormSubmitConfig;
1333
- phone_click: PhoneClickConfig;
1334
- cta_click: CtaClickConfig;
1335
- };
1336
- /**
1337
- * Metadata payload type for a specific tracking event.
1338
- *
1339
- * @example
1340
- * ```ts
1341
- * type SubmitMetadata = EventMetadata<'form_submit'>;
1342
- * ```
1343
- */
1344
- type EventMetadata<K extends EventName> = MetadataByName[K];
1345
- /**
1346
- * Trigger registration config type for a specific tracking event.
1347
- */
1348
- type EventConfig<K extends EventName> = ConfigByName[K];
1349
- /**
1350
- * Runtime list of automatic event names.
1351
- */
1352
- declare const ALL_AUTOMATIC_EVENT_NAMES: readonly AutomaticEventName[];
1353
- /**
1354
- * Runtime list of manual event names.
1355
- */
1356
- declare const ALL_MANUAL_EVENT_NAMES: readonly ManualEventName[];
1357
- /**
1358
- * Events that represent a lead/outcome in first-party tracking projections.
1359
- */
1360
- declare const ALL_LEAD_EVENT_NAMES: readonly EventName[];
1361
- /**
1362
- * Trigger registry passed to `createTracking({ triggers })`.
1363
- *
1364
- * `automatic.page_view` is required because every install should capture page
1365
- * views. Other automatic events are opt-in. Manual events must be registered
1366
- * here before the typed client accepts `trackEvent()` calls for them.
1367
- *
1368
- * @example
1369
- * ```ts
1370
- * createTracking({
1371
- * apiKey,
1372
- * endpoint,
1373
- * triggers: {
1374
- * automatic: {
1375
- * page_view: {},
1376
- * time_on_site: { thresholdSeconds: 60 },
1377
- * },
1378
- * manual: {
1379
- * form_submit: {},
1380
- * phone_click: {},
1381
- * },
1382
- * },
1383
- * });
1384
- * ```
1385
- */
1386
- type TriggerRegistryConfig = {
1387
- automatic: {
1388
- page_view: EventConfig<"page_view">;
1389
- } & Partial<{
1390
- time_on_site: EventConfig<"time_on_site">;
1391
- specific_page_visit: EventConfig<"specific_page_visit">;
1392
- scroll_depth: EventConfig<"scroll_depth">;
1393
- multi_page_session: EventConfig<"multi_page_session">;
1394
- form_start: EventConfig<"form_start">;
1395
- }>;
1396
- manual?: Partial<{
1397
- form_submit: EventConfig<"form_submit">;
1398
- phone_click: EventConfig<"phone_click">;
1399
- cta_click: EventConfig<"cta_click">;
1400
- }>;
1401
- };
1402
- /**
1403
- * Manual event names registered in a concrete trigger registry.
1404
- *
1405
- * Used by `TypedTrackingClient` so `trackEvent()` only accepts events the
1406
- * consumer explicitly enabled.
1407
- */
1408
- type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry["manual"]>, ManualEventName>;
1409
- /**
1410
- * Automatic event names registered in a concrete trigger registry.
1411
- */
1412
- type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry["automatic"], AutomaticEventName>;
1413
- /**
1414
- * Discriminated union of valid manual tracking calls for a registry.
1415
- */
1416
- type TrackableEvent<TRegistry extends TriggerRegistryConfig> = {
1417
- [K in RegisteredManualEvents<TRegistry>]: {
1418
- eventType: K;
1419
- metadata: EventMetadata<K>;
1420
- };
1421
- }[RegisteredManualEvents<TRegistry>];
1422
- declare function getEventDefinition(name: EventName): {
1423
- kind: EventKind;
1424
- semantics: EventSemantics;
1425
- metadataSchema: z.ZodTypeAny;
1426
- configSchema: z.ZodTypeAny;
1427
- };
1428
-
1429
64
  /**
1430
65
  * Input accepted by the low-level stringly-typed client.
1431
66
  *
@@ -1464,356 +99,4 @@ interface TrackingClient {
1464
99
  destroy: () => void;
1465
100
  }
1466
101
 
1467
- interface TypedTrackEventOptions {
1468
- /**
1469
- * Override the page URL associated with this event.
1470
- *
1471
- * Omit this for normal browser usage; the SDK captures `window.location.href`.
1472
- */
1473
- pageUrl?: string | null;
1474
- /**
1475
- * Override the event timestamp.
1476
- *
1477
- * Defaults to the time the event is queued. Accepts a `Date` or ISO string.
1478
- */
1479
- occurredAt?: Date | string | null;
1480
- }
1481
- /**
1482
- * Typed tracking client returned by `useTracking()`.
1483
- *
1484
- * The accepted event names and metadata shapes are narrowed from the concrete
1485
- * trigger registry supplied to `createTracking()`.
1486
- */
1487
- interface TypedTrackingClient<TRegistry extends TriggerRegistryConfig> {
1488
- /**
1489
- * Fire a manually-registered event. The event name must be present in
1490
- * the registry's `manual` map and the metadata must match that event's
1491
- * canonical Zod-derived shape.
1492
- */
1493
- trackEvent<K extends RegisteredManualEvents<TRegistry>>(eventType: K, metadata: EventMetadata<K>, options?: TypedTrackEventOptions): void;
1494
- /**
1495
- * Immediately flush queued events to the ingest endpoint.
1496
- *
1497
- * Normal consumers rarely need this because the SDK flushes on a debounce,
1498
- * when the queue reaches the batch threshold, and on `pagehide`.
1499
- */
1500
- flush(): Promise<void>;
1501
- /**
1502
- * Return the current rolling session id.
1503
- */
1504
- getSessionId(): string;
1505
- /**
1506
- * Return the persistent visitor id for this browser profile.
1507
- */
1508
- getVisitorId(): string;
1509
- }
1510
-
1511
- /**
1512
- * Props for the combined ad-platform tag loader.
1513
- *
1514
- * Every field is optional and independent: pass the Google fields, the Meta
1515
- * fields, or both. For each platform a labelled `*Ids` map (ALL loaded) takes
1516
- * precedence over the single `*Id` shortcut.
1517
- */
1518
- interface AdPlatformTrackingProps {
1519
- /** Single Google Ads tag id, e.g. `AW-123456789`. */
1520
- gtagId?: string;
1521
- /** Labelled Google Ads tag map — ALL loaded; wins over `gtagId`. */
1522
- gtagIds?: GtagEnvironmentMap;
1523
- /** R2-authoritative Google tracking config. When set, static gtagId(s) are ignored. */
1524
- trackingConfig?: TrackingConfigReference;
1525
- /** Fire a Google page view from this standalone loader. Leave false when using TrackingProvider. */
1526
- standalonePageView?: boolean;
1527
- /** Single Meta Pixel id, e.g. `123456789012345`. */
1528
- metaPixelId?: string;
1529
- /** Labelled Meta Pixel map — ALL loaded; wins over `metaPixelId`. */
1530
- metaPixelIds?: MetaPixelEnvironmentMap;
1531
- }
1532
- /**
1533
- * Client component that loads the configured ad-platform tags — the Google tag
1534
- * (`gtag`) and/or the Meta Pixel (`fbq`) — each with the visitor's effective
1535
- * consent applied as the default (opt-out model). One mount handles both
1536
- * platforms; omit a platform's props to skip it. Renders nothing.
1537
- *
1538
- * On React you usually don't need this at all — `<TrackingProvider>` already
1539
- * accepts the same `gtagId/gtagIds` + `metaPixelId/metaPixelIds` props. Use this
1540
- * standalone component when you want the ad tags WITHOUT the event-ingest SDK.
1541
- */
1542
- declare function AdPlatformTracking({ gtagId, gtagIds, trackingConfig, standalonePageView, metaPixelId, metaPixelIds, }: AdPlatformTrackingProps): null;
1543
-
1544
- /**
1545
- * Props for the Google Ads tracking component.
1546
- *
1547
- * Accepts either a single `gtagId` (legacy) or a labelled `gtagIds` map
1548
- * where ALL entries are loaded simultaneously via `gtag('config', ...)`.
1549
- */
1550
- type GoogleAdsTrackingProps = {
1551
- gtagId: string;
1552
- gtagIds?: undefined;
1553
- } | {
1554
- gtagId?: undefined;
1555
- gtagIds: GtagEnvironmentMap;
1556
- };
1557
- /**
1558
- * Client component that loads Google Ads gtag with the visitor's effective
1559
- * consent applied as the Consent Mode default (opt-out model — granted unless
1560
- * an unexpired stored decline exists).
1561
- *
1562
- * Render once near the application root when the client site runs paid Google
1563
- * Ads. The component renders nothing.
1564
- */
1565
- declare function GoogleAdsTracking(props: GoogleAdsTrackingProps): null;
1566
-
1567
- /**
1568
- * Read the captured Google Ads click id from first-party cookies.
1569
- *
1570
- * Returns `null` during SSR and before the client has mounted.
1571
- */
1572
- declare function useGclid(): string | null;
1573
- /**
1574
- * Read all captured attribution parameters from first-party cookies.
1575
- *
1576
- * Values are loaded after mount, so the initial render returns all `null`s.
1577
- */
1578
- declare function useTrackingParams(): TrackingParams;
1579
- /** Options for {@link useCookiePreferences}. */
1580
- interface UseCookiePreferencesOptions {
1581
- /** Days an explicit decline is honored. Defaults to 90. */
1582
- declineTtlDays?: number;
1583
- }
1584
- /**
1585
- * The headless cookie-preferences surface returned by
1586
- * {@link useCookiePreferences}.
1587
- */
1588
- interface UseCookiePreferencesResult {
1589
- /** Effective consent — `granted` unless an unexpired explicit decline exists. */
1590
- state: ConsentChoiceState;
1591
- /** `default` = no valid explicit choice stored; `explicit` = visitor chose. */
1592
- source: ConsentSource;
1593
- /** True when the visitor has made no (valid, unexpired) explicit choice. */
1594
- isDefault: boolean;
1595
- isGranted: boolean;
1596
- isDenied: boolean;
1597
- /** ISO timestamp of the explicit choice; null for the default state. */
1598
- updatedAt: string | null;
1599
- /** ISO expiry of an unexpired decline; null otherwise. */
1600
- expiresAt: string | null;
1601
- /** Explicitly opt out of ad tracking (honored for 90 days by default). */
1602
- optOut: () => void;
1603
- /** Explicitly opt in (never expires). */
1604
- optIn: () => void;
1605
- /** Clear the explicit choice — back to default-granted. */
1606
- reset: () => void;
1607
- }
1608
- /**
1609
- * Headless cookie-preferences hook for the opt-out consent model (consent v2).
1610
- *
1611
- * Tracking is ON by default; this hook is how each client site wires its own
1612
- * footer "Cookie preferences" control (button, dialog, toggle — the packages
1613
- * ship no consent UI). State stays in sync with actions from other components
1614
- * in the same tab (via `onConsentChange`) and other tabs (via `storage`
1615
- * events).
1616
- *
1617
- * ```tsx
1618
- * function CookiePreferences() {
1619
- * const { isDenied, optOut, optIn } = useCookiePreferences();
1620
- * return isDenied ? (
1621
- * <button onClick={optIn}>Enable ad measurement</button>
1622
- * ) : (
1623
- * <button onClick={optOut}>Opt out of ad measurement</button>
1624
- * );
1625
- * }
1626
- * ```
1627
- */
1628
- declare function useCookiePreferences(options?: UseCookiePreferencesOptions): UseCookiePreferencesResult;
1629
- /**
1630
- * Read the current visitor consent state.
1631
- *
1632
- * @deprecated Since consent v2 (opt-out model) the state is never `pending`.
1633
- * Use {@link useCookiePreferences} — it exposes the effective state plus
1634
- * `source` so you can tell a default grant from an explicit one.
1635
- */
1636
- declare function useConsentState(): ConsentState;
1637
- /**
1638
- * Result shape of the deprecated {@link useConsent} hook.
1639
- *
1640
- * @deprecated Use {@link UseCookiePreferencesResult} via
1641
- * {@link useCookiePreferences}. `isPending` is always `false` since consent v2.
1642
- */
1643
- interface UseConsentResult {
1644
- state: ConsentState;
1645
- isPending: boolean;
1646
- isGranted: boolean;
1647
- isDenied: boolean;
1648
- accept: () => void;
1649
- decline: () => void;
1650
- reset: () => void;
1651
- }
1652
- /**
1653
- * Legacy opt-in-era consent hook.
1654
- *
1655
- * @deprecated Since consent v2 tracking defaults ON (opt-out model): the state
1656
- * is never `pending`, so banner UIs gated on `isPending` never render. Use
1657
- * {@link useCookiePreferences} for footer "cookie preferences" controls.
1658
- * `accept` / `decline` still work and map to `optIn` / `optOut`.
1659
- */
1660
- declare function useConsent(): UseConsentResult;
1661
-
1662
- interface CreateTrackingOptions<TRegistry extends TriggerRegistryConfig> {
1663
- /**
1664
- * Public tracking API key issued for this business.
1665
- *
1666
- * This key is safe to expose in browser code. Abuse is bounded by the
1667
- * server-side origin allowlist and rate limits.
1668
- */
1669
- apiKey: string;
1670
- /**
1671
- * Tracking endpoint base URL, usually ending in `/tracking`.
1672
- *
1673
- * The client posts events to `${endpoint}/events`.
1674
- */
1675
- endpoint: string;
1676
- /**
1677
- * Trigger registry. Determines which events the SDK fires automatically
1678
- * and which ones the consumer can fire manually via `trackEvent()`.
1679
- * `automatic.page_view` is required — every tracking install needs it.
1680
- */
1681
- triggers: TRegistry;
1682
- /**
1683
- * Deployment environment label reported in session context.
1684
- *
1685
- * Does not affect which gtag IDs are loaded — all configured IDs are
1686
- * loaded simultaneously. This value is purely for event tagging so the
1687
- * dashboard can filter by environment.
1688
- */
1689
- environment?: TrackingEnvironment;
1690
- /**
1691
- * When true, the typed client validates every `trackEvent()` metadata
1692
- * payload through the Zod schema before forwarding. Errors are thrown
1693
- * loudly. Leave off in prod; turn on in dev to catch shape bugs early.
1694
- */
1695
- debug?: boolean;
1696
- /**
1697
- * Phone-field display + default-country config, read by `usePhoneField` /
1698
- * `<PhoneField>`. Display is customizable; the transmitted value is always E.164.
1699
- */
1700
- phone?: PhoneConfig;
1701
- /**
1702
- * GAP28 / unified-goal: enable real-time on-site conversion firing. When set, the SDK
1703
- * fetches the per-business config from `cdnUrl` (optional offline `baked` fallback) and
1704
- * AUTOMATICALLY fires `gtag('event','conversion')` for any automatic event-goal
1705
- * (scroll/time/page-view/…) whose trigger threshold a detector crosses. Omit to keep events
1706
- * analytics-only. (Sale + manual-event firing lives in the server/browser sales client.)
1707
- */
1708
- conversionConfig?: {
1709
- cdnUrl: string;
1710
- baked?: ConversionConfig | null;
1711
- };
1712
- /**
1713
- * R2-authoritative config reference — `ARANOVA_TRACKING_CONFIG` from
1714
- * `tracking-cli gen`. Wins over `conversionConfig`. The object URL is composed
1715
- * from `businessId` + `environment` against the production CDN; spread in a
1716
- * `cdnBaseUrl` to read it from somewhere else, e.g.
1717
- * `{ ...ARANOVA_TRACKING_CONFIG, cdnBaseUrl: import.meta.env.VITE_ARANOVA_CDN_BASE_URL }`.
1718
- */
1719
- trackingConfig?: TrackingConfigReference;
1720
- }
1721
- interface TrackingProviderProps {
1722
- /**
1723
- * Optional Google Ads tag id, for example `AW-123456789`.
1724
- *
1725
- * If omitted and `gtagIds` is also omitted, no gtag script is loaded.
1726
- */
1727
- gtagId?: string;
1728
- /**
1729
- * Labelled map of Google Ads tag IDs. ALL are loaded simultaneously.
1730
- * When provided, `gtagId` is ignored.
1731
- */
1732
- gtagIds?: GtagEnvironmentMap;
1733
- /** Optional Meta Pixel id, for example `123456789012345`. */
1734
- metaPixelId?: string;
1735
- /**
1736
- * Labelled map of Meta Pixel IDs. ALL are loaded simultaneously.
1737
- * When provided, `metaPixelId` is ignored.
1738
- */
1739
- metaPixelIds?: MetaPixelEnvironmentMap;
1740
- /**
1741
- * Application tree that should have access to the scoped tracking client.
1742
- */
1743
- children: ReactNode;
1744
- }
1745
- interface CreateTrackingResult<TRegistry extends TriggerRegistryConfig> {
1746
- /**
1747
- * Provider component that initializes the page-level tracking client.
1748
- *
1749
- * Mount this once near the root of the React tree.
1750
- */
1751
- TrackingProvider: (props: TrackingProviderProps) => ReactNode;
1752
- /**
1753
- * Hook that returns the registry-typed tracking client.
1754
- *
1755
- * Import this hook from your local tracking module, not directly from the
1756
- * package root, so TypeScript preserves your trigger registry.
1757
- */
1758
- useTracking: () => TypedTrackingClient<TRegistry>;
1759
- }
1760
- declare function createTracking<TRegistry extends TriggerRegistryConfig>(options: CreateTrackingOptions<TRegistry>): CreateTrackingResult<TRegistry>;
1761
-
1762
- /** Resolve the effective phone config (provider value or built-in defaults). */
1763
- declare function usePhoneConfig(): {
1764
- defaultCountry: CountryCode;
1765
- display: PhoneDisplayFormat;
1766
- };
1767
- interface UsePhoneFieldOptions {
1768
- defaultValue?: string;
1769
- /** Overrides the provider's `defaultCountry`. */
1770
- country?: CountryCode;
1771
- /** Overrides the provider's `display` (applied to the settled value on blur). */
1772
- display?: PhoneDisplayFormat;
1773
- /** Notified with the canonical E.164 (or `null`) on every change. */
1774
- onValueChange?: (e164: string | null) => void;
1775
- }
1776
- interface PhoneInputProps {
1777
- value: string;
1778
- onChange: (event: ChangeEvent<HTMLInputElement>) => void;
1779
- onBlur: (event: FocusEvent<HTMLInputElement>) => void;
1780
- type: "tel";
1781
- inputMode: "tel";
1782
- autoComplete: "tel";
1783
- }
1784
- interface PhoneFieldApi {
1785
- /** Display value for the `<input>` (live `AsYouType` while typing). */
1786
- value: string;
1787
- /** Canonical E.164 — what gets transmitted. `null` while invalid/incomplete. */
1788
- e164: string | null;
1789
- isValid: boolean;
1790
- /** Validation message, surfaced only after blur with non-empty invalid input. */
1791
- error: string | null;
1792
- parsed: ParsedPhone;
1793
- /** Spread onto an `<input>`: pre-wires value/onChange/onBlur/type/inputMode/autoComplete. */
1794
- inputProps: PhoneInputProps;
1795
- }
1796
- /** Headless phone field — the client owns the markup. */
1797
- declare function usePhoneField(opts?: UsePhoneFieldOptions): PhoneFieldApi;
1798
- interface PhoneFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange"> {
1799
- country?: CountryCode;
1800
- /** Controlled display value. */
1801
- value?: string;
1802
- /** Uncontrolled initial value. */
1803
- defaultValue?: string;
1804
- /** Receives the native change event (RHF `register().onChange` or your own); the
1805
- * event's `target.value` is already `AsYouType`-formatted. */
1806
- onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
1807
- /** Receives the canonical E.164 (or `null`) on every change. */
1808
- onE164Change?: (e164: string | null) => void;
1809
- }
1810
- /**
1811
- * Batteries-included phone input. Composes identically with react-hook-form
1812
- * `{...register('phone')}` and with controlled state — the `AsYouType` +
1813
- * mutate-`e.target.value`-before-`onChange` technique lives inside, so RHF and
1814
- * controlled parents both receive the formatted value, and the wire value stays
1815
- * E.164.
1816
- */
1817
- declare const PhoneField: react.ForwardRefExoticComponent<PhoneFieldProps & react.RefAttributes<HTMLInputElement>>;
1818
-
1819
- export { ALL_AUTOMATIC_EVENT_NAMES, ALL_LEAD_EVENT_NAMES, ALL_MANUAL_EVENT_NAMES, AdPlatformTracking, type AdPlatformTrackingProps, type AutomaticEventName, ConsentBanner, type ConsentBannerProps, ConsentChoiceState, ConsentSource, ConsentState, ConversionConfig, type CreateTrackingOptions, type CreateTrackingResult, type CtaClickConfig, type CtaClickMetadata, EVENT_REGISTRY, EVENT_SEMANTICS, type EventCategory, type EventClientVisibility, type EventConfig, type EventKind, type EventMetadata, type EventName, type EventOutcomeRole, type EventSemantics, type FormStartConfig, type FormStartMetadata, FormSubmitConfig, FormSubmitMetadata, GoogleAdsTracking, type GoogleAdsTrackingProps, GtagEnvironmentMap, type ManualEventName, MetaPixelEnvironmentMap, type MultiPageSessionConfig, type MultiPageSessionMetadata, PAGE_IDENTITY_MAX_LENGTH, PAGE_IDENTITY_PATTERN, type PageExitConfig, type PageExitMetadata, type PageIdentity, type PageViewConfig, type PageViewMetadata, ParsedPhone, type PhoneClickConfig, type PhoneClickMetadata, PhoneConfig, PhoneDisplayFormat, PhoneField, type PhoneFieldApi, type PhoneFieldProps, type PhoneInputProps, type RegisteredAutomaticEvents, type RegisteredManualEvents, SPECIFIC_PAGE_NAMES, type ScrollDepthConfig, type ScrollDepthMetadata, type SdkHeartbeatConfig, type SdkHeartbeatMetadata, type SpecificPageName, type SpecificPageVisitConfig, type SpecificPageVisitMetadata, TRACKING_PARAM_KEYS, type TimeOnSiteConfig, type TimeOnSiteMetadata, type TrackableEvent, type TrackingClient, TrackingClientContext, TrackingConfigReference, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, type TrackingProviderProps, TrackingSessionUpsertPayload, type TriggerRegistryConfig, type TypedTrackEventOptions, type TypedTrackingClient, type UseConsentResult, type UseCookiePreferencesOptions, type UseCookiePreferencesResult, type UsePhoneFieldOptions, captureTrackingParamsFromLocation, createTracking, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload, ctaClickConfigSchema, ctaClickMetadataSchema, formStartConfigSchema, formStartMetadataSchema, getEventDefinition, getEventSemantics, multiPageSessionConfigSchema, multiPageSessionMetadataSchema, pageExitConfigSchema, pageExitMetadataSchema, pageIdentitySchema, pageViewConfigSchema, pageViewMetadataSchema, phoneClickConfigSchema, phoneClickMetadataSchema, scrollDepthConfigSchema, scrollDepthMetadataSchema, sdkHeartbeatConfigSchema, sdkHeartbeatMetadataSchema, sdkHeartbeatTriggersSchema, specificPageNameSchema, specificPageVisitConfigSchema, specificPageVisitMetadataSchema, timeOnSiteConfigSchema, timeOnSiteMetadataSchema, useConsent, useConsentState, useCookiePreferences, useGclid, usePhoneConfig, usePhoneField, useTrackingParams };
102
+ export { TRACKING_PARAM_KEYS, type TrackingClient, TrackingClientContext, TrackingEventCreatePayload, TrackingInstallSurface, TrackingParams, TrackingSessionUpsertPayload, captureTrackingParamsFromLocation, createTrackingClientContext, createTrackingEventCreatePayload, createTrackingSessionUpsertPayload };