diff --git a/extras/docs/themes/config.json b/extras/docs/themes/config.json index f3d98a32887..9761d24d456 100644 --- a/extras/docs/themes/config.json +++ b/extras/docs/themes/config.json @@ -1,24 +1,30 @@ { "en": { "development": { - "url": "https://dev.infragistics.local" + "url": "https://dev.infragistics.local", + "gaID": "GTM-WLXLBZD" }, "staging": { - "url": "https://staging.infragistics.local" + "url": "https://staging.infragistics.local", + "gaID": "GTM-NCKNPN" }, "production": { - "url": "https://www.infragistics.com" + "url": "https://www.infragistics.com", + "gaID": "GTM-T65CF7" } }, "jp": { "development": { - "url": "https://jp.dev.infragistics.local" + "url": "https://jp.dev.infragistics.local", + "gaID": "GTM-NNHVMC7" }, "staging": { - "url": "https://jp.staging.infragistics.local" + "url": "https://jp.staging.infragistics.local", + "gaID": "GTM-WLWSDK" }, "production": { - "url": "https://jp.infragistics.com" + "url": "https://jp.infragistics.com", + "gaID": "GTM-KVNSWJ" } - } -} \ No newline at end of file + } +} diff --git a/extras/docs/themes/sassdoc/index.js b/extras/docs/themes/sassdoc/index.js index bc88e6adea5..2a5ed2a2ea2 100644 --- a/extras/docs/themes/sassdoc/index.js +++ b/extras/docs/themes/sassdoc/index.js @@ -112,20 +112,13 @@ const theme = themeleon(__dirname, function (t) { return value.substring(0, 3); }, retrieveEnvLink: () => { - let { - NODE_ENV: node, - SASSDOC_LANG: lang - } = process.env; - - if (!node || !lang) { - return; - } - - const pathConfig = path.join('extras', 'docs', 'themes', 'config.json'); - const config_file = JSON.parse(fs.readFileSync(pathConfig, 'utf8')); - const config = config_file[lang.trim()][node.trim()]; + const config = getConfigData(process.env); return config ? config.url : ''; }, + gaID: () => { + const config = getConfigData(process.env); + return config ? config.gaID : ''; + }, ifCond: (v1, operator, v2, options) => { switch (operator) { case '==': @@ -290,3 +283,18 @@ module.exports = function (dest, ctx) { */ return theme.apply(this, arguments); }; + +function getConfigData(envs) { + let { + NODE_ENV: env, + SASSDOC_LANG: lang + } = envs; + + if (!env || !lang) { + return; + } + + const pathConfig = path.join('extras', 'docs', 'themes', 'config.json'); + const data = JSON.parse(fs.readFileSync(pathConfig, 'utf8')); + return data[lang.trim()][env.trim()]; +} diff --git a/extras/docs/themes/sassdoc/views/index.hbs b/extras/docs/themes/sassdoc/views/index.hbs index 21be916ca6d..f80d22cc620 100644 --- a/extras/docs/themes/sassdoc/views/index.hbs +++ b/extras/docs/themes/sassdoc/views/index.hbs @@ -16,10 +16,29 @@ + + + + + + + + + {{> header}} + {{! ! You can access any variable you set in your configuration file from the `view` object. ! Basically your configuration file is passed to the view as the `view` object. diff --git a/extras/docs/themes/typedoc/src/assets/js/src/theme.ts b/extras/docs/themes/typedoc/src/assets/js/src/theme.ts index f4f0d54a6c2..9c8553bdaaa 100644 --- a/extras/docs/themes/typedoc/src/assets/js/src/theme.ts +++ b/extras/docs/themes/typedoc/src/assets/js/src/theme.ts @@ -11,10 +11,10 @@ export default class EnvironmentLinkSetup extends DefaultTheme { constructor(renderer: Renderer, basePath) { super(renderer, basePath); - Handlebars.registerHelper('envUrl', this.retrieveEnvUrl); + Handlebars.registerHelper('getConfigData', this.getConfigData); } - private retrieveEnvUrl() { + private getConfigData(prop) { const fileName = 'config.json'; let settings; let config; @@ -32,6 +32,6 @@ export default class EnvironmentLinkSetup extends DefaultTheme { data = config[settings.localize][process.env.NODE_ENV.trim()]; } - return data ? data.url : ''; + return data ? data[prop] : ''; } } diff --git a/extras/docs/themes/typedoc/src/layouts/default.hbs b/extras/docs/themes/typedoc/src/layouts/default.hbs index 9a346294fa8..9d999297cb7 100644 --- a/extras/docs/themes/typedoc/src/layouts/default.hbs +++ b/extras/docs/themes/typedoc/src/layouts/default.hbs @@ -17,8 +17,25 @@ + + + + - + + + + + {{> header}}