import { z } from "zod"; /** * List of events that can open a message channel/port between the game and the iFrame. * For each message port, we define a type (key), zod validator for data passed on creation, and the * list of events that can be sent and received through this message port. */ export declare const iframeMessagePortTypeGuards: { joinSpace: { data: z.ZodObject<{ spaceName: z.ZodString; filterType: z.ZodEnum<["everyone", "streaming"]>; propertiesToSync: z.ZodArray; }, "strip", z.ZodTypeAny, { spaceName: string; filterType: "everyone" | "streaming"; propertiesToSync: string[]; }, { spaceName: string; filterType: "everyone" | "streaming"; propertiesToSync: string[]; }>; iframeEvents: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"watch">; data: z.ZodUndefined; }, "strip", z.ZodTypeAny, { type: "watch"; data?: undefined; }, { type: "watch"; data?: undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"unwatch">; data: z.ZodUndefined; }, "strip", z.ZodTypeAny, { type: "unwatch"; data?: undefined; }, { type: "unwatch"; data?: undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"leave">; data: z.ZodUndefined; }, "strip", z.ZodTypeAny, { type: "leave"; data?: undefined; }, { type: "leave"; data?: undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"startStreaming">; data: z.ZodUndefined; }, "strip", z.ZodTypeAny, { type: "startStreaming"; data?: undefined; }, { type: "startStreaming"; data?: undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"stopStreaming">; data: z.ZodUndefined; }, "strip", z.ZodTypeAny, { type: "stopStreaming"; data?: undefined; }, { type: "stopStreaming"; data?: undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"setMetadata">; data: z.ZodObject<{ metadata: z.ZodRecord; }, "strip", z.ZodTypeAny, { metadata: Record; }, { metadata: Record; }>; }, "strip", z.ZodTypeAny, { type: "setMetadata"; data: { metadata: Record; }; }, { type: "setMetadata"; data: { metadata: Record; }; }>]>; workAdventureEvents: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"onNewUser">; data: z.ZodObject<{ spaceUserId: z.ZodString; name: z.ZodString; playUri: z.ZodString; isLogged: z.ZodBoolean; availabilityStatus: z.ZodNumber; tags: z.ZodArray; cameraState: z.ZodBoolean; microphoneState: z.ZodBoolean; screenSharingState: z.ZodBoolean; megaphoneState: z.ZodBoolean; uuid: z.ZodString; chatID: z.ZodOptional; showVoiceIndicator: z.ZodBoolean; }, "strip", z.ZodTypeAny, { name: string; uuid: string; tags: string[]; isLogged: boolean; availabilityStatus: number; spaceUserId: string; playUri: string; cameraState: boolean; microphoneState: boolean; screenSharingState: boolean; megaphoneState: boolean; showVoiceIndicator: boolean; chatID?: string | undefined; }, { name: string; uuid: string; tags: string[]; isLogged: boolean; availabilityStatus: number; spaceUserId: string; playUri: string; cameraState: boolean; microphoneState: boolean; screenSharingState: boolean; megaphoneState: boolean; showVoiceIndicator: boolean; chatID?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "onNewUser"; data: { name: string; uuid: string; tags: string[]; isLogged: boolean; availabilityStatus: number; spaceUserId: string; playUri: string; cameraState: boolean; microphoneState: boolean; screenSharingState: boolean; megaphoneState: boolean; showVoiceIndicator: boolean; chatID?: string | undefined; }; }, { type: "onNewUser"; data: { name: string; uuid: string; tags: string[]; isLogged: boolean; availabilityStatus: number; spaceUserId: string; playUri: string; cameraState: boolean; microphoneState: boolean; screenSharingState: boolean; megaphoneState: boolean; showVoiceIndicator: boolean; chatID?: string | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"onDeleteUser">; data: z.ZodObject<{ spaceUserId: z.ZodString; }, "strip", z.ZodTypeAny, { spaceUserId: string; }, { spaceUserId: string; }>; }, "strip", z.ZodTypeAny, { type: "onDeleteUser"; data: { spaceUserId: string; }; }, { type: "onDeleteUser"; data: { spaceUserId: string; }; }>, z.ZodObject<{ type: z.ZodLiteral<"onUpdateUser">; data: z.ZodObject<{ spaceUserId: z.ZodString; changes: z.ZodObject<{ spaceUserId: z.ZodOptional; name: z.ZodOptional; playUri: z.ZodOptional; isLogged: z.ZodOptional; availabilityStatus: z.ZodOptional; tags: z.ZodOptional>; cameraState: z.ZodOptional; microphoneState: z.ZodOptional; screenSharingState: z.ZodOptional; megaphoneState: z.ZodOptional; uuid: z.ZodOptional; chatID: z.ZodOptional>; showVoiceIndicator: z.ZodOptional; }, "strip", z.ZodTypeAny, { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }, { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }>; updateMask: z.ZodArray; }, "strip", z.ZodTypeAny, { spaceUserId: string; changes: { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }; updateMask: string[]; }, { spaceUserId: string; changes: { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }; updateMask: string[]; }>; }, "strip", z.ZodTypeAny, { type: "onUpdateUser"; data: { spaceUserId: string; changes: { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }; updateMask: string[]; }; }, { type: "onUpdateUser"; data: { spaceUserId: string; changes: { name?: string | undefined; uuid?: string | undefined; tags?: string[] | undefined; isLogged?: boolean | undefined; availabilityStatus?: number | undefined; chatID?: string | undefined; spaceUserId?: string | undefined; playUri?: string | undefined; cameraState?: boolean | undefined; microphoneState?: boolean | undefined; screenSharingState?: boolean | undefined; megaphoneState?: boolean | undefined; showVoiceIndicator?: boolean | undefined; }; updateMask: string[]; }; }>, z.ZodObject<{ type: z.ZodLiteral<"onSetMetadata">; data: z.ZodObject<{ metadata: z.ZodRecord; }, "strip", z.ZodTypeAny, { metadata: Record; }, { metadata: Record; }>; }, "strip", z.ZodTypeAny, { type: "onSetMetadata"; data: { metadata: Record; }; }, { type: "onSetMetadata"; data: { metadata: Record; }; }>]>; }; enterLeave: { data: z.ZodObject<{ zoneName: z.ZodString; type: z.ZodUnion<[z.ZodLiteral<"layer">, z.ZodLiteral<"tiledArea">, z.ZodLiteral<"mapEditorArea">]>; }, "strip", z.ZodTypeAny, { type: "layer" | "tiledArea" | "mapEditorArea"; zoneName: string; }, { type: "layer" | "tiledArea" | "mapEditorArea"; zoneName: string; }>; iframeEvents: z.ZodVoid; workAdventureEvents: z.ZodObject<{ type: z.ZodLiteral<"onAction">; action: z.ZodUnion<[z.ZodLiteral<"enter">, z.ZodLiteral<"leave">]>; data: z.ZodObject<{ reason: z.ZodUnion<[z.ZodLiteral<"initial">, z.ZodLiteral<"move">]>; }, "strip", z.ZodTypeAny, { reason: "initial" | "move"; }, { reason: "initial" | "move"; }>; }, "strip", z.ZodTypeAny, { type: "onAction"; action: "leave" | "enter"; data: { reason: "initial" | "move"; }; }, { type: "onAction"; action: "leave" | "enter"; data: { reason: "initial" | "move"; }; }>; }; }; type IframeMessagePortTypeGuards = typeof iframeMessagePortTypeGuards; export type IframeMessagePortMap = { [key in keyof IframeMessagePortTypeGuards]: { data: z.infer; iframeEvents: z.infer; workAdventureEvents: IframeMessagePortTypeGuards[key]["workAdventureEvents"]; }; }; export interface IframeMessagePortData { type: T; data: IframeMessagePortMap[T]["data"]; } export interface MessagePortIframeEvent { type: T; data: IframeMessagePortMap[T]["iframeEvents"]; } export interface MessagePortWorkAdventureEvent { type: T; data: IframeMessagePortMap[T]["workAdventureEvents"]; } export declare const isIframeMessagePortType: (type: string) => type is keyof IframeMessagePortMap; export interface IframeMessagePortWrapper { messagePort: true; id: number; type: T; data: IframeMessagePortMap[T]["data"]; } export declare const isIframeMessagePortWrapper: (event: any) => event is IframeMessagePortWrapper; export declare const isIframeErrorMessagePortEvent: z.ZodObject<{ id: z.ZodNumber; error: z.ZodString; messagePort: z.ZodLiteral; }, "strip", z.ZodTypeAny, { error: string; id: number; messagePort: true; }, { error: string; id: number; messagePort: true; }>; /** * A message sent from the game to the iFrame when an error occurs while processing a message port opening. */ export type IframeErrorMessagePortEvent = z.infer; export declare const isIframeSuccessMessagePortEvent: z.ZodObject<{ id: z.ZodNumber; messagePort: z.ZodLiteral; }, "strip", z.ZodTypeAny, { id: number; messagePort: true; }, { id: number; messagePort: true; }>; /** * A message sent from the game to the iFrame when an error occurs while processing a message port opening. */ export type IframeSuccessMessagePortEvent = z.infer; export {};