Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c12e9eaf76 | |||
2aa1839c22 | |||
8e4bdb867c | |||
359e18f5dc | |||
751a325c81 | |||
93d4bc491f | |||
bdf55a19d9 | |||
cd1f68f55e |
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
dist_*/
|
||||
|
||||
# custom
|
@ -24,13 +24,14 @@ mirror:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
snyk:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
||||
audit:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
|
@ -1,2 +0,0 @@
|
||||
var tsbundle=function(t){"use strict";const e=async(t,e)=>{const n=document.createElement("meta");n.name=t,n.content=e,document.getElementsByTagName("head")[0].appendChild(n)},n=async(t,e)=>{const n=document.querySelector("link[rel='canonical']")?document.querySelector("link[rel='canonical']"):document.createElement("link");return n.setAttribute("rel",t),n.setAttribute("href",e),document.head.appendChild(n),n},a=async(t,e)=>{const n=document.createElement("meta");return n.setAttribute("property",t),n.content=e,document.getElementsByTagName("head")[0].appendChild(n),n},o=async t=>{const e=[],n={"@context":"https://schema.org","@type":"Corporation",name:t.name,alternateName:t.name.replace(" GmbH",""),url:t.contact.website,logo:t.contact.logoUrl,contactPoint:{"@type":"ContactPoint",telephone:t.contact.phone,contactType:"customer service",areaServed:"DE",availableLanguage:["en","German"]},sameAs:[]};t.contact.facebookUrl&&n.sameAs.push(t.contact.facebookUrl),t.contact.twitterUrl&&n.sameAs.push(t.contact.twitterUrl);const o=document.createElement("script");return o.type="application/ld+json",o.text=JSON.stringify(n),document.querySelector("head").appendChild(o),e.push(o),e.push(await a("og:type","business.business")),e.push(await a("og:title",t.name)),e.push(await a("og:url",t.contact.website)),e.push(await a("og:image",t.contact.logoUrl)),e.push(await a("business:contact_data:street_address",`${t.contact.address.streetName} ${t.contact.address.houseNumber}`)),e.push(await a("business:contact_data:locality",t.contact.address.postalCode)),e.push(await a("business:contact_data:region",t.contact.address.city)),e.push(await a("business:contact_data:postal_code",t.contact.address.postalCode)),e.push(await a("business:contact_data:country_name",t.contact.address.country)),e};return t.WebSetup=class{constructor(t){this.options=t}async setup(){await(async t=>{document.title=t.title,e("description",t.description),e("google","notranslate"),e("revisit-after","1 days"),t.canonicalDomain&&n("canonical",t.canonicalDomain),t.ldCompany&&o(t.ldCompany)})(this.options.metaObject),this.options.googleAnalyticsCode&&await(async t=>{var e,n,a,o,s,c;e=window,n=document,a="script",o="analytics",e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=(new Date).getTime(),s=n.createElement(a),c=n.getElementsByTagName(a)[0],s.async=1,s.src="//www.google-analytics.com/analytics.js",s.crossorigin="anonymous",c.parentNode.insertBefore(s,c),window.analytics("create",t,"auto"),window.analytics("send","pageview"),console.log("Loaded Google Analytics. You may view our privacy policy at https://lossless.gmbh")})(this.options.googleAnalyticsCode),this.options.fsCode&&await(async t=>{var e,n,a,o,s,c,i,r;window._fs_debug=!1,window._fs_host="fullstory.com",window._fs_org=t,window._fs_namespace="FS",e=window,n=document,a=window._fs_namespace,o="script",s="user",a in e?e.console&&e.console.log&&e.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'):((i=e[a]=function(t,e,n){i.q?i.q.push([t,e,n]):i._api(t,e,n)}).q=[],(c=n.createElement(o)).async=1,c.src="https://"+window._fs_host+"/s/fs.js",c.crossorigin="anonymous",(r=n.getElementsByTagName(o)[0]).parentNode.insertBefore(c,r),i.identify=function(t,e,n){i(s,{uid:t},n),e&&i(s,e,n)},i.setUserVars=function(t,e){i(s,t,e)},i.event=function(t,e,n){i("event",{n:t,p:e},n)},i.shutdown=function(){i("rec",!1)},i.restart=function(){i("rec",!0)},i.consent=function(t){i("consent",!arguments.length||t)},i.identifyAccount=function(t,e){c="account",(e=e||{}).acctId=t,i(c,e)},i.clearUserCookie=function(){})})(this.options.fsCode)}},t}({});
|
||||
//# sourceMappingURL=bundle.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"bundle.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
3789
package-lock.json
generated
3789
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -1,38 +1,37 @@
|
||||
{
|
||||
"name": "@pushrocks/websetup",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.16",
|
||||
"private": false,
|
||||
"description": "setup basic page properties",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web && npm run bundle)",
|
||||
"format": "(gitzone format)",
|
||||
"bundle": "tsbundle --production --from ./ts/index.ts --to ./dist_bundle/bundle.js"
|
||||
"build": "(tsbuild --web && tsbundle npm)"
|
||||
},
|
||||
"keywords": [
|
||||
"lossless",
|
||||
"websafe"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsbundle": "^1.0.50",
|
||||
"@gitzone/tsbuild": "^2.1.22",
|
||||
"@gitzone/tsbundle": "^1.0.57",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0",
|
||||
"tslint": "^6.0.0",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"tslint": "^6.1.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tsclass/tsclass": "^3.0.12"
|
||||
"@tsclass/tsclass": "^3.0.18"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_web/**/*",
|
||||
"dist_*/**/*",
|
||||
"dist_ts/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
|
22
readme.md
22
readme.md
@ -8,16 +8,24 @@ setup basic page properties
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/websetup/)
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/pushrocks/websetup/commits/master)
|
||||
[](https://gitlab.com/pushrocks/websetup/commits/master)
|
||||
[](https://www.npmjs.com/package/@pushrocks/websetup)
|
||||
[](https://snyk.io/test/npm/@pushrocks/websetup)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
Use TypeScript for best in class intellisense.
|
||||
|
||||
## Contribution
|
||||
|
||||
|
@ -66,9 +66,9 @@ const addCompanyInfo = async (
|
||||
telephone: companyDataArg.contact.phone,
|
||||
contactType: 'customer service',
|
||||
areaServed: 'DE',
|
||||
availableLanguage: ['en', 'German']
|
||||
availableLanguage: ['en', 'German'],
|
||||
},
|
||||
sameAs: []
|
||||
sameAs: [],
|
||||
};
|
||||
|
||||
if (companyDataArg.contact.facebookUrl) {
|
||||
@ -96,10 +96,27 @@ const addCompanyInfo = async (
|
||||
`${companyDataArg.contact.address.streetName} ${companyDataArg.contact.address.houseNumber}`
|
||||
)
|
||||
);
|
||||
returnElementArray.push(await addOpenGraphProperty('business:contact_data:locality', companyDataArg.contact.address.postalCode));
|
||||
returnElementArray.push(await addOpenGraphProperty('business:contact_data:region', companyDataArg.contact.address.city));
|
||||
returnElementArray.push(await addOpenGraphProperty('business:contact_data:postal_code', companyDataArg.contact.address.postalCode));
|
||||
returnElementArray.push(await addOpenGraphProperty('business:contact_data:country_name', companyDataArg.contact.address.country));
|
||||
returnElementArray.push(
|
||||
await addOpenGraphProperty(
|
||||
'business:contact_data:locality',
|
||||
companyDataArg.contact.address.postalCode
|
||||
)
|
||||
);
|
||||
returnElementArray.push(
|
||||
await addOpenGraphProperty('business:contact_data:region', companyDataArg.contact.address.city)
|
||||
);
|
||||
returnElementArray.push(
|
||||
await addOpenGraphProperty(
|
||||
'business:contact_data:postal_code',
|
||||
companyDataArg.contact.address.postalCode
|
||||
)
|
||||
);
|
||||
returnElementArray.push(
|
||||
await addOpenGraphProperty(
|
||||
'business:contact_data:country_name',
|
||||
companyDataArg.contact.address.country
|
||||
)
|
||||
);
|
||||
|
||||
return returnElementArray;
|
||||
};
|
||||
|
@ -24,7 +24,7 @@ export const setupFullStory = async (fsCodeArg: string) => {
|
||||
return;
|
||||
}
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g = m[e] = function(a, b, s) {
|
||||
g = m[e] = function (a, b, s) {
|
||||
g.q ? g.q.push([a, b, s]) : g._api(a, b, s);
|
||||
};
|
||||
g.q = [];
|
||||
@ -35,36 +35,36 @@ export const setupFullStory = async (fsCodeArg: string) => {
|
||||
y = n.getElementsByTagName(t)[0];
|
||||
y.parentNode.insertBefore(o, y);
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g.identify = function(i, v, s) {
|
||||
g.identify = function (i, v, s) {
|
||||
g(l, { uid: i }, s);
|
||||
if (v) g(l, v, s);
|
||||
};
|
||||
g.setUserVars = function(v, s) {
|
||||
g.setUserVars = function (v, s) {
|
||||
g(l, v, s);
|
||||
};
|
||||
g.event = function(i, v, s) {
|
||||
g.event = function (i, v, s) {
|
||||
g('event', { n: i, p: v }, s);
|
||||
};
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g.shutdown = function() {
|
||||
g.shutdown = function () {
|
||||
g('rec', !1);
|
||||
};
|
||||
g.restart = function() {
|
||||
g.restart = function () {
|
||||
g('rec', !0);
|
||||
};
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g.consent = function(a) {
|
||||
g.consent = function (a) {
|
||||
g('consent', !arguments.length || a);
|
||||
};
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g.identifyAccount = function(i, v) {
|
||||
g.identifyAccount = function (i, v) {
|
||||
o = 'account';
|
||||
v = v || {};
|
||||
v.acctId = i;
|
||||
g(o, v);
|
||||
};
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
g.clearUserCookie = function() {};
|
||||
g.clearUserCookie = function () {};
|
||||
// tslint:disable-next-line: no-string-literal
|
||||
})(window, document, window['_fs_namespace'], 'script', 'user');
|
||||
};
|
||||
|
@ -7,14 +7,14 @@ declare global {
|
||||
|
||||
export const setupGoogleAnalytics = async (gaCode: string) => {
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
(function (i, s, o, g, r, a, m) {
|
||||
// tslint:disable-next-line: no-string-literal
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
// tslint:disable-next-line: ban-comma-operator
|
||||
(i[r] =
|
||||
i[r] ||
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
function() {
|
||||
function () {
|
||||
(i[r].q = i[r].q || []).push(arguments);
|
||||
}),
|
||||
(i[r].l = new Date().getTime());
|
||||
|
@ -1,5 +1,3 @@
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
tsclass
|
||||
};
|
||||
export { tsclass };
|
||||
|
Reference in New Issue
Block a user