@aranova/tracking-react 1.17.0 → 1.19.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.
@@ -1,6 +1,6 @@
1
+ import { J as JsonValue, j as FormSubmitConfig, k as FormSubmitMetadata } from './phone-utils-BlWj8oxq.mjs';
1
2
  import * as zod_v4_core from 'zod/v4/core';
2
3
  import * as z from 'zod/mini';
3
- import { J as JsonValue, j as FormSubmitConfig, k as FormSubmitMetadata } from './phone-utils-CYr6AmEP.js';
4
4
 
5
5
  /**
6
6
  * Metadata for a manually fired `cta_click` event.
@@ -92,6 +92,48 @@ declare const formStartConfigSchema: z.ZodMiniObject<{
92
92
  }, z.core.$strict>;
93
93
  type FormStartConfig = z.infer<typeof formStartConfigSchema>;
94
94
 
95
+ /**
96
+ * A manual `form_details`: optional answers the API folds into the `form_submit` whose
97
+ * `submission_id` it names (add-only, never a lead). Built by `leadForms.addDetails()`.
98
+ */
99
+ declare const formDetailsMetadataSchema: z.ZodMiniObject<{
100
+ form: z.ZodMiniObject<{
101
+ id: z.ZodMiniString<string>;
102
+ submission_id: z.ZodMiniUUID;
103
+ kind: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
104
+ fields: z.ZodMiniArray<z.ZodMiniObject<{
105
+ name: z.ZodMiniString<string>;
106
+ type: z.ZodMiniString<string>;
107
+ label: z.ZodMiniNullable<z.ZodMiniString<string>>;
108
+ value: z.ZodMiniType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
109
+ role: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
110
+ }, z.core.$strict>>;
111
+ contract_version: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniInt>>;
112
+ contract_hash: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
113
+ extra: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
114
+ key: z.ZodMiniString<string>;
115
+ label: z.ZodMiniString<string>;
116
+ value: z.ZodMiniType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>;
117
+ }, z.core.$strict>>>>;
118
+ contract_violations: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
119
+ role: z.ZodMiniNullable<z.ZodMiniString<string>>;
120
+ rule: z.ZodMiniString<string>;
121
+ }, z.core.$strict>>>>;
122
+ }, z.core.$strict>;
123
+ page: z.ZodMiniObject<{
124
+ path: z.ZodMiniString<string>;
125
+ }, z.core.$strict>;
126
+ }, z.core.$strict>;
127
+ type FormDetailsMetadata = z.infer<typeof formDetailsMetadataSchema>;
128
+ /**
129
+ * Registration config for `form_details`.
130
+ *
131
+ * Manual-only with no options; the empty object enables typed
132
+ * `trackEvent('form_details', ...)` calls.
133
+ */
134
+ declare const formDetailsConfigSchema: z.ZodMiniObject<{}, z.core.$strict>;
135
+ type FormDetailsConfig = z.infer<typeof formDetailsConfigSchema>;
136
+
95
137
  /**
96
138
  * Metadata for a manually fired `form_step` event.
97
139
  *
@@ -345,6 +387,80 @@ declare const timeOnSiteConfigSchema: z.ZodMiniObject<{
345
387
  }, z.core.$strict>;
346
388
  type TimeOnSiteConfig = z.infer<typeof timeOnSiteConfigSchema>;
347
389
 
390
+ declare const videoVariantSchema: z.ZodMiniEnum<{
391
+ "16x9": "16x9";
392
+ "9x16": "9x16";
393
+ }>;
394
+ type VideoVariant = z.infer<typeof videoVariantSchema>;
395
+ declare const videoProgressTriggerReasonSchema: z.ZodMiniEnum<{
396
+ goal: "goal";
397
+ ended: "ended";
398
+ pause: "pause";
399
+ page_exit: "page_exit";
400
+ checkpoint: "checkpoint";
401
+ seek: "seek";
402
+ }>;
403
+ type VideoProgressTriggerReason = z.infer<typeof videoProgressTriggerReasonSchema>;
404
+ declare const videoRangeSchema: z.ZodMiniObject<{
405
+ start_s: z.ZodMiniNumber<number>;
406
+ end_s: z.ZodMiniNumber<number>;
407
+ }, z.core.$strict>;
408
+ type VideoWatchRange = z.infer<typeof videoRangeSchema>;
409
+ /** Metadata for `video_play` emitted when playback starts or resumes on `<TrackedVideo>`. */
410
+ declare const videoPlayMetadataSchema: z.ZodMiniObject<{
411
+ video_id: z.ZodMiniString<string>;
412
+ variant: z.ZodMiniEnum<{
413
+ "16x9": "16x9";
414
+ "9x16": "9x16";
415
+ }>;
416
+ current_s: z.ZodMiniNumber<number>;
417
+ duration_s: z.ZodMiniNumber<number>;
418
+ play_sequence: z.ZodMiniInt;
419
+ page: z.ZodMiniObject<{
420
+ path: z.ZodMiniString<string>;
421
+ }, z.core.$strict>;
422
+ }, z.core.$strict>;
423
+ type VideoPlayMetadata = z.infer<typeof videoPlayMetadataSchema>;
424
+ declare const videoPlayConfigSchema: z.ZodMiniObject<{}, z.core.$strict>;
425
+ type VideoPlayConfig = z.infer<typeof videoPlayConfigSchema>;
426
+ /**
427
+ * Metadata for `video_progress` emitted at checkpoints, goal thresholds, pause, seek, ended, and page_exit.
428
+ * `ranges` carries cumulative merged `[start_s, end_s]` intervals watched in the session so far.
429
+ */
430
+ declare const videoProgressMetadataSchema: z.ZodMiniObject<{
431
+ video_id: z.ZodMiniString<string>;
432
+ variant: z.ZodMiniEnum<{
433
+ "16x9": "16x9";
434
+ "9x16": "9x16";
435
+ }>;
436
+ trigger: z.ZodMiniEnum<{
437
+ goal: "goal";
438
+ ended: "ended";
439
+ pause: "pause";
440
+ page_exit: "page_exit";
441
+ checkpoint: "checkpoint";
442
+ seek: "seek";
443
+ }>;
444
+ current_s: z.ZodMiniNumber<number>;
445
+ furthest_s: z.ZodMiniNumber<number>;
446
+ watched_s: z.ZodMiniNumber<number>;
447
+ duration_s: z.ZodMiniNumber<number>;
448
+ max_percent: z.ZodMiniInt;
449
+ watched_percent: z.ZodMiniInt;
450
+ play_count: z.ZodMiniInt;
451
+ seek_count: z.ZodMiniInt;
452
+ ranges: z.ZodMiniArray<z.ZodMiniObject<{
453
+ start_s: z.ZodMiniNumber<number>;
454
+ end_s: z.ZodMiniNumber<number>;
455
+ }, z.core.$strict>>;
456
+ page: z.ZodMiniObject<{
457
+ path: z.ZodMiniString<string>;
458
+ }, z.core.$strict>;
459
+ }, z.core.$strict>;
460
+ type VideoProgressMetadata = z.infer<typeof videoProgressMetadataSchema>;
461
+ declare const videoProgressConfigSchema: z.ZodMiniObject<{}, z.core.$strict>;
462
+ type VideoProgressConfig = z.infer<typeof videoProgressConfigSchema>;
463
+
348
464
  type EventOutcomeRole = "lead" | "engagement" | "navigation" | "diagnostic";
