@reservamos/browser-analytics 1.0.2 → 1.0.4
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/browser-analytics.cjs +1 -1
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.esm.js +1 -6
- package/dist/browser-analytics.esm.js.map +1 -1
- package/dist/browser-analytics.iife.js +1 -1
- package/dist/browser-analytics.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/events/identify/identifySchema.ts +1 -1
- package/src/services/validator/index.ts +4 -0
- package/src/services/validator/validator.test.ts +41 -0
- package/src/services/{validator.ts → validator/validator.ts} +4 -8
|
@@ -13071,7 +13071,7 @@ const IdentifySchema = z.object({
|
|
|
13071
13071
|
firstName: z.string().optional(),
|
|
13072
13072
|
lastName: z.string().optional(),
|
|
13073
13073
|
email: z.string().email().optional(),
|
|
13074
|
-
phone: z.string().regex(
|
|
13074
|
+
phone: z.string().regex(/^(\+?[1-9]\d{1,14})?$/).optional()
|
|
13075
13075
|
});
|
|
13076
13076
|
const PRODUCT_TYPES = ["web", "web-mobile", "ios", "android", "app"];
|
|
13077
13077
|
const productValidation = z.enum(PRODUCT_TYPES).refine((val) => PRODUCT_TYPES.includes(val), {
|
|
@@ -13308,7 +13308,6 @@ const viewResultsSchema = z.object({
|
|
|
13308
13308
|
"Route": z.string().min(1, "Route is required"),
|
|
13309
13309
|
"product": productValidation
|
|
13310
13310
|
});
|
|
13311
|
-
const TrackTestEventSchema = z.object({});
|
|
13312
13311
|
const InitConfigSchema = z.object({
|
|
13313
13312
|
/**
|
|
13314
13313
|
* The Mixpanel token used for authenticating API requests.
|
|
@@ -13369,7 +13368,6 @@ const SchemaErrorFormatter = (error) => {
|
|
|
13369
13368
|
});
|
|
13370
13369
|
};
|
|
13371
13370
|
const eventSchemas = {
|
|
13372
|
-
"Track Test": TrackTestEventSchema,
|
|
13373
13371
|
"Search": searchSchema,
|
|
13374
13372
|
"Seat Change": seatChangeSchema,
|
|
13375
13373
|
"Interest In Home": interestInHomeSchema,
|
|
@@ -13382,9 +13380,6 @@ const eventSchemas = {
|
|
|
13382
13380
|
};
|
|
13383
13381
|
function parseEventProps(eventName, eventData) {
|
|
13384
13382
|
const eventSchema = eventSchemas[eventName] || customEventSchema;
|
|
13385
|
-
if (!eventSchema) {
|
|
13386
|
-
throw { message: `Event ${eventName} not found` };
|
|
13387
|
-
}
|
|
13388
13383
|
try {
|
|
13389
13384
|
eventSchema.parse(eventData);
|
|
13390
13385
|
} catch (error) {
|