2022-06-07 08:49:12 +02:00
|
|
|
import { z } from 'zod'
|
2023-01-25 11:27:47 +01:00
|
|
|
import { blockBaseSchema } from '../baseSchemas'
|
|
|
|
import { IntegrationBlockType } from './enums'
|
2022-06-07 08:49:12 +02:00
|
|
|
|
|
|
|
export const googleAnalyticsOptionsSchema = z.object({
|
|
|
|
trackingId: z.string().optional(),
|
|
|
|
category: z.string().optional(),
|
|
|
|
action: z.string().optional(),
|
|
|
|
label: z.string().optional(),
|
|
|
|
value: z.number().optional(),
|
|
|
|
})
|
|
|
|
|
2023-03-14 16:42:12 +01:00
|
|
|
export const googleAnalyticsBlockSchema = blockBaseSchema.merge(
|
2022-06-07 08:49:12 +02:00
|
|
|
z.object({
|
2022-06-11 07:27:38 +02:00
|
|
|
type: z.enum([IntegrationBlockType.GOOGLE_ANALYTICS]),
|
2022-06-07 08:49:12 +02:00
|
|
|
options: googleAnalyticsOptionsSchema,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
|
|
|
|
export const defaultGoogleAnalyticsOptions: GoogleAnalyticsOptions = {}
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type GoogleAnalyticsBlock = z.infer<typeof googleAnalyticsBlockSchema>
|
2022-06-07 08:49:12 +02:00
|
|
|
export type GoogleAnalyticsOptions = z.infer<
|
|
|
|
typeof googleAnalyticsOptionsSchema
|
|
|
|
>
|