@craftercms/studio-ui
Version:
Services, components, models & utils to build CrafterCMS authoring extensions.
109 lines (107 loc) • 4.44 kB
TypeScript
/*
* Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Observable } from 'rxjs';
import { ContentTypeField } from '../models/ContentType';
import ContentInstance from '../models/ContentInstance';
import { ItemHistoryEntry } from '../models/Version';
import LookupTable from '../models/LookupTable';
import GlobalState from '../models/GlobalState';
import { SiteConfigurationFile } from '../models/SiteConfigurationFile';
export type CrafterCMSModules = 'studio' | 'engine';
export declare function fetchConfigurationXML(
site: string,
configPath: string,
module: CrafterCMSModules,
environment?: string
): Observable<string>;
export declare function fetchConfigurationDOM(
site: string,
configPath: string,
module: CrafterCMSModules,
environment?: string
): Observable<XMLDocument>;
/**
* Fetches the requested configPath XML and deserializes such XML into JSON
* @param site {string} The site id from which to fetch the configuration from
* @param configPath {string} The path — inside the module — to the configuration file to fetch
* @param module {engine | studio} The module from which to fetch the configuration from
* @param environment {string} Optional environment to fetch the configuration from
*/
export declare function fetchConfigurationJSON(
site: string,
configPath: string,
module: CrafterCMSModules,
environment?: string
): Observable<any>;
/**
* Persists the content of a configuration file.
* @param site {string} The site id from which to fetch the configuration from.
* @param partialPath {string} The path *inside the module*, excluding root (/config) and module (/studio|engine). If full path is `/config/studio/ui.xml`, partial path `/ui.xml`.
* @param module {engine | studio} The module that owns this configuration file.
* @param content {string} The content to write.
* @param environment {string} Optional environment to write to.
**/
export declare function writeConfiguration(
site: string,
partialPath: string,
module: CrafterCMSModules,
content: string,
environment?: string
): Observable<boolean>;
export interface ActiveTargetingModel {
id: string;
[prop: string]: string;
}
export declare function fetchActiveTargetingModel(site?: string): Observable<ContentInstance>;
export declare function deserializeActiveTargetingModelData<T extends Object>(
data: T,
contentTypeFields: LookupTable<ContentTypeField>
): ContentInstance;
export declare function setActiveTargetingModel(data: any): Observable<ActiveTargetingModel>;
export declare function fetchSiteUiConfig(site: string, environment: string): Observable<string>;
export declare function fetchGlobalMenuItems(): Observable<GlobalState['globalNavigation']['items']>;
export declare function fetchProductLanguages(): Observable<
{
id: string;
label: string;
}[]
>;
export declare function fetchHistory(
site: string,
path: string,
environment: string,
module: string
): Observable<ItemHistoryEntry[]>;
export declare function fetchCannedMessage(site: string, locale: string, type: string): Observable<string>;
export declare function fetchSiteLocale(site: string, environment: string): Observable<any>;
export declare function fetchSiteConfigurationFiles(
site: string,
environment?: string
): Observable<SiteConfigurationFile[]>;
export interface StudioSiteConfig
extends Pick<
GlobalState['uiConfig'],
'cdataEscapedFieldPatterns' | 'upload' | 'locale' | 'publishing' | 'remoteGitBranch'
> {
site: string;
}
export declare function fetchSiteConfig(site: string, environment: string): Observable<StudioSiteConfig>;
export interface CannedMessage {
key: string;
title: string;
message: string;
}
export declare function fetchCannedMessages(site: string, environment: string): Observable<CannedMessage[]>;