fix(core): update
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import * as plugins from './websetup.plugins';
|
||||
import * as interfaces from './interfaces';
|
||||
|
||||
import { Tag } from "./websetup.classes.tag";
|
||||
import { Tag } from './websetup.classes.tag';
|
||||
|
||||
export class JsonLdTag extends Tag {
|
||||
public static createCompanyLd(companyDataArg: plugins.tsclass.business.ICompany) {
|
||||
@ -22,11 +22,11 @@ export class JsonLdTag extends Tag {
|
||||
},
|
||||
sameAs: [],
|
||||
};
|
||||
|
||||
|
||||
if (companyDataArg.contact.facebookUrl) {
|
||||
companyLd.sameAs.push(companyDataArg.contact.facebookUrl);
|
||||
}
|
||||
|
||||
|
||||
if (companyDataArg.contact.twitterUrl) {
|
||||
companyLd.sameAs.push(companyDataArg.contact.twitterUrl);
|
||||
}
|
||||
@ -42,4 +42,4 @@ export class JsonLdTag extends Tag {
|
||||
jsonLdElement.text = JSON.stringify(JSON.stringify(ldObjectArg));
|
||||
this.elementRef = jsonLdElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Tag } from "./websetup.classes.tag";
|
||||
import { Tag } from './websetup.classes.tag';
|
||||
|
||||
export class MetaTag extends Tag {
|
||||
constructor(metaNameArg: string, contentArg: string) {
|
||||
@ -8,4 +8,4 @@ export class MetaTag extends Tag {
|
||||
metaElement.content = contentArg;
|
||||
this.elementRef = metaElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,4 +18,4 @@ export class Tag {
|
||||
this.elementRef.parentNode.removeChild(this.elementRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export type TBaseLevelType = 'global' | 'base' | 'subpage';
|
||||
|
||||
export class TagLevel {
|
||||
public tagManagerRef: TagManager;
|
||||
|
||||
|
||||
public title: string;
|
||||
public type: TBaseLevelType;
|
||||
public tags: Tag[] = [];
|
||||
@ -21,12 +21,9 @@ export class TagLevel {
|
||||
this.tags.push(tagArg);
|
||||
}
|
||||
|
||||
public async addCompanyInfo(
|
||||
companyDataArg: plugins.tsclass.business.ICompany
|
||||
) {
|
||||
|
||||
public async addCompanyInfo(companyDataArg: plugins.tsclass.business.ICompany) {
|
||||
this.addTag(JsonLdTag.createCompanyLd(companyDataArg));
|
||||
|
||||
|
||||
// lets care about open graph
|
||||
this.addTag(new OpengraphTag('og:type', 'business.business'));
|
||||
this.addTag(new OpengraphTag('og:title', companyDataArg.name));
|
||||
@ -39,10 +36,7 @@ export class TagLevel {
|
||||
)
|
||||
);
|
||||
this.addTag(
|
||||
new OpengraphTag(
|
||||
'business:contact_data:locality',
|
||||
companyDataArg.contact.address.postalCode
|
||||
)
|
||||
new OpengraphTag('business:contact_data:locality', companyDataArg.contact.address.postalCode)
|
||||
);
|
||||
this.addTag(
|
||||
new OpengraphTag('business:contact_data:region', companyDataArg.contact.address.city)
|
||||
@ -54,13 +48,12 @@ export class TagLevel {
|
||||
)
|
||||
);
|
||||
this.addTag(
|
||||
new OpengraphTag(
|
||||
'business:contact_data:country_name',
|
||||
companyDataArg.contact.address.country
|
||||
)
|
||||
new OpengraphTag('business:contact_data:country_name', companyDataArg.contact.address.country)
|
||||
);
|
||||
}
|
||||
|
||||
public addPostInfo() {}
|
||||
|
||||
public async enable() {
|
||||
if (this.title) {
|
||||
document.title = this.title;
|
||||
@ -75,4 +68,4 @@ export class TagLevel {
|
||||
tagArg.removeFromDom();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ export class TagManager {
|
||||
this.baseLevel = new TagLevel(this, 'base');
|
||||
this.baseLevel.title = metaObjectArg.title;
|
||||
this.baseLevel.addTag(new MetaTag('description', metaObjectArg.description));
|
||||
|
||||
if (metaObjectArg.canonicalDomain){
|
||||
this.baseLevel.addTag(new MetaTag('canonical', metaObjectArg.canonicalDomain))
|
||||
|
||||
if (metaObjectArg.canonicalDomain) {
|
||||
this.baseLevel.addTag(new MetaTag('canonical', metaObjectArg.canonicalDomain));
|
||||
}
|
||||
|
||||
|
||||
if (metaObjectArg.ldCompany) {
|
||||
this.baseLevel.addCompanyInfo(metaObjectArg.ldCompany);
|
||||
}
|
||||
@ -50,4 +50,4 @@ export class TagManager {
|
||||
this.activeLevel.enable();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,9 @@ export class WebSetup {
|
||||
public readyPromise = this.readyDeferred.promise;
|
||||
constructor(optionsArg: IWebSetupConstructorOptions) {
|
||||
this.options = optionsArg;
|
||||
this.setup().then(() => {this.readyDeferred.resolve()});
|
||||
this.setup().then(() => {
|
||||
this.readyDeferred.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,6 +40,5 @@ export class WebSetup {
|
||||
* sets a subpage
|
||||
* @param metaObject
|
||||
*/
|
||||
public setSubLevel(metaObject: interfaces.IMetaObject) {
|
||||
}
|
||||
public setSubLevel(metaObject: interfaces.IMetaObject) {}
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
// pushrocks scope
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
|
||||
export {
|
||||
smartpromise
|
||||
};
|
||||
export { smartpromise };
|
||||
|
||||
// tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
Reference in New Issue
Block a user