/** * The named context actions a provider can declare on its manifest * (`EditorContextProvider.actions`). Mirrors the vocabulary of * `@wix/editor-platform-context-actions-service` — `settings` is deliberately * excluded there and therefore never surfaces here. */ export type ContextActionName = 'addItem' | 'editItem' | 'openItem' | 'openSource'; /** * What the consumer passes to `execute` — only what is genuinely runtime-known. * The `providerIdentifier` is baked into the command at resolution time; * `openItem`/`editItem` operate on a concrete item and require its id. */ export type ContextActionExecuteArgsByName = { addItem: []; editItem: [payload: { sourceItemId: string; }]; openItem: [payload: { sourceItemId: string; }]; openSource: []; }; /** * Commands form a union discriminated on `actionName`, so narrowing the name * narrows what `execute` accepts (e.g. an `openItem` command requires * `sourceItemId` at compile time, while `openSource` takes no arguments). */ export type ContextActionCommandByName = { [TName in ContextActionName]: { actionName: TName; description?: string; displayName: string; execute: (...args: ContextActionExecuteArgsByName[TName]) => Promise; }; }; export type ContextActionCommand = ContextActionCommandByName[TName]; export type GetContextActionsOptions = { /** Optional filter — omit to resolve every declared action. */ actionNames?: ContextActionName[]; providerIdentifier: string; };