@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
88 lines • 2.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Service = void 0;
exports.newService = newService;
const service_1 = require("../../../domain/config/vo/service");
/**
* Service entity holds service configuration
*/
class Service {
constructor(serviceConfig) {
this.serviceConfig = serviceConfig;
}
/**
* Check if Google Analytics is enabled
*/
isGoogleAnalyticsEnabled() {
return !this.serviceConfig.googleAnalytics.disable;
}
/**
* Get Google Analytics ID
*/
googleAnalyticsID() {
return this.serviceConfig.googleAnalytics.id;
}
/**
* Check if Google Analytics should respect Do Not Track
*/
isGoogleAnalyticsRespectDoNotTrack() {
return this.serviceConfig.googleAnalytics.respectDoNotTrack;
}
/**
* Check if Disqus is enabled
*/
isDisqusEnabled() {
return !this.serviceConfig.disqus.disable;
}
/**
* Get Disqus shortname
*/
disqusShortname() {
return this.serviceConfig.disqus.shortname;
}
/**
* Get RSS limit
*/
rssLimit() {
return this.serviceConfig.rss.limit;
}
/**
* Get the service configuration
*/
getServiceConfig() {
return this.serviceConfig;
}
/**
* Get Google Analytics configuration
*/
getGoogleAnalytics() {
return this.serviceConfig.googleAnalytics;
}
/**
* Get Disqus configuration
*/
getDisqus() {
return this.serviceConfig.disqus;
}
/**
* Get RSS configuration
*/
getRSS() {
return this.serviceConfig.rss;
}
/**
* Check if any service is enabled
*/
hasEnabledServices() {
return this.isGoogleAnalyticsEnabled() || this.isDisqusEnabled();
}
}
exports.Service = Service;
/**
* Create a new Service instance from provider data
*/
function newService(data) {
const serviceConfig = (0, service_1.decodeServiceConfig)(data);
return new Service(serviceConfig);
}
//# sourceMappingURL=service.js.map