diff --git a/package-lock.json b/package-lock.json index 44a1fbb1..41a352bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1419,33 +1419,33 @@ "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" }, "@formatjs/intl-listformat": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-1.4.4.tgz", - "integrity": "sha512-b9DFftQDQEE4fVHX8WFCIXLWdlt98XPyXoyNt9wTSOhUZBJUmu97w9y8fRZnPry6pES/D9yGLJeD4/XDjG0tbw==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@formatjs/intl-listformat/-/intl-listformat-1.4.5.tgz", + "integrity": "sha512-UHZdNuFZxZYhNsUIl31g0zuhRt4mD/j18HlY1t/w6nwe3p5qLySi4ZmxHplGdZMl54ap6Z4+XGEgnxxwqQ4R1g==", "requires": { - "@formatjs/intl-utils": "^2.2.2" + "@formatjs/intl-utils": "^2.2.3" } }, "@formatjs/intl-relativetimeformat": { - "version": "4.5.12", - "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-4.5.12.tgz", - "integrity": "sha512-Fh57ZnwOgAIA61i3BQhTb8C8OrCP1zDLQ35xzJ7yv/UiDDExAS8rQPf80+7Hu/8+kydL1DDgVY1PXvE63fxF+Q==", + "version": "4.5.13", + "resolved": "https://registry.npmjs.org/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-4.5.13.tgz", + "integrity": "sha512-DocBGUaxOydgs0PuN2YGX0zw4ibYqZXLpHn9jnIpn4Gi4YopEEf+6Xf0DGMfaRvjnPe1QztagoaIOtyLvG47fw==", "requires": { - "@formatjs/intl-utils": "^2.2.2" + "@formatjs/intl-utils": "^2.2.3" } }, "@formatjs/intl-unified-numberformat": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-3.3.3.tgz", - "integrity": "sha512-dic7DA8REMy8gkidkCSoWqTjaLIlCyLJ5fDtlgHzK/ftwxAlbSSHkbeozZ/IKQDPbbcSppI/t9hp9KT+co/Ksg==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-3.3.4.tgz", + "integrity": "sha512-RhgGUOiMvpCOMc0EqM28JgyfFyAKsw1EfnrDAdqMKAZhbUcRj73iQwdusKXoOp++3DAEg9L2TUUes9QcAv5Ypw==", "requires": { - "@formatjs/intl-utils": "^2.2.2" + "@formatjs/intl-utils": "^2.2.3" } }, "@formatjs/intl-utils": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.2.2.tgz", - "integrity": "sha512-rKINaMRYH3FeNwYjEQwPtsA0kP2/hLLMB9mLi/QYfszz/huTqkInFmYilFRCX4oLlhFXDK5UQQMGNfEavN02Sg==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.2.3.tgz", + "integrity": "sha512-CeswyzLq2A3uu7dFptBTn1j815B/stndfHMr+ZPj0QxaN/Q9zLRTQxMYskRW07uPp+a7XobLFqEJHLrMu/tZEw==" }, "@formatjs/macro": { "version": "0.2.7", @@ -1689,15 +1689,15 @@ } }, "@octokit/types": { - "version": "2.11.1", - "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.11.1.tgz", - "integrity": "sha512-QaLoLkmFdfoNbk3eOzPv7vKrUY0nRJIYmZDoz/pTer4ICpqu80aSQTVHnnUxEFuURCiidig76CcxUOYC/bY3RQ==", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-2.12.1.tgz", + "integrity": "sha512-LRLR1tjbcCfAmUElvTmMvLEzstpx6Xt/aQVTg2xvd+kHA2Ekp1eWl5t+gU7bcwjXHYEAzh4hH4WH+kS3vh+wRw==", "requires": { "@types/node": ">= 8" } }, "@plone/volto": { - "version": "github:eea/volto#fdae0bf5938d21a06ef7f04960f23802f54aebef", + "version": "github:eea/volto#463b1c1c13a03090921ff16b61391e5e0a0e5108", "from": "github:eea/volto#kitchen_sink", "requires": { "@babel/core": "7.7.4", @@ -2708,9 +2708,9 @@ } }, "@types/invariant": { - "version": "2.2.31", - "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.31.tgz", - "integrity": "sha512-jMlgg9pIURvy9jgBHCjQp/CyBjYHUwj91etVcDdXkFl2CwTFiQlB+8tcsMeXpXf2PFE5X2pjk4Gm43hQSMHAdA==" + "version": "2.2.32", + "resolved": "https://registry.npmjs.org/@types/invariant/-/invariant-2.2.32.tgz", + "integrity": "sha512-WjY4WVFaehHv+TOgm+dS3UI559NvsPGFz/C0nIo7KOOdC+HeC7Y3/yLzdJYQ3+oFQaTXrOVm7cNtIgMataIDVg==" }, "@types/istanbul-lib-coverage": { "version": "2.0.1", @@ -2746,9 +2746,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "13.13.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.0.tgz", - "integrity": "sha512-WE4IOAC6r/yBZss1oQGM5zs2D7RuKR6Q+w+X2SouPofnWn+LbCqClRyhO3ZE7Ix8nmFgo/oVuuE01cJT2XB13A==" + "version": "13.13.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.2.tgz", + "integrity": "sha512-LB2R1Oyhpg8gu4SON/mfforE525+Hi/M1ineICEDftqNVTyFg1aRIeGuTvXAoWHc4nbrFncWtJgMmoyRvuGh7A==" }, "@types/parse-json": { "version": "4.0.0", @@ -9757,7 +9757,7 @@ "bundled": true, "optional": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -9868,7 +9868,7 @@ "bundled": true, "optional": true, "requires": { - "minimatch": "3.0.4" + "minimatch": "^3.0.4" } }, "inflight": { @@ -9908,7 +9908,7 @@ "bundled": true, "optional": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -9938,7 +9938,7 @@ "bundled": true, "optional": true, "requires": { - "minimist": "1.2.5" + "minimist": "^1.2.5" } }, "ms": { @@ -11824,14 +11824,14 @@ "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==" }, "intl-format-cache": { - "version": "4.2.24", - "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.2.24.tgz", - "integrity": "sha512-eea8rHu7ipmUilSd9+MCglgR07E+xJXmTYVFODmeLKsO3Psr/OrixDr6vWprz1whli7cwRdSc1/jHVBxrd+QBw==" + "version": "4.2.25", + "resolved": "https://registry.npmjs.org/intl-format-cache/-/intl-format-cache-4.2.25.tgz", + "integrity": "sha512-ZwHX7n/Inusc8j/8+Ng6Ik4xHmDkSxOk/kT0KOnEqxpIQQ/2o9TV5aUeorf+RbYA84yLawOcBy4SRZAHSTNTAA==" }, "intl-locales-supported": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/intl-locales-supported/-/intl-locales-supported-1.8.5.tgz", - "integrity": "sha512-0rfI2lxC5ZTi75WW/Zbvb/0f+mSggw3G4AYqhIyIGDXMZWRIyUN2a0ELWmaKxNvW46+3ybV5BhAvGSO7rI/SiQ==" + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/intl-locales-supported/-/intl-locales-supported-1.8.6.tgz", + "integrity": "sha512-AeZ01biOzPLt8Tg80rRYWNnt5su/nts4iro3fzL9J6jiG1BCjqW8gHrsBUuhAs/wsyjNFGzcpNLg4To7SqDVfg==" }, "intl-messageformat": { "version": "7.8.4", @@ -12990,9 +12990,9 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { - "version": "0.5.17", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.17.tgz", - "integrity": "sha512-bwdKOBZ5L0gFRh4KOxNap/J/MpvX9Yxsq9lFDx65s3o7F/NiHy7JRaGIS8MwW6tZPAq9UXE207Il0cfcb5yu/Q==", + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.18.tgz", + "integrity": "sha512-9luZr/BZ2QeU6tO2uG8N2aZpVSli4TSAOAqFOyTO51AJcD9P99c0K1h6dD6r6qo5dyT44BR5exweOaLLeldTkQ==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -15938,9 +15938,9 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" }, "node-abi": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.15.0.tgz", - "integrity": "sha512-FeLpTS0F39U7hHZU1srAK4Vx+5AHNVOTP+hxBNQknR/54laTHSFIJkDWDqiquY1LeLUgTfPN7sLPhMubx0PLAg==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.16.0.tgz", + "integrity": "sha512-+sa0XNlWDA6T+bDLmkCUYn6W5k5W6BPRL6mqzSCs6H/xUgtl4D5x2fORKDzopKiU6wsyn/+wXlRXwXeSp+mtoA==", "requires": { "semver": "^5.4.1" } @@ -21096,9 +21096,9 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { - "version": "0.5.17", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.17.tgz", - "integrity": "sha512-bwdKOBZ5L0gFRh4KOxNap/J/MpvX9Yxsq9lFDx65s3o7F/NiHy7JRaGIS8MwW6tZPAq9UXE207Il0cfcb5yu/Q==", + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.18.tgz", + "integrity": "sha512-9luZr/BZ2QeU6tO2uG8N2aZpVSli4TSAOAqFOyTO51AJcD9P99c0K1h6dD6r6qo5dyT44BR5exweOaLLeldTkQ==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -29720,9 +29720,9 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { - "version": "0.5.17", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.17.tgz", - "integrity": "sha512-bwdKOBZ5L0gFRh4KOxNap/J/MpvX9Yxsq9lFDx65s3o7F/NiHy7JRaGIS8MwW6tZPAq9UXE207Il0cfcb5yu/Q==", + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.18.tgz", + "integrity": "sha512-9luZr/BZ2QeU6tO2uG8N2aZpVSli4TSAOAqFOyTO51AJcD9P99c0K1h6dD6r6qo5dyT44BR5exweOaLLeldTkQ==", "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" diff --git a/src/customizations/volto/components/theme/App/App.jsx b/src/customizations/volto/components/theme/App/App.jsx new file mode 100644 index 00000000..e9243f88 --- /dev/null +++ b/src/customizations/volto/components/theme/App/App.jsx @@ -0,0 +1,223 @@ +/** + * App container. + * @module components/theme/App/App + */ + +import React, { Component, Fragment } from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; +import { compose } from 'redux'; +import { asyncConnect } from 'redux-connect'; +import { Segment } from 'semantic-ui-react'; +import { renderRoutes } from 'react-router-config'; +import { Slide, ToastContainer, toast } from 'react-toastify'; +import split from 'lodash/split'; +import join from 'lodash/join'; +import trim from 'lodash/trim'; +import cx from 'classnames'; +import { settings } from '~/config'; +import loadable from '@loadable/component'; + +import Error from '@plone/volto/error'; + +import { + Breadcrumbs, + Footer, + Header, + Icon, + OutdatedBrowser, + AppExtras, +} from '@plone/volto/components'; +import { BodyClass, getBaseUrl, getView } from '@plone/volto/helpers'; +import { + getBreadcrumbs, + getContent, + getNavigation, + getTypes, + getWorkflow, +} from '@plone/volto/actions'; + +import clearSVG from '@plone/volto/icons/clear.svg'; +import MultilingualRedirector from '@plone/volto/components/theme/MultilingualRedirector/MultilingualRedirector'; + +/** + * @export + * @class App + * @extends {Component} + */ +class App extends Component { + /** + * Property types. + * @property {Object} propTypes Property types. + * @static + */ + static propTypes = { + pathname: PropTypes.string.isRequired, + }; + + state = { + hasError: false, + error: null, + errorInfo: null, + }; + + /** + * ComponentDidMount + * @method ComponentDidMount + * @param {string} error The error + * @param {string} info The info + * @returns {undefined} + */ + componentDidMount() { + if (__CLIENT__ && process.env.SENTRY_DSN) { + const Raven = loadable(() => import('raven-js')); + Raven.config(process.env.SENTRY_DSN).install(); + } + } + + /** + * @method componentWillReceiveProps + * @param {Object} nextProps Next properties + * @returns {undefined} + */ + UNSAFE_componentWillReceiveProps(nextProps) { + if (nextProps.pathname !== this.props.pathname) { + if (this.state.hasError) { + this.setState({ hasError: false }); + } + } + } + + /** + * ComponentDidCatch + * @method ComponentDidCatch + * @param {string} error The error + * @param {string} info The info + * @returns {undefined} + */ + componentDidCatch(error, info) { + this.setState({ hasError: true, error, errorInfo: info }); + if (__CLIENT__ && process.env.SENTRY_DSN) { + const Raven = loadable(() => import('raven-js')); + Raven.captureException(error, { extra: info }); + } + } + + /** + * Render method. + * @method render + * @returns {string} Markup for the component. + */ + render() { + const path = getBaseUrl(this.props.pathname); + const action = getView(this.props.pathname); + + return ( + + + + {/* Body class depending on content type */} + {this.props.content && this.props.content['@type'] && ( + + )} + + {/* Body class depending on sections */} + +
+ + + +
+ + {this.state.hasError ? ( + + ) : ( + renderRoutes(this.props.route.routes) + )} +
+
+
+