import { FetchRepositoryBase } from "../../../shared/index.js"; import type { CreatePageRequest, CreatePageResponse, ListPagesParams, ListPagesResponse, PageActivityResponse, PageResponse, PageTemplateResponse, UnpublishPageRequest, UpdatePageRequest, UpdatePageResponse } from "./PagesTypes.js"; /** * Repository for managing Modyo layout pages (widget, content, and origination pages) * * Supports three page types: * - Widget pages: Accept custom widgets with grid layouts * - Content pages: Display content from Content API with Liquid templates * - Origination pages: Multi-step form workflows */ export declare class PagesRepository extends FetchRepositoryBase { /** * Retrieves a paginated list of layout pages for a site * * @param siteId - The ID of the site * @param queryParams - Optional query parameters for filtering and pagination * @param queryParams.query - Search query to filter pages by name or path * @param queryParams.states - Filter by page states (e.g., 'draft', 'published') * @param queryParams.type - Filter by page type * @param queryParams.show_archived - Include archived pages in results * @param queryParams.page - Page number for pagination (default: 1) * @param queryParams.per_page - Items per page (default: 100) * @param queryParams.sort_by - Field to sort by (name, path, created_at, updated_at) * @param queryParams.order - Sort order (asc, desc) * @returns Promise resolving to paginated list of pages with metadata * @throws Error if API request fails or authentication is invalid */ getPages(siteId: number, queryParams?: ListPagesParams): Promise; /** * Fetches all pages from all pages in parallel * * @param siteId - The ID of the site * @returns Promise resolving to array of all pages across all pages */ getAllPages(siteId: number): Promise; /** * Finds a page by UUID using API-side filtering. * Handles nested children — the API may return the page inside a parent's children array. */ findPageByUuid(siteId: number, uuid: string): Promise; /** * Recursively flattens nested page hierarchy into a single-level array. * The API returns pages with nested `children[]` — grandchild+ pages * are invisible without flattening. */ private flattenPages; /** * Creates a new layout page in a site * * Page types: * - 'custom' or 'default': Widget pages that accept custom widgets * - 'content' or 'entry': Content pages connected to Content API * - 'origination': Form workflow pages * * Important notes: * - Widget pages require grid_type (e.g., 'full_grid', 'side_left_grid') * - Content pages require content_type_id to connect to content type * - Path should not include leading slash (use 'blog' not '/blog') * - Home page path is '/' or empty string * * @param siteId - The ID of the site * @param data - Page creation data * @param data.name - Page name (displayed in admin) * @param data.path - URL path without leading slash * @param data.type - Page type ('custom', 'content', 'origination') * @param data.grid_type - Grid layout for widget pages * @param data.content_type_id - Content type ID for content pages (required for content pages) * @param data.has_router - Enable routing (client-side for widgets, server-side for content) * @returns Promise resolving to created page data * @throws Error if API request fails, validation fails, or authentication is invalid */ createPage(siteId: number, data: CreatePageRequest): Promise; /** * Retrieves a single page by ID with full details * * Returns complete page data including content, CSS, JS, meta tags, widgets, and templates * * @param siteId - The ID of the site * @param pageId - The ID of the page * @returns Promise resolving to page data with all details * @throws Error if page not found, API request fails, or authentication is invalid */ getPage(siteId: number, pageId: number): Promise; /** * Updates an existing layout page * * Partial updates supported - only include fields to change. * Can update page properties, widgets, templates, content, CSS, and JS. * * Important notes: * - Updating widgets replaces entire widget array (not merged) * - Updating templates is per-template by id — only sent fields are updated, omitted fields are preserved * - Use empty path ('') for home page * * @param siteId - The ID of the site * @param pageId - The ID of the page to update * @param data - Page update data (partial) * @param data.name - Updated page name * @param data.path - Updated URL path * @param data.widgets - Complete widget array (replaces existing) * @param data.templates - Templates to update (matched by id, only sent fields are changed) * @param data.content - HTML content * @param data.css - Custom CSS * @param data.js - Custom JavaScript * @returns Promise resolving to updated page data * @throws Error if page not found, validation fails, API request fails, or authentication is invalid */ updatePage(siteId: number, pageId: number, data: UpdatePageRequest): Promise; /** * Permanently deletes a layout page * * Workflow for deleting published pages: * 1. Unpublish page (unpublishPage) * 2. Archive workflow * 3. Delete page (this method) * * Important restrictions: * - Cannot delete published pages directly - must unpublish first * - Cannot delete home pages via API (Modyo platform protection) * - Deletion is permanent and cannot be undone * * @param siteId - The ID of the site * @param pageId - The ID of the page to delete * @returns Promise resolving when deletion completes * @throws Error if page is published, is home page, API request fails, or authentication is invalid */ deletePage(siteId: number, pageId: number): Promise; /** * Retrieves page activity history * * Returns chronological list of actions performed on the page * (creation, updates, publishing, archiving, etc.) * * @param siteId - The ID of the site * @param pageId - The ID of the page * @returns Promise resolving to activity log with user and timestamp data * @throws Error if page not found, API request fails, or authentication is invalid */ getPageActivity(siteId: number, pageId: number): Promise; /** * Retrieves page template content * * For content pages, retrieves Liquid template body for index or show views * * @param siteId - The ID of the site * @param pageId - The ID of the page * @param queryParams - Optional query parameters * @param queryParams.type - Template type ('index' or 'show') * @param queryParams.version - Template version number * @returns Promise resolving to template content and metadata * @throws Error if page not found, template not found, API request fails, or authentication is invalid */ getPageTemplate(siteId: number, pageId: number, queryParams?: { type?: string; version?: number; }): Promise; /** * Unpublishes a layout page (removes from live site) * * This is Step 1 in the published page deletion workflow: * 1. Unpublish page (this method) - Removes from live site * 2. Archive workflow - Closes the workflow * 3. Delete page - Permanently removes page * * Scheduling options: * - Immediate unpublish: Omit data parameter or pass empty object * - Scheduled unpublish: Provide unpublish_at with ISO 8601 date * * Important restrictions: * - Cannot unpublish home pages via API (Modyo platform protection) * - Home pages identified by path '/' or '' or page_type 'home'/'homelayoutpage' * * @param siteId - The ID of the site * @param pageId - The ID of the page to unpublish * @param data - Optional scheduling parameters * @param data.unpublish_at - ISO 8601 date for scheduled unpublish (omit for immediate) * @param data.publish_at - ISO 8601 date for re-publishing * @returns Promise resolving when unpublish operation completes or is scheduled * @throws Error if page is home page, not published, API request fails, or authentication is invalid */ unpublishPage(siteId: number, pageId: number, data?: UnpublishPageRequest): Promise; /** * Creates a copy of an existing page * * Copies all page properties, widgets, templates, content, CSS, and JS. * New page is created as a draft with name suffixed with "(copy)" * * @param siteId - The ID of the site * @param pageId - The ID of the page to copy * @returns Promise resolving to newly created page data * @throws Error if source page not found, API request fails, or authentication is invalid */ copyPage(siteId: number, pageId: number): Promise; } //# sourceMappingURL=PagesRepository.d.ts.map