import { Button } from '@pimcore/portal-ui-kit/components'; import { ButtonProps } from '@pimcore/portal-ui-kit/components'; import { ComponentRegistry } from '@pimcore/portal-ui-kit/studio'; import { container } from '@pimcore/portal-ui-kit'; import { DataTable } from '@pimcore/portal-ui-kit/ui'; import { DataTableColumn } from '@pimcore/portal-ui-kit/ui'; import { DataTableProps } from '@pimcore/portal-ui-kit/ui'; import { DataTableRow } from '@pimcore/portal-ui-kit/ui'; import { DataTableSort } from '@pimcore/portal-ui-kit/ui'; import { DtAction } from '@pimcore/portal-ui-kit/ui'; import { EmptyState } from '@pimcore/portal-ui-kit/ui'; import { EmptyStateProps } from '@pimcore/portal-ui-kit/ui'; import { FlagIcon } from '@pimcore/portal-ui-kit/ui'; import { FlagIconProps } from '@pimcore/portal-ui-kit/ui'; import type { IAbstractPlugin } from '@pimcore/portal-ui-kit/plugins'; import { Icon } from '@pimcore/portal-ui-kit/components'; import { IconButton } from '@pimcore/portal-ui-kit/studio'; import { MetaList } from '@pimcore/portal-ui-kit/ui'; import { MetaListProps } from '@pimcore/portal-ui-kit/ui'; import { MetaRow } from '@pimcore/portal-ui-kit/ui'; import { Panel } from '@pimcore/portal-ui-kit/ui'; import { PanelProps } from '@pimcore/portal-ui-kit/ui'; import { PathTag } from '@pimcore/portal-ui-kit/ui'; import { PathTagProps } from '@pimcore/portal-ui-kit/ui'; import type { PluginDiagnostic } from '@pimcore/portal-ui-kit/plugins'; import type { PluginModule } from '@pimcore/portal-ui-kit/plugins'; import type { PluginModuleSystem } from '@pimcore/portal-ui-kit/plugins'; import React from 'react'; import { SanitizeHtml } from '@pimcore/portal-ui-kit/components'; import { SectionHeader } from '@pimcore/portal-ui-kit/ui'; import { SectionHeaderProps } from '@pimcore/portal-ui-kit/ui'; import { SlotRenderer } from '@pimcore/portal-ui-kit/studio'; import { SortDirection } from '@pimcore/portal-ui-kit/ui'; import { SortValueResolver } from '@pimcore/portal-ui-kit/ui'; import { TabStrip } from '@pimcore/portal-ui-kit/ui'; import { TabStripItem } from '@pimcore/portal-ui-kit/ui'; import { TabStripProps } from '@pimcore/portal-ui-kit/ui'; import { WIDE_MIN } from '@pimcore/portal-ui-kit/ui'; import { WIDE_SHARE } from '@pimcore/portal-ui-kit/ui'; /** One contributable action. */ export declare interface ActionDef { /** Stable identity, unique per surface. Namespace plugin keys with your plugin id. */ key: string; /** Human label. Also the fallback when `icon` is null or unregistered. */ label: string; /** * Name of a glyph in the portal's icon library, or null for a text-only action. * * Null is a first-class choice rather than an oversight: an unregistered glyph name renders an * EMPTY button, so falling back to the label is strictly better than falling back to nothing. * collectionActions already works this way; this generalises it. */ icon?: string | null; /** * Draw a control of your own instead of the portal's button. * * The surfaces render contributions in the portal's own chrome, which is what buys placement, * permission filtering and overflow — but the shape was label + icon + onClick, so a * contribution could only ever BE a button. This is the escape hatch for a dropdown, a split * button or a popover, without giving up the surrounding behaviour. * * `label` is still required and still supplies the accessible name. A control that draws * itself is responsible for its own click handling; `run` is not called for it. */ render?: () => React.ReactNode; /** Destructive styling. */ danger?: boolean; /** * Own control, or folded into the overflow menu. * * Optional with NO global default, because what absence should mean differs by surface and * only the surface knows: the detail toolbar has an overflow menu and treats an unstated * placement as 'more' (a contributed action should not compete with Download for pill space * unless it asks to), while a grid tile has no overflow at all and can only draw it inline. * Same reasoning as the context type — the model is generic, the surface decides. */ placement?: ActionPlacement; /** Lower sorts first. Defaults to 0; ties keep registration order. */ priority?: number; /** Whether this action applies to the given context. Absent means always. */ when?: (ctx: Ctx) => boolean; /** What the action does. */ run: (ctx: Ctx) => void | Promise; } /** Where in a surface's chrome an action is drawn. */ export declare type ActionPlacement = 'inline' | 'more'; export declare const actions: { /** * Contribute an action to a surface. * * ```ts * sdk.actions.register(sdk.actions.surfaces.gridItem, { * key: 'my-plugin/send-to-review', * label: sdk.i18n.t('send-to-review', 'Send to review', 'my-plugin'), * icon: 'share', * when: (ctx) => ctx.permissions.update === true, * run: (ctx) => { void send(ctx.id) } * }) * ``` * * Namespace your key with your plugin id: keys are unique per surface, and a duplicate is * REFUSED rather than replacing what is there, so a collision costs you your action rather * than silently replacing the portal's. * * Register during your plugin's module onInit. Registration is one-shot — the portal collects * contributions before first paint and does not re-read them, so registering later will not * show up. */ register(surface: S, def: ActionDef): void; /** The surfaces available to contribute to. */ surfaces: { /** Per-item actions on a grid tile or list row. Ctx: GridItemCtx. */ readonly gridItem: "PortalEngine/Actions/GridItem"; /** Actions on the grid's selection bar, acting on every ticked item. Ctx: GridSelectionCtx. */ readonly gridSelection: "PortalEngine/Actions/GridSelection"; /** The element detail toolbar and its overflow menu. Ctx: DetailToolbarCtx. */ readonly detailToolbar: "PortalEngine/Actions/DetailToolbar"; /** Actions on a collection card. Ctx: CollectionCardCtx. */ readonly collectionCard: "PortalEngine/Actions/CollectionCard"; /** * Actions on a row of the owner's public-share list. Ctx: ShareRowCtx. * * The AUTHENTICATED half of public share -- the screen where a user manages the links they * created, not the anonymous shell those links lead to. A contribution here runs for a signed-in * portal user like every other surface; nothing about it is share-recipient code. */ readonly shareRow: "PortalEngine/Actions/ShareRow"; }; }; /** * This source file is available under the terms of the * Pimcore Open Core License (POCL) * Full copyright and license information is available in * LICENSE.md which is distributed with this source code. * * @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) * @license Pimcore Open Core License (POCL) */ export declare const api: { /** * Add endpoints to the portal's api and get the generated hooks back. * * ```ts * const { useThingQuery } = sdk.api.injectEndpoints({ * endpoints: (build) => ({ * thing: build.query({ * query: () => '/my-plugin/thing', * providesTags: [{ type: 'Plugin', id: 'my-plugin/thing' }] * }) * }) * }) * ``` * * Paths are relative to the portal's api base. `overrideExisting` defaults to RTK's own * behaviour; leave it alone unless you mean to replace a portal endpoint, which you almost * certainly do not. */ injectEndpoints: (args: { endpoints: (build: any) => Record; overrideExisting?: boolean; }) => Record; /** * Register tag types of your own on the portal's api. * * ```ts * sdk.api.addTagTypes(['my-plugin/Thing']) * * const { useThingQuery } = sdk.api.injectEndpoints({ * endpoints: (build) => ({ * thing: build.query({ * query: () => '/my-plugin/thing', * providesTags: [{ type: 'my-plugin/Thing', id: 'LIST' }] * }) * }) * }) * ``` * * NAMESPACE THE TYPE with your plugin id, as above. Tag types are a flat global space shared * with the portal and with every other plugin, and this is the one place a collision has * teeth: two plugins that both declare 'Settings' will invalidate each other's caches, which * looks like a random refetch and is very hard to trace back here. The ids under a type are * yours alone once the type is. * * Adding a type that already exists is a no-op, so calling this on every init is safe, and * naming one of the portal's own types does NOT give you control of it — you simply share it, * which is occasionally what you want (invalidate 'Collections' after your own write). * * Returns nothing on purpose. RTK's `enhanceEndpoints` hands back the same api object it was * called on, so there is no new value a caller has to thread through; keep using `sdk.api`. */ addTagTypes: (types: readonly string[]) => void; }; /** * The audience for this page. * * `read` is a parameter so the rule can be tested without a document; callers pass nothing and * get the page's own value. */ export declare function audience(read?: unknown): PluginAudience; /** * The portal's own gates, named. * * Each matches what the portal applies to its own control of the same name, so a contributed * action sits beside a built-in one and appears under exactly the same conditions. That is the * point: a plugin's "Download" offered where the portal's is not looks like a bug in the portal. */ export declare const can: { /** @see read */ readonly view: (p?: PermissionFlags) => boolean; /** @see read */ readonly download: (p?: PermissionFlags) => boolean; /** Both flags, as the portal's own cart control checks them. */ readonly addToCart: (p?: PermissionFlags) => boolean; /** @see read */ readonly addToCollection: (p?: PermissionFlags) => boolean; /** @see read */ readonly removeFromCollection: (p?: PermissionFlags) => boolean; /** @see read */ readonly publicShare: (p?: PermissionFlags) => boolean; /** @see write */ readonly edit: (p?: PermissionFlags) => boolean; /** Relocating an element is an update, and the portal gates it default-closed. */ readonly relocate: (p?: PermissionFlags) => boolean; /** @see write */ readonly delete: (p?: PermissionFlags) => boolean; }; /** * May this user change the collection itself — rename it, and anything like it? * * OWNERSHIP IS NOT THE QUESTION, and this is the trap. renameAction authorises with * isCollectionEditAllowed(), true for the owner OR anyone holding an edit share. Gating a * rename-like action on `ctx.owner` silently takes it away from shared editors who are entitled * to it — which is exactly the bug the portal's own list had. */ export declare const canEditCollection: (ctx: CollectionCardCtx) => boolean; /** * May this user manage who else sees it, or destroy it? * * Owner-only, unlike editing: an edit share does not confer sharing or deleting. If your action * is destructive or changes who has access, this is the question, not canEditCollection. */ export declare const canManageCollection: (ctx: CollectionCardCtx) => boolean; /** * May this user create a public share of it? * * Read the flag; do NOT re-derive it. canPublicShare already folds ownership together with the * per-pool public-share permission, so `ctx.owner && …` would be wrong in both directions — an * owner without the pool right would be offered it, and a non-owner holding it would not. */ export declare const canPublicShareCollection: (ctx: CollectionCardCtx) => boolean; /** * An element's flags as a plugin should see them in a public-share recipient shell. * * Applied by the portal at every point where it hands permissions to a contribution, so a plugin * normally receives capped flags without asking. It is exported because a plugin that carries its * own payload -- one it fetched itself, or held across a render -- has no other way to apply the * same rule, and re-deriving it by hand is exactly the mistake this prevents. * * Idempotent, and safe to apply to an authenticated payload: it only ever narrows. */ export declare function capForPublicShare(p: PermissionFlags | undefined): PermissionFlags; /** * One collection card, drawn exactly as the portal draws its own. * * The rights fields are all set to their denying values so visibleCollectionActions() returns * an empty list and the portal's Rename / Share / Public share / Delete never appear. Same * principle as the tile: suppress the built-ins with the component's own gate rather than a new * branch. The remaining DTO fields are the ones the card reads for layout, defaulted to empty * so a plugin supplies four values instead of a dozen. */ declare const CollectionCard: React.FC; /** * Context for an action on a collection card. * * Note this is NOT Permissions — collections carry their own rights, which is precisely why the * action model is generic over its context instead of fixing one permission shape. `permission` * being 'edit' is not the same question as `owner`, and conflating them has already removed * Rename from shared editors once. */ export declare interface CollectionCardCtx { id: number; owner: boolean; permission?: string; canPublicShare?: boolean; } declare interface CollectionCardProps { collection: CollectionCardSummary; actions?: TextComponentAction[]; onOpen?: (id: number) => void; } /** What a plugin has to know about a collection to draw a card for it. */ declare interface CollectionCardSummary { id: number; name: string; itemCount: number; /** Already formatted for display; the portal does no parsing. */ creationDate?: string; /** Up to three cover images. */ coverThumbnails?: string[]; } /** An action a plugin draws on a portal component. The glyph must be a registered name. */ declare interface ComponentAction { /** Unique within the component. Namespace it with your plugin id. */ key: string; label: string; /** A registered glyph name — register your own with `sdk.icons.register()` first. */ icon: string; onClick: () => void; } export declare const componentRegistry: { registerToSlot: (slot: string, entry: { name: string; component: React.ComponentType; priority?: number; }) => void; /** * Register a component under a NAME, retrievable with get(). * * The config is declared here rather than left to the caller. The kit's register() refuses a * name it has no config entry for — "Component configuration for "x" not found." — so this * was unusable as published: every call threw, and because a plugin's module onInit is not * wrapped, that one throw took every later registration in the same plugin with it. Whether * a name needs declaring before it can be registered is an internal detail of Studio's * registry, not something a plugin should have to know or could have guessed. */ register: (entry: { name: string; component: React.ComponentType; }) => void; getSlotComponents: (slot: string) => ReturnType; /** * A component registered by name, or undefined. * * `register()` was published without this and was therefore unusable: a plugin could put a * component in the registry and nothing — not the portal, not another plugin, not itself — * had any published way to get it back. The kit's registry throws on an unknown name, so * this answers undefined instead; asking for a component another plugin may not have * installed is an ordinary question, not an error. */ get: (name: string) => React.ComponentType | undefined; /** Whether a name is registered. Cheaper than get() when the component itself is not wanted. */ has: (name: string) => boolean; /** * Declare a slot of your OWN, so other plugins can contribute into your UI. * * registerToSlot() refuses a slot that was never declared as type SLOT, and declaring one * means registerConfig() — which is deliberately NOT published, because it takes arbitrary * config and would let a plugin redefine the portal's own slots. This is the narrow door: * it can only ever declare a slot, never redefine anything else about the registry. * * Namespace the name with your plugin id. The portal's own slots live under * 'PortalEngine/...' and a plugin must not declare into that space. */ declareSlot: (name: string) => void; }; export declare namespace components { export { ComponentAction, TextComponentAction, TileCardItem, TileMetaRow, TileCardProps, CollectionCardSummary, CollectionCardProps, DetailCardProps, ThumbProps, NavEntryProps, HeaderActionProps, TileCard, CollectionCard, DetailCard, Thumb, NavEntry, HeaderAction } } export declare function config>(pluginId: string): T | undefined; export { container } /** Props given to a replacement for the custom-download card. */ export declare interface CustomDownloadCardProps { id: number; dataPoolId: number; /** Set when the detail screen is being read through a public share link. */ shareHash?: string; } /** * This source file is available under the terms of the * Pimcore Open Core License (POCL) * Full copyright and license information is available in * LICENSE.md which is distributed with this source code. * * @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) * @license Pimcore Open Core License (POCL) */ /** Which element family a data pool holds. */ export declare type DataPoolKind = 'asset' | 'data-object'; /** * The portal's card shell, as used down the detail view — a bordered, optionally collapsible * panel with a title and an optional header control. * * Passed straight through: its props are already narrow and carry nothing internal, so this is * the one component whose plugin-facing shape is the portal's own. */ declare const DetailCard: React.FC; export declare type DetailCardName = typeof detailCards[keyof typeof detailCards]; /** Every published name, for diagnostics and for the SDK to re-export. */ export declare const detailCardNames: DetailCardName[]; declare interface DetailCardProps { title?: string; /** Rendered in the card header, opposite the title. */ action?: React.ReactNode; /** Drops the header entirely — the card becomes a plain bordered panel. */ plain?: boolean; children?: React.ReactNode; } /** * Detail cards a plugin may replace or suppress. * * WHAT IS NOT HERE, and why. ResultsRail is composed the same way but is deliberately absent: * its props are the portal's own action vocabulary (the internal ActionKey union) plus callbacks * wired into the detail screen's dialogs. A replacement would have to reimplement that wiring, * which makes it a rebuild rather than an override — and publishing the union to make it * possible would freeze an internal vocabulary into the plugin contract. The rail's tiles are * already reachable through `components.TileCard`, which is the part a plugin actually wants. */ export declare const detailCards: { /** Assigned/available tags, with the save control. */ readonly tags: "PortalEngine/detail/tagsCard"; /** Current workflow state and its transitions. */ readonly workflow: "PortalEngine/detail/workflowCard"; /** Made-to-measure rendition download. */ readonly customDownload: "PortalEngine/detail/customDownloadCard"; /** The Versions tab's body. */ readonly versions: "PortalEngine/detail/versionsTab"; }; /** Props for the `detailPanels` slot — rendered below the element detail. */ export declare interface DetailPanelsProps { id?: number | string; dataPoolId?: number | string; kind?: DataPoolKind; } /** Context for an action in the element detail toolbar or its overflow menu. */ export declare interface DetailToolbarCtx { id: number; dataPoolId: number; kind: DataPoolKind; name: string; permissions: Permissions_2; } /** * Resolve a service from the portal's container. * * Answers `undefined` instead of throwing when the id is not bound. inversify's own `get()` * throws, and an unbound service is an ordinary condition for a plugin: the portal's host binds * a subset of Studio's services and which subset is not a promise a plugin should be crashing * on. This mirrors `componentRegistry.get()`, which answers undefined for the same reason. * * Resolved per call, never captured — a module-level value here and inside the exposed `./sdk` * chunk are different instances, so the container is the only reliable singleton across that * boundary. */ export declare function getService(id: string): T | undefined; /** Props for the `gridActions` slot — rendered only while a selection exists. */ export declare interface GridActionsProps { /** The ticked items, in selection order. */ itemIds: Array; dataPoolId?: number | string; kind?: DataPoolKind; } /** Context for an action on one grid item — a tile or a row. */ export declare interface GridItemCtx { id: number; dataPoolId: number; kind: DataPoolKind; permissions: Permissions_2; } /** Context for an action on the grid's selection bar. */ export declare interface GridSelectionCtx { itemIds: number[]; dataPoolId: number; kind: DataPoolKind; /** The permissions common to the selection; absent when it could not be resolved. */ permissions?: Permissions_2; } /** Hyperscript helper, so a plugin can build UI without importing React itself. */ export declare const h: typeof React.createElement; /** * `p-hdr-ic` is the header's icon-button shape -- fixed hit area, the header's hover, and the * alignment that keeps it on the strip's baseline beside the portal's own controls. * * Renders an `` when given an href and a `