@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
84 lines • 4.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PagingOptions = exports.isSameModel = exports.isCustomModel = exports.BOTONIC_CONTENT_TYPES = exports.BotonicContentType = exports.ResourceType = exports.AssetType = exports.CONTENT_TYPES = exports.ContentType = exports.CustomContentType = exports.SubContentType = exports.TOP_CONTENT_TYPES = exports.TopContentType = exports.NonMessageTopContentType = exports.MESSAGE_CONTENT_TYPES = exports.MessageContentType = exports.DEFAULT_REFERENCES_TO_INCLUDE = void 0;
exports.DEFAULT_REFERENCES_TO_INCLUDE = 6;
var MessageContentType;
(function (MessageContentType) {
MessageContentType["CAROUSEL"] = "carousel";
MessageContentType["CHITCHAT"] = "chitchat";
MessageContentType["DOCUMENT"] = "document";
MessageContentType["IMAGE"] = "image";
MessageContentType["VIDEO"] = "video";
MessageContentType["TEXT"] = "text";
MessageContentType["STARTUP"] = "startUp";
})(MessageContentType = exports.MessageContentType || (exports.MessageContentType = {}));
// CHITCHAT removed because it's an alias for texts
exports.MESSAGE_CONTENT_TYPES = Object.values(MessageContentType).filter(m => m != MessageContentType.CHITCHAT);
var NonMessageTopContentType;
(function (NonMessageTopContentType) {
NonMessageTopContentType["DATE_RANGE"] = "dateRange";
NonMessageTopContentType["HANDOFF"] = "handoff";
NonMessageTopContentType["QUEUE"] = "queue";
NonMessageTopContentType["SCHEDULE"] = "schedule";
NonMessageTopContentType["URL"] = "url";
NonMessageTopContentType["PAYLOAD"] = "payload";
NonMessageTopContentType["INPUT"] = "user-input";
})(NonMessageTopContentType = exports.NonMessageTopContentType || (exports.NonMessageTopContentType = {}));
exports.TopContentType = Object.assign(Object.assign({}, MessageContentType), NonMessageTopContentType);
exports.TOP_CONTENT_TYPES = [
...exports.MESSAGE_CONTENT_TYPES,
...Object.values(NonMessageTopContentType),
];
var SubContentType;
(function (SubContentType) {
SubContentType["BUTTON"] = "button";
SubContentType["ELEMENT"] = "element";
})(SubContentType = exports.SubContentType || (exports.SubContentType = {}));
var CustomContentType;
(function (CustomContentType) {
CustomContentType["CUSTOM"] = "custom";
})(CustomContentType = exports.CustomContentType || (exports.CustomContentType = {}));
exports.ContentType = Object.assign(Object.assign({}, exports.TopContentType), SubContentType);
exports.CONTENT_TYPES = [
...exports.TOP_CONTENT_TYPES,
...Object.values(SubContentType),
];
var AssetType;
(function (AssetType) {
AssetType["AUDIO"] = "audio";
AssetType["IMAGE"] = "image";
AssetType["VIDEO"] = "video";
AssetType["DOCUMENT"] = "document";
AssetType["SPREADSHEET"] = "spreadsheet";
AssetType["OTHER"] = "other";
})(AssetType = exports.AssetType || (exports.AssetType = {}));
exports.ResourceType = Object.assign(Object.assign({}, exports.ContentType), AssetType);
exports.BotonicContentType = Object.assign(Object.assign({}, MessageContentType), SubContentType);
exports.BOTONIC_CONTENT_TYPES = [
...exports.MESSAGE_CONTENT_TYPES,
...Object.values(SubContentType),
];
function isCustomModel(cmsModelType, localModelType) {
return (localModelType === CustomContentType.CUSTOM &&
(isSameModel(cmsModelType, CustomContentType.CUSTOM) ||
!exports.CONTENT_TYPES.includes(cmsModelType)));
}
exports.isCustomModel = isCustomModel;
function isSameModel(model1, model2) {
switch (model1) {
case exports.ContentType.TEXT:
case exports.ContentType.CHITCHAT:
return model2 == exports.ContentType.TEXT || model2 == exports.ContentType.CHITCHAT;
default:
return model1 == model2;
}
}
exports.isSameModel = isSameModel;
class PagingOptions {
constructor(limit = 1000, skip = 0) {
this.limit = limit;
this.skip = skip;
}
}
exports.PagingOptions = PagingOptions;
//# sourceMappingURL=cms.js.map