import { DataType, FunctionParameter } from '@wix/app-extensions/trusted'; import { ElementAudio, ElementDataDefinition, ElementDirection, ElementImage, ElementLink, ElementMenuItem, ElementMenuItems, ElementRichText, ElementVectorArt, ElementVideo } from './sdk'; import { AttachState, Provider, ProviderArrayItem, ProviderFunctionItem, ProviderItem, 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; providerItemDetails?: Exclude; } export interface MethodBinding { bindingItemType: BindingItemType.MethodBinding; callOptions: CallOptions; displayName?: string; methodPath: string; providerItemDetails?: ProviderFunctionItem; } export declare enum BindingItemType { ItemBinding = "ItemBinding", MethodBinding = "MethodBinding" } export type BindingArgument = ArrayItemBindingArgument | ArrayItemIndexBindingArgument | ArrayTransformBindingArgument | ObjectPropertyBindingArgument | ObjectTransformBindingArgument | ProviderItemBindingArgument | StaticArgument; export interface CallOptions { arguments: BindingArgument[]; asCallback: boolean; } export declare enum ArgumentType { ArrayItem = "ArrayItemBinding", ArrayItemIndex = "ArrayItemIndexBinding", ArrayTransform = "ArrayTransformBinding", ObjectProperty = "ObjectPropertyBinding", ObjectTransform = "ObjectTransformBinding", ProviderBinding = "ProviderBindingItem", Static = "StaticArgItem" } export interface ArrayTransformBindingArgument { source: ProviderItemBindingArgument; transformConfig: TransformConfig; type: ArgumentType.ArrayTransform; } export interface ObjectTransformBindingArgument { source?: ProviderItemBindingArgument; transformConfig: TransformConfig; type: ArgumentType.ObjectTransform; } export interface ObjectPropertyBindingArgument { displayName?: string; propertyPath?: string; type: ArgumentType.ObjectProperty; } export interface ArrayItemBindingArgument { itemPath?: string; type: ArgumentType.ArrayItem; } export interface ArrayItemIndexBindingArgument { type: ArgumentType.ArrayItemIndex; } export type TransformConfig = Record; 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; [DataType.localDate]: string; [DataType.localTime]: string; [DataType.localDateTime]: string; [DataType.dateTime]: string; 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; includeProviderItemDetails?: boolean; includeReferencedProviders?: 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 ReferencedProviders = Partial>>>; type BaseBindingDetails = { bindingDisplayName?: string; bindingItemType?: DataType; referencedProviders?: ReferencedProviders; }; export declare enum BindingType { ArrayTransform = "ArrayTransformBinding", ObjectTransform = "ObjectTransformBinding", ProviderBinding = "ProviderBindingItem" } export type ProviderBindingDetails = BaseBindingDetails & { bindingType: BindingType.ProviderBinding; providerDisplayName?: string; providerIdentifier: string; providerItem: PropertyBinding; providerType: ProviderType; }; export type ArrayTransformBindingDetails = BaseBindingDetails & { bindingType: BindingType.ArrayTransform; source: ProviderItemBindingArgument; transformConfig: TransformConfig; }; export type ObjectTransformBindingDetails = BaseBindingDetails & { bindingType: BindingType.ObjectTransform; source?: ProviderItemBindingArgument; transformConfig: TransformConfig; }; export type BindingDetails = ArrayTransformBindingDetails | ObjectTransformBindingDetails | ProviderBindingDetails; 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 {};