import * as z from "zod/mini"; import { createGeneration, type Generation, generationSchema, } from "./v3-generation.js"; export type { EventViewActivated, EventViewAllocationFailed, EventViewClosed, EventViewCloseFailed, EventViewPrerendered, } from "./view-host-lifecycle-events.js"; export { buildEventViewActivated, buildEventViewAllocationFailed, buildEventViewClosed, buildEventViewCloseFailed, buildEventViewPrerendered, eventViewActivatedSchema, eventViewAllocationFailedSchema, eventViewClosedSchema, eventViewCloseFailedSchema, eventViewPrerenderedSchema, } from "./view-host-lifecycle-events.js"; const canonicalIdStringSchema = z.string().check(z.trim(), z.minLength(1)); export const eventViewActivationDecidedSchema = z.strictObject({ t: z.literal("getuserfeedback:event:viewActivationDecided"), gen: generationSchema, viewId: canonicalIdStringSchema, activationAttemptId: canonicalIdStringSchema, allowed: z.boolean(), }); export type EventViewActivationDecided = z.output< typeof eventViewActivationDecidedSchema >; export function buildEventViewActivationDecided(input: { gen: number | Generation; viewId: string; activationAttemptId: string; allowed: boolean; }): EventViewActivationDecided { return { t: "getuserfeedback:event:viewActivationDecided", gen: typeof input.gen === "number" ? createGeneration(input.gen) : input.gen, viewId: input.viewId, activationAttemptId: input.activationAttemptId, allowed: input.allowed, }; }