@reservamos/browser-analytics 1.1.8-alpha.1 → 1.1.8-alpha.3

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/README.md +32 -4
  3. package/dist/browser-analytics.cjs +2 -2
  4. package/dist/browser-analytics.cjs.map +1 -1
  5. package/dist/browser-analytics.d.ts +23 -10
  6. package/dist/browser-analytics.esm.js +466 -154
  7. package/dist/browser-analytics.esm.js.map +1 -1
  8. package/dist/browser-analytics.iife.js +2 -2
  9. package/dist/browser-analytics.iife.js.map +1 -1
  10. package/package.json +2 -2
  11. package/src/events/identify/identify.recovery.test.ts +367 -0
  12. package/src/events/identify/identify.robustness.test.ts +112 -13
  13. package/src/events/identify/identify.ts +72 -35
  14. package/src/events/passengersCreated/passengersCreatedSchema.test.ts +142 -0
  15. package/src/events/passengersCreated/passengersCreatedSchema.ts +7 -1
  16. package/src/events/purchaseConfirmation/purchaseConfirmation.integration.test.ts +49 -0
  17. package/src/events/purchaseConfirmation/purchaseConfirmation.test.ts +17 -0
  18. package/src/events/purchaseConfirmation/purchaseConfirmationSchema.ts +2 -0
  19. package/src/index.ts +1 -0
  20. package/src/init.ts +10 -1
  21. package/src/profiles/createAnonymousProfile/createAnonymousProfile.ts +18 -2
  22. package/src/services/botDetectionRelay.test.ts +3 -2
  23. package/src/services/fingerprint.test.ts +172 -0
  24. package/src/services/fingerprint.ts +106 -5
  25. package/src/services/fingerprint.wait.integration.test.ts +129 -0
  26. package/src/services/mixpanel.batch.test.ts +108 -0
  27. package/src/services/mixpanel.test.ts +77 -73
  28. package/src/services/mixpanel.ts +45 -18
  29. package/src/services/profileEnrichment.ts +258 -0
  30. package/src/track.storage.test.ts +27 -12
@@ -158,6 +158,7 @@ declare const passengersCreatedSchema: z.ZodObject<{
158
158
  "Passenger Document Type": string;
159
159
  "Passenger Document Id": string;
160
160
  }>, "many">>;
161
+ Coupon: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
161
162
  }, "strict", z.ZodTypeAny, {
162
163
  product: "web" | "web-mobile" | "ios" | "android" | "app";
163
164
  Trips: {
@@ -198,6 +199,7 @@ declare const passengersCreatedSchema: z.ZodObject<{
198
199
  "Passenger Document Type": string;
199
200
  "Passenger Document Id": string;
200
201
  }[] | undefined;
202
+ Coupon?: string | undefined;
201
203
  }, {
202
204
  product: "web" | "web-mobile" | "ios" | "android" | "app";
203
205
  Trips: {
@@ -238,6 +240,7 @@ declare const passengersCreatedSchema: z.ZodObject<{
238
240
  "Passenger Document Type": string;
239
241
  "Passenger Document Id": string;
240
242
  }[] | undefined;
243
+ Coupon?: string | undefined;
241
244
  }>;
242
245
  export type PassengersCreatedProps = z.infer<typeof passengersCreatedSchema>;
243
246
  declare function trackPassengersCreated(eventProps: PassengersCreatedProps, meta?: EventMetadata): void;
@@ -366,9 +369,9 @@ declare const paymentAttemptSchema: z.ZodObject<{
366
369
  "Passenger Document Type": string;
367
370
  "Passenger Document Id": string;
368
371
  }[] | undefined;
372
+ Coupon?: string | undefined;
369
373
  "Operation Id"?: string | undefined;
370
374
  Insurance?: boolean | undefined;
371
- Coupon?: string | undefined;
372
375
  "User Status"?: string | undefined;
373
376
  }, {
374
377
  product: "web" | "web-mobile" | "ios" | "android" | "app";
@@ -411,9 +414,9 @@ declare const paymentAttemptSchema: z.ZodObject<{
411
414
  "Passenger Document Type": string;
412
415
  "Passenger Document Id": string;
413
416
  }[] | undefined;
417
+ Coupon?: string | undefined;
414
418
  "Operation Id"?: string | undefined;
415
419
  Insurance?: boolean | undefined;
416
- Coupon?: string | undefined;
417
420
  "User Status"?: string | undefined;
418
421
  }>;
419
422
  export type PaymentAttemptProps = z.infer<typeof paymentAttemptSchema>;
@@ -821,14 +824,23 @@ declare const purchaseConfirmationSchema: z.ZodObject<{
821
824
  ]>;
822
825
  "Payment Type": z.ZodOptional<z.ZodString>;
823
826
  Total: z.ZodOptional<z.ZodNumber>;
827
+ product: z.ZodOptional<z.ZodEffects<z.ZodEnum<[
828
+ "web",
829
+ "web-mobile",
830
+ "ios",
831
+ "android",
832
+ "app"
833
+ ]>, "web" | "web-mobile" | "ios" | "android" | "app", "web" | "web-mobile" | "ios" | "android" | "app">>;
824
834
  }, "strict", z.ZodTypeAny, {
825
835
  "Operation Id": string;
826
836
  "Payment Status": "confirmed" | "pending_pix";
837
+ product?: "web" | "web-mobile" | "ios" | "android" | "app" | undefined;
827
838
  Total?: number | undefined;
828
839
  "Payment Type"?: string | undefined;
829
840
  }, {
830
841
  "Operation Id": string;
831
842
  "Payment Status": "confirmed" | "pending_pix";
843
+ product?: "web" | "web-mobile" | "ios" | "android" | "app" | undefined;
832
844
  Total?: number | undefined;
833
845
  "Payment Type"?: string | undefined;
834
846
  }>;
