BREAKING CHANGE(core): update

This commit is contained in:
Philipp Kunz 2020-09-22 14:26:13 +00:00
parent 1f7be6b8a0
commit c802e8846a
3 changed files with 0 additions and 115 deletions

View File

@ -1,12 +1,7 @@
import * as plugins from './websetup.plugins';
import { setupGoogleAnalytics } from './tools/ganalytics';
import { setupFullStory } from './tools/fullstory';
import { IMetaObject, setupMetaInformation } from './meta';
export interface IWebSetupConstructorOptions {
googleAnalyticsCode?: string;
fsCode?: string;
metaObject: IMetaObject;
}
@ -21,13 +16,5 @@ export class WebSetup {
public async setup() {
await setupMetaInformation(this.options.metaObject);
if (this.options.googleAnalyticsCode) {
await setupGoogleAnalytics(this.options.googleAnalyticsCode);
}
if (this.options.fsCode) {
await setupFullStory(this.options.fsCode);
}
}
}

View File

@ -1,70 +0,0 @@
declare global {
// tslint:disable-next-line: interface-name
interface Window {
_fs_debug: boolean;
_fs_host: any;
_fs_org: string;
_fs_namespace: string;
}
}
export const setupFullStory = async (fsCodeArg: string) => {
// 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'] = fsCodeArg;
// tslint:disable-next-line: no-string-literal
window['_fs_namespace'] = 'FS';
((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';
o.crossorigin = 'anonymous';
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');
};

View File

@ -1,32 +0,0 @@
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;
a.crossorigin = 'anonymous';
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');
};