@botonic/plugin-contentful
Version:
Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet
66 lines (65 loc) • 2.23 kB
TypeScript
import { Content, ContentType } from '../cms';
export declare enum ContentFieldType {
TEXT = "Text",
SHORT_TEXT = "Short text",
KEYWORDS = "Keywords",
TITLE = "Title",
SUBTITLE = "Subtitle",
BUTTONS = "Buttons",
ELEMENTS = "Elements",
IMAGE = "Image",
PIC = "pic",
URL = "URL",
PAYLOAD = "payload",
NAME = "Name",
BUTTONS_STYLE = "Buttons Style",
FOLLOW_UP = "FollowUp",
TARGET = "Target",
QUEUE = "Queue",
HANDOFF_QUEUE = "Handoff Queue",
MESSAGE = "Message",
FAIL_MESSAGE = "Fail Message",
AGENT_EMAIL = "Agent Email",
AGENT_ID = "Agent Id",
ON_FINISH = "On Finish",
SHADOWING = "Shadowing",
INPUT_TYPE = "Input Type"
}
export declare enum ContentFieldValueType {
STRING = "string",
STRING_ARRAY = "string[]",
REFERENCE = "reference",
REFERENCE_ARRAY = "reference[]",
ASSET = "asset",
BOOLEAN = "boolean"
}
export declare class ContentField {
readonly fieldType: ContentFieldType;
readonly cmsName: string;
readonly valueType: ContentFieldValueType;
readonly isLocalized: boolean;
/**
* Used for keywords.
* Maybe we should use instead a comma, since it's error prone that in Excel
* the array values are ; separated, but in contentful dashboard they must be
* separated by commas (a workaround is adding a validation on contentful dashboard
* to prevent ; on array fields)
*/
static STRING_ARRAY_SEPARATOR: string;
constructor(fieldType: ContentFieldType, cmsName: string, valueType: ContentFieldValueType, isLocalized: boolean);
parse(fieldValue: string): any;
getValue(content: Content): any;
isNotEmptyAt(content: Content): boolean;
}
export declare const CONTENT_FIELDS: Map<ContentFieldType, ContentField>;
export declare function contentFieldByCmsName(cmsName: string): ContentField;
export declare class I18nField {
readonly name: ContentFieldType;
readonly value: string;
constructor(name: ContentFieldType, value: string);
}
/**
* Adds common fields to FIELDS_PER_CONTENT_TYPE
* IMPORTANT @see FIELDS_PER_CONTENT_TYPE
*/
export declare function getFieldsForContentType(contentType: ContentType): ContentFieldType[];