@aranova/tracking-next 0.5.0 → 0.5.1

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
@@ -34,77 +34,6 @@ declare function createTrackingEventCreatePayload(trackingParams: TrackingParams
34
34
  declare const TRACKING_PARAM_KEYS: readonly ["gclid", "fbclid", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
35
35
  declare function captureTrackingParamsFromLocation(url?: string, maxAgeSeconds?: number): TrackingParams;
36
36
 
37
- interface TrackEventInput {
38
- eventType: string;
39
- pageUrl?: string | null;
40
- metadata?: Record<string, unknown> | null;
41
- occurredAt?: Date | string | null;
42
- }
43
- interface TrackingClient {
44
- trackEvent: (input: TrackEventInput) => void;
45
- flush: () => Promise<void>;
46
- getSessionId: () => string;
47
- getVisitorId: () => string;
48
- destroy: () => void;
49
- }
50
-
51
- declare const pageViewMetadataSchema: z.ZodObject<{
52
- page: z.ZodObject<{
53
- title: z.ZodNullable<z.ZodString>;
54
- path: z.ZodString;
55
- search: z.ZodString;
56
- hash: z.ZodString;
57
- }, "strip", z.ZodTypeAny, {
58
- search: string;
59
- title: string | null;
60
- path: string;
61
- hash: string;
62
- }, {
63
- search: string;
64
- title: string | null;
65
- path: string;
66
- hash: string;
67
- }>;
68
- referrer: z.ZodNullable<z.ZodString>;
69
- viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
- w: z.ZodNumber;
71
- h: z.ZodNumber;
72
- }, "strip", z.ZodTypeAny, {
73
- w: number;
74
- h: number;
75
- }, {
76
- w: number;
77
- h: number;
78
- }>>>;
79
- }, "strict", z.ZodTypeAny, {
80
- page: {
81
- search: string;
82
- title: string | null;
83
- path: string;
84
- hash: string;
85
- };
86
- referrer: string | null;
87
- viewport?: {
88
- w: number;
89
- h: number;
90
- } | null | undefined;
91
- }, {
92
- page: {
93
- search: string;
94
- title: string | null;
95
- path: string;
96
- hash: string;
97
- };
98
- referrer: string | null;
99
- viewport?: {
100
- w: number;
101
- h: number;
102
- } | null | undefined;
103
- }>;
104
- type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
105
- declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
106
- type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
107
-
108
37
  declare const ctaClickMetadataSchema: z.ZodObject<{
109
38
  cta_name: z.ZodString;
110
39
  page: z.ZodObject<{
@@ -135,6 +64,44 @@ type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
135
64
  declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
136
65
  type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
137
66
 
67
+ declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
68
+ sdk_version: z.ZodString;
69
+ package_name: z.ZodNullable<z.ZodString>;
70
+ surface: z.ZodEnum<["next", "react", "script"]>;
71
+ triggers: z.ZodObject<{
72
+ automatic: z.ZodArray<z.ZodString, "many">;
73
+ manual: z.ZodArray<z.ZodString, "many">;
74
+ }, "strict", z.ZodTypeAny, {
75
+ automatic: string[];
76
+ manual: string[];
77
+ }, {
78
+ automatic: string[];
79
+ manual: string[];
80
+ }>;
81
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
82
+ }, "strict", z.ZodTypeAny, {
83
+ sdk_version: string;
84
+ package_name: string | null;
85
+ surface: "next" | "react" | "script";
86
+ triggers: {
87
+ automatic: string[];
88
+ manual: string[];
89
+ };
90
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
91
+ }, {
92
+ sdk_version: string;
93
+ package_name: string | null;
94
+ surface: "next" | "react" | "script";
95
+ triggers: {
96
+ automatic: string[];
97
+ manual: string[];
98
+ };
99
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
100
+ }>;
101
+ type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
102
+ declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
103
+ type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
104
+
138
105
  declare const formStartMetadataSchema: z.ZodObject<{
139
106
  form: z.ZodObject<{
140
107
  id: z.ZodString;
@@ -289,6 +256,63 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
289
256
  }>;
290
257
  type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
291
258
 
259
+ declare const pageViewMetadataSchema: z.ZodObject<{
260
+ page: z.ZodObject<{
261
+ title: z.ZodNullable<z.ZodString>;
262
+ path: z.ZodString;
263
+ search: z.ZodString;
264
+ hash: z.ZodString;
265
+ }, "strip", z.ZodTypeAny, {
266
+ search: string;
267
+ title: string | null;
268
+ path: string;
269
+ hash: string;
270
+ }, {
271
+ search: string;
272
+ title: string | null;
273
+ path: string;
274
+ hash: string;
275
+ }>;
276
+ referrer: z.ZodNullable<z.ZodString>;
277
+ viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
278
+ w: z.ZodNumber;
279
+ h: z.ZodNumber;
280
+ }, "strip", z.ZodTypeAny, {
281
+ w: number;
282
+ h: number;
283
+ }, {
284
+ w: number;
285
+ h: number;
286
+ }>>>;
287
+ }, "strict", z.ZodTypeAny, {
288
+ page: {
289
+ search: string;
290
+ title: string | null;
291
+ path: string;
292
+ hash: string;
293
+ };
294
+ referrer: string | null;
295
+ viewport?: {
296
+ w: number;
297
+ h: number;
298
+ } | null | undefined;
299
+ }, {
300
+ page: {
301
+ search: string;
302
+ title: string | null;
303
+ path: string;
304
+ hash: string;
305
+ };
306
+ referrer: string | null;
307
+ viewport?: {
308
+ w: number;
309
+ h: number;
310
+ } | null | undefined;
311
+ }>;
312
+ type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
313
+ declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
314
+ type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
315
+
292
316
  declare const phoneClickMetadataSchema: z.ZodObject<{
293
317
  phone_number: z.ZodString;
294
318
  page: z.ZodObject<{
@@ -661,6 +685,44 @@ declare const EVENT_REGISTRY: {
661
685
  selector?: string | undefined;
662
686
  }>;
663
687
  };
688
+ readonly sdk_heartbeat: {
689
+ readonly kind: "automatic";
690
+ readonly metadataSchema: z.ZodObject<{
691
+ sdk_version: z.ZodString;
692
+ package_name: z.ZodNullable<z.ZodString>;
693
+ surface: z.ZodEnum<["next", "react", "script"]>;
694
+ triggers: z.ZodObject<{
695
+ automatic: z.ZodArray<z.ZodString, "many">;
696
+ manual: z.ZodArray<z.ZodString, "many">;
697
+ }, "strict", z.ZodTypeAny, {
698
+ automatic: string[];
699
+ manual: string[];
700
+ }, {
701
+ automatic: string[];
702
+ manual: string[];
703
+ }>;
704
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
705
+ }, "strict", z.ZodTypeAny, {
706
+ sdk_version: string;
707
+ package_name: string | null;
708
+ surface: "next" | "react" | "script";
709
+ triggers: {
710
+ automatic: string[];
711
+ manual: string[];
712
+ };
713
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
714
+ }, {
715
+ sdk_version: string;
716
+ package_name: string | null;
717
+ surface: "next" | "react" | "script";
718
+ triggers: {
719
+ automatic: string[];
720
+ manual: string[];
721
+ };
722
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
723
+ }>;
724
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
725
+ };
664
726
  readonly form_submit: {
665
727
  readonly kind: "manual";
666
728
  readonly metadataSchema: z.ZodObject<{
@@ -812,6 +874,7 @@ type MetadataByName = {
812
874
  scroll_depth: ScrollDepthMetadata;
813
875
  multi_page_session: MultiPageSessionMetadata;
814
876
  form_start: FormStartMetadata;
877
+ sdk_heartbeat: SdkHeartbeatMetadata;
815
878
  form_submit: FormSubmitMetadata;
816
879
  phone_click: PhoneClickMetadata;
817
880
  cta_click: CtaClickMetadata;
@@ -823,6 +886,7 @@ type ConfigByName = {
823
886
  scroll_depth: ScrollDepthConfig;
824
887
  multi_page_session: MultiPageSessionConfig;
825
888
  form_start: FormStartConfig;
889
+ sdk_heartbeat: SdkHeartbeatConfig;
826
890
  form_submit: FormSubmitConfig;
827
891
  phone_click: PhoneClickConfig;
828
892
  cta_click: CtaClickConfig;
@@ -848,6 +912,20 @@ type TriggerRegistryConfig = {
848
912
  type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry['manual']>, ManualEventName>;
849
913
  type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry['automatic'], AutomaticEventName>;
850
914
 
915
+ interface TrackEventInput {
916
+ eventType: string;
917
+ pageUrl?: string | null;
918
+ metadata?: Record<string, unknown> | null;
919
+ occurredAt?: Date | string | null;
920
+ }
921
+ interface TrackingClient {
922
+ trackEvent: (input: TrackEventInput) => void;
923
+ flush: () => Promise<void>;
924
+ getSessionId: () => string;
925
+ getVisitorId: () => string;
926
+ destroy: () => void;
927
+ }
928
+
851
929
  interface TypedTrackEventOptions {
852
930
  /** Override the page URL captured automatically. Rarely needed. */
853
931
  pageUrl?: string | null;
package/dist/index.d.ts CHANGED
@@ -34,77 +34,6 @@ declare function createTrackingEventCreatePayload(trackingParams: TrackingParams
34
34
  declare const TRACKING_PARAM_KEYS: readonly ["gclid", "fbclid", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
35
35
  declare function captureTrackingParamsFromLocation(url?: string, maxAgeSeconds?: number): TrackingParams;
36
36
 
37
- interface TrackEventInput {
38
- eventType: string;
39
- pageUrl?: string | null;
40
- metadata?: Record<string, unknown> | null;
41
- occurredAt?: Date | string | null;
42
- }
43
- interface TrackingClient {
44
- trackEvent: (input: TrackEventInput) => void;
45
- flush: () => Promise<void>;
46
- getSessionId: () => string;
47
- getVisitorId: () => string;
48
- destroy: () => void;
49
- }
50
-
51
- declare const pageViewMetadataSchema: z.ZodObject<{
52
- page: z.ZodObject<{
53
- title: z.ZodNullable<z.ZodString>;
54
- path: z.ZodString;
55
- search: z.ZodString;
56
- hash: z.ZodString;
57
- }, "strip", z.ZodTypeAny, {
58
- search: string;
59
- title: string | null;
60
- path: string;
61
- hash: string;
62
- }, {
63
- search: string;
64
- title: string | null;
65
- path: string;
66
- hash: string;
67
- }>;
68
- referrer: z.ZodNullable<z.ZodString>;
69
- viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
- w: z.ZodNumber;
71
- h: z.ZodNumber;
72
- }, "strip", z.ZodTypeAny, {
73
- w: number;
74
- h: number;
75
- }, {
76
- w: number;
77
- h: number;
78
- }>>>;
79
- }, "strict", z.ZodTypeAny, {
80
- page: {
81
- search: string;
82
- title: string | null;
83
- path: string;
84
- hash: string;
85
- };
86
- referrer: string | null;
87
- viewport?: {
88
- w: number;
89
- h: number;
90
- } | null | undefined;
91
- }, {
92
- page: {
93
- search: string;
94
- title: string | null;
95
- path: string;
96
- hash: string;
97
- };
98
- referrer: string | null;
99
- viewport?: {
100
- w: number;
101
- h: number;
102
- } | null | undefined;
103
- }>;
104
- type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
105
- declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
106
- type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
107
-
108
37
  declare const ctaClickMetadataSchema: z.ZodObject<{
109
38
  cta_name: z.ZodString;
110
39
  page: z.ZodObject<{
@@ -135,6 +64,44 @@ type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
135
64
  declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
136
65
  type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
137
66
 
67
+ declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
68
+ sdk_version: z.ZodString;
69
+ package_name: z.ZodNullable<z.ZodString>;
70
+ surface: z.ZodEnum<["next", "react", "script"]>;
71
+ triggers: z.ZodObject<{
72
+ automatic: z.ZodArray<z.ZodString, "many">;
73
+ manual: z.ZodArray<z.ZodString, "many">;
74
+ }, "strict", z.ZodTypeAny, {
75
+ automatic: string[];
76
+ manual: string[];
77
+ }, {
78
+ automatic: string[];
79
+ manual: string[];
80
+ }>;
81
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
82
+ }, "strict", z.ZodTypeAny, {
83
+ sdk_version: string;
84
+ package_name: string | null;
85
+ surface: "next" | "react" | "script";
86
+ triggers: {
87
+ automatic: string[];
88
+ manual: string[];
89
+ };
90
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
91
+ }, {
92
+ sdk_version: string;
93
+ package_name: string | null;
94
+ surface: "next" | "react" | "script";
95
+ triggers: {
96
+ automatic: string[];
97
+ manual: string[];
98
+ };
99
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
100
+ }>;
101
+ type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
102
+ declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
103
+ type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
104
+
138
105
  declare const formStartMetadataSchema: z.ZodObject<{
139
106
  form: z.ZodObject<{
140
107
  id: z.ZodString;
@@ -289,6 +256,63 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
289
256
  }>;
290
257
  type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
291
258
 
259
+ declare const pageViewMetadataSchema: z.ZodObject<{
260
+ page: z.ZodObject<{
261
+ title: z.ZodNullable<z.ZodString>;
262
+ path: z.ZodString;
263
+ search: z.ZodString;
264
+ hash: z.ZodString;
265
+ }, "strip", z.ZodTypeAny, {
266
+ search: string;
267
+ title: string | null;
268
+ path: string;
269
+ hash: string;
270
+ }, {
271
+ search: string;
272
+ title: string | null;
273
+ path: string;
274
+ hash: string;
275
+ }>;
276
+ referrer: z.ZodNullable<z.ZodString>;
277
+ viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
278
+ w: z.ZodNumber;
279
+ h: z.ZodNumber;
280
+ }, "strip", z.ZodTypeAny, {
281
+ w: number;
282
+ h: number;
283
+ }, {
284
+ w: number;
285
+ h: number;
286
+ }>>>;
287
+ }, "strict", z.ZodTypeAny, {
288
+ page: {
289
+ search: string;
290
+ title: string | null;
291
+ path: string;
292
+ hash: string;
293
+ };
294
+ referrer: string | null;
295
+ viewport?: {
296
+ w: number;
297
+ h: number;
298
+ } | null | undefined;
299
+ }, {
300
+ page: {
301
+ search: string;
302
+ title: string | null;
303
+ path: string;
304
+ hash: string;
305
+ };
306
+ referrer: string | null;
307
+ viewport?: {
308
+ w: number;
309
+ h: number;
310
+ } | null | undefined;
311
+ }>;
312
+ type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
313
+ declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
314
+ type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
315
+
292
316
  declare const phoneClickMetadataSchema: z.ZodObject<{
293
317
  phone_number: z.ZodString;
294
318
  page: z.ZodObject<{
@@ -661,6 +685,44 @@ declare const EVENT_REGISTRY: {
661
685
  selector?: string | undefined;
662
686
  }>;
663
687
  };
688
+ readonly sdk_heartbeat: {
689
+ readonly kind: "automatic";
690
+ readonly metadataSchema: z.ZodObject<{
691
+ sdk_version: z.ZodString;
692
+ package_name: z.ZodNullable<z.ZodString>;
693
+ surface: z.ZodEnum<["next", "react", "script"]>;
694
+ triggers: z.ZodObject<{
695
+ automatic: z.ZodArray<z.ZodString, "many">;
696
+ manual: z.ZodArray<z.ZodString, "many">;
697
+ }, "strict", z.ZodTypeAny, {
698
+ automatic: string[];
699
+ manual: string[];
700
+ }, {
701
+ automatic: string[];
702
+ manual: string[];
703
+ }>;
704
+ trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
705
+ }, "strict", z.ZodTypeAny, {
706
+ sdk_version: string;
707
+ package_name: string | null;
708
+ surface: "next" | "react" | "script";
709
+ triggers: {
710
+ automatic: string[];
711
+ manual: string[];
712
+ };
713
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
714
+ }, {
715
+ sdk_version: string;
716
+ package_name: string | null;
717
+ surface: "next" | "react" | "script";
718
+ triggers: {
719
+ automatic: string[];
720
+ manual: string[];
721
+ };
722
+ trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
723
+ }>;
724
+ readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
725
+ };
664
726
  readonly form_submit: {
665
727
  readonly kind: "manual";
666
728
  readonly metadataSchema: z.ZodObject<{
@@ -812,6 +874,7 @@ type MetadataByName = {
812
874
  scroll_depth: ScrollDepthMetadata;
813
875
  multi_page_session: MultiPageSessionMetadata;
814
876
  form_start: FormStartMetadata;
877
+ sdk_heartbeat: SdkHeartbeatMetadata;
815
878
  form_submit: FormSubmitMetadata;
816
879
  phone_click: PhoneClickMetadata;
817
880
  cta_click: CtaClickMetadata;
@@ -823,6 +886,7 @@ type ConfigByName = {
823
886
  scroll_depth: ScrollDepthConfig;
824
887
  multi_page_session: MultiPageSessionConfig;
825
888
  form_start: FormStartConfig;
889
+ sdk_heartbeat: SdkHeartbeatConfig;
826
890
  form_submit: FormSubmitConfig;
827
891
  phone_click: PhoneClickConfig;
828
892
  cta_click: CtaClickConfig;
@@ -848,6 +912,20 @@ type TriggerRegistryConfig = {
848
912
  type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry['manual']>, ManualEventName>;
849
913
  type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry['automatic'], AutomaticEventName>;
850
914
 
915
+ interface TrackEventInput {
916
+ eventType: string;
917
+ pageUrl?: string | null;
918
+ metadata?: Record<string, unknown> | null;
919
+ occurredAt?: Date | string | null;
920
+ }
921
+ interface TrackingClient {
922
+ trackEvent: (input: TrackEventInput) => void;
923
+ flush: () => Promise<void>;
924
+ getSessionId: () => string;
925
+ getVisitorId: () => string;
926
+ destroy: () => void;
927
+ }
928
+
851
929
  interface TypedTrackEventOptions {
852
930
  /** Override the page URL captured automatically. Rarely needed. */
853
931
  pageUrl?: string | null;