fix(core): update

This commit is contained in:
Philipp Kunz 2019-03-25 15:57:38 +01:00
parent d4c3d23634
commit 9eb9f14a38
5 changed files with 1735 additions and 2 deletions

1617
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,6 @@
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0"
},

View File

@ -1,3 +1,23 @@
import * as plugins from './websetup.plugins';
export let standardExport = 'Hi there! :) This is an exported string';
import { setupGoogleAnalytics } from './tools/ganalytics';
export interface IWebSetupConstructorOptions {
googleAnalyticsCode?: string;
fsCode?: string;
}
/**
* the main WebSetup class
*/
export class WebSetup {
constructor(optionsArg: IWebSetupConstructorOptions) {
if (optionsArg.googleAnalyticsCode) {
setupGoogleAnalytics(optionsArg.googleAnalyticsCode);
}
if () {
}
}
}

66
ts/tools/fullstory.ts Normal file
View File

@ -0,0 +1,66 @@
declare global {
// tslint:disable-next-line: interface-name
interface Window {
_fs_host: any;
}
}
export const setupFullStory = async () => {
// tslint:disable-next-line: no-string-literal
window['_fs_debug'] = false;
// tslint:disable-next-line: no-string-literal
window['_fs_host'] = 'fullstory.com';
// tslint:disable-next-line: no-string-literal
window['_fs_org'] = 'G6FC5';
// tslint:disable-next-line: no-string-literal
window['_fs_namespace'] = 'FS';
(function(m, n, e, t, l, o, g, y) {
if (e in m) {
if (m.console && m.console.log) {
m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');
}
return;
}
// tslint:disable-next-line: only-arrow-functions
g = m[e] = function(a, b, s) {
g.q ? g.q.push([a, b, s]) : g._api(a, b, s);
};
g.q = [];
o = n.createElement(t);
o.async = 1;
o.src = 'https://' + window._fs_host + '/s/fs.js';
y = n.getElementsByTagName(t)[0];
y.parentNode.insertBefore(o, y);
// tslint:disable-next-line: only-arrow-functions
g.identify = function(i, v, s) {
g(l, { uid: i }, s);
if (v) g(l, v, s);
};
g.setUserVars = function(v, s) {
g(l, 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('rec', !1);
};
g.restart = function() {
g('rec', !0);
};
// tslint:disable-next-line: only-arrow-functions
g.consent = function(a) {
g('consent', !arguments.length || a);
};
// tslint:disable-next-line: only-arrow-functions
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() {};
// tslint:disable-next-line: no-string-literal
})(window, document, window['_fs_namespace'], 'script', 'user');
};

31
ts/tools/ganalytics.ts Normal file
View File

@ -0,0 +1,31 @@
declare global {
// tslint:disable-next-line: interface-name
interface Window {
analytics: any;
}
}
export const setupGoogleAnalytics = async (gaCode: string) => {
// tslint:disable-next-line: only-arrow-functions
(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() {
(i[r].q = i[r].q || []).push(arguments);
}),
(i[r].l = new Date().getTime());
// tslint:disable-next-line: ban-comma-operator
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'analytics');
window.analytics('create', gaCode, 'auto');
window.analytics('send', 'pageview');
console.log('Loaded Google Analytics. You may view our privacy policy at https://lossless.gmbh');
};