diff --git a/CHANGELOG.md b/CHANGELOG.md
index a6ca99b..d1b5946 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
-### [0.2.5](https://github.com/eea/volto-freshwater-policy/compare/1.0.0-prefix-path-fixes.1-alpha...0.2.5) - 26 February 2024
+### [0.2.6](https://github.com/eea/volto-freshwater-policy/compare/1.0.0-prefix-path-fixes.1-alpha...0.2.6) - 27 February 2024
#### :rocket: New Features
@@ -44,6 +44,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
#### :hammer_and_wrench: Others
+- Remove volto-datablocks and volto-embed customization [laszlocseh - [`1f7ff4b`](https://github.com/eea/volto-freshwater-policy/commit/1f7ff4b4fd822b0b8d058f673729128164566059)]
- Fix eslint [laszlocseh - [`afe29a4`](https://github.com/eea/volto-freshwater-policy/commit/afe29a45df99febd0c95d6ecaee99931edfebdd1)]
- Temporarily add volto-datablocks and volto-embed customizations [laszlocseh - [`fbbbaec`](https://github.com/eea/volto-freshwater-policy/commit/fbbbaec17459d87b14526caec18725a3817a20ae)]
- possibility to download country profiles as pdf [laszlocseh - [`7c03677`](https://github.com/eea/volto-freshwater-policy/commit/7c03677817fbd96631a6af69ba28a566219cecf2)]
@@ -85,8 +86,14 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- fix: override of volto-call-to-action widget [nileshgulia1 - [`bc613be`](https://github.com/eea/volto-freshwater-policy/commit/bc613be163d32ffd296458c7307ac5fa1c586c9e)]
-### [1.0.0-prefix-path-fixes.0-alpha](https://github.com/eea/volto-freshwater-policy/compare/0.2.4...1.0.0-prefix-path-fixes.0-alpha) - 15 January 2024
+### [1.0.0-prefix-path-fixes.0-alpha](https://github.com/eea/volto-freshwater-policy/compare/0.2.5...1.0.0-prefix-path-fixes.0-alpha) - 15 January 2024
+### [0.2.5](https://github.com/eea/volto-freshwater-policy/compare/0.2.4...0.2.5) - 26 February 2024
+
+#### :hammer_and_wrench: Others
+
+- Fix eslint [laszlocseh - [`afe29a4`](https://github.com/eea/volto-freshwater-policy/commit/afe29a45df99febd0c95d6ecaee99931edfebdd1)]
+- Temporarily add volto-datablocks and volto-embed customizations [laszlocseh - [`fbbbaec`](https://github.com/eea/volto-freshwater-policy/commit/fbbbaec17459d87b14526caec18725a3817a20ae)]
### [0.2.4](https://github.com/eea/volto-freshwater-policy/compare/0.2.3...0.2.4) - 23 February 2024
#### :house: Internal changes
diff --git a/package.json b/package.json
index b25a967..a2647cf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-freshwater-policy",
- "version": "0.2.5",
+ "version": "0.2.6",
"description": "@eeacms/volto-freshwater-policy: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
diff --git a/src/customizations/@eeacms/volto-datablocks/components/theme/VisibilitySensor/VisibilitySensor.jsx b/src/customizations/@eeacms/volto-datablocks/components/theme/VisibilitySensor/VisibilitySensor.jsx
deleted file mode 100644
index 4ea0be8..0000000
--- a/src/customizations/@eeacms/volto-datablocks/components/theme/VisibilitySensor/VisibilitySensor.jsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import React, { useState, useEffect } from 'react';
-import ReactVisibilitySensor from 'react-visibility-sensor';
-import { flushSync } from 'react-dom';
-
-const usePrint = () => {
- const [isPrint, setIsPrint] = useState(false);
-
- /**
- * Use instead of window.print because window.print does not wait for react-rerender
- */
- function print() {
- flushSync(() => {
- setIsPrint(true);
- window.print();
- });
- }
-
- useEffect(() => {
- const beforePrint = () => {
- flushSync(() => {
- setIsPrint(true);
- });
- };
- const afterPrint = () => {
- flushSync(() => {
- setIsPrint(false);
- });
- };
-
- if (window.matchMedia) {
- const mediaQueryList = window.matchMedia('print');
- const handleMediaChange = (event) => {
- event.preventDefault();
- if (event.matches) {
- beforePrint();
- } else {
- afterPrint();
- }
- };
-
- try {
- mediaQueryList.addEventListener('change', handleMediaChange);
- } catch (error) {
- mediaQueryList.addListener(handleMediaChange);
- }
-
- setIsPrint(mediaQueryList.matches);
-
- return () => {
- try {
- mediaQueryList.removeEventListener('change', handleMediaChange);
- } catch (error) {
- mediaQueryList.removeListener(handleMediaChange);
- }
- };
- }
-
- // Fallback for browsers that don't support matchMedia
- window.onbeforeprint = beforePrint;
- window.onafterprint = afterPrint;
-
- // Cleanup function for the fallback
- return () => {
- window.onbeforeprint = null;
- window.onafterprint = null;
- };
- }, [setIsPrint]);
-
- return { isPrint, print };
-};
-
-const VisibilitySensor = ({
- children,
- scrollCheck = true,
- resizeCheck = true,
- partialVisibility = true,
- delayedCall = true,
- offset = { top: -50, bottom: -50 },
- useVisibilitySensor = true,
- Placeholder = () =>
,
- ...rest
-}) => {
- const { isPrint } = usePrint();
- const [active, setActive] = React.useState(isPrint);
- // const [active, setActive] = React.useState(useVisibilitySensor);
-
- return (
- {
- if (visible && active) {
- setActive(false);
- }
- }}
- active={active}
- getDOMElement={(val) => {
- return val?.el;
- }}
- offset={offset}
- {...rest}
- >
- {({ isVisible }) => {
- if (isVisible || !active) {
- return children;
- }
-
- return ;
- }}
-
- );
-};
-
-export default VisibilitySensor;
diff --git a/src/customizations/@eeacms/volto-embed/PrivacyProtection/PrivacyProtection.jsx b/src/customizations/@eeacms/volto-embed/PrivacyProtection/PrivacyProtection.jsx
deleted file mode 100644
index 73ed2a3..0000000
--- a/src/customizations/@eeacms/volto-embed/PrivacyProtection/PrivacyProtection.jsx
+++ /dev/null
@@ -1,272 +0,0 @@
-import React, { useState } from 'react';
-import cx from 'classnames';
-import { isNumber } from 'lodash';
-import { compose } from 'redux';
-import { useSelector, useDispatch } from 'react-redux';
-import {
- Placeholder,
- Dimmer,
- Loader,
- Button,
- Checkbox,
-} from 'semantic-ui-react';
-import { withCookies } from 'react-cookie';
-import { serializeNodes } from '@plone/volto-slate/editor/render';
-import { defineMessages, injectIntl } from 'react-intl';
-import { toast } from 'react-toastify';
-import config from '@plone/volto/registry';
-import { getBaseUrl, toPublicURL, isInternalURL } from '@plone/volto/helpers';
-import { Toast } from '@plone/volto/components';
-import {
- getConnectedDataParametersForContext,
- getFilteredURL,
-} from '@eeacms/volto-datablocks/helpers';
-import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
-
-import { createImageUrl } from './helpers';
-import { ProtectionSchema } from './schema';
-
-import './styles.less';
-
-const messages = defineMessages({
- success: {
- id: 'Success',
- defaultMessage: 'Success',
- },
- image: {
- id: 'Live image generated',
- defaultMessage: 'Live image generated',
- },
-});
-
-const key = (domain_key) => `accept-${domain_key}`;
-
-const getExpDays = () =>
- typeof config.settings.embedCookieExpirationDays !== 'undefined'
- ? config.settings.embedCookieExpirationDays
- : 90;
-
-function saveCookie(domain_key, cookies) {
- const date = new Date();
- date.setDate(date.getDate() + getExpDays());
-
- cookies.set(key(domain_key), 'true', {
- path: '/',
- expires: date,
- });
-}
-
-function canShow(domain_key, cookies) {
- return cookies.get(key(domain_key)) === 'true';
-}
-
-const cookieExist = (domain_key, cookies) => cookies.get(key(domain_key));
-
-const CookieWatcher = (domain_key, cookies, pollingRate = 250) => {
- // state for cookie existence
- const [exist, setExist] = useState(cookieExist(domain_key, cookies));
-
- React.useEffect(() => {
- const interval = setInterval(
- () => setExist(cookieExist(domain_key, cookies)),
- pollingRate,
- );
- return () => clearInterval(interval);
- });
-
- return exist;
-};
-
-const PrivacyProtection = (props) => {
- const {
- className,
- children,
- data = {},
- id,
- editable,
- intl,
- path,
- cookies,
- // useVisibilitySensor = true,
- } = props;
- const {
- enabled = false,
- privacy_statement,
- background_image: bgImg,
- privacy_cookie_key = 'esri-maps',
- } = data.dataprotection || {};
-
- const [image, setImage] = React.useState(null);
- const defaultShow = canShow(privacy_cookie_key, cookies);
- const [show, setShow] = useState(defaultShow);
- const [remember, setRemember] = useState(
- cookieExist(privacy_cookie_key, cookies) ? defaultShow : true,
- );
- const dispatch = useDispatch();
- const checkExistance = CookieWatcher(privacy_cookie_key, cookies);
- const connected_data_parameters = useSelector((state) => {
- return getConnectedDataParametersForContext(
- state?.connected_data_parameters,
- state.router?.location?.pathname,
- );
- });
- const mapUrl = data.url || data.vis_url;
- const url = getFilteredURL(mapUrl, connected_data_parameters);
-
- const height = React.useMemo(() => {
- if (!props.height || enabled || !show) return 'auto';
- if (isNumber(props.height)) return `${props.height}px`;
- return props.height;
- }, [props.height, enabled, show]);
-
- React.useEffect(() => {
- if (bgImg) {
- setImage(createImageUrl(bgImg)); //create imageUrl from uploaded image
- }
- }, [bgImg]);
-
- //Effect hook for polling the cookie_key
- React.useEffect(
- () => {
- if (!editable && defaultShow) {
- setShow(true);
- }
- },
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [checkExistance],
- );
-
- const urlToScreenshot = isInternalURL(url) ? toPublicURL(url) : url;
-
- //screenshot api
- React.useEffect(() => {
- if (enabled && !bgImg && !show && url) {
- fetch(
- `${getBaseUrl(
- '',
- )}/cors-proxy/https://screenshot.eea.europa.eu/api/v1/retrieve_image_for_url?url=${encodeURIComponent(
- urlToScreenshot,
- )}&w=1920&h=1000&waitfor=4000`,
- )
- .then((e) => e.blob())
- .then((blob) => {
- setImage(URL.createObjectURL(blob));
- if (editable) {
- toast.success(
- ,
- );
- }
- })
- .catch(() => {
- if (__DEVELOPMENT__) {
- /* eslint-disable-next-line */
- console.log('Please enable your VPN!');
- }
- });
- }
- }, [
- enabled,
- url,
- path,
- dispatch,
- bgImg,
- show,
- intl,
- editable,
- urlToScreenshot,
- ]);
-
- return (
- (
-
-
-
- )}
- // useVisibilitySensor={useVisibilitySensor}
- >
-
- {!enabled || show ? (
- children
- ) : !__DEVELOPMENT__ && !image && !process.env.JEST_WORKER_ID ? (
-
-
-
- ) : (
-
-
-
-
-
-
-
- {!editable && (
-
- {
- setRemember(checked);
- }}
- checked={remember}
- />
-
- )}
-
-
- Your choice will be saved in a cookie managed by{' '}
- {config.settings.ownDomain || '.eea.europa.eu'} that will
- expire in {getExpDays()} days.
-
-
- {serializeNodes(
- privacy_statement ||
- ProtectionSchema().properties.privacy_statement
- .defaultValue,
- )}
-
-
-
-
- )}
-
-
- );
-};
-
-export default compose(injectIntl, withCookies)(PrivacyProtection);
diff --git a/src/customizations/@eeacms/volto-embed/PrivacyProtection/helpers.js b/src/customizations/@eeacms/volto-embed/PrivacyProtection/helpers.js
deleted file mode 100644
index ab0e818..0000000
--- a/src/customizations/@eeacms/volto-embed/PrivacyProtection/helpers.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export function createImageUrl(result) {
- const decoded = window.atob(result.data);
- const byteNumbers = new Array(decoded.length);
- for (let i = 0; i < decoded.length; i++) {
- byteNumbers[i] = decoded.charCodeAt(i);
- }
- const byteArray = new Uint8Array(byteNumbers);
-
- const image = new Blob([byteArray], { type: result['content-type'] });
- return URL.createObjectURL(image);
-}
diff --git a/src/customizations/@eeacms/volto-embed/PrivacyProtection/schema.js b/src/customizations/@eeacms/volto-embed/PrivacyProtection/schema.js
deleted file mode 100644
index 2b39a27..0000000
--- a/src/customizations/@eeacms/volto-embed/PrivacyProtection/schema.js
+++ /dev/null
@@ -1,66 +0,0 @@
-export const ProtectionSchema = () => ({
- title: 'Data Protection',
-
- fieldsets: [
- {
- id: 'default',
- title: 'Default',
- fields: [
- 'privacy_statement',
- 'privacy_cookie_key',
- 'enabled',
- 'background_image',
- ],
- },
- ],
-
- properties: {
- privacy_statement: {
- title: 'Privacy statement',
- description: 'Defined in template. Change only if necessary',
- widget: 'slate_richtext',
- className: 'slate-Widget',
- defaultValue: [
- {
- children: [
- {
- text:
- 'This map is hosted by a third party, Environmental Systems Research Institute. By showing the external content you accept the terms and conditions of ',
- },
- {
- type: 'a',
- url: 'https://www.esri.com',
- children: [
- {
- text: 'esri.com',
- },
- ],
- },
- {
- text:
- '. This includes their cookie policies, which we have no control over.',
- },
- ],
- },
- ],
- },
- privacy_cookie_key: {
- title: 'Privacy cookie key',
- description: 'Use default for Esri maps, otherwise change',
- defaultValue: 'esri-maps',
- },
- enabled: {
- title: 'Data protection disclaimer enabled',
- description: 'Enable/disable the privacy protection',
- type: 'boolean',
- },
- background_image: {
- title: 'Background image',
- description:
- 'The component will automatically generate a static image as placeholder from the URL of the map defined. This image is refreshed on page edit. To override this, upload an image here',
- widget: 'file',
- },
- },
-
- required: [],
-});
diff --git a/src/customizations/@eeacms/volto-embed/PrivacyProtection/styles.less b/src/customizations/@eeacms/volto-embed/PrivacyProtection/styles.less
deleted file mode 100644
index de7b89f..0000000
--- a/src/customizations/@eeacms/volto-embed/PrivacyProtection/styles.less
+++ /dev/null
@@ -1,52 +0,0 @@
-.privacy-protection-wrapper {
- .ui.dimmer {
- z-index: 9;
-
- .ui.loader {
- padding: 0;
- }
- }
-}
-
-.privacy-protection {
- display: flex;
- height: 100%;
- flex-direction: column;
- justify-content: center;
- background-color: #eee;
- text-align: center;
-
- .wrapped {
- width: 300px;
- padding: 1.4rem;
- margin: 0 auto;
- background: white;
- border-radius: 5px;
- opacity: 1;
- }
-
- .discreet,
- .discreet > p {
- color: grey;
- font-size: 14px;
- }
-
- .overlay {
- width: 100%;
- height: 100%;
- padding: 2rem;
- background-color: rgba(0, 0, 0, 0.35);
- }
-}
-
-.privacy-button {
- margin-top: 0.5rem;
-}
-
-.privacy-toggle {
- margin: 0.8rem auto 2rem auto;
-}
-
-.slate-Widget {
- left: 855px !important;
-}