2
0

📈 Send onboarding replies to PostHog

This commit is contained in:
Baptiste Arnaud
2024-02-02 11:58:32 +01:00
parent ce79e897a7
commit fd4867f3ae
12 changed files with 99 additions and 36 deletions

View File

@ -37,6 +37,18 @@ const userCreatedEventSchema = userEvent.merge(
})
)
const userUpdatedEventSchema = userEvent.merge(
z.object({
name: z.literal('User updated'),
data: z.object({
name: z.string().optional(),
onboardingCategories: z.array(z.string()).optional(),
referral: z.string().optional(),
company: z.string().optional(),
}),
})
)
const typebotCreatedEventSchema = typebotEvent.merge(
z.object({
name: z.literal('Typebot created'),
@ -129,6 +141,7 @@ export const eventSchema = z.discriminatedUnion('name', [
subscriptionAutoUpdatedEventSchema,
workspacePastDueEventSchema,
workspaceNotPastDueEventSchema,
userUpdatedEventSchema,
])
export type TelemetryEvent = z.infer<typeof eventSchema>

View File

@ -14,6 +14,7 @@ export const userSchema = z.object({
image: z.string().nullable(),
company: z.string().nullable(),
onboardingCategories: z.array(z.string()),
referral: z.string().nullable(),
graphNavigation: z.nativeEnum(GraphNavigation),
preferredAppAppearance: z.string().nullable(),
displayedInAppNotifications: displayedInAppNotificationsSchema.nullable(),