cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
100 lines (87 loc) • 3.05 kB
JavaScript
let currentClientDom = document.getElementById('currentClient');
let currentEnvDom = document.getElementById('env');
let tokenDom = document.getElementById('token');
const protocol = 'https://';
export const clientId = currentClientDom ? currentClientDom.value : __cluedIn.org;
const env = currentEnvDom ? currentEnvDom.value : (__cluedIn.env || 'production');
import providerUrl from './provider';
import jsCookie from 'js-cookie';
const urlConfig = {
local: {
auth: `${protocol}localhost:9001/`,
api: `${protocol}localhost:9000/`,
app: `http://${clientId}.cluedin.test:8080/`,
cdnUrl: 'https://s3-eu-west-1.amazonaws.com/cluedindev/',
mainDomain: '.cluedin.test:8080/',
mainCookieDomain: '.cluedin.test',
mainApp: 'http://app.cluedin.test:8080/',
},
development: {
auth: `${protocol}auth.cerebro.technology:1338/`,
api: `${protocol}api.cerebro.technology:1339/`,
app: `http://${clientId}.cluedin.test:3000/`,
cdnUrl: 'https://s3-eu-west-1.amazonaws.com/cluedindev/',
mainDomain: '.cluedin.test:3000/',
mainCookieDomain: '.cluedin.test',
mainApp: 'http://app.cluedin.test:3000/',
},
test: {
auth: `${protocol}auth.cerebro.technology:1338/`,
api: `${protocol}api.cerebro.technology:1339/`,
app: `${protocol}${clientId}.singlepageapp.be/`,
cdnUrl: 'https://s3.eu-central-1.amazonaws.com/cluedintest/',
mainDomain: '.singlepageapp.be/',
mainCookieDomain: '.singlepageapp.be',
mainApp: `${protocol}app.singlepageapp.be/`,
},
production: {
auth: `${protocol}auth.cluedin.net/`,
api: `${protocol}api.cluedin.net/`,
app: `${protocol}${clientId}.cluedin.net/`,
cdnUrl: 'https://s3-eu-west-1.amazonaws.com/staticcluedin/',
mainDomain: '.cluedin.net/',
mainCookieDomain: '.cluedin.net',
mainApp: `${protocol}app.cluedin.net/`,
},
};
export const url = urlConfig[env];
export const DOM = {
typeAttribute: 'cluedInType',
idAttribute: 'id',
};
export const image = require('./image')(url.cdnUrl);
export const location = require('./location')(protocol, url.mainDomain, clientId, env);
export const excludedProviders = require('./excludedProvider');
export const providers = providerUrl(url.cdnUrl);
export const setCurrentToken = (token) => {
__cluedIn.token = token;
};
export const getCurrentToken = () => {
return (tokenDom && tokenDom.value) ? tokenDom.value : __cluedIn.token;
};
export const storage = {
isSearchDone: () => (!!jsCookie.get('markAsSearched')),
isBoardingFinished: () => (!!jsCookie.get('isBoardingFinishedCached')),
isEntityPageVisited: () => (!!jsCookie.get('isEntityPageVisited')),
markSearchAsDone: () => {
jsCookie.set('markAsSearched', true);
},
markEntityPageVisister: () => {
jsCookie.set('isEntityPageVisited', true);
},
markBoadringFinished: () => {
jsCookie.set('isBoardingFinishedCached', true);
},
};
export default {
DOM,
image,
getCurrentToken,
setCurrentToken,
clientId,
location,
url,
excludedProviders,
providers,
storage,
};