@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
36 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StartUpDelivery = void 0;
const tslib_1 = require("tslib");
const cms = tslib_1.__importStar(require("../../cms"));
const delivery_utils_1 = require("../delivery-utils");
const reference_1 = require("./reference");
class StartUpDelivery extends reference_1.DeliveryWithReference {
constructor(delivery, button, resumeErrors) {
super(cms.ContentType.STARTUP, delivery, resumeErrors);
this.delivery = delivery;
this.button = button;
}
startUp(id, context) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
// we only get the 1 level of included references...
const entry = yield this.getEntry(id, context);
// .. so we need to fetch the buttons
return this.fromEntry(entry, context);
});
}
fromEntry(entry, context) {
var _a;
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const fields = entry.fields;
const buttons = yield this.button.fromReferenceSkipErrors(fields.buttons || [], context);
const referenceDelivery = {
delivery: this.reference,
context,
};
return (0, delivery_utils_1.addCustomFields)(new cms.StartUp(yield this.getReference().commonFields(entry, context), this.urlFromAssetOptional(fields.pic, context), (_a = fields.text) !== null && _a !== void 0 ? _a : '', buttons), fields, referenceDelivery, ['pic']);
});
}
}
exports.StartUpDelivery = StartUpDelivery;
//# sourceMappingURL=startup.js.map