@eeacms/volto-embed 3.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -1
- package/Jenkinsfile +5 -4
- package/cypress/support/index.js +1 -1
- package/cypress.json +6 -1
- package/package.json +1 -1
- package/src/Iframe/EditIframe.jsx +42 -9
- package/src/Iframe/ViewIframe.jsx +2 -2
- package/src/PrivacyProtection/PrivacyProtection.jsx +168 -193
- package/src/PrivacyProtection/styles.less +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,9 +4,36 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [4.0.2](https://github.com/eea/volto-embed/compare/4.0.1...4.0.2)
|
|
8
|
+
|
|
9
|
+
- Fix destructure of undefined [`a15b86f`](https://github.com/eea/volto-embed/commit/a15b86f71f4a5ccf3a37b7a8b98683d669c18d14)
|
|
10
|
+
- Backward compatibility [`68abd0e`](https://github.com/eea/volto-embed/commit/68abd0eea6635f104b4668edc1fba33a9322f71b)
|
|
11
|
+
|
|
12
|
+
#### [4.0.1](https://github.com/eea/volto-embed/compare/4.0.0...4.0.1)
|
|
13
|
+
|
|
14
|
+
> 29 April 2022
|
|
15
|
+
|
|
16
|
+
- Release: fix and use `getfilteredUrl` method from datablocks [`#23`](https://github.com/eea/volto-embed/pull/23)
|
|
17
|
+
- dedupe getFiltered method, use from datablocks [`7f7b1b5`](https://github.com/eea/volto-embed/commit/7f7b1b51b280edc856e19d6b02a37f3f8894bd04)
|
|
18
|
+
- fix regex [`1dc059f`](https://github.com/eea/volto-embed/commit/1dc059fa58f7a1789e4b570d1631226b404fa805)
|
|
19
|
+
- early return [`467e6fc`](https://github.com/eea/volto-embed/commit/467e6fc2c053d2e17526ad6fb4cbf34c2bb8abe1)
|
|
20
|
+
- safari: don't use lookbehind [`a4e4ece`](https://github.com/eea/volto-embed/commit/a4e4ece2891a5e2bcbf7f47a4345d0adca5258e6)
|
|
21
|
+
|
|
22
|
+
### [4.0.0](https://github.com/eea/volto-embed/compare/3.0.1...4.0.0)
|
|
23
|
+
|
|
24
|
+
> 5 April 2022
|
|
25
|
+
|
|
26
|
+
- Breaking. Volto 15.x compatibility [`#22`](https://github.com/eea/volto-embed/pull/22)
|
|
27
|
+
- Prettier [`fffa1c9`](https://github.com/eea/volto-embed/commit/fffa1c9f42c9dacc7de1fed730e0a4494c04d2f8)
|
|
28
|
+
- Prettier [`f9ca05d`](https://github.com/eea/volto-embed/commit/f9ca05d3c55d204080f8769bd7d556b4d8f0ce21)
|
|
29
|
+
- Breaking changes. Bumped to version 4.0.0 [`eb78abf`](https://github.com/eea/volto-embed/commit/eb78abf98103ee8831814b3df4c441279c586da2)
|
|
30
|
+
- Volto 15.x compatibility: updated react-cookie library [`a480372`](https://github.com/eea/volto-embed/commit/a480372f47e6e34d6f3e14d7b54b345dc83fd328)
|
|
31
|
+
|
|
7
32
|
#### [3.0.1](https://github.com/eea/volto-embed/compare/3.0.0...3.0.1)
|
|
8
33
|
|
|
9
|
-
|
|
34
|
+
> 11 February 2022
|
|
35
|
+
|
|
36
|
+
- fix query case [`#20`](https://github.com/eea/volto-embed/pull/20)
|
|
10
37
|
|
|
11
38
|
#### [3.0.0](https://github.com/eea/volto-embed/compare/3.0.0-beta.0...3.0.0)
|
|
12
39
|
|
package/Jenkinsfile
CHANGED
|
@@ -6,6 +6,7 @@ pipeline {
|
|
|
6
6
|
NAMESPACE = "@eeacms"
|
|
7
7
|
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,water.europa.eu-freshwater"
|
|
8
8
|
DEPENDENCIES = "volto-slate"
|
|
9
|
+
VOLTO = "alpha"
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
stages {
|
|
@@ -124,8 +125,8 @@ pipeline {
|
|
|
124
125
|
node(label: 'docker') {
|
|
125
126
|
script {
|
|
126
127
|
try {
|
|
127
|
-
sh '''docker pull plone; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="
|
|
128
|
-
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" plone/volto-addon-ci cypress'''
|
|
128
|
+
sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
|
|
129
|
+
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
|
|
129
130
|
} finally {
|
|
130
131
|
try {
|
|
131
132
|
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
|
|
@@ -184,10 +185,10 @@ pipeline {
|
|
|
184
185
|
unstash "xunit-reports"
|
|
185
186
|
unstash "cypress-coverage"
|
|
186
187
|
def scannerHome = tool 'SonarQubeScanner';
|
|
187
|
-
def nodeJS = tool '
|
|
188
|
+
def nodeJS = tool 'NodeJS';
|
|
188
189
|
withSonarQubeEnv('Sonarqube') {
|
|
189
190
|
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
190
|
-
sh "export PATH=$
|
|
191
|
+
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
|
|
191
192
|
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
|
|
192
193
|
}
|
|
193
194
|
}
|
package/cypress/support/index.js
CHANGED
package/cypress.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"baseUrl": "http://localhost:3000",
|
|
3
3
|
"viewportWidth": 1280,
|
|
4
|
-
"defaultCommandTimeout":
|
|
4
|
+
"defaultCommandTimeout": 8888,
|
|
5
5
|
"reporter": "junit",
|
|
6
6
|
"video": true,
|
|
7
7
|
"reporterOptions": {
|
|
8
8
|
"mochaFile": "cypress/reports/cypress-[hash].xml",
|
|
9
9
|
"jenkinsMode": true,
|
|
10
10
|
"toConsole": true
|
|
11
|
+
},
|
|
12
|
+
"chromeWebSecurity": false,
|
|
13
|
+
"retries": {
|
|
14
|
+
"runMode": 8,
|
|
15
|
+
"openMode": 0
|
|
11
16
|
}
|
|
12
17
|
}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { Component } from 'react';
|
|
7
|
+
import { isString } from 'lodash';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import { Button, Input, Message } from 'semantic-ui-react';
|
|
9
10
|
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
|
@@ -16,6 +17,7 @@ import aheadSVG from '@plone/volto/icons/ahead.svg';
|
|
|
16
17
|
import mapsBlockSVG from '@plone/volto/components/manage/Blocks/Maps/block-maps.svg';
|
|
17
18
|
import schema from './schema';
|
|
18
19
|
import { addPrivacyProtectionToSchema } from '../PrivacyProtection';
|
|
20
|
+
import { PrivacyProtection } from '../PrivacyProtection';
|
|
19
21
|
|
|
20
22
|
const messages = defineMessages({
|
|
21
23
|
MapsBlockInputPlaceholder: {
|
|
@@ -86,6 +88,32 @@ class Edit extends Component {
|
|
|
86
88
|
this.onKeyDownVariantMenuForm = this.onKeyDownVariantMenuForm.bind(this);
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Backward compatibility
|
|
93
|
+
* @method componentDidMount
|
|
94
|
+
* @returns {undefined}
|
|
95
|
+
*/
|
|
96
|
+
componentDidMount() {
|
|
97
|
+
const { privacy_statement } = this.props.data.dataprotection || {};
|
|
98
|
+
if (isString(privacy_statement)) {
|
|
99
|
+
this.props.onChangeBlock(this.props.block, {
|
|
100
|
+
...this.props.data,
|
|
101
|
+
dataprotection: {
|
|
102
|
+
...(this.props.data.dataprotection || {}),
|
|
103
|
+
privacy_statement: [
|
|
104
|
+
{
|
|
105
|
+
children: [
|
|
106
|
+
{
|
|
107
|
+
text: privacy_statement,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
89
117
|
/**
|
|
90
118
|
* Change url handler
|
|
91
119
|
* @method onChangeUrl
|
|
@@ -182,15 +210,20 @@ class Edit extends Component {
|
|
|
182
210
|
'full-width': this.props.data.align === 'full',
|
|
183
211
|
})}
|
|
184
212
|
>
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
213
|
+
<PrivacyProtection
|
|
214
|
+
data={this.props.data}
|
|
215
|
+
editable={this.props.editable}
|
|
216
|
+
>
|
|
217
|
+
<iframe
|
|
218
|
+
title={this.props.intl.formatMessage(
|
|
219
|
+
messages.GoogleMapsEmbeddedBlock,
|
|
220
|
+
)}
|
|
221
|
+
src={this.props.data.url}
|
|
222
|
+
className="google-map"
|
|
223
|
+
frameBorder="0"
|
|
224
|
+
allowFullScreen
|
|
225
|
+
/>
|
|
226
|
+
</PrivacyProtection>
|
|
194
227
|
</div>
|
|
195
228
|
) : (
|
|
196
229
|
<Message>
|
|
@@ -22,7 +22,7 @@ const messages = defineMessages({
|
|
|
22
22
|
* @extends Component
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const View = ({ data, intl }) => {
|
|
25
|
+
const View = ({ data, intl, id }) => {
|
|
26
26
|
return (
|
|
27
27
|
<div
|
|
28
28
|
className={cx(
|
|
@@ -42,7 +42,7 @@ const View = ({ data, intl }) => {
|
|
|
42
42
|
})}
|
|
43
43
|
style={{ height: '100%' }}
|
|
44
44
|
>
|
|
45
|
-
<PrivacyProtection data={data}>
|
|
45
|
+
<PrivacyProtection data={data} id={id}>
|
|
46
46
|
<iframe
|
|
47
47
|
title={intl.formatMessage(messages.EmbededGoogleMaps)}
|
|
48
48
|
src={data.url}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import { compose } from 'redux';
|
|
2
3
|
import { useSelector } from 'react-redux';
|
|
3
4
|
import VisibilitySensor from 'react-visibility-sensor';
|
|
4
5
|
import { Placeholder, Dimmer, Loader } from 'semantic-ui-react';
|
|
5
|
-
import
|
|
6
|
-
|
|
6
|
+
import { withCookies } from 'react-cookie';
|
|
7
7
|
//import { find, without } from 'lodash';
|
|
8
8
|
import { serializeNodes } from 'volto-slate/editor/render';
|
|
9
9
|
import { Button, Checkbox } from 'semantic-ui-react';
|
|
@@ -13,7 +13,10 @@ import { toast } from 'react-toastify';
|
|
|
13
13
|
import config from '@plone/volto/registry';
|
|
14
14
|
import { getBaseUrl } from '@plone/volto/helpers';
|
|
15
15
|
import { Toast } from '@plone/volto/components';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
getConnectedDataParametersForContext,
|
|
18
|
+
getFilteredURL,
|
|
19
|
+
} from '@eeacms/volto-datablocks/helpers';
|
|
17
20
|
|
|
18
21
|
import { createImageUrl } from './helpers';
|
|
19
22
|
import { ProtectionSchema } from './schema';
|
|
@@ -38,29 +41,29 @@ const getExpDays = () =>
|
|
|
38
41
|
? config.settings.embedCookieExpirationDays
|
|
39
42
|
: 90;
|
|
40
43
|
|
|
41
|
-
function saveCookie(domain_key) {
|
|
44
|
+
function saveCookie(domain_key, cookies) {
|
|
42
45
|
const date = new Date();
|
|
43
46
|
date.setDate(date.getDate() + getExpDays());
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
cookies.set(key(domain_key), 'true', {
|
|
46
49
|
path: '/',
|
|
47
50
|
expires: date,
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
function canShow(domain_key) {
|
|
52
|
-
return
|
|
54
|
+
function canShow(domain_key, cookies) {
|
|
55
|
+
return cookies.get(key(domain_key)) === 'true';
|
|
53
56
|
}
|
|
54
57
|
|
|
55
|
-
const cookieExist = (domain_key) =>
|
|
58
|
+
const cookieExist = (domain_key, cookies) => cookies.get(key(domain_key));
|
|
56
59
|
|
|
57
|
-
const CookieWatcher = (
|
|
60
|
+
const CookieWatcher = (domain_key, cookies, pollingRate = 250) => {
|
|
58
61
|
// state for cookie existence
|
|
59
|
-
const [exist, setExist] = useState(cookieExist(
|
|
62
|
+
const [exist, setExist] = useState(cookieExist(domain_key, cookies));
|
|
60
63
|
|
|
61
64
|
React.useEffect(() => {
|
|
62
65
|
const interval = setInterval(
|
|
63
|
-
() => setExist(cookieExist(
|
|
66
|
+
() => setExist(cookieExist(domain_key, cookies)),
|
|
64
67
|
pollingRate,
|
|
65
68
|
);
|
|
66
69
|
return () => clearInterval(interval);
|
|
@@ -69,196 +72,168 @@ const CookieWatcher = (cookie, pollingRate = 250) => {
|
|
|
69
72
|
return exist;
|
|
70
73
|
};
|
|
71
74
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
({
|
|
95
|
-
children,
|
|
96
|
-
data = {},
|
|
97
|
-
id,
|
|
98
|
-
isEditMode,
|
|
99
|
-
onChangeBlock,
|
|
100
|
-
intl,
|
|
101
|
-
path,
|
|
102
|
-
properties,
|
|
103
|
-
...rest
|
|
104
|
-
}) => {
|
|
105
|
-
const { dataprotection = {}, height } = data;
|
|
106
|
-
const { background_image: bgImg, enabled = false } = dataprotection;
|
|
107
|
-
const [image, setImage] = React.useState(null);
|
|
108
|
-
const [visible, setVisibility] = useState(false);
|
|
109
|
-
const defaultShow = canShow(dataprotection.privacy_cookie_key);
|
|
110
|
-
const [show, setShow] = useState(defaultShow);
|
|
111
|
-
const [remember, setRemember] = useState(
|
|
112
|
-
cookieExist(dataprotection.privacy_cookie_key) ? defaultShow : true,
|
|
75
|
+
const PrivacyProtection = (props) => {
|
|
76
|
+
const { children, data = {}, id, editable, intl, path, cookies } = props;
|
|
77
|
+
const {
|
|
78
|
+
enabled = false,
|
|
79
|
+
privacy_statement,
|
|
80
|
+
background_image: bgImg,
|
|
81
|
+
privacy_cookie_key = 'esri-maps',
|
|
82
|
+
} = data.dataprotection || {};
|
|
83
|
+
|
|
84
|
+
const [image, setImage] = React.useState(null);
|
|
85
|
+
const [visible, setVisibility] = useState(false);
|
|
86
|
+
const defaultShow = canShow(privacy_cookie_key, cookies);
|
|
87
|
+
const [show, setShow] = useState(defaultShow);
|
|
88
|
+
const [remember, setRemember] = useState(
|
|
89
|
+
cookieExist(privacy_cookie_key, cookies) ? defaultShow : true,
|
|
90
|
+
);
|
|
91
|
+
const dispatch = useDispatch();
|
|
92
|
+
const checkExistance = CookieWatcher(privacy_cookie_key, cookies);
|
|
93
|
+
const connected_data_parameters = useSelector((state) => {
|
|
94
|
+
return getConnectedDataParametersForContext(
|
|
95
|
+
state?.connected_data_parameters,
|
|
96
|
+
state.router?.location?.pathname,
|
|
113
97
|
);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const connected_data_parameters = useSelector((state) => {
|
|
117
|
-
return getConnectedDataParametersForContext(
|
|
118
|
-
state?.connected_data_parameters,
|
|
119
|
-
state.router?.location?.pathname,
|
|
120
|
-
);
|
|
121
|
-
});
|
|
98
|
+
});
|
|
99
|
+
const url = getFilteredURL(data.url, connected_data_parameters);
|
|
122
100
|
|
|
123
|
-
|
|
101
|
+
React.useEffect(() => {
|
|
102
|
+
if (bgImg) {
|
|
103
|
+
setImage(createImageUrl(bgImg)); //create imageUrl from uploaded image
|
|
104
|
+
}
|
|
105
|
+
}, [bgImg]);
|
|
124
106
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (bgImg) {
|
|
131
|
-
setImage(createImageUrl(bgImg)); //create imageUrl from uploaded image
|
|
107
|
+
//Effect hook for polling the cookie_key
|
|
108
|
+
React.useEffect(
|
|
109
|
+
() => {
|
|
110
|
+
if (!editable && defaultShow) {
|
|
111
|
+
setShow(true);
|
|
132
112
|
}
|
|
133
|
-
},
|
|
113
|
+
},
|
|
114
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
115
|
+
[checkExistance],
|
|
116
|
+
);
|
|
134
117
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
118
|
+
//screenshot api
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
if (enabled && !bgImg && !show) {
|
|
121
|
+
fetch(
|
|
122
|
+
`${getBaseUrl(
|
|
123
|
+
'',
|
|
124
|
+
)}/cors-proxy/https://screenshot.eea.europa.eu/api/v1/retrieve_image_for_url?url=${encodeURIComponent(
|
|
125
|
+
url,
|
|
126
|
+
)}&w=1920&waitfor=4000`,
|
|
127
|
+
)
|
|
128
|
+
.then((e) => e.blob())
|
|
129
|
+
.then((blob) => {
|
|
130
|
+
setImage(URL.createObjectURL(blob));
|
|
131
|
+
if (editable) {
|
|
132
|
+
toast.success(
|
|
133
|
+
<Toast
|
|
134
|
+
success
|
|
135
|
+
title={intl.formatMessage(messages.success)}
|
|
136
|
+
content={intl.formatMessage(messages.image)}
|
|
137
|
+
/>,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
.catch(() => {
|
|
142
|
+
if (__DEVELOPMENT__) {
|
|
143
|
+
/* eslint-disable-next-line */
|
|
144
|
+
console.log('Please enable your VPN!');
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}, [enabled, url, path, dispatch, bgImg, show, intl, editable]);
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<VisibilitySensor
|
|
152
|
+
onChange={(isVisible) => {
|
|
153
|
+
!visible && isVisible && setVisibility(true);
|
|
154
|
+
}}
|
|
155
|
+
partialVisibility={true}
|
|
156
|
+
offset={{ bottom: 200 }}
|
|
157
|
+
>
|
|
158
|
+
{visible ? (
|
|
159
|
+
<div
|
|
160
|
+
className="privacy-protection-wrapper"
|
|
161
|
+
style={{ position: 'relative', minHeight: '200px' }}
|
|
162
|
+
>
|
|
163
|
+
{!enabled || show ? (
|
|
164
|
+
children
|
|
165
|
+
) : !__DEVELOPMENT__ && !image ? (
|
|
166
|
+
<Dimmer active>
|
|
167
|
+
<Loader />
|
|
168
|
+
</Dimmer>
|
|
169
|
+
) : (
|
|
170
|
+
<div
|
|
171
|
+
className="privacy-protection"
|
|
172
|
+
style={
|
|
173
|
+
image
|
|
174
|
+
? {
|
|
175
|
+
backgroundImage: `url(${image})`,
|
|
176
|
+
backgroundRepeat: 'no-repeat',
|
|
177
|
+
backgroundSize: 'cover',
|
|
178
|
+
backgroundPosition: 'center -70px',
|
|
179
|
+
}
|
|
180
|
+
: {}
|
|
181
|
+
}
|
|
182
|
+
>
|
|
183
|
+
<div className="overlay">
|
|
184
|
+
<div className="wrapped">
|
|
185
|
+
<div className="privacy-button">
|
|
186
|
+
<Button
|
|
187
|
+
primary
|
|
188
|
+
onClick={() => {
|
|
189
|
+
setShow(true);
|
|
190
|
+
if (remember) {
|
|
191
|
+
saveCookie(privacy_cookie_key, cookies);
|
|
192
|
+
}
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
Show external content
|
|
196
|
+
</Button>
|
|
197
|
+
</div>
|
|
177
198
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
{visible ? (
|
|
187
|
-
<div className="privacy-protection-wrapper" style={styles}>
|
|
188
|
-
{!dataprotection.enabled || show ? (
|
|
189
|
-
children
|
|
190
|
-
) : !__DEVELOPMENT__ && !image ? (
|
|
191
|
-
<Dimmer active>
|
|
192
|
-
<Loader />
|
|
193
|
-
</Dimmer>
|
|
194
|
-
) : (
|
|
195
|
-
<div
|
|
196
|
-
className="privacy-protection"
|
|
197
|
-
{...rest}
|
|
198
|
-
style={
|
|
199
|
-
image
|
|
200
|
-
? {
|
|
201
|
-
backgroundImage: `url(${image})`,
|
|
202
|
-
backgroundRepeat: 'no-repeat',
|
|
203
|
-
backgroundSize: 'cover',
|
|
204
|
-
backgroundPosition: 'center -70px',
|
|
205
|
-
}
|
|
206
|
-
: {}
|
|
207
|
-
}
|
|
208
|
-
>
|
|
209
|
-
<div className="overlay">
|
|
210
|
-
<div className="wrapped">
|
|
211
|
-
<div className="privacy-button">
|
|
212
|
-
<Button
|
|
213
|
-
primary
|
|
214
|
-
onClick={() => {
|
|
215
|
-
setShow(true);
|
|
216
|
-
if (remember) {
|
|
217
|
-
saveCookie(dataprotection.privacy_cookie_key);
|
|
218
|
-
}
|
|
199
|
+
{!editable && (
|
|
200
|
+
<div className="privacy-toggle">
|
|
201
|
+
<Checkbox
|
|
202
|
+
toggle
|
|
203
|
+
label="Remember my choice"
|
|
204
|
+
id={`remember-choice-${id}`}
|
|
205
|
+
onChange={(ev, { checked }) => {
|
|
206
|
+
setRemember(checked);
|
|
219
207
|
}}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
</Button>
|
|
208
|
+
checked={remember}
|
|
209
|
+
/>
|
|
223
210
|
</div>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
</div>
|
|
211
|
+
)}
|
|
212
|
+
|
|
213
|
+
<p className="discreet">
|
|
214
|
+
Your choice will be saved in a cookie managed by{' '}
|
|
215
|
+
{config.settings.ownDomain || '.eea.europa.eu'} that will
|
|
216
|
+
expire in {getExpDays()} days.
|
|
217
|
+
</p>
|
|
218
|
+
<p className="discreet">
|
|
219
|
+
{serializeNodes(
|
|
220
|
+
privacy_statement ||
|
|
221
|
+
ProtectionSchema().properties.privacy_statement
|
|
222
|
+
.defaultValue,
|
|
237
223
|
)}
|
|
238
|
-
|
|
239
|
-
<p className="discreet">
|
|
240
|
-
Your choice will be saved in a cookie managed by{' '}
|
|
241
|
-
{config.settings.ownDomain || '.eea.europa.eu'} that will
|
|
242
|
-
expire in {getExpDays()} days.
|
|
243
|
-
</p>
|
|
244
|
-
<p className="discreet">
|
|
245
|
-
{serializeNodes(
|
|
246
|
-
dataprotection.privacy_statement ||
|
|
247
|
-
ProtectionSchema().properties.privacy_statement
|
|
248
|
-
.defaultValue,
|
|
249
|
-
)}
|
|
250
|
-
</p>
|
|
251
|
-
</div>
|
|
224
|
+
</p>
|
|
252
225
|
</div>
|
|
253
226
|
</div>
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
227
|
+
</div>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
) : (
|
|
231
|
+
<Placeholder style={{ height: '100%', width: '100%' }}>
|
|
232
|
+
<Placeholder.Image rectangular />
|
|
233
|
+
</Placeholder>
|
|
234
|
+
)}
|
|
235
|
+
</VisibilitySensor>
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
export default compose(injectIntl, withCookies)(PrivacyProtection);
|