import type * as DmTypes from '../generated/dm-types'; import { DataType } from '../generated/dm-types'; export { DataType } from '../generated/dm-types'; /** * Viewer-derived fields added by the SDK to all link types. * - `displayName`: human-readable label resolved by editor * - `href`: resolved URL (viewer concern, not stored in DM) * - `rel`: normalized to space-separated string (DM stores as enum array) */ type ElementLinkExtension = { displayName: string; href?: string; rel?: string; }; export type ElementPageLink = DmTypes.PageLink & ElementLinkExtension & { type: 'PageLink'; }; export type ElementExternalLink = DmTypes.ExternalLink & ElementLinkExtension & { type: 'ExternalLink'; }; export type ElementEmailLink = DmTypes.EmailLink & ElementLinkExtension & { type: 'EmailLink'; }; export type ElementPhoneLink = DmTypes.PhoneLink & ElementLinkExtension & { type: 'PhoneLink'; }; export type ElementWhatsAppLink = DmTypes.WhatsAppLink & ElementLinkExtension & { type: 'WhatsAppLink'; }; export type ElementAddressLink = DmTypes.AddressLink & ElementLinkExtension & { type: 'AddressLink'; }; export type ElementAnchorLink = DmTypes.AnchorLink & ElementLinkExtension & { type: 'AnchorLink'; }; export type ElementDocumentLink = DmTypes.DocumentLink & ElementLinkExtension & { type: 'DocumentLink'; }; export type ElementDynamicPageLink = DmTypes.DynamicPageLink & ElementLinkExtension & { type: 'DynamicPageLink'; }; export type ElementTpaPageLink = DmTypes.TpaPageLink & ElementLinkExtension & { type: 'TpaPageLink'; }; export type ElementLoginToWixLink = DmTypes.LoginToWixLink & ElementLinkExtension & { type: 'LoginToWixLink'; }; export type ElementTextLink = DmTypes.TextLink & ElementLinkExtension & { type: 'TextLink'; }; export type ElementLink = ElementPageLink | ElementExternalLink | ElementEmailLink | ElementPhoneLink | ElementWhatsAppLink | ElementAddressLink | ElementAnchorLink | ElementDocumentLink | ElementDynamicPageLink | ElementTpaPageLink | ElementLoginToWixLink | ElementTextLink; export type ElementImage = DmTypes.Image; export interface ElementVideo { /** * Video media identifier. * @maxLength 1000 */ uri: string; /** * Available video sources in different qualities. * @maxSize 20 */ sources?: { quality: '1080p' | '720p' | '480p' | '360p'; width: number; height: number; types: { format: 'mp4' | 'mp4-luminance'; uri: string; }[]; }[]; /** * Adaptive streaming sources. * @maxSize 10 */ adaptiveSources?: { format: 'hls' | 'dash'; uri: string; }[]; /** Whether the video contains an audio track. */ hasAudio?: boolean; /** Frames per second. */ fps?: number; /** * ORIGINAL video poster field is a string URL */ poster?: { uri: string; name?: string; width?: number; height?: number; }; /** Duration in seconds. */ duration?: number; /** * Display name of the video. * @maxLength 100 */ name?: string; } export type ElementAudio = DmTypes.Audio; export type ElementVectorArt = DmTypes.VectorArt; export type ElementA11y = DmTypes.A11y; export type ElementDirection = DmTypes.Direction; export type ElementMenuItem = Omit & { link?: ElementLink; items?: ElementMenuItem[]; }; export type ElementMenuItems = Omit & { items?: ElementMenuItem[]; }; export type ElementRichText = Omit & { linkList?: ElementLink[]; }; export type ElementDataValue = string | number | boolean | ElementLink | ElementImage | ElementVideo | ElementAudio | ElementVectorArt | ElementMenuItems | ElementA11y | ElementRichText | ElementDirection | ElementDataObject | ElementDataValue[] | null | undefined; export type ElementDataObject = { [key: string]: ElementDataValue; }; export type ElementData = T; export type ElementDataInput = Partial; export type ElementDataTypeMap = { [DataType.TEXT]: string; [DataType.TEXT_ENUM]: string; [DataType.NUMBER]: number; [DataType.BOOLEAN_VALUE]: boolean; [DataType.A11Y]: ElementA11y; [DataType.LINK]: ElementLink; [DataType.IMAGE]: ElementImage; [DataType.VIDEO]: ElementVideo; [DataType.VECTOR_ART]: ElementVectorArt; [DataType.AUDIO]: ElementAudio; [DataType.LOCAL_DATE]: string; [DataType.LOCAL_TIME]: string; [DataType.LOCAL_DATE_TIME]: string; [DataType.WEB_URL]: string; [DataType.EMAIL]: string; [DataType.PHONE]: string; [DataType.HOSTNAME]: string; [DataType.REGEX]: string; [DataType.GUID]: string; [DataType.RICH_TEXT]: ElementRichText; [DataType.CONTAINER]: ElementDataObject | string; [DataType.ARRAY_ITEMS]: ElementDataValue[]; [DataType.DIRECTION]: ElementDirection; [DataType.MENU_ITEMS]: ElementMenuItems; [DataType.DATA]: ElementDataObject; [DataType.SCHEMA]: ElementDataValue; [DataType.UNKNOWN_DATA_TYPE]: ElementDataValue; }; export type ElementDefaultValueFor = ElementDataTypeMap[TypeKey];