349
465
  type EventCategory = "page" | "engagement" | "lead" | "commerce" | "system";
350
466
  type EventClientVisibility = "simple" | "detailed" | "hidden";
@@ -414,6 +530,12 @@ declare const EVENT_SEMANTICS: {
414
530
  readonly outcomeRole: "engagement";
415
531
  readonly clientVisibility: "detailed";
416
532
  };
533
+ readonly form_details: {
534
+ readonly label: "Form details added";
535
+ readonly category: "lead";
536
+ readonly outcomeRole: "engagement";
537
+ readonly clientVisibility: "detailed";
538
+ };
417
539
  readonly form_submit: {
418
540
  readonly label: "Form submitted";
419
541
  readonly category: "lead";
@@ -444,6 +566,18 @@ declare const EVENT_SEMANTICS: {
444
566
  readonly outcomeRole: "navigation";
445
567
  readonly clientVisibility: "simple";
446
568
  };
569
+ readonly video_play: {
570
+ readonly label: "Video played";
571
+ readonly category: "engagement";
572
+ readonly outcomeRole: "engagement";
573
+ readonly clientVisibility: "simple";
574
+ };
575
+ readonly video_progress: {
576
+ readonly label: "Video watched";
577
+ readonly category: "engagement";
578
+ readonly outcomeRole: "engagement";
579
+ readonly clientVisibility: "detailed";
580
+ };
447
581
  };
