@reservamos/browser-analytics 1.1.8-alpha.0 → 1.1.8-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.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -3
  2. package/README.md +33 -7
  3. package/dist/browser-analytics.cjs +2 -2
  4. package/dist/browser-analytics.cjs.map +1 -1
  5. package/dist/browser-analytics.d.ts +15 -2
  6. package/dist/browser-analytics.esm.js +590 -109
  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.robustness.test.ts +112 -13
  12. package/src/events/identify/identify.ts +84 -34
  13. package/src/events/passengersCreated/passengersCreatedSchema.test.ts +142 -0
  14. package/src/events/passengersCreated/passengersCreatedSchema.ts +7 -1
  15. package/src/events/purchaseConfirmation/purchaseConfirmation.integration.test.ts +49 -0
  16. package/src/events/purchaseConfirmation/purchaseConfirmation.test.ts +17 -0
  17. package/src/events/purchaseConfirmation/purchaseConfirmationSchema.ts +2 -0
  18. package/src/events/sharedSchemas/tripSchema.ts +3 -8
  19. package/src/index.ts +1 -0
  20. package/src/init.botDetection.test.ts +187 -0
  21. package/src/init.test.ts +1 -0
  22. package/src/init.ts +15 -2
  23. package/src/services/botDetectionRelay.test.ts +3 -2
  24. package/src/services/deferredBotDetection.ts +60 -0
  25. package/src/services/fingerprint.test.ts +190 -0
  26. package/src/services/fingerprint.ts +141 -13
  27. package/src/services/fingerprint.wait.integration.test.ts +129 -0
  28. package/src/services/mixpanel.test.ts +119 -73
  29. package/src/services/mixpanel.ts +82 -23
  30. package/src/services/trackingLifecycle.ts +54 -0
  31. package/src/services/validator/validator.test.ts +79 -0
  32. package/src/track.readiness.test.ts +131 -0
  33. package/src/track.recovery.test.ts +339 -0
  34. package/src/track.storage.test.ts +142 -0
  35. package/src/track.test.ts +130 -5
  36. package/src/track.ts +110 -25
  37. package/src/util/pendingWork.test.ts +164 -0
  38. package/src/util/pendingWork.ts +148 -0
  39. package/src/util/snapshotEventData.ts +15 -0
@@ -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
  }>;
@@ -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: {