2022-06-07 08:49:12 +02:00
|
|
|
import { z } from 'zod'
|
2023-11-08 15:34:16 +01:00
|
|
|
import { variableStringSchema } from '../../../utils'
|
|
|
|
import { blockBaseSchema } from '../../shared'
|
|
|
|
import { IntegrationBlockType } from '../constants'
|
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(),
|
2023-05-02 13:46:49 -04:00
|
|
|
value: z.number().or(variableStringSchema).optional(),
|
2023-04-27 13:23:10 +02:00
|
|
|
sendTo: z.string().optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
|
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]),
|
2023-11-08 15:34:16 +01:00
|
|
|
options: googleAnalyticsOptionsSchema.optional(),
|
2022-06-07 08:49:12 +02:00
|
|
|
})
|
|
|
|
)
|
|
|
|
|
2022-06-11 07:27:38 +02:00
|
|
|
export type GoogleAnalyticsBlock = z.infer<typeof googleAnalyticsBlockSchema>
|