448
582
  type EventName = keyof typeof EVENT_SEMANTICS;
449
583
  declare function getEventSemantics(eventName: string): EventSemantics | null;
@@ -655,6 +789,69 @@ declare const EVENT_REGISTRY: {
655
789
  }, zod_v4_core.$strict>;
656
790
  readonly configSchema: z.ZodMiniObject<{}, zod_v4_core.$strict>;
657
791
  };
792
+ readonly video_play: {
793
+ readonly kind: "automatic";
794
+ readonly semantics: {
795
+ readonly label: "Video played";
796
+ readonly category: "engagement";
797
+ readonly outcomeRole: "engagement";
798
+ readonly clientVisibility: "simple";
799
+ };
800
+ readonly metadataSchema: z.ZodMiniObject<{
801
+ video_id: z.ZodMiniString<string>;
802
+ variant: z.ZodMiniEnum<{
803
+ "16x9": "16x9";
804
+ "9x16": "9x16";
805
+ }>;
806
+ current_s: z.ZodMiniNumber<number>;
807
+ duration_s: z.ZodMiniNumber<number>;
808
+ play_sequence: z.ZodMiniInt;
809
+ page: z.ZodMiniObject<{
810
+ path: z.ZodMiniString<string>;
811
+ }, zod_v4_core.$strict>;
812
+ }, zod_v4_core.$strict>;
813
+ readonly configSchema: z.ZodMiniObject<{}, zod_v4_core.$strict>;
814
+ };
815
+ readonly video_progress: {
816
+ readonly kind: "automatic";
817
+ readonly semantics: {
818
+ readonly label: "Video watched";
819
+ readonly category: "engagement";
820
+ readonly outcomeRole: "engagement";
821
+ readonly clientVisibility: "detailed";
822
+ };
823
+ readonly metadataSchema: z.ZodMiniObject<{
824
+ video_id: z.ZodMiniString<string>;
825
+ variant: z.ZodMiniEnum<{
826
+ "16x9": "16x9";
827
+ "9x16": "9x16";
828
+ }>;
829
+ trigger: z.ZodMiniEnum<{
830
+ goal: "goal";
831
+ ended: "ended";
832
+ pause: "pause";
833
+ page_exit: "page_exit";
834
+ checkpoint: "checkpoint";
835
+ seek: "seek";
836
+ }>;
837
+ current_s: z.ZodMiniNumber<number>;
838
+ furthest_s: z.ZodMiniNumber<number>;
839
+ watched_s: z.ZodMiniNumber<number>;
840
+ duration_s: z.ZodMiniNumber<number>;
841
+ max_percent: z.ZodMiniInt;
842
+ watched_percent: z.ZodMiniInt;
843
+ play_count: z.ZodMiniInt;
844
+ seek_count: z.ZodMiniInt;
845
+ ranges: z.ZodMiniArray<z.ZodMiniObject<{
846
+ start_s: z.ZodMiniNumber<number>;
847
+ end_s: z.ZodMiniNumber<number>;
848
+ }, zod_v4_core.$strict>>;
849
+ page: z.ZodMiniObject<{
850
+ path: z.ZodMiniString<string>;
851
+ }, zod_v4_core.$strict>;
852
+ }, zod_v4_core.$strict>;
853
+ readonly configSchema: z.ZodMiniObject<{}, zod_v4_core.$strict>;
854
+ };
658
855
  readonly form_submit: {
659
856
  readonly kind: "manual";
660
857
  readonly semantics: {
@@ -686,6 +883,7 @@ declare const EVENT_REGISTRY: {
686
883
  role: z.ZodMiniNullable<z.ZodMiniString<string>>;
687
884
  rule: z.ZodMiniString<string>;
688
885
  }, zod_v4_core.$strict>>>>;
886
+ submission_id: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniUUID>>;
689
887
  }, zod_v4_core.$strict>;
690
888
  page: z.ZodMiniObject<{
691
889
  path: z.ZodMiniString<string>;
@@ -721,6 +919,44 @@ declare const EVENT_REGISTRY: {
721
919
  }, zod_v4_core.$strict>;
722
920
  readonly configSchema: z.ZodMiniObject<{}, zod_v4_core.$strict>;
723
921
  };
922
+ readonly form_details: {
923
+ readonly kind: "manual";
924
+ readonly semantics: {
925
+ readonly label: "Form details added";
926
+ readonly category: "lead";
927
+ readonly outcomeRole: "engagement";
928
+ readonly clientVisibility: "detailed";
929
+ };
930
+ readonly metadataSchema: z.ZodMiniObject<{
931
+ form: z.ZodMiniObject<{
932
+ id: z.ZodMiniString<string>;
933
+ submission_id: z.ZodMiniUUID;
934
+ kind: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
935
+ fields: z.ZodMiniArray<z.ZodMiniObject<{
936
+ name: z.ZodMiniString<string>;
937
+ type: z.ZodMiniString<string>;
938
+ label: z.ZodMiniNullable<z.ZodMiniString<string>>;
939
+ value: z.ZodMiniType<JsonValue, unknown, zod_v4_core.$ZodTypeInternals<JsonValue, unknown>>;
940
+ role: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
941
+ }, zod_v4_core.$strict>>;
942
+ contract_version: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniInt>>;
943
+ contract_hash: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniString<string>>>;
944
+ extra: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
945
+ key: z.ZodMiniString<string>;
946
+ label: z.ZodMiniString<string>;
947
+ value: z.ZodMiniType<JsonValue, unknown, zod_v4_core.$ZodTypeInternals<JsonValue, unknown>>;
948
+ }, zod_v4_core.$strict>>>>;
949
+ contract_violations: z.ZodMiniOptional<z.ZodMiniNullable<z.ZodMiniArray<z.ZodMiniObject<{
950
+ role: z.ZodMiniNullable<z.ZodMiniString<string>>;
951
+ rule: z.ZodMiniString<string>;
952
+ }, zod_v4_core.$strict>>>>;
953
+ }, zod_v4_core.$strict>;
954
+ page: z.ZodMiniObject<{
955
+ path: z.ZodMiniString<string>;
956
+ }, zod_v4_core.$strict>;
957
+ }, zod_v4_core.$strict>;
958
+ readonly configSchema: z.ZodMiniObject<{}, zod_v4_core.$strict>;
959
+ };
724
960
  readonly phone_click: {
725
961
  readonly kind: "manual";
726
962
  readonly semantics: {
@@ -792,8 +1028,11 @@ type MetadataByName = {
792
1028
  page_exit: PageExitMetadata;
793
1029
  site_link_click: SiteLinkClickMetadata;
794
1030
  site_link_arrival: SiteLinkArrivalMetadata;
1031
+ video_play: VideoPlayMetadata;
1032
+ video_progress: VideoProgressMetadata;
795
1033
  form_submit: FormSubmitMetadata;
796
1034
  form_step: FormStepMetadata;
1035
+ form_details: FormDetailsMetadata;
797
1036
  phone_click: PhoneClickMetadata;
798
1037
  cta_click: CtaClickMetadata;
799
1038
  };
@@ -808,8 +1047,11 @@ type ConfigByName = {
808
1047
  page_exit: PageExitConfig;
809
1048
  site_link_click: SiteLinkClickConfig;
810
1049
  site_link_arrival: SiteLinkArrivalConfig;
1050
+ video_play: VideoPlayConfig;
1051
+ video_progress: VideoProgressConfig;
811
1052
  form_submit: FormSubmitConfig;
812
1053
  form_step: FormStepConfig;
1054
+ form_details: FormDetailsConfig;
813
1055
  phone_click: PhoneClickConfig;
814
1056
  cta_click: CtaClickConfig;
815
1057
  };
@@ -864,6 +1106,7 @@ type TriggerRegistryConfig = {
864
1106
  manual?: Partial<{
865
1107
  form_submit: EventConfig<"form_submit">;
866
1108
  form_step: EventConfig<"form_step">;
1109
+ form_details: EventConfig<"form_details">;
867
1110
  phone_click: EventConfig<"phone_click">;
868
1111
  cta_click: EventConfig<"cta_click">;
869
1112
  }>;
@@ -889,6 +1132,51 @@ type TrackableEvent<TRegistry extends TriggerRegistryConfig> = {
889
1132
  };
890
1133
  }[RegisteredManualEvents<TRegistry>];
891
1134
 
1135
+ /**
1136
+ * Input accepted by the low-level stringly-typed client.
1137
+ *
1138
+ * Prefer the typed `trackEvent(eventName, metadata)` facade exposed by
1139
+ * `useTracking()` in React/Next integrations.
1140
+ */
1141
+ interface TrackEventInput {
1142
+ /** Event name to enqueue. */
1143
+ eventType: string;
1144
+ /** URL associated with the event. Defaults to the current page URL. */
1145
+ pageUrl?: string | null;
1146
+ /** Event-specific metadata. */
1147
+ metadata?: Record<string, unknown> | null;
1148
+ /** Timestamp override. Defaults to queue time. */
1149
+ occurredAt?: Date | string | null;
1150
+ }
1151
+ /**
1152
+ * Low-level tracking client responsible for queueing and flushing events.
1153
+ */
1154
+ interface TrackingClient {
1155
+ /** Enqueue an event for batched delivery. */
1156
+ trackEvent: (input: TrackEventInput) => void;
1157
+ /** Flush queued events immediately (fetch, non-keepalive). */
1158
+ flush: () => Promise<void>;
1159
+ /**
1160
+ * Flush queued events through the keepalive transport so the request
1161
+ * survives document unload. Use from `pagehide`/`visibilitychange:hidden`
1162
+ * handlers — a plain `flush()` there is aborted by the browser on unload.
1163
+ */
1164
+ flushBeacon: () => void;
1165
+ /**
1166
+ * Register a synchronous pre-unload hook invoked right before `flushBeacon`
1167
+ * snapshots the queue into a keepalive batch. Used by `page_exit` and
1168
+ * `<TrackedVideo>` so their final segment/progress events ride in the same
1169
+ * keepalive request as any queued events.
1170
+ */
1171
+ onBeforeUnload?: (listener: () => void) => () => void;
1172
+ /** Return the current rolling session id. */
1173
+ getSessionId: () => string;
1174
+ /** Return the persistent visitor id. */
1175
+ getVisitorId: () => string;
1176
+ /** Remove timers/listeners and prevent future flushes. */
1177
+ destroy: () => void;
1178
+ }
1179
+
892
1180
  interface TypedTrackEventOptions {
893
1181
  /**
894
1182
  * Override the page URL associated with this event.
@@ -933,4 +1221,4 @@ interface TypedTrackingClient<TRegistry extends TriggerRegistryConfig> {
933
1221
  getVisitorId(): string;
934
1222
  }
935
1223
 
936
- export { type AutomaticEventName as A, type SiteLinkClickConfig as B, type CtaClickConfig as C, type SiteLinkClickMetadata as D, EVENT_SEMANTICS as E, type FormStartConfig as F, type SpecificPageName as G, type SpecificPageVisitConfig as H, type SpecificPageVisitMetadata as I, type TimeOnSiteMetadata as J, type TrackableEvent as K, type TriggerRegistryConfig as L, type ManualEventName as M, type TypedTrackEventOptions as N, type TypedTrackingClient as O, type PageExitConfig as P, getEventSemantics as Q, type RegisteredAutomaticEvents as R, type ScrollDepthConfig as S, type TimeOnSiteConfig as T, type CtaClickMetadata as a, type EventCategory as b, type EventClientVisibility as c, type EventConfig as d, type EventKind as e, type EventMetadata as f, type EventName as g, type EventOutcomeRole as h, type EventSemantics as i, type FormStartMetadata as j, type FormStepConfig as k, type FormStepMetadata as l, type MultiPageSessionConfig as m, type MultiPageSessionMetadata as n, type PageExitMetadata as o, type PageIdentity as p, type PageViewConfig as q, type PageViewMetadata as r, type PhoneClickConfig as s, type PhoneClickMetadata as t, type RegisteredManualEvents as u, type ScrollDepthMetadata as v, type SdkHeartbeatConfig as w, type SdkHeartbeatMetadata as x, type SiteLinkArrivalConfig as y, type SiteLinkArrivalMetadata as z };
1224
+ export { type VideoVariant as $, type AutomaticEventName as A, type SiteLinkArrivalConfig as B, type CtaClickConfig as C, type SiteLinkArrivalMetadata as D, EVENT_SEMANTICS as E, type FormDetailsConfig as F, type SiteLinkClickConfig as G, type SiteLinkClickMetadata as H, type SpecificPageName as I, type SpecificPageVisitConfig as J, type SpecificPageVisitMetadata as K, type TimeOnSiteMetadata as L, type ManualEventName as M, type TrackableEvent as N, type TrackingClient as O, type PageExitConfig as P, type TriggerRegistryConfig as Q, type RegisteredAutomaticEvents as R, type ScrollDepthConfig as S, type TimeOnSiteConfig as T, type TypedTrackEventOptions as U, type TypedTrackingClient as V, type VideoPlayConfig as W, type VideoPlayMetadata as X, type VideoProgressConfig as Y, type VideoProgressMetadata as Z, type VideoProgressTriggerReason as _, type CtaClickMetadata as a, type VideoWatchRange as a0, getEventSemantics as a1, type EventCategory as b, type EventClientVisibility as c, type EventConfig as d, type EventKind as e, type EventMetadata as f, type EventName as g, type EventOutcomeRole as h, type EventSemantics as i, type FormDetailsMetadata as j, type FormStartConfig as k, type FormStartMetadata as l, type FormStepConfig as m, type FormStepMetadata as n, type MultiPageSessionConfig as o, type MultiPageSessionMetadata as p, type PageExitMetadata as q, type PageIdentity as r, type PageViewConfig as s, type PageViewMetadata as t, type PhoneClickConfig as u, type PhoneClickMetadata as v, type RegisteredManualEvents as w, type ScrollDepthMetadata as x, type SdkHeartbeatConfig as y, type SdkHeartbeatMetadata as z };