@aranova/tracking-react 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 +149 -71
- package/dist/index.d.ts +149 -71
- package/dist/index.js +158 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -105,77 +105,6 @@ declare function createTrackingEventCreatePayload(trackingParams: TrackingParams
|
|
|
105
105
|
declare const TRACKING_PARAM_KEYS: readonly ["gclid", "fbclid", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
106
106
|
declare function captureTrackingParamsFromLocation(url?: string, maxAgeSeconds?: number): TrackingParams;
|
|
107
107
|
|
|
108
|
-
interface TrackEventInput {
|
|
109
|
-
eventType: string;
|
|
110
|
-
pageUrl?: string | null;
|
|
111
|
-
metadata?: Record<string, unknown> | null;
|
|
112
|
-
occurredAt?: Date | string | null;
|
|
113
|
-
}
|
|
114
|
-
interface TrackingClient {
|
|
115
|
-
trackEvent: (input: TrackEventInput) => void;
|
|
116
|
-
flush: () => Promise<void>;
|
|
117
|
-
getSessionId: () => string;
|
|
118
|
-
getVisitorId: () => string;
|
|
119
|
-
destroy: () => void;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
declare const pageViewMetadataSchema: z.ZodObject<{
|
|
123
|
-
page: z.ZodObject<{
|
|
124
|
-
title: z.ZodNullable<z.ZodString>;
|
|
125
|
-
path: z.ZodString;
|
|
126
|
-
search: z.ZodString;
|
|
127
|
-
hash: z.ZodString;
|
|
128
|
-
}, "strip", z.ZodTypeAny, {
|
|
129
|
-
search: string;
|
|
130
|
-
title: string | null;
|
|
131
|
-
path: string;
|
|
132
|
-
hash: string;
|
|
133
|
-
}, {
|
|
134
|
-
search: string;
|
|
135
|
-
title: string | null;
|
|
136
|
-
path: string;
|
|
137
|
-
hash: string;
|
|
138
|
-
}>;
|
|
139
|
-
referrer: z.ZodNullable<z.ZodString>;
|
|
140
|
-
viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
141
|
-
w: z.ZodNumber;
|
|
142
|
-
h: z.ZodNumber;
|
|
143
|
-
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
w: number;
|
|
145
|
-
h: number;
|
|
146
|
-
}, {
|
|
147
|
-
w: number;
|
|
148
|
-
h: number;
|
|
149
|
-
}>>>;
|
|
150
|
-
}, "strict", z.ZodTypeAny, {
|
|
151
|
-
page: {
|
|
152
|
-
search: string;
|
|
153
|
-
title: string | null;
|
|
154
|
-
path: string;
|
|
155
|
-
hash: string;
|
|
156
|
-
};
|
|
157
|
-
referrer: string | null;
|
|
158
|
-
viewport?: {
|
|
159
|
-
w: number;
|
|
160
|
-
h: number;
|
|
161
|
-
} | null | undefined;
|
|
162
|
-
}, {
|
|
163
|
-
page: {
|
|
164
|
-
search: string;
|
|
165
|
-
title: string | null;
|
|
166
|
-
path: string;
|
|
167
|
-
hash: string;
|
|
168
|
-
};
|
|
169
|
-
referrer: string | null;
|
|
170
|
-
viewport?: {
|
|
171
|
-
w: number;
|
|
172
|
-
h: number;
|
|
173
|
-
} | null | undefined;
|
|
174
|
-
}>;
|
|
175
|
-
type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
|
|
176
|
-
declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
177
|
-
type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
|
|
178
|
-
|
|
179
108
|
declare const ctaClickMetadataSchema: z.ZodObject<{
|
|
180
109
|
cta_name: z.ZodString;
|
|
181
110
|
page: z.ZodObject<{
|
|
@@ -206,6 +135,44 @@ type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
|
|
|
206
135
|
declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
207
136
|
type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
|
|
208
137
|
|
|
138
|
+
declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
|
|
139
|
+
sdk_version: z.ZodString;
|
|
140
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
141
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
142
|
+
triggers: z.ZodObject<{
|
|
143
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
144
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
146
|
+
automatic: string[];
|
|
147
|
+
manual: string[];
|
|
148
|
+
}, {
|
|
149
|
+
automatic: string[];
|
|
150
|
+
manual: string[];
|
|
151
|
+
}>;
|
|
152
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
153
|
+
}, "strict", z.ZodTypeAny, {
|
|
154
|
+
sdk_version: string;
|
|
155
|
+
package_name: string | null;
|
|
156
|
+
surface: "next" | "react" | "script";
|
|
157
|
+
triggers: {
|
|
158
|
+
automatic: string[];
|
|
159
|
+
manual: string[];
|
|
160
|
+
};
|
|
161
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
sdk_version: string;
|
|
164
|
+
package_name: string | null;
|
|
165
|
+
surface: "next" | "react" | "script";
|
|
166
|
+
triggers: {
|
|
167
|
+
automatic: string[];
|
|
168
|
+
manual: string[];
|
|
169
|
+
};
|
|
170
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
|
|
173
|
+
declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
174
|
+
type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
|
|
175
|
+
|
|
209
176
|
declare const formStartMetadataSchema: z.ZodObject<{
|
|
210
177
|
form: z.ZodObject<{
|
|
211
178
|
id: z.ZodString;
|
|
@@ -360,6 +327,63 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
|
|
|
360
327
|
}>;
|
|
361
328
|
type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
|
|
362
329
|
|
|
330
|
+
declare const pageViewMetadataSchema: z.ZodObject<{
|
|
331
|
+
page: z.ZodObject<{
|
|
332
|
+
title: z.ZodNullable<z.ZodString>;
|
|
333
|
+
path: z.ZodString;
|
|
334
|
+
search: z.ZodString;
|
|
335
|
+
hash: z.ZodString;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
search: string;
|
|
338
|
+
title: string | null;
|
|
339
|
+
path: string;
|
|
340
|
+
hash: string;
|
|
341
|
+
}, {
|
|
342
|
+
search: string;
|
|
343
|
+
title: string | null;
|
|
344
|
+
path: string;
|
|
345
|
+
hash: string;
|
|
346
|
+
}>;
|
|
347
|
+
referrer: z.ZodNullable<z.ZodString>;
|
|
348
|
+
viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
349
|
+
w: z.ZodNumber;
|
|
350
|
+
h: z.ZodNumber;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
w: number;
|
|
353
|
+
h: number;
|
|
354
|
+
}, {
|
|
355
|
+
w: number;
|
|
356
|
+
h: number;
|
|
357
|
+
}>>>;
|
|
358
|
+
}, "strict", z.ZodTypeAny, {
|
|
359
|
+
page: {
|
|
360
|
+
search: string;
|
|
361
|
+
title: string | null;
|
|
362
|
+
path: string;
|
|
363
|
+
hash: string;
|
|
364
|
+
};
|
|
365
|
+
referrer: string | null;
|
|
366
|
+
viewport?: {
|
|
367
|
+
w: number;
|
|
368
|
+
h: number;
|
|
369
|
+
} | null | undefined;
|
|
370
|
+
}, {
|
|
371
|
+
page: {
|
|
372
|
+
search: string;
|
|
373
|
+
title: string | null;
|
|
374
|
+
path: string;
|
|
375
|
+
hash: string;
|
|
376
|
+
};
|
|
377
|
+
referrer: string | null;
|
|
378
|
+
viewport?: {
|
|
379
|
+
w: number;
|
|
380
|
+
h: number;
|
|
381
|
+
} | null | undefined;
|
|
382
|
+
}>;
|
|
383
|
+
type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
|
|
384
|
+
declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
385
|
+
type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
|
|
386
|
+
|
|
363
387
|
declare const phoneClickMetadataSchema: z.ZodObject<{
|
|
364
388
|
phone_number: z.ZodString;
|
|
365
389
|
page: z.ZodObject<{
|
|
@@ -732,6 +756,44 @@ declare const EVENT_REGISTRY: {
|
|
|
732
756
|
selector?: string | undefined;
|
|
733
757
|
}>;
|
|
734
758
|
};
|
|
759
|
+
readonly sdk_heartbeat: {
|
|
760
|
+
readonly kind: "automatic";
|
|
761
|
+
readonly metadataSchema: z.ZodObject<{
|
|
762
|
+
sdk_version: z.ZodString;
|
|
763
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
764
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
765
|
+
triggers: z.ZodObject<{
|
|
766
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
767
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
768
|
+
}, "strict", z.ZodTypeAny, {
|
|
769
|
+
automatic: string[];
|
|
770
|
+
manual: string[];
|
|
771
|
+
}, {
|
|
772
|
+
automatic: string[];
|
|
773
|
+
manual: string[];
|
|
774
|
+
}>;
|
|
775
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
776
|
+
}, "strict", z.ZodTypeAny, {
|
|
777
|
+
sdk_version: string;
|
|
778
|
+
package_name: string | null;
|
|
779
|
+
surface: "next" | "react" | "script";
|
|
780
|
+
triggers: {
|
|
781
|
+
automatic: string[];
|
|
782
|
+
manual: string[];
|
|
783
|
+
};
|
|
784
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
785
|
+
}, {
|
|
786
|
+
sdk_version: string;
|
|
787
|
+
package_name: string | null;
|
|
788
|
+
surface: "next" | "react" | "script";
|
|
789
|
+
triggers: {
|
|
790
|
+
automatic: string[];
|
|
791
|
+
manual: string[];
|
|
792
|
+
};
|
|
793
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
794
|
+
}>;
|
|
795
|
+
readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
796
|
+
};
|
|
735
797
|
readonly form_submit: {
|
|
736
798
|
readonly kind: "manual";
|
|
737
799
|
readonly metadataSchema: z.ZodObject<{
|
|
@@ -883,6 +945,7 @@ type MetadataByName = {
|
|
|
883
945
|
scroll_depth: ScrollDepthMetadata;
|
|
884
946
|
multi_page_session: MultiPageSessionMetadata;
|
|
885
947
|
form_start: FormStartMetadata;
|
|
948
|
+
sdk_heartbeat: SdkHeartbeatMetadata;
|
|
886
949
|
form_submit: FormSubmitMetadata;
|
|
887
950
|
phone_click: PhoneClickMetadata;
|
|
888
951
|
cta_click: CtaClickMetadata;
|
|
@@ -894,6 +957,7 @@ type ConfigByName = {
|
|
|
894
957
|
scroll_depth: ScrollDepthConfig;
|
|
895
958
|
multi_page_session: MultiPageSessionConfig;
|
|
896
959
|
form_start: FormStartConfig;
|
|
960
|
+
sdk_heartbeat: SdkHeartbeatConfig;
|
|
897
961
|
form_submit: FormSubmitConfig;
|
|
898
962
|
phone_click: PhoneClickConfig;
|
|
899
963
|
cta_click: CtaClickConfig;
|
|
@@ -919,6 +983,20 @@ type TriggerRegistryConfig = {
|
|
|
919
983
|
type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry['manual']>, ManualEventName>;
|
|
920
984
|
type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry['automatic'], AutomaticEventName>;
|
|
921
985
|
|
|
986
|
+
interface TrackEventInput {
|
|
987
|
+
eventType: string;
|
|
988
|
+
pageUrl?: string | null;
|
|
989
|
+
metadata?: Record<string, unknown> | null;
|
|
990
|
+
occurredAt?: Date | string | null;
|
|
991
|
+
}
|
|
992
|
+
interface TrackingClient {
|
|
993
|
+
trackEvent: (input: TrackEventInput) => void;
|
|
994
|
+
flush: () => Promise<void>;
|
|
995
|
+
getSessionId: () => string;
|
|
996
|
+
getVisitorId: () => string;
|
|
997
|
+
destroy: () => void;
|
|
998
|
+
}
|
|
999
|
+
|
|
922
1000
|
interface TypedTrackEventOptions {
|
|
923
1001
|
/** Override the page URL captured automatically. Rarely needed. */
|
|
924
1002
|
pageUrl?: string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -105,77 +105,6 @@ declare function createTrackingEventCreatePayload(trackingParams: TrackingParams
|
|
|
105
105
|
declare const TRACKING_PARAM_KEYS: readonly ["gclid", "fbclid", "utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
|
|
106
106
|
declare function captureTrackingParamsFromLocation(url?: string, maxAgeSeconds?: number): TrackingParams;
|
|
107
107
|
|
|
108
|
-
interface TrackEventInput {
|
|
109
|
-
eventType: string;
|
|
110
|
-
pageUrl?: string | null;
|
|
111
|
-
metadata?: Record<string, unknown> | null;
|
|
112
|
-
occurredAt?: Date | string | null;
|
|
113
|
-
}
|
|
114
|
-
interface TrackingClient {
|
|
115
|
-
trackEvent: (input: TrackEventInput) => void;
|
|
116
|
-
flush: () => Promise<void>;
|
|
117
|
-
getSessionId: () => string;
|
|
118
|
-
getVisitorId: () => string;
|
|
119
|
-
destroy: () => void;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
declare const pageViewMetadataSchema: z.ZodObject<{
|
|
123
|
-
page: z.ZodObject<{
|
|
124
|
-
title: z.ZodNullable<z.ZodString>;
|
|
125
|
-
path: z.ZodString;
|
|
126
|
-
search: z.ZodString;
|
|
127
|
-
hash: z.ZodString;
|
|
128
|
-
}, "strip", z.ZodTypeAny, {
|
|
129
|
-
search: string;
|
|
130
|
-
title: string | null;
|
|
131
|
-
path: string;
|
|
132
|
-
hash: string;
|
|
133
|
-
}, {
|
|
134
|
-
search: string;
|
|
135
|
-
title: string | null;
|
|
136
|
-
path: string;
|
|
137
|
-
hash: string;
|
|
138
|
-
}>;
|
|
139
|
-
referrer: z.ZodNullable<z.ZodString>;
|
|
140
|
-
viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
141
|
-
w: z.ZodNumber;
|
|
142
|
-
h: z.ZodNumber;
|
|
143
|
-
}, "strip", z.ZodTypeAny, {
|
|
144
|
-
w: number;
|
|
145
|
-
h: number;
|
|
146
|
-
}, {
|
|
147
|
-
w: number;
|
|
148
|
-
h: number;
|
|
149
|
-
}>>>;
|
|
150
|
-
}, "strict", z.ZodTypeAny, {
|
|
151
|
-
page: {
|
|
152
|
-
search: string;
|
|
153
|
-
title: string | null;
|
|
154
|
-
path: string;
|
|
155
|
-
hash: string;
|
|
156
|
-
};
|
|
157
|
-
referrer: string | null;
|
|
158
|
-
viewport?: {
|
|
159
|
-
w: number;
|
|
160
|
-
h: number;
|
|
161
|
-
} | null | undefined;
|
|
162
|
-
}, {
|
|
163
|
-
page: {
|
|
164
|
-
search: string;
|
|
165
|
-
title: string | null;
|
|
166
|
-
path: string;
|
|
167
|
-
hash: string;
|
|
168
|
-
};
|
|
169
|
-
referrer: string | null;
|
|
170
|
-
viewport?: {
|
|
171
|
-
w: number;
|
|
172
|
-
h: number;
|
|
173
|
-
} | null | undefined;
|
|
174
|
-
}>;
|
|
175
|
-
type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
|
|
176
|
-
declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
177
|
-
type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
|
|
178
|
-
|
|
179
108
|
declare const ctaClickMetadataSchema: z.ZodObject<{
|
|
180
109
|
cta_name: z.ZodString;
|
|
181
110
|
page: z.ZodObject<{
|
|
@@ -206,6 +135,44 @@ type CtaClickMetadata = z.infer<typeof ctaClickMetadataSchema>;
|
|
|
206
135
|
declare const ctaClickConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
207
136
|
type CtaClickConfig = z.infer<typeof ctaClickConfigSchema>;
|
|
208
137
|
|
|
138
|
+
declare const sdkHeartbeatMetadataSchema: z.ZodObject<{
|
|
139
|
+
sdk_version: z.ZodString;
|
|
140
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
141
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
142
|
+
triggers: z.ZodObject<{
|
|
143
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
144
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
145
|
+
}, "strict", z.ZodTypeAny, {
|
|
146
|
+
automatic: string[];
|
|
147
|
+
manual: string[];
|
|
148
|
+
}, {
|
|
149
|
+
automatic: string[];
|
|
150
|
+
manual: string[];
|
|
151
|
+
}>;
|
|
152
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
153
|
+
}, "strict", z.ZodTypeAny, {
|
|
154
|
+
sdk_version: string;
|
|
155
|
+
package_name: string | null;
|
|
156
|
+
surface: "next" | "react" | "script";
|
|
157
|
+
triggers: {
|
|
158
|
+
automatic: string[];
|
|
159
|
+
manual: string[];
|
|
160
|
+
};
|
|
161
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
sdk_version: string;
|
|
164
|
+
package_name: string | null;
|
|
165
|
+
surface: "next" | "react" | "script";
|
|
166
|
+
triggers: {
|
|
167
|
+
automatic: string[];
|
|
168
|
+
manual: string[];
|
|
169
|
+
};
|
|
170
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
type SdkHeartbeatMetadata = z.infer<typeof sdkHeartbeatMetadataSchema>;
|
|
173
|
+
declare const sdkHeartbeatConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
174
|
+
type SdkHeartbeatConfig = z.infer<typeof sdkHeartbeatConfigSchema>;
|
|
175
|
+
|
|
209
176
|
declare const formStartMetadataSchema: z.ZodObject<{
|
|
210
177
|
form: z.ZodObject<{
|
|
211
178
|
id: z.ZodString;
|
|
@@ -360,6 +327,63 @@ declare const multiPageSessionConfigSchema: z.ZodObject<{
|
|
|
360
327
|
}>;
|
|
361
328
|
type MultiPageSessionConfig = z.infer<typeof multiPageSessionConfigSchema>;
|
|
362
329
|
|
|
330
|
+
declare const pageViewMetadataSchema: z.ZodObject<{
|
|
331
|
+
page: z.ZodObject<{
|
|
332
|
+
title: z.ZodNullable<z.ZodString>;
|
|
333
|
+
path: z.ZodString;
|
|
334
|
+
search: z.ZodString;
|
|
335
|
+
hash: z.ZodString;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
search: string;
|
|
338
|
+
title: string | null;
|
|
339
|
+
path: string;
|
|
340
|
+
hash: string;
|
|
341
|
+
}, {
|
|
342
|
+
search: string;
|
|
343
|
+
title: string | null;
|
|
344
|
+
path: string;
|
|
345
|
+
hash: string;
|
|
346
|
+
}>;
|
|
347
|
+
referrer: z.ZodNullable<z.ZodString>;
|
|
348
|
+
viewport: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
349
|
+
w: z.ZodNumber;
|
|
350
|
+
h: z.ZodNumber;
|
|
351
|
+
}, "strip", z.ZodTypeAny, {
|
|
352
|
+
w: number;
|
|
353
|
+
h: number;
|
|
354
|
+
}, {
|
|
355
|
+
w: number;
|
|
356
|
+
h: number;
|
|
357
|
+
}>>>;
|
|
358
|
+
}, "strict", z.ZodTypeAny, {
|
|
359
|
+
page: {
|
|
360
|
+
search: string;
|
|
361
|
+
title: string | null;
|
|
362
|
+
path: string;
|
|
363
|
+
hash: string;
|
|
364
|
+
};
|
|
365
|
+
referrer: string | null;
|
|
366
|
+
viewport?: {
|
|
367
|
+
w: number;
|
|
368
|
+
h: number;
|
|
369
|
+
} | null | undefined;
|
|
370
|
+
}, {
|
|
371
|
+
page: {
|
|
372
|
+
search: string;
|
|
373
|
+
title: string | null;
|
|
374
|
+
path: string;
|
|
375
|
+
hash: string;
|
|
376
|
+
};
|
|
377
|
+
referrer: string | null;
|
|
378
|
+
viewport?: {
|
|
379
|
+
w: number;
|
|
380
|
+
h: number;
|
|
381
|
+
} | null | undefined;
|
|
382
|
+
}>;
|
|
383
|
+
type PageViewMetadata = z.infer<typeof pageViewMetadataSchema>;
|
|
384
|
+
declare const pageViewConfigSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
385
|
+
type PageViewConfig = z.infer<typeof pageViewConfigSchema>;
|
|
386
|
+
|
|
363
387
|
declare const phoneClickMetadataSchema: z.ZodObject<{
|
|
364
388
|
phone_number: z.ZodString;
|
|
365
389
|
page: z.ZodObject<{
|
|
@@ -732,6 +756,44 @@ declare const EVENT_REGISTRY: {
|
|
|
732
756
|
selector?: string | undefined;
|
|
733
757
|
}>;
|
|
734
758
|
};
|
|
759
|
+
readonly sdk_heartbeat: {
|
|
760
|
+
readonly kind: "automatic";
|
|
761
|
+
readonly metadataSchema: z.ZodObject<{
|
|
762
|
+
sdk_version: z.ZodString;
|
|
763
|
+
package_name: z.ZodNullable<z.ZodString>;
|
|
764
|
+
surface: z.ZodEnum<["next", "react", "script"]>;
|
|
765
|
+
triggers: z.ZodObject<{
|
|
766
|
+
automatic: z.ZodArray<z.ZodString, "many">;
|
|
767
|
+
manual: z.ZodArray<z.ZodString, "many">;
|
|
768
|
+
}, "strict", z.ZodTypeAny, {
|
|
769
|
+
automatic: string[];
|
|
770
|
+
manual: string[];
|
|
771
|
+
}, {
|
|
772
|
+
automatic: string[];
|
|
773
|
+
manual: string[];
|
|
774
|
+
}>;
|
|
775
|
+
trigger_config: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
776
|
+
}, "strict", z.ZodTypeAny, {
|
|
777
|
+
sdk_version: string;
|
|
778
|
+
package_name: string | null;
|
|
779
|
+
surface: "next" | "react" | "script";
|
|
780
|
+
triggers: {
|
|
781
|
+
automatic: string[];
|
|
782
|
+
manual: string[];
|
|
783
|
+
};
|
|
784
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
785
|
+
}, {
|
|
786
|
+
sdk_version: string;
|
|
787
|
+
package_name: string | null;
|
|
788
|
+
surface: "next" | "react" | "script";
|
|
789
|
+
triggers: {
|
|
790
|
+
automatic: string[];
|
|
791
|
+
manual: string[];
|
|
792
|
+
};
|
|
793
|
+
trigger_config?: Record<string, Record<string, unknown>> | null | undefined;
|
|
794
|
+
}>;
|
|
795
|
+
readonly configSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
796
|
+
};
|
|
735
797
|
readonly form_submit: {
|
|
736
798
|
readonly kind: "manual";
|
|
737
799
|
readonly metadataSchema: z.ZodObject<{
|
|
@@ -883,6 +945,7 @@ type MetadataByName = {
|
|
|
883
945
|
scroll_depth: ScrollDepthMetadata;
|
|
884
946
|
multi_page_session: MultiPageSessionMetadata;
|
|
885
947
|
form_start: FormStartMetadata;
|
|
948
|
+
sdk_heartbeat: SdkHeartbeatMetadata;
|
|
886
949
|
form_submit: FormSubmitMetadata;
|
|
887
950
|
phone_click: PhoneClickMetadata;
|
|
888
951
|
cta_click: CtaClickMetadata;
|
|
@@ -894,6 +957,7 @@ type ConfigByName = {
|
|
|
894
957
|
scroll_depth: ScrollDepthConfig;
|
|
895
958
|
multi_page_session: MultiPageSessionConfig;
|
|
896
959
|
form_start: FormStartConfig;
|
|
960
|
+
sdk_heartbeat: SdkHeartbeatConfig;
|
|
897
961
|
form_submit: FormSubmitConfig;
|
|
898
962
|
phone_click: PhoneClickConfig;
|
|
899
963
|
cta_click: CtaClickConfig;
|
|
@@ -919,6 +983,20 @@ type TriggerRegistryConfig = {
|
|
|
919
983
|
type RegisteredManualEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof NonNullable<TRegistry['manual']>, ManualEventName>;
|
|
920
984
|
type RegisteredAutomaticEvents<TRegistry extends TriggerRegistryConfig> = Extract<keyof TRegistry['automatic'], AutomaticEventName>;
|
|
921
985
|
|
|
986
|
+
interface TrackEventInput {
|
|
987
|
+
eventType: string;
|
|
988
|
+
pageUrl?: string | null;
|
|
989
|
+
metadata?: Record<string, unknown> | null;
|
|
990
|
+
occurredAt?: Date | string | null;
|
|
991
|
+
}
|
|
992
|
+
interface TrackingClient {
|
|
993
|
+
trackEvent: (input: TrackEventInput) => void;
|
|
994
|
+
flush: () => Promise<void>;
|
|
995
|
+
getSessionId: () => string;
|
|
996
|
+
getVisitorId: () => string;
|
|
997
|
+
destroy: () => void;
|
|
998
|
+
}
|
|
999
|
+
|
|
922
1000
|
interface TypedTrackEventOptions {
|
|
923
1001
|
/** Override the page URL captured automatically. Rarely needed. */
|
|
924
1002
|
pageUrl?: string | null;
|