import { Ctx, CustomBlockStylesForStructuredTextFieldCtx, CustomMarksForStructuredTextFieldCtx, ExecuteFieldDropdownActionCtx, ExecuteItemFormDropdownActionCtx, ExecuteItemsDropdownActionCtx, ExecuteUploadsDropdownActionCtx, Field, FieldType, Icon, Item, ItemCollectionOutletsCtx, ItemFormOutletsCtx, ItemFormSidebarPanelPlacement, ItemFormSidebarsCtx, ItemType, OnBeforeItemUpsertCtx, OnBeforeItemsDestroyCtx, OnBeforeItemsPublishCtx, OnBeforeItemsUnpublishCtx, OnBootCtx, OverrideFieldExtensionsCtx, RenderConfigScreenCtx, RenderFieldExtensionCtx, RenderItemCollectionOutletCtx, RenderItemFormOutletCtx, RenderItemFormSidebarCtx, RenderItemFormSidebarPanelCtx, RenderManualFieldExtensionConfigScreenCtx, RenderModalCtx, RenderPageCtx, StructuredTextCustomBlockStyle, StructuredTextCustomMark } from "datocms-plugin-sdk"; //#region src/types.d.ts type HiddenFieldPredicate = (field: Field, ctx: OverrideFieldExtensionsCtx) => boolean; type DuplicateIdHandling = 'throw' | 'warn' | 'ignore'; interface PluginOptions { render: (component: React.ReactNode) => void; duplicateIdHandling?: DuplicateIdHandling; } interface FormOutletConfig { id: string; component: React.ComponentType<{ ctx: RenderItemFormOutletCtx; }>; initialHeight?: number; shouldApply?: (model: ItemType, ctx: ItemFormOutletsCtx) => boolean; } interface CollectionOutletConfig { id: string; component: React.ComponentType<{ ctx: RenderItemCollectionOutletCtx; }>; initialHeight?: number; shouldApply?: (model: ItemType, ctx: ItemCollectionOutletsCtx) => boolean; } interface PageConfig { pageId: string; component: React.ComponentType<{ ctx: RenderPageCtx; }>; } interface MainNavigationTabConfig { label: string; icon: Icon; pointsTo: { pageId: string; }; placement?: ['before' | 'after', 'content' | 'media' | 'schema' | 'configuration' | 'cdaPlayground']; rank?: number; } interface ContentAreaSidebarItemConfig { label: string; icon: Icon; pointsTo: { pageId: string; }; placement?: ['before' | 'after', 'menuItems' | 'seoPreferences']; rank?: number; } interface SidebarPanelConfig { id: string; component: React.ComponentType<{ ctx: RenderItemFormSidebarPanelCtx; }>; label: string; startOpen?: boolean; placement?: ItemFormSidebarPanelPlacement; rank?: number; } interface SidebarConfig { id: string; component: React.ComponentType<{ ctx: RenderItemFormSidebarCtx; }>; label: string; preferredWidth?: number; shouldApply?: (model: ItemType, ctx: ItemFormSidebarsCtx) => boolean; } interface FieldExtensionConfig { id: string; name: string; type: 'editor' | 'addon'; fieldTypes: FieldType[] | 'all'; component: React.ComponentType<{ ctx: RenderFieldExtensionCtx; }>; configurable?: boolean; configComponent?: React.ComponentType<{ ctx: RenderManualFieldExtensionConfigScreenCtx; }>; validateConfig?: (params: Record) => Record; } interface FieldExtensionOverrideConfig { shouldApply: (field: Field, ctx: OverrideFieldExtensionsCtx) => boolean; editor?: { id: string; parameters?: Record; }; addons?: Array<{ id: string; parameters?: Record; }>; } interface ModalConfig { id: string; component: React.ComponentType<{ ctx: RenderModalCtx; }>; } interface ConfigScreenConfig { component: React.ComponentType<{ ctx: RenderConfigScreenCtx; }>; } type DropdownActionType = 'field' | 'itemForm' | 'items' | 'uploads'; interface BaseDropdownActionConfig { id: string; label: string; icon?: Icon; shouldApply?: (...args: unknown[]) => boolean; } type FieldDropdownActionConfig = BaseDropdownActionConfig & { type: 'field'; execute: (ctx: ExecuteFieldDropdownActionCtx) => Promise; }; type ItemFormDropdownActionConfig = BaseDropdownActionConfig & { type: 'itemForm'; execute: (ctx: ExecuteItemFormDropdownActionCtx) => Promise; }; type ItemsDropdownActionConfig = BaseDropdownActionConfig & { type: 'items'; execute: (ctx: ExecuteItemsDropdownActionCtx) => Promise; }; type UploadsDropdownActionConfig = BaseDropdownActionConfig & { type: 'uploads'; execute: (ctx: ExecuteUploadsDropdownActionCtx) => Promise; }; type DropdownActionConfig = FieldDropdownActionConfig | ItemFormDropdownActionConfig | ItemsDropdownActionConfig | UploadsDropdownActionConfig; type OnBootHandler = (ctx: OnBootCtx) => void | Promise; type OnBeforeItemUpsertHandler = (createOrUpdateItemPayload: Record, ctx: OnBeforeItemUpsertCtx) => boolean | Promise; type OnBeforeItemsDestroyHandler = (items: Item[], ctx: OnBeforeItemsDestroyCtx) => boolean | Promise; type OnBeforeItemsPublishHandler = (items: Item[], ctx: OnBeforeItemsPublishCtx) => boolean | Promise; type OnBeforeItemsUnpublishHandler = (items: Item[], ctx: OnBeforeItemsUnpublishCtx) => boolean | Promise; type CustomBlockStylesForStructuredTextFieldHandler = (field: Field, ctx: CustomBlockStylesForStructuredTextFieldCtx) => StructuredTextCustomBlockStyle[] | undefined; type CustomMarksForStructuredTextFieldHandler = (field: Field, ctx: CustomMarksForStructuredTextFieldCtx) => StructuredTextCustomMark[] | undefined; //#endregion //#region src/factory.d.ts declare function createPluginConfig(options: PluginOptions): { addFormOutlet: (outletConfig: FormOutletConfig) => void; addCollectionOutlet: (_outletConfig: CollectionOutletConfig) => void; addPage: (pageConfig: PageConfig) => void; addMainNavigationTab: (tabConfig: MainNavigationTabConfig) => void; addContentAreaSidebarItem: (itemConfig: ContentAreaSidebarItemConfig) => void; addSettingsAreaSidebarItem: (_itemConfig: unknown) => void; addSidebarPanel: (panelConfig: SidebarPanelConfig) => void; addSidebar: (sidebarConfig: SidebarConfig) => void; addFieldExtension: (extensionConfig: FieldExtensionConfig) => void; overrideFieldExtension: (overrideConfig: FieldExtensionOverrideConfig) => void; addHiddenField: (predicate: HiddenFieldPredicate) => void; addModal: (modalConfig: ModalConfig) => void; configureConfigScreen: (screenConfig: ConfigScreenConfig) => void; addDropdownAction: (actionConfig: DropdownActionConfig) => void; onBoot: (handler: OnBootHandler) => void; onBeforeItemUpsert: (handler: OnBeforeItemUpsertHandler) => void; onBeforeItemsDestroy: (handler: OnBeforeItemsDestroyHandler) => void; onBeforeItemsPublish: (handler: OnBeforeItemsPublishHandler) => void; onBeforeItemsUnpublish: (handler: OnBeforeItemsUnpublishHandler) => void; customBlockStylesForStructuredTextField: (handler: CustomBlockStylesForStructuredTextFieldHandler) => void; customMarksForStructuredTextField: (handler: CustomMarksForStructuredTextFieldHandler) => void; connect: () => Promise; }; //#endregion //#region src/helpers.d.ts type CtxWithItemTypes = Ctx<{ itemTypes: Partial>; }>; /** * Gets the ItemType (model) that a field belongs to */ declare const getFieldItemType: (field: Field, ctx: CtxWithItemTypes) => ItemType | null; /** * Gets an ItemType by its API key */ declare const getItemTypeByApiKey: (apiKey: string, ctx: CtxWithItemTypes) => ItemType | undefined; /** * Checks if an ItemType is a singleton model */ declare const isSingletonModel: (itemType: ItemType) => boolean; /** * Checks if an ItemType is a collection model */ declare const isCollectionModel: (itemType: ItemType) => boolean; /** * Checks if a field belongs to an ItemType with the given API key */ declare const fieldBelongsToItemType: (field: Field, itemTypeApiKey: string, ctx: CtxWithItemTypes) => boolean; /** * Gets all fields that belong to an ItemType with the given API key */ declare const getFieldsByItemType: (itemTypeApiKey: string, ctx: CtxWithItemTypes) => Field[]; /** * Gets all fields of a specific field type */ declare const getAllFieldsOfType: (fieldType: string, ctx: Ctx) => Field[]; /** * Checks if the context has all the specified fields by API key */ declare const contextHasAllFields: (ctx: Ctx, fieldsApiKeys: string[]) => boolean; /** * Checks if a field is of a specific field type */ declare const isFieldType: (field: Field, fieldType: string) => boolean; /** * Checks if a field is a string field */ declare const isStringField: (field: Field) => boolean; /** * Checks if a field is a text field */ declare const isTextField: (field: Field) => boolean; /** * Checks if a field is a JSON field */ declare const isJsonField: (field: Field) => boolean; /** * Checks if a field is a structured text field */ declare const isStructuredTextField: (field: Field) => boolean; /** * Checks if a field is a link field (single or multiple) */ declare const isLinkField: (field: Field) => boolean; /** * Checks if a field is a file field (single or gallery) */ declare const isFileField: (field: Field) => boolean; /** * Checks if a field is a boolean field */ declare const isBooleanField: (field: Field) => boolean; /** * Checks if a field is a date field */ declare const isDateField: (field: Field) => boolean; /** * Checks if a field is a datetime field */ declare const isDateTimeField: (field: Field) => boolean; /** * Checks if a field is an integer field */ declare const isIntegerField: (field: Field) => boolean; /** * Checks if a field is a float field */ declare const isFloatField: (field: Field) => boolean; /** * Checks if a field is a color field */ declare const isColorField: (field: Field) => boolean; /** * Checks if a field is a lat/lon field */ declare const isLatLonField: (field: Field) => boolean; /** * Checks if a field is a SEO field */ declare const isSeoField: (field: Field) => boolean; /** * Checks if a field is a slug field */ declare const isSlugField: (field: Field) => boolean; /** * Checks if a field is a video field */ declare const isVideoField: (field: Field) => boolean; /** * Checks if a field is required */ declare const isFieldRequired: (field: Field) => boolean; /** * Checks if a field is localized */ declare const isLocalizedField: (field: Field) => boolean; /** * Checks if a field has a unique validator */ declare const isUniqueField: (field: Field) => boolean; /** * Gets all validators for a field */ declare const getFieldValidators: (field: Field) => Record; /** * Checks if a field has a specific field extension */ declare const hasFieldExtension: (field: Field, extensionId: string) => boolean; /** * Gets the field extension ID for a field */ declare const getFieldExtensionId: (field: Field) => string | null; /** * Validates if a string is a valid DatoCMS API key */ declare const isValidApiKey: (apiKey: string) => boolean; /** * Type guard to check if context has form methods */ declare const hasFormMethods: (ctx: unknown) => ctx is Ctx & { formValues: unknown; setFieldValue: (field: string, value: unknown) => void; }; /** * Type guard to check if context has current user permissions */ declare const hasCurrentUserPermissions: (ctx: unknown) => ctx is Ctx & { currentUserAccessLevel: string; }; interface StructuredTextDocument { document?: { children?: unknown[]; }; } /** * Extracts plain text from structured text (simple implementation) */ declare const extractTextFromStructuredText: (structuredText: StructuredTextDocument) => string; /** * Checks if structured text is empty */ declare const isStructuredTextEmpty: (structuredText: StructuredTextDocument) => boolean; interface Upload { attributes?: { url?: string; }; } /** * Gets the URL for an upload with optional imgix parameters */ declare const getUploadUrl: (upload: Upload, imgixParams?: Record) => string | null; /** * Creates a shouldApply function that matches specific ItemType API keys */ declare const shouldApplyToItemTypes: (...apiKeys: string[]) => (itemType: ItemType) => boolean; /** * Creates a shouldApply function that matches specific field types */ declare const shouldApplyToFieldTypes: (...fieldTypes: string[]) => (field: Field) => boolean; //#endregion export { type CollectionOutletConfig, type ConfigScreenConfig, type DropdownActionConfig, type DropdownActionType, type FieldExtensionConfig, type FieldExtensionOverrideConfig, type FormOutletConfig, type HiddenFieldPredicate, type MainNavigationTabConfig, type ModalConfig, type OnBeforeItemUpsertHandler, type OnBeforeItemsDestroyHandler, type OnBeforeItemsPublishHandler, type OnBeforeItemsUnpublishHandler, type OnBootHandler, type PageConfig, type PluginOptions, type SidebarConfig, type SidebarPanelConfig, contextHasAllFields, createPluginConfig, extractTextFromStructuredText, fieldBelongsToItemType, getAllFieldsOfType, getFieldExtensionId, getFieldItemType, getFieldValidators, getFieldsByItemType, getItemTypeByApiKey, getUploadUrl, hasCurrentUserPermissions, hasFieldExtension, hasFormMethods, isBooleanField, isCollectionModel, isColorField, isDateField, isDateTimeField, isFieldRequired, isFieldType, isFileField, isFloatField, isIntegerField, isJsonField, isLatLonField, isLinkField, isLocalizedField, isSeoField, isSingletonModel, isSlugField, isStringField, isStructuredTextEmpty, isStructuredTextField, isTextField, isUniqueField, isValidApiKey, isVideoField, shouldApplyToFieldTypes, shouldApplyToItemTypes }; //# sourceMappingURL=index.d.cts.map