@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
25 lines • 1.03 kB
JavaScript
import { __awaiter } from "tslib";
import { ContentType, DEFAULT_CONTEXT, } from '../../cms';
import { addCustomFields, ContentfulEntryUtils, } from '../delivery-utils';
import { DeliveryWithReference } from './reference';
export class DateRangeDelivery extends DeliveryWithReference {
constructor(delivery, resumeErrors) {
super(ContentType.DATE_RANGE, delivery, resumeErrors);
}
dateRange(id, context) {
return __awaiter(this, void 0, void 0, function* () {
const entry = yield this.getEntry(id, DEFAULT_CONTEXT);
return this.fromEntry(entry, context);
});
}
fromEntry(entry, context) {
return __awaiter(this, void 0, void 0, function* () {
const referenceDelivery = {
delivery: this.reference,
context,
};
return addCustomFields(ContentfulEntryUtils.fromDateRangeEntry(entry), entry.fields, referenceDelivery, ['from', 'to']);
});
}
}
//# sourceMappingURL=date-range.js.map