import { z } from 'zod'; import { type ParseResult } from '../../lib/zod'; import { type CopyContext } from '../../context'; import { type IntrospectionTarget } from '../../introspection'; import { type ResourceResolver } from '../../resources/resolver'; import { ControlDefinition, type Resolvable, type SchemaType } from '../definition'; import { DefaultControlInstance, type ControlInstanceArgs } from '../instance'; import { ControlDefinitionVisitor } from '../visitor'; import { type GenericMouseEvent } from './mouse-event'; import * as LinkSchema from './schema'; /** * Defining the config schema out of the Definition class to avoid a `Type alias * 'Config' circularly references itself` error from TS. Given that we use this * pattern of defining the config schema in the class itself in other controls, * this may be a case of the compiler reaching some limit. */ declare const configSchema: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; }, { label?: string | undefined; description?: string | undefined; }>; type Config = z.infer; type Schema<_C extends Config> = typeof Definition.schema; type LinkTarget = z.infer['linkTarget']>; type DataType = z.infer['data']>; type ValueType = z.infer['value']>; type ScrollOptions = z.infer; type OnClick = ((event: MouseEventType) => void) & { $scrollOptions?: ScrollOptions; }; type ResolvedValueType = { href: string; target?: LinkTarget; onClick: OnClick; }; declare class Definition extends ControlDefinition, ValueType, ResolvedValueType> { static readonly type: "makeswift::controls::link"; static get schema(): { type: z.ZodLiteral<"makeswift::controls::link">; data: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"OPEN_PAGE">; payload: z.ZodEffects>; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { openInNewTab: boolean; pageId?: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>, { openInNewTab: boolean; pageId: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; }, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId?: string | null | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"OPEN_URL">; payload: z.ZodObject<{ url: z.ZodString; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { url: string; openInNewTab: boolean; }, { url: string; openInNewTab: boolean; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SEND_EMAIL">; payload: z.ZodObject<{ to: z.ZodString; subject: z.ZodOptional; body: z.ZodOptional; }, "strip", z.ZodTypeAny, { to: string; subject?: string | undefined; body?: string | undefined; }, { to: string; subject?: string | undefined; body?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"CALL_PHONE">; payload: z.ZodObject<{ phoneNumber: z.ZodString; }, "strip", z.ZodTypeAny, { phoneNumber: string; }, { phoneNumber: string; }>; }, "strip", z.ZodTypeAny, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SCROLL_TO_ELEMENT">; payload: z.ZodEffects>>; block: z.ZodEnum<["start", "center", "end", "nearest"]>; }, "strip", z.ZodTypeAny, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>, { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; }, { type: "SCROLL_TO_ELEMENT"; payload: { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }; }>]>, z.ZodNull]>; link: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"OPEN_PAGE">; payload: z.ZodEffects>; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { openInNewTab: boolean; pageId?: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>, { openInNewTab: boolean; pageId: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; }, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId?: string | null | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"OPEN_URL">; payload: z.ZodObject<{ url: z.ZodString; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { url: string; openInNewTab: boolean; }, { url: string; openInNewTab: boolean; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SEND_EMAIL">; payload: z.ZodObject<{ to: z.ZodString; subject: z.ZodOptional; body: z.ZodOptional; }, "strip", z.ZodTypeAny, { to: string; subject?: string | undefined; body?: string | undefined; }, { to: string; subject?: string | undefined; body?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"CALL_PHONE">; payload: z.ZodObject<{ phoneNumber: z.ZodString; }, "strip", z.ZodTypeAny, { phoneNumber: string; }, { phoneNumber: string; }>; }, "strip", z.ZodTypeAny, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SCROLL_TO_ELEMENT">; payload: z.ZodEffects>>; block: z.ZodEnum<["start", "center", "end", "nearest"]>; }, "strip", z.ZodTypeAny, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>, { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; }, { type: "SCROLL_TO_ELEMENT"; payload: { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }; }>]>; linkTarget: z.ZodEnum<["_blank", "_self"]>; value: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"OPEN_PAGE">; payload: z.ZodEffects>; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { openInNewTab: boolean; pageId?: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>, { openInNewTab: boolean; pageId: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; }, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId?: string | null | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"OPEN_URL">; payload: z.ZodObject<{ url: z.ZodString; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { url: string; openInNewTab: boolean; }, { url: string; openInNewTab: boolean; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SEND_EMAIL">; payload: z.ZodObject<{ to: z.ZodString; subject: z.ZodOptional; body: z.ZodOptional; }, "strip", z.ZodTypeAny, { to: string; subject?: string | undefined; body?: string | undefined; }, { to: string; subject?: string | undefined; body?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"CALL_PHONE">; payload: z.ZodObject<{ phoneNumber: z.ZodString; }, "strip", z.ZodTypeAny, { phoneNumber: string; }, { phoneNumber: string; }>; }, "strip", z.ZodTypeAny, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SCROLL_TO_ELEMENT">; payload: z.ZodEffects>>; block: z.ZodEnum<["start", "center", "end", "nearest"]>; }, "strip", z.ZodTypeAny, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>, { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; }, { type: "SCROLL_TO_ELEMENT"; payload: { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }; }>]>, z.ZodNull]>; resolvedValue: z.ZodObject<{ href: z.ZodString; target: z.ZodOptional>; onClick: z.ZodFunction, z.ZodVoid>; }, "strip", z.ZodTypeAny, { href: string; onClick: (args_0: any, ...args_1: unknown[]) => void; target?: "_blank" | "_self" | undefined; }, { href: string; onClick: (args_0: any, ...args_1: unknown[]) => void; target?: "_blank" | "_self" | undefined; }>; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; }, { label?: string | undefined; description?: string | undefined; }>; definition: z.ZodObject<{ type: z.ZodLiteral<"makeswift::controls::link">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; }, { label?: string | undefined; description?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "makeswift::controls::link"; config: { label?: string | undefined; description?: string | undefined; }; }, { type: "makeswift::controls::link"; config: { label?: string | undefined; description?: string | undefined; }; }>; }; get controlType(): "makeswift::controls::link"; get schema(): { data: SchemaType<{ type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; } | { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; } | { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; } | { type: "CALL_PHONE"; payload: { phoneNumber: string; }; } | { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; } | null>; value: SchemaType<{ type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; } | { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; } | { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; } | { type: "CALL_PHONE"; payload: { phoneNumber: string; }; } | { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; } | null>; resolvedValue: SchemaType>; type: z.ZodLiteral<"makeswift::controls::link">; link: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"OPEN_PAGE">; payload: z.ZodEffects>; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { openInNewTab: boolean; pageId?: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>, { openInNewTab: boolean; pageId: string | null | undefined; }, { openInNewTab: boolean; pageId?: string | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId: string | null | undefined; }; }, { type: "OPEN_PAGE"; payload: { openInNewTab: boolean; pageId?: string | null | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"OPEN_URL">; payload: z.ZodObject<{ url: z.ZodString; openInNewTab: z.ZodBoolean; }, "strip", z.ZodTypeAny, { url: string; openInNewTab: boolean; }, { url: string; openInNewTab: boolean; }>; }, "strip", z.ZodTypeAny, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }, { type: "OPEN_URL"; payload: { url: string; openInNewTab: boolean; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SEND_EMAIL">; payload: z.ZodObject<{ to: z.ZodString; subject: z.ZodOptional; body: z.ZodOptional; }, "strip", z.ZodTypeAny, { to: string; subject?: string | undefined; body?: string | undefined; }, { to: string; subject?: string | undefined; body?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }, { type: "SEND_EMAIL"; payload: { to: string; subject?: string | undefined; body?: string | undefined; }; }>, z.ZodObject<{ type: z.ZodLiteral<"CALL_PHONE">; payload: z.ZodObject<{ phoneNumber: z.ZodString; }, "strip", z.ZodTypeAny, { phoneNumber: string; }, { phoneNumber: string; }>; }, "strip", z.ZodTypeAny, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }, { type: "CALL_PHONE"; payload: { phoneNumber: string; }; }>, z.ZodObject<{ type: z.ZodLiteral<"SCROLL_TO_ELEMENT">; payload: z.ZodEffects>>; block: z.ZodEnum<["start", "center", "end", "nearest"]>; }, "strip", z.ZodTypeAny, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>, { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }, { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }>; }, "strip", z.ZodTypeAny, { type: "SCROLL_TO_ELEMENT"; payload: { elementIdConfig: { elementKey: string; propName: string; } | null | undefined; block: "start" | "center" | "end" | "nearest"; }; }, { type: "SCROLL_TO_ELEMENT"; payload: { block: "start" | "center" | "end" | "nearest"; elementIdConfig?: { elementKey: string; propName: string; } | null | undefined; }; }>]>; linkTarget: z.ZodEnum<["_blank", "_self"]>; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; }, { label?: string | undefined; description?: string | undefined; }>; definition: z.ZodObject<{ type: z.ZodLiteral<"makeswift::controls::link">; config: z.ZodObject<{ label: z.ZodOptional; description: z.ZodOptional; }, "strip", z.ZodTypeAny, { label?: string | undefined; description?: string | undefined; }, { label?: string | undefined; description?: string | undefined; }>; }, "strip", z.ZodTypeAny, { type: "makeswift::controls::link"; config: { label?: string | undefined; description?: string | undefined; }; }, { type: "makeswift::controls::link"; config: { label?: string | undefined; description?: string | undefined; }; }>; }; safeParse(data: unknown | undefined): ParseResult | undefined>; fromData(data: DataType | undefined): ValueType | undefined; toData(value: ValueType): DataType; copyData(data: DataType | undefined, ctx: CopyContext): DataType | undefined; resolveValue(data: DataType | undefined, resolver: ResourceResolver): Resolvable>; resolveOnClick(_data: DataType | undefined, _href: string, scrollOptions: ScrollOptions | undefined): OnClick; introspect(data: DataType | undefined, target: IntrospectionTarget): R[]; createInstance(args: ControlInstanceArgs): DefaultControlInstance; accept(visitor: ControlDefinitionVisitor, ...args: unknown[]): R; } export { Definition as LinkDefinition, type GenericMouseEvent }; //# sourceMappingURL=link.d.ts.map