2018-12-27 23:23:13 +00:00
|
|
|
import * as plugins from './websetup.plugins';
|
|
|
|
|
2019-03-25 14:57:38 +00:00
|
|
|
import { setupGoogleAnalytics } from './tools/ganalytics';
|
2019-03-25 15:07:04 +00:00
|
|
|
import { setupFullStory } from './tools/fullstory';
|
2019-03-27 13:38:24 +00:00
|
|
|
import { IMetaObject, setupMetaInformation } from './meta';
|
2019-03-25 14:57:38 +00:00
|
|
|
|
|
|
|
export interface IWebSetupConstructorOptions {
|
|
|
|
googleAnalyticsCode?: string;
|
|
|
|
fsCode?: string;
|
2019-03-27 13:38:24 +00:00
|
|
|
metaObject: IMetaObject;
|
2019-03-25 14:57:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* the main WebSetup class
|
|
|
|
*/
|
|
|
|
export class WebSetup {
|
2019-07-16 16:49:15 +00:00
|
|
|
public options: IWebSetupConstructorOptions;
|
2019-03-25 14:57:38 +00:00
|
|
|
constructor(optionsArg: IWebSetupConstructorOptions) {
|
2019-07-16 16:49:15 +00:00
|
|
|
this.options = optionsArg;
|
2019-03-27 13:38:24 +00:00
|
|
|
}
|
|
|
|
|
2019-07-16 16:49:15 +00:00
|
|
|
public async setup() {
|
|
|
|
await setupMetaInformation(this.options.metaObject);
|
2019-03-27 13:58:24 +00:00
|
|
|
|
2019-07-16 16:49:15 +00:00
|
|
|
if (this.options.googleAnalyticsCode) {
|
|
|
|
await setupGoogleAnalytics(this.options.googleAnalyticsCode);
|
2019-03-27 13:38:24 +00:00
|
|
|
}
|
|
|
|
|
2019-07-16 16:49:15 +00:00
|
|
|
if (this.options.fsCode) {
|
|
|
|
await setupFullStory(this.options.fsCode);
|
2019-03-25 14:57:38 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-27 13:40:06 +00:00
|
|
|
}
|