@@ -1047,35 +1059,35 @@ declare const CreateAnonymousProfileSchema: z.ZodEffects<z.ZodObject<{
1047
1059
  }, "strip", z.ZodTypeAny, {
1048
1060
  email?: string | undefined;
1049
1061
  phone?: string | undefined;
1050
- firstName?: string | undefined;
1051
- lastName?: string | undefined;
1052
1062
  cpf?: string | undefined;
1053
1063
  passport?: string | undefined;
1054
1064
  rg?: string | undefined;
1065
+ firstName?: string | undefined;
1066
+ lastName?: string | undefined;
1055
1067
  }, {
1056
1068
  email?: string | undefined;
1057
1069
  phone?: string | undefined;
1058
- firstName?: string | undefined;
1059
- lastName?: string | undefined;
1060
1070
  cpf?: string | undefined;
1061
1071
  passport?: string | undefined;
1062
1072
  rg?: string | undefined;
1073
+ firstName?: string | undefined;
1074
+ lastName?: string | undefined;
1063
1075
  }>, {
1064
1076
  email?: string | undefined;
1065
1077
  phone?: string | undefined;
1066
- firstName?: string | undefined;
1067
- lastName?: string | undefined;
1068
1078
  cpf?: string | undefined;
1069
1079
  passport?: string | undefined;
1070
1080
  rg?: string | undefined;
1081
+ firstName?: string | undefined;
1082
+ lastName?: string | undefined;
1071
1083
  }, {
1072
1084
  email?: string | undefined;
1073
1085
  phone?: string | undefined;
1074
- firstName?: string | undefined;
1075
- lastName?: string | undefined;
1076
1086
  cpf?: string | undefined;
1077
1087
  passport?: string | undefined;
1078
1088
  rg?: string | undefined;
1089
+ firstName?: string | undefined;
1090
+ lastName?: string | undefined;
1079
1091
  }>;
1080
1092
  export type CreateAnonymousProfileProps = z.infer<typeof CreateAnonymousProfileSchema>;
1081
1093
  declare function createAnonymousProfile(payload: CreateAnonymousProfileProps): Promise<AnonymousProfile | undefined>;
@@ -1300,6 +1312,7 @@ declare const analytics: {
1300
1312
  identify: typeof identify;
1301
1313
  identifiers: {
1302
1314
  getFingerprintId: () => string | null;
1315
+ waitForFingerprintId: (timeoutMs?: number) => Promise<string | null>;
1303
1316
  getDistinctId: () => string | null;
1304
1317
  };
1305
1318
  profiles: {