@reservamos/browser-analytics 0.1.3 → 0.1.4-alpha.2
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/CHANGELOG.md +14 -0
- package/README.md +23 -11
- package/dist/browser-analytics.cjs +3 -3
- package/dist/browser-analytics.d.ts +80 -13
- package/dist/browser-analytics.esm.js +12231 -12316
- package/dist/browser-analytics.iife.js +24 -24
- package/package.json +1 -1
- package/src/constants/ProductTypes.ts +6 -0
- package/src/events/identify/identify.ts +81 -0
- package/src/events/identify/identifySchema.ts +15 -0
- package/src/events/identify/index.ts +3 -0
- package/src/events/search/index.ts +7 -0
- package/src/events/search/searchSchema.ts +44 -0
- package/src/events/search/trackSearch.ts +14 -0
- package/src/events/test/index.ts +3 -0
- package/src/events/{trackTest.ts → test/trackTest.ts} +4 -2
- package/src/index.ts +13 -8
- package/src/init.ts +6 -8
- package/src/{fingerprint.ts → services/fingerprint.ts} +11 -3
- package/src/services/mixpanel.ts +89 -0
- package/src/services/validator.ts +138 -0
- package/src/track.ts +7 -13
- package/src/util/dateValidation.ts +26 -0
- package/src/util/userFingerprintValidation.ts +9 -0
- package/src/events/event_schema/PaymentFailedEventSchema.ts +0 -247
- package/src/events/event_schema/PurchaseCompleteEventSchema.ts +0 -62
- package/src/events/event_schema/validationSchema.ts +0 -135
- package/src/mixpanel.ts +0 -36
|
@@ -2,10 +2,78 @@
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
declare const IdentifySchema: z.ZodObject<{
|
|
6
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
7
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
8
|
+
email: z.ZodOptional<z.ZodString>;
|
|
9
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
email?: string | undefined;
|
|
12
|
+
firstName?: string | undefined;
|
|
13
|
+
lastName?: string | undefined;
|
|
14
|
+
phone?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
email?: string | undefined;
|
|
17
|
+
firstName?: string | undefined;
|
|
18
|
+
lastName?: string | undefined;
|
|
19
|
+
phone?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type DefaultProperties = z.infer<typeof IdentifySchema>;
|
|
22
|
+
export interface UserProperties extends DefaultProperties, Record<string, string | number | boolean | undefined> {
|
|
23
|
+
}
|
|
24
|
+
declare function identify(userId: string, properties?: UserProperties): Promise<void>;
|
|
25
|
+
declare const searchSchema: z.ZodObject<{
|
|
26
|
+
Departure: z.ZodEffects<z.ZodString, string, string>;
|
|
27
|
+
"Departure Delta": z.ZodNumber;
|
|
28
|
+
Destination: z.ZodString;
|
|
29
|
+
"Destination Terminal": z.ZodString;
|
|
30
|
+
"User Fingerprint": z.ZodOptional<z.ZodEffects<z.ZodUnion<[
|
|
31
|
+
z.ZodString,
|
|
32
|
+
z.ZodNull
|
|
33
|
+
]>, string | null, string | null>>;
|
|
34
|
+
Origin: z.ZodString;
|
|
35
|
+
"Origin Terminal": z.ZodString;
|
|
36
|
+
Passengers: z.ZodNumber;
|
|
37
|
+
Return: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
38
|
+
Route: z.ZodString;
|
|
39
|
+
"Trip Length": z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
product: z.ZodEffects<z.ZodEnum<[
|
|
41
|
+
"web",
|
|
42
|
+
"web-mobile",
|
|
43
|
+
"ios",
|
|
44
|
+
"android",
|
|
45
|
+
"app"
|
|
46
|
+
]>, "web" | "web-mobile" | "ios" | "android" | "app", "web" | "web-mobile" | "ios" | "android" | "app">;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
product: "web" | "web-mobile" | "ios" | "android" | "app";
|
|
49
|
+
Departure: string;
|
|
50
|
+
"Departure Delta": number;
|
|
51
|
+
Destination: string;
|
|
52
|
+
"Destination Terminal": string;
|
|
53
|
+
Origin: string;
|
|
54
|
+
"Origin Terminal": string;
|
|
55
|
+
Passengers: number;
|
|
56
|
+
Route: string;
|
|
57
|
+
"User Fingerprint"?: string | null | undefined;
|
|
58
|
+
Return?: string | undefined;
|
|
59
|
+
"Trip Length"?: number | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
product: "web" | "web-mobile" | "ios" | "android" | "app";
|
|
62
|
+
Departure: string;
|
|
63
|
+
"Departure Delta": number;
|
|
64
|
+
Destination: string;
|
|
65
|
+
"Destination Terminal": string;
|
|
66
|
+
Origin: string;
|
|
67
|
+
"Origin Terminal": string;
|
|
68
|
+
Passengers: number;
|
|
69
|
+
Route: string;
|
|
70
|
+
"User Fingerprint"?: string | null | undefined;
|
|
71
|
+
Return?: string | undefined;
|
|
72
|
+
"Trip Length"?: number | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
export type SearchProps = z.infer<typeof searchSchema>;
|
|
75
|
+
declare function trackSearch(eventData: SearchProps): void;
|
|
76
|
+
declare function trackTest(): void;
|
|
9
77
|
declare const InitConfigSchema: z.ZodObject<{
|
|
10
78
|
/**
|
|
11
79
|
* The Mixpanel token used for authenticating API requests.
|
|
@@ -33,19 +101,18 @@ declare const InitConfigSchema: z.ZodObject<{
|
|
|
33
101
|
* Configuration object for initializing the tracking library.
|
|
34
102
|
*/
|
|
35
103
|
export type InitConfig = z.infer<typeof InitConfigSchema>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
* @param {InitConfig} config - The configuration object for initialization.
|
|
39
|
-
* @throws {Error} Throws an error if the configuration is invalid.
|
|
40
|
-
*/
|
|
41
|
-
export declare function init(config: InitConfig): Promise<void>;
|
|
42
|
-
declare const tracker: {
|
|
104
|
+
declare function init(config: InitConfig): Promise<void>;
|
|
105
|
+
declare const analytics: {
|
|
43
106
|
init: typeof init;
|
|
44
|
-
|
|
107
|
+
identify: typeof identify;
|
|
108
|
+
track: {
|
|
109
|
+
test: typeof trackTest;
|
|
110
|
+
search: typeof trackSearch;
|
|
111
|
+
};
|
|
45
112
|
};
|
|
46
113
|
|
|
47
114
|
export {
|
|
48
|
-
|
|
115
|
+
analytics as default,
|
|
49
116
|
};
|
|
50
117
|
|
|
51
118
|
export {};
|