import { DataType, FunctionParameter } from '@wix/app-extensions/trusted'; import { ElementAudio, ElementDataDefinition, ElementDirection, ElementImage, ElementLink, ElementMenuItem, ElementMenuItems, ElementRichText, ElementVectorArt, ElementVideo } from './sdk'; import { AttachState, ProviderArrayItem, ProviderFunctionItem, ProviderObjectItem, ProviderSimpleItem, ProviderTextEnumItem, ProviderType } from './Providers'; export declare const UNBIND_ALL: "ALL"; export type UnbindAll = typeof UNBIND_ALL; /** * @deprecated Used by the deprecated `bind` / `listBindings`. Use {@link BindingDetailsMap} instead, * a flat property-name -> binding dictionary with provider details inlined. */ export interface BindingProperties { bindingsMap: ProviderBindingsMap; displayName?: string; providerIdentifier: string; providerType: ProviderType; } /** * @deprecated Used by the deprecated `bind` / `listBindings`. Use {@link BindingDetailsMap} instead. */ export type ProviderBindingsMap = Record; export type PropertyBinding = MethodBinding | ProviderItemBinding; export interface ProviderItemBinding { bindingItemType: BindingItemType.ItemBinding; displayName?: string; itemPath: string; } export interface MethodBinding { bindingItemType: BindingItemType.MethodBinding; callOptions: CallOptions; displayName?: string; methodPath: string; } export declare enum BindingItemType { ItemBinding = "ItemBinding", MethodBinding = "MethodBinding" } export type BindingArgument = ProviderItemBindingArgument | StaticArgument; export interface CallOptions { arguments: BindingArgument[]; asCallback: boolean; } export declare enum ArgumentType { ProviderBinding = "ProviderBindingItem", Static = "StaticArgItem" } export interface ProviderItemBindingArgument { displayName?: string; providerIdentifier: string; providerItem: PropertyBinding; providerType: ProviderType; type: ArgumentType.ProviderBinding; } /** * Public static argument contract, intentionally independent of Document Management types. * Data Binding Service adapts the whole argument between this shape and the DM one. */ type StaticArgumentValues = { [DataType.audio]: ElementAudio; [DataType.booleanValue]: boolean; [DataType.direction]: ElementDirection; [DataType.email]: string; [DataType.guid]: string; [DataType.hostname]: string; [DataType.image]: ElementImage; [DataType.link]: ElementLink; menuItem: ElementMenuItem; [DataType.menuItems]: ElementMenuItems; [DataType.number]: number; [DataType.phone]: string; [DataType.regex]: string; [DataType.richText]: ElementRichText; [DataType.text]: string; [DataType.textEnum]: string; [DataType.vectorArt]: ElementVectorArt; [DataType.video]: ElementVideo; [DataType.webUrl]: string; }; export type StaticArgument = { [Key in keyof StaticArgumentValues]: { dataType: `${Key}`; type: ArgumentType.Static; value: StaticArgumentValues[Key]; }; }[keyof StaticArgumentValues]; export interface ListBindingsOptions { includeDisplayNames?: boolean; providerIdentifiers?: string[]; providerTypes?: ProviderType[]; } export type Converter = ProviderFunctionItem & { itemPath: string; providerIdentifier: string; providerType: ProviderType; }; export type BaseCandidate = { itemPath: string; providerIdentifier: string; providerType: ProviderType; withConverter?: Converter; }; export type SimpleCandidate = ProviderSimpleItem & BaseCandidate; export type TextEnumCandidate = ProviderTextEnumItem & BaseCandidate; export type ArrayCandidate = ProviderArrayItem & BaseCandidate; export type FunctionCandidate = ProviderFunctionItem & BaseCandidate & { asCallback: boolean; validPreBoundCounts?: number[]; }; export type ObjectCandidate = ProviderObjectItem & BaseCandidate; export type ItemCandidate = ArrayCandidate | FunctionCandidate | ObjectCandidate | SimpleCandidate | TextEnumCandidate; export type BindingCandidateDisplayGroup = { displayGroupKey: string; displayName?: string; /** Ordered item paths within this group. Ordering between groups is not guaranteed. */ itemPaths: string[]; }; export type BindingCandidate = { attachState?: AttachState; /** Optional for backwards compatibility; the runtime returns an empty array when no groups exist. */ displayGroups?: BindingCandidateDisplayGroup[]; displayName: string; itemCandidates: ItemCandidate[]; providerIdentifier: string; providerType: ProviderType; }; export type BindingTargetDetails = ElementDataDefinition | FunctionParameter; export type BindingDetails = { providerType: ProviderType; providerIdentifier: string; providerItem: PropertyBinding; providerDisplayName?: string; bindingDisplayName?: string; bindingItemType?: DataType; }; export type BindingDetailsMap = Record; export type SelectBindingOptions = { bindingTargetDetails: BindingTargetDetails; onApply: (bindingDetails: BindingDetails) => Promise; anchor?: HTMLElement; initialState?: BindingDetails; maxBindingDepth?: number; /** Component property being bound — the `setBinding` map key. */ propertyName?: string; }; export type findBindingCandidatesOptions = { filterAttachState?: AttachState[]; includeCandidatesWithConverters?: boolean; }; export type OverriddenSelectBindingOptions = SelectBindingOptions | ((options: SelectBindingOptions) => SelectBindingOptions); export {};