{"version":3,"sources":["webpack:///./src/main/web/app/BrowserDetector.ts","webpack:///./src/main/web/app/page/Page.ts","webpack:///./src/main/web/components/admin/repositories/RepositoryConfigInitializer.tsx","webpack:///./src/main/web/app/page/PageToolbar.ts","webpack:///./src/main/web/app/page/ResourceViewer.ts","webpack:///./src/main/web/app/page/ResourceViewerDialog.tsx","webpack:///./src/main/web/app/app.ts"],"names":["nameOffset","verOffset","index","this","_userAgent","navigator","userAgent","_browserName","appName","_fullVersion","parseFloat","appVersion","_majorVersion","parseInt","indexOf","substring","lastIndexOf","toLowerCase","toUpperCase","isNaN","BrowserDetector","render","props","iri","getCurrentResource","params","getCurrentUrl","search","pageComponent","hasQuery","ComponentsLoader","factory","componentTagName","componentProps","createElement","BaseSemanticContextProvider","repository","getCurrentRepository","D","div","className","DefaultRepositoryInfo","isValidDefault","RepositoryConfigInitializer","Component","PageComponent","context","cancellation","Cancellation","state","componentDidMount","map","getRepositoryConfigTemplates","observe","value","repositoryTemplates","setState","error","loadingError","componentWillUnmount","cancelAll","Alert","bsStyle","styles","editorArea","Row","Col","sm","RepositoryConfigEditor","id","showRestartPrompt","reloadPageOnSuccess","initializerMode","preselectedTemplate","ButtonGroup","createFactory","ReactBootstrap","ButtonToolbar","currentIri","Action","canShowExploreActions","checkIfPageIsResource","flatMap","pageIsResource","hasExploreActionsPermissions","Kefir","constant","showExploreActions","SecurityService","Util","isPermitted","Permissions","pageToolbarExplore","SparqlClient","select","setBindings","PageEditorToolbarComponent","isResourceQuery","semanticContext","res","SparqlUtil","isSelectResultEmpty","renderIriCopyAction","CopyToClipboard","text","a","title","renderExploreActions","ResourceViewer","pageIri","isOpen","urlqueryparamShowStatements","hasEditPermission","$property","onValue","templateSave","answer","componentWillReceiveProps","showAssetsRepositoryIndicator","ResourceLink","resource","activeClassName","action","ResourceLinkAction","edit","i","span","Sparql","PageToolbar","openDialog","dialogRef","getOverlaySystem","show","ResourceViewerDialog","componentDidUpdate","prevProps","onClick","cloneElement","Children","only","children","OverlayDialog","type","onHide","hideAll","bsSize","PageLoader","component","initModuleRegistry","customElements","define","TemplateItemComponent","BASE_TITLE","document","AsyncSparqlEndpointComponent","getSessionTimeout","getSessionInfo","sessionObject","Cookies","set","timout","setupSessionTimeoutCheck","getUser","user","isAnonymous","_","isEqual","get","addNotification","message","level","autoDismiss","label","callback","window","location","href","sessionIntervalID","setInterval","checkSessionTimeout","bind","lastRequestTime","sessionTimeout","clearInterval","timeLeftMinutes","moment","diff","Date","now","timeLeftFormated","to","touchSession","headerHTML","maybe","Nothing","footerHTML","route","getRoute","last","segment","updatePageTitle","isSparqlEndpoint","getLabel","onError","e","console","TemplateService","getHeader","html","ModuleRegistry","parseHtmlToReact","then","components","Just","getFooter","addLastRequestTimeInterceptorToHttpRequests","registerNotificationSystem","registerOverlaySystem","listen","eventType","event","url","browserWarningShown","supportedBrowsers","ConfigHolder","getUIConfig","browserWarningMessage","unsupportedBrowserMessage","some","browserAndMinVersion","browserAndVersion","split","browserName","majorVersion","every","open","XMLHttpRequest","prototype","method","async","pass","addEventListener","call","renderNotificationSystem","renderOverlaySystem","key","isNothing","header","style","visibility","position","MainAppComponent","combine","init","prefixes","getRegisteredPrefixes","rawConfig","fetchConfig","repositories","initializeConfig","constantError","getElementById","NotEnoughPermissionsError","getNoPermissionsPage","page","innerHTML","color"],"mappings":"+HAmBA,iBAME,2BACE,IAAIA,EACAC,EACAC,EACJC,KAAKC,WAAaC,UAAUC,UAC5BH,KAAKI,aAAeF,UAAUG,QAC9BL,KAAKM,aAAe,GAAKC,WAAWL,UAAUM,YAC9CR,KAAKS,cAAgBC,SAASR,UAAUM,WAAY,KAGG,IAAlDV,EAAYE,KAAKC,WAAWU,QAAQ,WACvCX,KAAKI,aAAe,QACpBJ,KAAKM,aAAeN,KAAKC,WAAWW,UAAUd,EAAY,IACD,IAApDA,EAAYE,KAAKC,WAAWU,QAAQ,cACvCX,KAAKM,aAAeN,KAAKC,WAAWW,UAAUd,EAAY,MAIH,IAAjDA,EA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AWyJ,KAAKC,GAChB,EAAA9B,aAAamC,iBAAiBH,GAC9B,MAAOpD,GACP,OAAOvH,EAAM+K,cAAmBxD,GAElC,OAAOvH,EAAMC,SAASuI,MAEvB3G,SAAQ,WACP,EAAA7F,OAAO,EAAAa,cAAcyN,GAAmBlG,SAAS4G,eAAe,mBAEjE1D,SAAQ,SAACC,GACR,GAAIA,aAAapH,EAAgB8K,0BAC/BxD,EAAgByD,sBAAqB,SAACC,GAAS,OAAC/G,SAAS4G,eAAe,eAAeI,UAAYD,SAC9F,CACL,IAAM/F,EAAU,gDACbmC,EAAC,mEAGJ,EAAAvL,OAAOiB,EAAEC,IAAI,CAAEiN,MAAO,CAAEkB,MAAO,QAAWjG,GAAUhB,SAAS4G,eAAe","file":"default~app-accf4239acb199ef902c.js","sourcesContent":["/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nclass BrowserDetector {\n private _userAgent: string;\n private _browserName: string;\n private _fullVersion: string;\n private _majorVersion: number;\n\n constructor() {\n let nameOffset: number;\n let verOffset: number;\n let index: number;\n this._userAgent = navigator.userAgent;\n this._browserName = navigator.appName;\n this._fullVersion = '' + parseFloat(navigator.appVersion);\n this._majorVersion = parseInt(navigator.appVersion, 10);\n\n // In Opera, the true version is after \"Opera\" or after \"Version\"\n if ((verOffset = this._userAgent.indexOf('Opera')) != -1) {\n this._browserName = 'Opera';\n this._fullVersion = this._userAgent.substring(verOffset + 6);\n if ((verOffset = this._userAgent.indexOf('Version')) != -1) {\n this._fullVersion = this._userAgent.substring(verOffset + 8);\n }\n }\n // In MSIE, the true version is after \"MSIE\" in userAgent\n else if ((verOffset = this._userAgent.indexOf('MSIE')) != -1) {\n this._browserName = 'Microsoft Internet Explorer';\n this._fullVersion = this._userAgent.substring(verOffset + 5);\n }\n // In Chrome, the true version is after \"Chrome\"\n else if ((verOffset = this._userAgent.indexOf('Chrome')) != -1) {\n this._browserName = 'Chrome';\n this._fullVersion = this._userAgent.substring(verOffset + 7);\n }\n // In Safari, the true version is after \"Safari\" or after \"Version\"\n else if ((verOffset = this._userAgent.indexOf('Safari')) != -1) {\n this._browserName = 'Safari';\n this._fullVersion = this._userAgent.substring(verOffset + 7);\n if ((verOffset = this._userAgent.indexOf('Version')) != -1) {\n this._fullVersion = this._userAgent.substring(verOffset + 8);\n }\n }\n // In Firefox, the true version is after \"Firefox\"\n else if ((verOffset = this._userAgent.indexOf('Firefox')) != -1) {\n this._browserName = 'Firefox';\n this._fullVersion = this._userAgent.substring(verOffset + 8);\n }\n // In most other browsers, \"name/version\" is at the end of userAgent\n else if ((nameOffset = this._userAgent.lastIndexOf(' ') + 1) < (verOffset = this._userAgent.lastIndexOf('/'))) {\n this._browserName = this._userAgent.substring(nameOffset, verOffset);\n this._fullVersion = this._userAgent.substring(verOffset + 1);\n if (this._browserName.toLowerCase() == this._browserName.toUpperCase()) {\n this._browserName = navigator.appName;\n }\n }\n // trim the this._fullVersion string at semicolon/space if present\n if ((index = this._fullVersion.indexOf(';')) != -1) {\n this._fullVersion = this._fullVersion.substring(0, index);\n }\n if ((index = this._fullVersion.indexOf(' ')) != -1) {\n this._fullVersion = this._fullVersion.substring(0, index);\n }\n\n this._majorVersion = parseInt('' + this._fullVersion, 10);\n if (isNaN(this._majorVersion)) {\n this._fullVersion = '' + parseFloat(navigator.appVersion);\n this._majorVersion = parseInt(navigator.appVersion, 10);\n }\n }\n\n /**\n * @returns browser user agent\n */\n get userAgent(): string {\n return this._userAgent;\n }\n\n /**\n * @returns browser name string\n */\n get browserName(): string {\n return this._browserName;\n }\n\n /**\n * @returns browser version string\n */\n get fullVersion(): string {\n return this._fullVersion;\n }\n\n /**\n * @returns browser major version number\n */\n get majorVersion(): number {\n return this._majorVersion;\n }\n}\n\nexport default new BrowserDetector();\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nimport { Component, createElement } from 'react';\nimport * as D from 'react-dom-factories';\n\nimport { getCurrentResource, getCurrentUrl, getCurrentRepository } from 'platform/api/navigation';\nimport { BaseSemanticContextProvider } from 'platform/api/components';\nimport { ComponentsLoader } from 'platform/api/module-loader';\nimport { RepositoryConfigInitializer } from 'platform/components/admin/repositories/RepositoryConfigInitializer';\nimport { DefaultRepositoryInfo } from 'platform/api/services/repository';\n\nimport PageToolbar from './PageToolbar';\nimport PageViewer from './PageViewer';\n\nexport class PageComponent extends Component<{}, {}> {\n public render() {\n const props = { iri: getCurrentResource(), params: getCurrentUrl().search(true) };\n const pageComponent = getCurrentUrl().hasQuery('action', 'edit')\n ? ComponentsLoader.factory({\n componentTagName: 'mp-internal-page-editor',\n componentProps: props,\n })\n : PageViewer(props);\n\n return createElement(\n BaseSemanticContextProvider,\n { repository: getCurrentRepository() },\n D.div(\n { className: 'page-holder' },\n PageToolbar(props),\n DefaultRepositoryInfo.isValidDefault() ? pageComponent : createElement(RepositoryConfigInitializer)\n )\n );\n }\n}\n\nexport default PageComponent;\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\nimport * as React from 'react';\nimport { Alert, Row, Col } from 'react-bootstrap';\nimport { Cancellation } from 'platform/api/async';\nimport { Component } from 'platform/api/components';\n\nimport { getRepositoryConfigTemplates } from 'platform/api/services/repository';\nimport { RepositoryConfigEditor } from './RepositoryConfigEditor';\n\nimport * as styles from './RepositoryConfigInitializer.scss';\n\ninterface State {\n readonly loadingError?: any;\n readonly repositoryTemplates?: string[];\n}\n\nexport class RepositoryConfigInitializer extends Component<{}, State> {\n private readonly cancellation = new Cancellation();\n\n constructor(props: {}, context: any) {\n super(props, context);\n this.state = {};\n }\n\n componentDidMount() {\n this.cancellation.map(getRepositoryConfigTemplates()).observe({\n value: (repositoryTemplates) =>\n this.setState({\n repositoryTemplates,\n }),\n error: (loadingError) => this.setState({ loadingError }),\n });\n }\n\n componentWillUnmount() {\n this.cancellation.cancelAll();\n }\n\n render() {\n const { loadingError, repositoryTemplates } = this.state;\n\n if (loadingError) {\n return {loadingError} ;\n }\n return (\n
\n
\n

Please configure the default repository

\n

\n There is no configuration for the default repository in the system. Please set the configuration of the\n repository you would like to use as the system default, then validate the connection and confirm with Update\n Config. The configuration has to be expressed in the RDF Turtle format. You can select a template for some\n of the commonly used repository types.\n

\n \n \n neptune\n

For use with Amazon Neptune.

\n \n \n stardog\n

For use with a Stardog repository

\n \n \n sparql\n

\n Use with any SPARQL 1.1 compliant database endpoint where authentication is not required, e.g.\n Blazegraph, RDF4J\n

\n \n \n sparql-basic\n

Same as \"sparql\", but includes basic authentication. Can be used for GraphDB amongst others.

\n \n
\n \n In the template, please replace all placeholders marked with {'{'}% and %{'} '}\n with your actual values.\n \n {\n \n }\n
\n
\n );\n }\n}\n\nexport default RepositoryConfigInitializer;\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nimport { createFactory, createElement } from 'react';\nimport * as D from 'react-dom-factories';\nimport * as ReactBootstrap from 'react-bootstrap';\nimport * as CopyToClipboard from 'react-copy-to-clipboard';\nimport * as Kefir from 'kefir';\n\nimport { Component } from 'platform/api/components';\nimport { ResourceLink, ResourceLinkAction } from 'platform/api/navigation/components';\nimport { Rdf } from 'platform/api/rdf';\nimport * as SecurityService from 'platform/api/services/security';\nimport { SparqlClient, SparqlUtil } from 'platform/api/sparql';\nimport { Cancellation } from 'platform/api/async';\nimport { Action } from 'platform/components/utils';\nimport { ResourceViewer } from './ResourceViewer';\n\nconst ButtonGroup = createFactory(ReactBootstrap.ButtonGroup);\nconst ButtonToolbar = createFactory(ReactBootstrap.ButtonToolbar);\n\ninterface PageEditorToolbarProps {\n iri: Rdf.Iri;\n params?: { [index: string]: string };\n}\n\ninterface PageEditorToolbarState {\n hasEditPermission: boolean;\n showExploreActions: boolean;\n pageIsResource: boolean;\n}\n\nclass PageEditorToolbarComponent extends Component {\n private readonly cancellation = new Cancellation();\n private readonly currentIri = Action();\n\n constructor(props: PageEditorToolbarProps, context) {\n super(props, context);\n this.state = {\n hasEditPermission: false,\n showExploreActions: false,\n pageIsResource: false,\n };\n\n this.cancellation\n .map(this.currentIri.$property.flatMap(this.canShowExploreActions))\n .onValue((state) => this.setState(state));\n }\n\n /**\n * Query that checks if there are any incoming/outgoing properties for the current resource.\n */\n private static isResourceQuery = SparqlUtil.Sparql`\n SELECT * WHERE {\n { ?iri ?p ?o } UNION { ?s ?p ?iri }\n } LIMIT 1\n `;\n\n public componentDidMount() {\n // Check edit permissions during the first load\n SecurityService.Util.isPermitted(\n SecurityService.Permissions.templateSave + ':<' + this.props.iri.value + '>'\n ).onValue((answer) => this.setState({ hasEditPermission: answer }));\n this.currentIri(this.props.iri);\n }\n\n public componentWillReceiveProps(props: PageEditorToolbarProps) {\n // Check edit permissions when re-redering the page with a new IRI (e.g, on following a semantic link)\n if (this.props.iri.value !== props.iri.value) {\n SecurityService.Util.isPermitted(\n SecurityService.Permissions.templateSave + ':<' + props.iri.value + '>'\n ).onValue((answer) => this.setState({ hasEditPermission: answer }));\n }\n this.currentIri(props.iri);\n }\n\n public componentWillUnmount() {\n this.cancellation.cancelAll();\n }\n\n /**\n * Show explore actions only if user has sufficient permissions and page actually corresponds to\n * some RDF resource.\n */\n private canShowExploreActions = (iri: Rdf.Iri) =>\n this.checkIfPageIsResource(iri).flatMap((pageIsResource) => {\n const showExploreActionsProp = pageIsResource ? this.hasExploreActionsPermissions() : Kefir.constant(false);\n return showExploreActionsProp.map((showExploreActions) => ({ pageIsResource, showExploreActions }));\n });\n\n private hasExploreActionsPermissions = (): Kefir.Property =>\n SecurityService.Util.isPermitted(SecurityService.Permissions.pageToolbarExplore);\n\n private checkIfPageIsResource = (iri: Rdf.Iri): Kefir.Property =>\n SparqlClient.select(SparqlClient.setBindings(PageEditorToolbarComponent.isResourceQuery, { iri }), {\n context: this.context.semanticContext,\n }).map((res) => !SparqlUtil.isSelectResultEmpty(res));\n\n public render() {\n return ButtonToolbar(\n { className: 'component-page-toolbar hidden-print' },\n ButtonGroup(\n {},\n this.showAssetsRepositoryIndicator(),\n this.state.hasEditPermission\n ? createElement(\n ResourceLink,\n {\n resource: this.props.iri,\n className: 'btn btn-default component-page-toolbar__btn_edit',\n activeClassName: 'active',\n title: 'Edit Page',\n action: ResourceLinkAction.edit,\n },\n D.div({}, \n D.i({className:'fa fa-pencil'}),\n D.span({}, ' Edit Page')\n )\n )\n : null,\n ...(this.state.showExploreActions ? this.renderExploreActions() : [null]),\n this.state.pageIsResource ? this.renderIriCopyAction() : null\n )\n );\n }\n\n private renderIriCopyAction = () =>\n createElement(\n CopyToClipboard,\n {\n text: this.props.iri.value,\n },\n D.a({\n className: 'btn btn-default component-page-toolbar__btn_copy_iri',\n title: 'Copy IRI',\n })\n );\n\n private renderExploreActions = () => [\n createElement(\n ResourceViewer,\n {\n pageIri: 'http://www.researchspace.org/resource/system/SourceStatements',\n title: 'Statements',\n isOpen: this.props.params['showStatements'] === 'true',\n params: { urlqueryparamShowStatements: 'true' },\n },\n D.a({\n className: 'btn btn-default component-page-toolbar__btn_show_source',\n title: 'Show Statements',\n })\n ),\n createElement(\n ResourceViewer,\n {\n pageIri: 'http://www.researchspace.org/resource/system/SourceGraph',\n title: 'Graph',\n },\n D.a({\n className: 'btn btn-default component-page-toolbar__btn_show_graph',\n title: 'Show Graph',\n })\n ),\n createElement(\n ResourceViewer,\n {\n pageIri: 'http://www.researchspace.org/resource/system/SourceDiagram',\n title: 'Diagram',\n },\n D.a({\n className: 'btn btn-default component-page-toolbar__btn_show_diagram',\n title: 'Show Diagram',\n })\n ),\n ];\n\n /**\n * Show assets repository indicator only to users with edit permission.\n */\n private showAssetsRepositoryIndicator() {\n const repository = this.context.semanticContext.repository;\n if (repository === 'assets' && this.state.hasEditPermission) {\n return D.div({ className: 'badge alert-info component-page-toolbar__repository_indicator' }, 'assets repository');\n } else {\n return null;\n }\n }\n}\n\nexport const PageToolbar = createFactory(PageEditorToolbarComponent);\nexport default PageToolbar;\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nimport { Component, createElement, cloneElement, Children } from 'react';\n\nimport { getOverlaySystem } from 'platform/components/ui/overlay';\nimport { ResourceViewerDialog } from './ResourceViewerDialog';\n\nexport interface ResourceViewerProps {\n pageIri: string;\n title: string;\n isOpen?: boolean;\n params?: { [index: string]: string };\n}\n\nexport class ResourceViewer extends Component {\n componentDidMount() {\n if (this.props.isOpen) {\n this.openDialog();\n }\n }\n\n componentDidUpdate(prevProps: ResourceViewerProps) {\n if (this.props.isOpen) {\n this.openDialog();\n }\n }\n\n public render() {\n const props = {\n onClick: this.openDialog,\n };\n return cloneElement(Children.only(this.props.children), props);\n }\n\n private openDialog = () => {\n const dialogRef = `show-source-statements-${this.props.title}`;\n getOverlaySystem().show(dialogRef, createElement(ResourceViewerDialog, this.props));\n };\n}\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\nimport * as React from 'react';\nimport { Component } from 'react';\nimport { getOverlaySystem, OverlayDialog } from 'platform/components/ui/overlay';\nimport * as PageLoader from 'platform/components/ui/page-loader';\n\nexport interface Props {\n pageIri: string;\n title: string;\n params?: { [index: string]: string };\n}\n\nexport class ResourceViewerDialog extends Component {\n render() {\n return (\n {\n getOverlaySystem().hideAll();\n }}\n title={this.props.title}\n show={true}\n className=\"resource-viewer-modal\"\n bsSize=\"lg\"\n >\n \n \n );\n }\n}\n","/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nimport '../styling/main.scss';\n\nimport { initModuleRegistry } from './bootstrap';\ninitModuleRegistry();\n\nimport { ModuleRegistry, ComponentsLoader } from 'platform/api/module-loader';\nimport BrowserDetector from './BrowserDetector';\n\nimport { Component, ReactNode, createElement, SFC, ComponentClass, cloneElement, ReactElement } from 'react';\nimport * as D from 'react-dom-factories';\nimport { render } from 'react-dom';\nimport * as moment from 'moment';\nimport * as _ from 'lodash';\nimport * as Kefir from 'kefir';\nimport * as maybe from 'data.maybe';\n\nimport { SparqlUtil } from 'platform/api/sparql';\nimport {\n renderNotificationSystem,\n registerNotificationSystem,\n addNotification,\n} from 'platform/components/ui/notification';\nimport { renderOverlaySystem, registerOverlaySystem, getOverlaySystem } from 'platform/components/ui/overlay';\nimport { listen, init as initNavigation, getCurrentUrl, getCurrentResource } from 'platform/api/navigation';\nimport { ConfigHolder } from 'platform/api/services/config-holder';\nimport { getRegisteredPrefixes } from 'platform/api/services/namespace';\nimport * as TemplateService from 'platform/api/services/template';\nimport * as SecurityService from 'platform/api/services/security';\nimport { getLabel } from 'platform/api/services/resource-label';\n\nimport { DefaultRepositoryInfo } from 'platform/api/services/repository';\n\nimport PageComponent from './page/Page';\n\nimport { TemplateItemComponent } from 'platform/components/ui/template';\ncustomElements.define('mp-template-item', TemplateItemComponent);\n\nimport * as Cookies from 'js-cookie';\nconst WINDOW_SESSION_TIMEOUT = 'sessionTimeout';\nconst WINDOW_LAST_REQUEST_TIME = 'lastRequestTime';\nconst WINDOW_ANONYMOUS_WARNING = 'anonymousWarning';\nconst BROWSER_WARNING = 'browserWarning';\n\n/**\n * Document title that is initially set in the HTML head. It is used as a base title for all pages.\n */\nconst BASE_TITLE = document.title;\n\nconst AsyncSparqlEndpointComponent = (props) =>\n ComponentsLoader.factory({\n componentTagName: 'mp-internal-sparql-endpoint',\n componentProps: props,\n });\n\nexport class MainAppComponent extends Component<\n {},\n {\n headerHTML?: Data.Maybe;\n footerHTML?: Data.Maybe;\n route?: ComponentClass | SFC;\n }\n> {\n private sessionIntervalID: number;\n\n constructor(props: {}, context: any) {\n super(props, context);\n this.state = {\n headerHTML: maybe.Nothing(),\n footerHTML: maybe.Nothing(),\n route: this.getRoute(getCurrentUrl()),\n };\n }\n\n private getRoute(location: uri.URI): ComponentClass | SFC {\n if (_.last(location.segment()) === 'sparql') {\n this.updatePageTitle(true);\n return AsyncSparqlEndpointComponent;\n } else {\n this.updatePageTitle(false);\n return PageComponent;\n }\n }\n\n /**\n * Set HTML header title based on the title of the current resource.\n */\n private updatePageTitle(isSparqlEndpoint: boolean) {\n if (isSparqlEndpoint) {\n document.title = `SPARQL Endpoint [${BASE_TITLE}]`;\n } else {\n try {\n getLabel(getCurrentResource())\n .onValue((label) => (document.title = `${label} [${BASE_TITLE}]`))\n .onError((e) => {\n document.title = BASE_TITLE;\n console.error(e);\n });\n } catch (e) {\n console.error(e);\n document.title = BASE_TITLE;\n }\n }\n }\n\n public componentDidMount() {\n // get sessionTimeout from backend\n this.getSessionTimeout();\n\n // get header template\n TemplateService.getHeader((html) =>\n ModuleRegistry.parseHtmlToReact(html).then((components) =>\n this.setState({\n headerHTML: maybe.Just(components),\n })\n )\n );\n // get footer template\n TemplateService.getFooter((html) =>\n ModuleRegistry.parseHtmlToReact(html).then((components) =>\n this.setState({\n footerHTML: maybe.Just(components),\n })\n )\n );\n\n this.addLastRequestTimeInterceptorToHttpRequests();\n registerNotificationSystem(this);\n registerOverlaySystem(this);\n\n // check all 10 seconds whether session is about to expire\n this.setupSessionTimeoutCheck();\n\n listen({\n eventType: 'NAVIGATED',\n callback: (event) => {\n this.setState({ route: this.getRoute(event.url) });\n },\n });\n\n const browserWarningShown = Cookies.get(BROWSER_WARNING);\n const supportedBrowsers = ConfigHolder.getUIConfig().supportedBrowsers;\n const browserWarningMessage = ConfigHolder.getUIConfig().unsupportedBrowserMessage;\n let showBrowserWarning = false;\n\n if (!browserWarningShown && supportedBrowsers && browserWarningMessage) {\n showBrowserWarning =\n supportedBrowsers.some((browserAndMinVersion) => {\n const browserAndVersion = browserAndMinVersion.split(/-\\s*([^-]+)$/);\n if (\n BrowserDetector.browserName === browserAndVersion[0] &&\n BrowserDetector.majorVersion < parseInt(browserAndVersion[1], 10)\n ) {\n return true;\n }\n }) ||\n supportedBrowsers.every((browserAndMinVersion) => {\n const browserAndVersion = browserAndMinVersion.split(/-\\s*([^-]+)$/);\n if (BrowserDetector.browserName !== browserAndVersion[0]) {\n return true;\n }\n });\n\n if (showBrowserWarning) {\n addNotification({\n title: 'Browser not supported',\n autoDismiss: 0,\n message: browserWarningMessage,\n level: 'error',\n });\n Cookies.set(BROWSER_WARNING, true);\n }\n }\n }\n\n /**\n * Adds interceptor to all AJAX requests to track the\n * lastRequest time in Cookies.get(WINDOW_LAST_REQUEST_TIME) variable\n * http://stackoverflow.com/questions/25335648/how-to-intercept-all-ajax-requests-made-by-different-js-libraries\n */\n addLastRequestTimeInterceptorToHttpRequests(): void {\n (function (open) {\n XMLHttpRequest.prototype.open = function (method: any, url: any, async?: any, user?: any, pass?: any) {\n this.addEventListener(\n 'readystatechange',\n function () {\n Cookies.set(WINDOW_LAST_REQUEST_TIME, Date.now());\n },\n false\n );\n open.call(this, method, url, async, user, pass);\n };\n })(XMLHttpRequest.prototype.open);\n }\n\n private getSessionTimeout = (): void => {\n SecurityService.Util.getSessionInfo((sessionObject: SecurityService.SessionInfoI) => {\n Cookies.set(WINDOW_SESSION_TIMEOUT, sessionObject.timout);\n });\n };\n\n private setupSessionTimeoutCheck = (): void => {\n SecurityService.Util.getUser((user: SecurityService.UserI) => {\n if (user.isAnonymous && !_.isEqual(Cookies.get(WINDOW_ANONYMOUS_WARNING), Cookies.get('JSESSIONID'))) {\n addNotification({\n message: 'Your are authenticated as anonymous \"guest\" user only',\n level: 'warning',\n autoDismiss: 2,\n action: {\n label: 'Login',\n callback: () => (window.location.href = '/login'),\n },\n });\n Cookies.set(WINDOW_ANONYMOUS_WARNING, Cookies.get('JSESSIONID'));\n } else if (!user.isAnonymous) {\n // check session timeout every minute\n this.sessionIntervalID = window.setInterval(this.checkSessionTimeout.bind(this), 60000);\n }\n });\n };\n\n /**\n * Checks whether the session is likely about to expire within the next 5minutes\n * and pushes a warning to the notificationSystem. Uses the cached last request\n * time and the session timeout from backend.\n *\n */\n private checkSessionTimeout = (): void => {\n const lastRequestTime = parseInt(Cookies.get(WINDOW_LAST_REQUEST_TIME));\n const sessionTimeout = parseInt(Cookies.get(WINDOW_SESSION_TIMEOUT));\n\n if (_.isNaN(sessionTimeout) && _.isNaN(lastRequestTime)) {\n return;\n } else if (sessionTimeout < 0) {\n window.clearInterval(this.sessionIntervalID);\n return;\n }\n\n const timeLeftMinutes = moment(sessionTimeout).diff(moment(Date.now() - lastRequestTime), 'minutes');\n if (timeLeftMinutes > 10) {\n return;\n }\n\n const timeLeftFormated = moment(Date.now() - lastRequestTime).to(sessionTimeout);\n\n if (timeLeftMinutes < 0) {\n addNotification({\n title: 'Session Info',\n autoDismiss: 0,\n message: 'Your session is expired.',\n level: 'error',\n action: {\n label: 'Login',\n callback: () => (window.location.href = '/login'),\n },\n });\n window.clearInterval(this.sessionIntervalID);\n }\n\n addNotification({\n title: 'Session Info',\n autoDismiss: 57,\n message: 'Your session is about to expire ' + timeLeftFormated,\n level: 'warning',\n action: {\n label: 'Extend Session',\n callback: () => SecurityService.Util.touchSession(() => {}), // some succes notificaiton to be shown here ?\n },\n });\n };\n\n public render() {\n return D.div(\n {},\n ...this.getHeader(),\n renderNotificationSystem(),\n renderOverlaySystem(),\n // we need to assign key to route component here because the component is created\n // when header is loading, in the beginning it is one null element. But after loading\n // we have two header elements, because number of elements changes react can't properly\n // unify components and fully recreate route component.\n createElement(this.state.route, { key: 'page-holder' }),\n this.state.footerHTML.isNothing ? null : this.state.footerHTML.get()\n );\n }\n\n private getHeader() {\n if (this.state.headerHTML.isNothing) {\n return [null];\n } else {\n const header = this.state.headerHTML.get() as ReactElement;\n // to make sure that page layout can adapt to header of any height we duplicate the header's\n // dom element and re-insert it as a hidden element with relative position.\n const hiddenHeader = cloneElement(header, {\n style: { visibility: 'hidden', position: 'relative' },\n key: 'hidden-header',\n });\n return [header, hiddenHeader];\n }\n }\n}\n\nlisten({\n eventType: 'NAVIGATED',\n callback: (event) => {\n if (getOverlaySystem()) {\n getOverlaySystem().hideAll();\n }\n },\n});\n\nwindow.addEventListener('DOMContentLoaded', function () {\n Kefir.combine({\n url: initNavigation(),\n prefixes: getRegisteredPrefixes(),\n rawConfig: ConfigHolder.fetchConfig(),\n repositories: DefaultRepositoryInfo.init(),\n })\n .flatMap(({ url, prefixes, rawConfig }) => {\n try {\n SparqlUtil.init(prefixes);\n ConfigHolder.initializeConfig(rawConfig);\n } catch (e) {\n return Kefir.constantError(e);\n }\n return Kefir.constant(url);\n })\n .onValue(() => {\n render(createElement(MainAppComponent), document.getElementById('application'));\n })\n .onError((e) => {\n if (e instanceof SecurityService.NotEnoughPermissionsError) {\n TemplateService.getNoPermissionsPage((page) => (document.getElementById('application').innerHTML = page));\n } else {\n const message = `Platform initialization failed: \\n\n ${e} \\n\n Please contact the system administrator.\n `;\n render(D.div({ style: { color: 'red' } }, message), document.getElementById('application'));\n }\n });\n});\n"],"sourceRoot":""}