@uncinc/uncinc-react-kitchen-sink 2.8.51 → 2.9.0
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/dist/components/ApiAutocomplete/index.js +41 -44
- package/dist/components/Button/index.d.ts +7 -1
- package/dist/components/Button/index.js +11 -3
- package/dist/components/Cookie/Checkbox/style.scss +0 -1
- package/dist/components/Form/Checkbox/index.js +2 -1
- package/dist/components/Form/Select/Input/index.js +9 -4
- package/dist/components/Form/TextField/index.js +18 -3
- package/dist/components/GoogleConsentCookieBanner/Checkbox/index.d.ts +14 -0
- package/dist/components/GoogleConsentCookieBanner/Checkbox/index.js +29 -0
- package/dist/components/GoogleConsentCookieBanner/Checkbox/style.scss +40 -0
- package/dist/components/GoogleConsentCookieBanner/CookieCategoryContents/index.d.ts +14 -0
- package/dist/components/GoogleConsentCookieBanner/CookieCategoryContents/index.js +19 -0
- package/dist/components/GoogleConsentCookieBanner/CookieCategoryContentsPartners/index.d.ts +14 -0
- package/dist/components/GoogleConsentCookieBanner/CookieCategoryContentsPartners/index.js +23 -0
- package/dist/components/GoogleConsentCookieBanner/index.d.ts +15 -0
- package/dist/components/GoogleConsentCookieBanner/index.js +341 -0
- package/dist/components/GoogleConsentCookieBanner/style.scss +105 -0
- package/dist/components/GoogleConsentCookieBanner/types.d.ts +68 -0
- package/dist/components/GoogleConsentCookieBanner/types.js +22 -0
- package/dist/components/Icon/style.scss +47 -0
- package/dist/components/Image/AdaptivePicture/index.js +25 -3
- package/dist/components/Image/AdaptivePicture/style.scss +1 -0
- package/dist/components/Image/helpers/index.js +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/SearchKit/SearchPage/index.js +1 -1
- package/dist/components/Share/CopyToClipboard/index.js +48 -11
- package/dist/components/Tag/style.scss +18 -3
- package/dist/components/WysiwygField/index.d.ts +5 -1
- package/dist/components/WysiwygField/index.js +10 -4
- package/dist/config/i18next/locales/nl.json +33 -0
- package/dist/helpers/apiAutoComplete.d.ts +1 -0
- package/dist/helpers/apiAutoComplete.js +55 -0
- package/dist/helpers/utm.d.ts +16 -0
- package/dist/helpers/utm.js +47 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -1
- package/package.json +14 -12
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
|
+
import useCookie from 'react-use-cookie';
|
|
15
|
+
import Cookies from 'js-cookie';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import Accordion from '../Accordion';
|
|
19
|
+
import AccordionItemVariant from '../Accordion/AccordionItemVariant';
|
|
20
|
+
import Button from '../Button';
|
|
21
|
+
import Container from '../Layout/Container';
|
|
22
|
+
import Checkbox from './Checkbox';
|
|
23
|
+
import './style.scss';
|
|
24
|
+
import { LocalConsentStatus, AvailableConsentPermissions } from './types';
|
|
25
|
+
export var COOKIE_CONSENT_CATEGORIES = 'cookie_consent_categories';
|
|
26
|
+
export var COOKIE_CONSENT_STATE = 'cookie_consent_state';
|
|
27
|
+
export var DEFAULT_COOKIE_EXPIRATION_DAYS = 365;
|
|
28
|
+
export var CONSENT_UPDATE_EVENT = 'consentUpdate';
|
|
29
|
+
var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
30
|
+
var _useTranslation = useTranslation(),
|
|
31
|
+
t = _useTranslation.t;
|
|
32
|
+
var className = props.className,
|
|
33
|
+
children = props.children,
|
|
34
|
+
_props$title = props.title,
|
|
35
|
+
title = _props$title === void 0 ? t('cookies.title') : _props$title,
|
|
36
|
+
_props$manualText = props.manualText,
|
|
37
|
+
manualText = _props$manualText === void 0 ? t('cookies.manual') : _props$manualText,
|
|
38
|
+
_props$acceptAllText = props.acceptAllText,
|
|
39
|
+
acceptAllText = _props$acceptAllText === void 0 ? t('cookies.acceptAll') : _props$acceptAllText,
|
|
40
|
+
_props$acceptSelectio = props.acceptSelectionText,
|
|
41
|
+
acceptSelectionText = _props$acceptSelectio === void 0 ? t('cookies.acceptSelection') : _props$acceptSelectio,
|
|
42
|
+
_props$onlyNecessaryT = props.onlyNecessaryText,
|
|
43
|
+
onlyNecessaryText = _props$onlyNecessaryT === void 0 ? t('cookies.acceptOnlyNecessary') : _props$onlyNecessaryT,
|
|
44
|
+
_props$cookieContents = props.cookieContentsShowMore,
|
|
45
|
+
cookieContentsShowMore = _props$cookieContents === void 0 ? /*#__PURE__*/React.createElement("div", null, t('cookies.showDetails')) : _props$cookieContents,
|
|
46
|
+
_props$cookieContents2 = props.cookieContentsShowLess,
|
|
47
|
+
cookieContentsShowLess = _props$cookieContents2 === void 0 ? /*#__PURE__*/React.createElement("div", null, t('cookies.hideDetails')) : _props$cookieContents2,
|
|
48
|
+
_props$showAcceptOnly = props.showAcceptOnlyNeeded,
|
|
49
|
+
showAcceptOnlyNeeded = _props$showAcceptOnly === void 0 ? true : _props$showAcceptOnly,
|
|
50
|
+
_props$onAgree = props.onAgree,
|
|
51
|
+
onAgree = _props$onAgree === void 0 ? function () {} : _props$onAgree,
|
|
52
|
+
_props$cookieLevels = props.cookieLevels,
|
|
53
|
+
cookieLevels = _props$cookieLevels === void 0 ? [{
|
|
54
|
+
value: 'necessary',
|
|
55
|
+
label: t('cookies.categories.necessary.label'),
|
|
56
|
+
subLabel: t('cookies.categories.necessary.subLabel'),
|
|
57
|
+
description: t('cookies.categories.necessary.description'),
|
|
58
|
+
disabled: true,
|
|
59
|
+
consentOptions: ['security_storage']
|
|
60
|
+
}, {
|
|
61
|
+
value: 'preferences',
|
|
62
|
+
label: t('cookies.categories.preferences.label'),
|
|
63
|
+
description: t('cookies.categories.preferences.description'),
|
|
64
|
+
disabled: false,
|
|
65
|
+
consentOptions: ['functionality_storage', 'personalization_storage']
|
|
66
|
+
}, {
|
|
67
|
+
value: 'statistics',
|
|
68
|
+
label: t('cookies.categories.statistics.label'),
|
|
69
|
+
description: t('cookies.categories.statistics.description'),
|
|
70
|
+
disabled: false,
|
|
71
|
+
consentOptions: ['analytics_storage']
|
|
72
|
+
}, {
|
|
73
|
+
value: 'marketing',
|
|
74
|
+
label: t('cookies.categories.marketing.label'),
|
|
75
|
+
description: t('cookies.categories.marketing.description'),
|
|
76
|
+
disabled: false,
|
|
77
|
+
consentOptions: ['ad_personalization', 'ad_user_data', 'ad_storage']
|
|
78
|
+
}] : _props$cookieLevels,
|
|
79
|
+
_props$cookieOptions = props.cookieOptions,
|
|
80
|
+
cookieOptions = _props$cookieOptions === void 0 ? {
|
|
81
|
+
days: DEFAULT_COOKIE_EXPIRATION_DAYS,
|
|
82
|
+
path: '/'
|
|
83
|
+
} : _props$cookieOptions,
|
|
84
|
+
_props$version = props.version,
|
|
85
|
+
version = _props$version === void 0 ? '1.0.0' : _props$version,
|
|
86
|
+
_props$cookieDomain = props.cookieDomain,
|
|
87
|
+
cookieDomain = _props$cookieDomain === void 0 ? null : _props$cookieDomain,
|
|
88
|
+
_props$defaultValues = props.defaultValues,
|
|
89
|
+
defaultValues = _props$defaultValues === void 0 ? {
|
|
90
|
+
necessary: true,
|
|
91
|
+
preferences: false,
|
|
92
|
+
statistics: false,
|
|
93
|
+
marketing: false
|
|
94
|
+
} : _props$defaultValues,
|
|
95
|
+
_props$manualHeader = props.manualHeader,
|
|
96
|
+
manualHeader = _props$manualHeader === void 0 ? '' : _props$manualHeader,
|
|
97
|
+
_props$manualButtonCl = props.manualButtonClassname,
|
|
98
|
+
manualButtonClassname = _props$manualButtonCl === void 0 ? 'Button' : _props$manualButtonCl,
|
|
99
|
+
_props$necessaryButto = props.necessaryButtonInverted,
|
|
100
|
+
necessaryButtonInverted = _props$necessaryButto === void 0 ? true : _props$necessaryButto;
|
|
101
|
+
if (!window.dataLayer) {
|
|
102
|
+
window.dataLayer = window.dataLayer || [];
|
|
103
|
+
}
|
|
104
|
+
if (!window.gtag) {
|
|
105
|
+
// eslint-disable-next-line prefer-rest-params
|
|
106
|
+
window.gtag = function () {
|
|
107
|
+
window.dataLayer.push(arguments);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// This is an internal state to check whether we should show the options.
|
|
112
|
+
var _useState = useState(false),
|
|
113
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
114
|
+
manualChoiceVisible = _useState2[0],
|
|
115
|
+
setManualChoiceVisible = _useState2[1];
|
|
116
|
+
// This is an internal state to check whether the user has answered in the current session.
|
|
117
|
+
// It is either null (because we don't know if it was already in the cookies) or true
|
|
118
|
+
var _useState3 = useState(null),
|
|
119
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
120
|
+
answeredInCurrentSession = _useState4[0],
|
|
121
|
+
setAnsweredInCurrentSession = _useState4[1];
|
|
122
|
+
|
|
123
|
+
// Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
124
|
+
// null: unknown
|
|
125
|
+
// STATUS DECLINED (0 as cookie value)
|
|
126
|
+
// STATUS NOT YET ANSWERED (1 as cookie value)
|
|
127
|
+
// STATUS ACCEPTED_ALL (2 as cookie value)
|
|
128
|
+
var _useCookie = useCookie(COOKIE_CONSENT_STATE, LocalConsentStatus.STATUS_DEFAULT),
|
|
129
|
+
_useCookie2 = _slicedToArray(_useCookie, 2),
|
|
130
|
+
didConsent = _useCookie2[0],
|
|
131
|
+
setDidConsent = _useCookie2[1];
|
|
132
|
+
var categories = cookieLevels.map(function (item) {
|
|
133
|
+
return item.value;
|
|
134
|
+
});
|
|
135
|
+
var defaultState = categories.reduce(function (prev, category) {
|
|
136
|
+
// eslint-disable-next-line valid-typeof
|
|
137
|
+
var newPartialState = prev;
|
|
138
|
+
if (defaultValues[category] !== undefined) {
|
|
139
|
+
newPartialState[category] = defaultValues[category];
|
|
140
|
+
} else {
|
|
141
|
+
newPartialState[category] = true;
|
|
142
|
+
}
|
|
143
|
+
return newPartialState;
|
|
144
|
+
}, {});
|
|
145
|
+
|
|
146
|
+
// Default choices for select, this way we can locally manage the state of the form.
|
|
147
|
+
var _useState5 = useState(defaultState),
|
|
148
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
149
|
+
choicesSelected = _useState6[0],
|
|
150
|
+
setChoicesSelected = _useState6[1];
|
|
151
|
+
useEffect(function () {
|
|
152
|
+
// We now know the value of the cookie. If there is no cookie set,
|
|
153
|
+
// immediately set the didConsent state to STATUS_NOT_YET_ANSWERED.
|
|
154
|
+
if (didConsent === LocalConsentStatus.STATUS_DEFAULT) {
|
|
155
|
+
setDidConsent(JSON.stringify({
|
|
156
|
+
status: LocalConsentStatus.STATUS_NOT_YET_ANSWERED,
|
|
157
|
+
version: version
|
|
158
|
+
}), cookieOptions);
|
|
159
|
+
}
|
|
160
|
+
}, [didConsent, cookieOptions, setDidConsent]);
|
|
161
|
+
var isLoading = didConsent === undefined;
|
|
162
|
+
var didConsentContent = typeof didConsent === 'string' && didConsent.length > 0 ? JSON.parse(didConsent) : null;
|
|
163
|
+
var isPrompting = (didConsentContent === null || didConsentContent === void 0 ? void 0 : didConsentContent.status) === LocalConsentStatus.STATUS_NOT_YET_ANSWERED;
|
|
164
|
+
var isAnswered = (didConsentContent === null || didConsentContent === void 0 ? void 0 : didConsentContent.status) === LocalConsentStatus.STATUS_ACCEPTED || (didConsentContent === null || didConsentContent === void 0 ? void 0 : didConsentContent.status) === LocalConsentStatus.STATUS_ONLY_NECESSARY;
|
|
165
|
+
|
|
166
|
+
// This function expands the notification to show the options.
|
|
167
|
+
var displayConsentChoices = function displayConsentChoices(e) {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
setManualChoiceVisible(true);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Build an object of passed consent, send that to google via "update"
|
|
173
|
+
// Set the cookie containing the consent categories and version
|
|
174
|
+
var handleGoogleConsent = function handleGoogleConsent() {
|
|
175
|
+
var selectedConsent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
176
|
+
var selectedCategories = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
177
|
+
var consentEventObject = {};
|
|
178
|
+
Object.values(AvailableConsentPermissions).forEach(function (consentOption) {
|
|
179
|
+
consentEventObject[consentOption] = selectedConsent.indexOf(consentOption) > -1 ? 'granted' : 'denied';
|
|
180
|
+
});
|
|
181
|
+
window.gtag('consent', 'update', consentEventObject);
|
|
182
|
+
window.gtag('event', CONSENT_UPDATE_EVENT);
|
|
183
|
+
Cookies.set(COOKIE_CONSENT_CATEGORIES, JSON.stringify({
|
|
184
|
+
categories: selectedCategories,
|
|
185
|
+
consent: consentEventObject
|
|
186
|
+
}), {
|
|
187
|
+
expires: cookieOptions.days,
|
|
188
|
+
domain: cookieDomain
|
|
189
|
+
});
|
|
190
|
+
setDidConsent(JSON.stringify({
|
|
191
|
+
status: LocalConsentStatus.STATUS_ACCEPTED,
|
|
192
|
+
version: version
|
|
193
|
+
}), cookieOptions);
|
|
194
|
+
setAnsweredInCurrentSession(true);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// On agree clicked, send consent for categories to Google
|
|
198
|
+
// Update cookie and fire agree callback
|
|
199
|
+
var onInternalAgree = function onInternalAgree(choices) {
|
|
200
|
+
var selectedCategories = Object.keys(choices).filter(function (key) {
|
|
201
|
+
return choices[key];
|
|
202
|
+
});
|
|
203
|
+
var selectedConsent = [];
|
|
204
|
+
cookieLevels.forEach(function (cookieLevel) {
|
|
205
|
+
if (selectedCategories.indexOf(cookieLevel.value) > -1) {
|
|
206
|
+
selectedConsent = selectedConsent.concat(cookieLevel.consentOptions);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
handleGoogleConsent(selectedConsent, selectedCategories);
|
|
210
|
+
onAgree({
|
|
211
|
+
selectedCategories: selectedCategories,
|
|
212
|
+
consent: selectedConsent
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// Function for accepting al categories at once.
|
|
217
|
+
var onConsentAll = function onConsentAll() {
|
|
218
|
+
var allCategoriesSelected = categories.reduce(function (prev, category) {
|
|
219
|
+
var newPartialState = prev;
|
|
220
|
+
newPartialState[category] = true;
|
|
221
|
+
return newPartialState;
|
|
222
|
+
}, {});
|
|
223
|
+
onInternalAgree(allCategoriesSelected);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// This function is fired when the accept button is pressed.
|
|
227
|
+
// Also has eventual support for a false case.
|
|
228
|
+
var onConsent = function onConsent(onlyNecessary) {
|
|
229
|
+
return function () {
|
|
230
|
+
if (onlyNecessary === true) {
|
|
231
|
+
onInternalAgree(defaultValues);
|
|
232
|
+
} else {
|
|
233
|
+
onInternalAgree(choicesSelected);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// This function sets the value of the checkmark in the form state.
|
|
239
|
+
var handleChoiceState = function handleChoiceState(event) {
|
|
240
|
+
var _ref = event.target,
|
|
241
|
+
value = _ref.value,
|
|
242
|
+
checked = _ref.checked;
|
|
243
|
+
setChoicesSelected(_objectSpread(_objectSpread({}, choicesSelected), {}, _defineProperty({}, value, checked)));
|
|
244
|
+
};
|
|
245
|
+
var classes = classNames('GoogleConsentCookieBanner', className, {
|
|
246
|
+
'GoogleConsentCookieBanner--prompting': isPrompting,
|
|
247
|
+
'GoogleConsentCookieBanner--loading': isLoading,
|
|
248
|
+
'GoogleConsentCookieBanner--answered': isAnswered,
|
|
249
|
+
// answering refers to the fact that the user has answered in the current session.
|
|
250
|
+
'GoogleConsentCookieBanner--answering': answeredInCurrentSession,
|
|
251
|
+
'GoogleConsentCookieBanner--hidden': isAnswered
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// if it is answered in the current session
|
|
255
|
+
// we still render the cookie but with the --hidden modifier,
|
|
256
|
+
// allowing consumers to apply an animation if desired.
|
|
257
|
+
// In other words, don't render only if a user has
|
|
258
|
+
// answered in a previous session.
|
|
259
|
+
if (isAnswered && !answeredInCurrentSession) {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// This function renders the different options of checkboxes,
|
|
264
|
+
// allowing us to add more checkboxes eventually.
|
|
265
|
+
var renderChoices = function renderChoices() {
|
|
266
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, cookieLevels.map(function (choice) {
|
|
267
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
className: "GoogleConsentCookieBanner__category",
|
|
269
|
+
key: choice.value
|
|
270
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
271
|
+
className: "CheckboxContainer"
|
|
272
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
273
|
+
name: "cookie-categories",
|
|
274
|
+
id: "cookie-category-".concat(choice.value),
|
|
275
|
+
onChange: handleChoiceState,
|
|
276
|
+
label: choice.label,
|
|
277
|
+
subLabel: choice.subLabel,
|
|
278
|
+
value: choice.value,
|
|
279
|
+
checked: choicesSelected[choice.value],
|
|
280
|
+
disabled: choice.disabled
|
|
281
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
className: "GoogleConsentCookieBanner__category__description"
|
|
283
|
+
}, choice.description), choice.contents && typeof choice.contents === 'function' && /*#__PURE__*/React.createElement(Accordion, null, /*#__PURE__*/React.createElement(AccordionItemVariant, {
|
|
284
|
+
title: "",
|
|
285
|
+
buttonOpened: cookieContentsShowLess,
|
|
286
|
+
buttonClosed: cookieContentsShowMore,
|
|
287
|
+
onClick: function onClick() {}
|
|
288
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
289
|
+
className: "GoogleConsentCookieBanner__category__description"
|
|
290
|
+
}, choice.contents()))));
|
|
291
|
+
}));
|
|
292
|
+
};
|
|
293
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
294
|
+
className: classes
|
|
295
|
+
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
|
|
296
|
+
className: "GoogleConsentCookieBanner__content ".concat(manualChoiceVisible ? 'GoogleConsentCookieBanner__content--full-height' : '')
|
|
297
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
298
|
+
className: "row"
|
|
299
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
300
|
+
className: "col-12 GoogleConsentCookieBanner__content_header"
|
|
301
|
+
}, title && /*#__PURE__*/React.createElement("h3", null, title))), !manualChoiceVisible ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
302
|
+
className: "row"
|
|
303
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: "col-12 GoogleConsentCookieBanner__content__message"
|
|
305
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
306
|
+
className: "col-12 GoogleConsentCookieBanner__content__buttons"
|
|
307
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
308
|
+
id: "complete-agree",
|
|
309
|
+
className: "Button--cta",
|
|
310
|
+
primary: true,
|
|
311
|
+
onClick: onConsentAll
|
|
312
|
+
}, acceptAllText), showAcceptOnlyNeeded && /*#__PURE__*/React.createElement(Button, {
|
|
313
|
+
id: "only-necessary-agree",
|
|
314
|
+
className: "Button--cta",
|
|
315
|
+
inverted: necessaryButtonInverted,
|
|
316
|
+
onClick: onConsent(true)
|
|
317
|
+
}, onlyNecessaryText), /*#__PURE__*/React.createElement("button", {
|
|
318
|
+
type: "button",
|
|
319
|
+
className: "GoogleConsentCookieBanner__content__buttons__manual GoogleConsentCookieBanner__content__buttons__manual-agree ".concat(manualButtonClassname),
|
|
320
|
+
onClick: function onClick(e) {
|
|
321
|
+
displayConsentChoices(e);
|
|
322
|
+
}
|
|
323
|
+
}, manualText)))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
324
|
+
className: "GoogleConsentCookieBanner__content__message"
|
|
325
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
className: "GoogleConsentCookieBanner__checkboxes-container"
|
|
327
|
+
}, manualHeader && /*#__PURE__*/React.createElement("div", {
|
|
328
|
+
className: "manualHeader"
|
|
329
|
+
}, manualHeader), renderChoices())), /*#__PURE__*/React.createElement("div", {
|
|
330
|
+
className: "GoogleConsentCookieBanner__content__buttons"
|
|
331
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
332
|
+
className: "Button--cta",
|
|
333
|
+
primary: true,
|
|
334
|
+
onClick: onConsent(false)
|
|
335
|
+
}, acceptSelectionText), /*#__PURE__*/React.createElement(Button, {
|
|
336
|
+
className: "Button--cta",
|
|
337
|
+
inverted: necessaryButtonInverted,
|
|
338
|
+
onClick: onConsentAll
|
|
339
|
+
}, acceptAllText))))));
|
|
340
|
+
};
|
|
341
|
+
export default CookieCompliancePopup;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
@import '../../styles/assets/mixins';
|
|
2
|
+
@import '../../styles/assets/variables';
|
|
3
|
+
|
|
4
|
+
@keyframes slide {
|
|
5
|
+
0% {
|
|
6
|
+
transform: translateX(-50%) translateY(110vh);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
100% {
|
|
10
|
+
transform: translateX(-50%) translateY(0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.GoogleConsentCookieBanner {
|
|
15
|
+
position: fixed;
|
|
16
|
+
z-index: 10000;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
left: 50%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
max-height: 100%;
|
|
21
|
+
|
|
22
|
+
&__content {
|
|
23
|
+
max-height: 80vh;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
|
|
27
|
+
&__message {
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__full-height {
|
|
32
|
+
overflow-y: scroll;
|
|
33
|
+
|
|
34
|
+
@media #{$normal} {
|
|
35
|
+
overflow-y: unset;
|
|
36
|
+
height: auto;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__buttons {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
align-items: center;
|
|
44
|
+
|
|
45
|
+
@media #{$tablet} {
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.Button {
|
|
50
|
+
margin-right: 1rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.GoogleConsentCookieBanner__content__buttons__manual {
|
|
54
|
+
margin-right: 1rem;
|
|
55
|
+
padding: 0;
|
|
56
|
+
font-family: inherit;
|
|
57
|
+
font-size: inherit;
|
|
58
|
+
background: none;
|
|
59
|
+
border: 0;
|
|
60
|
+
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.AccordionItem {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
|
|
70
|
+
&__title__wrapper {
|
|
71
|
+
order: 2;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__title {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&__category {
|
|
81
|
+
display: inline-block;
|
|
82
|
+
margin-bottom: 2rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&--hidden {
|
|
86
|
+
display: none;
|
|
87
|
+
|
|
88
|
+
&__content__full-height {
|
|
89
|
+
position: inherit;
|
|
90
|
+
top: inherit;
|
|
91
|
+
right: inherit;
|
|
92
|
+
bottom: inherit;
|
|
93
|
+
left: inherit;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&--prompting {
|
|
98
|
+
transform: translateX(-50%) translateY(0);
|
|
99
|
+
animation: slide 1s forwards;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&--loading {
|
|
103
|
+
transform: translateX(-50%) translateY(110vh);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare enum LocalConsentStatus {
|
|
2
|
+
STATUS_DEFAULT = "-1",
|
|
3
|
+
STATUS_ONLY_NECESSARY = "0",
|
|
4
|
+
STATUS_NOT_YET_ANSWERED = "1",
|
|
5
|
+
STATUS_ACCEPTED = "2"
|
|
6
|
+
}
|
|
7
|
+
export declare enum AvailableConsentPermissions {
|
|
8
|
+
SECURITY_STORAGE = "security_storage",
|
|
9
|
+
FUNCTIONALITY_STORAGE = "functionality_storage",
|
|
10
|
+
PERSONALISATION_STORAGE = "personalization_storage",
|
|
11
|
+
ANALYTICS_STORAGE = "analytics_storage",
|
|
12
|
+
AD_PERSONALISATION = "ad_personalization",
|
|
13
|
+
AD_USER_DATA = "ad_user_data",
|
|
14
|
+
AD_STORAGE = "ad_storage"
|
|
15
|
+
}
|
|
16
|
+
export declare enum ConsentEventOption {
|
|
17
|
+
GRANTED = "granted",
|
|
18
|
+
DENIED = "denied"
|
|
19
|
+
}
|
|
20
|
+
export interface CategoryDefaultValues extends Record<string, boolean> {
|
|
21
|
+
necessary: boolean;
|
|
22
|
+
preferences: boolean;
|
|
23
|
+
statistics: boolean;
|
|
24
|
+
marketing: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CookieLevel {
|
|
27
|
+
value: string;
|
|
28
|
+
label: string;
|
|
29
|
+
subLabel?: string;
|
|
30
|
+
description: string;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
consentOptions: Array<AvailableConsentPermissions>;
|
|
33
|
+
contents?: Function;
|
|
34
|
+
}
|
|
35
|
+
export interface CookieOptions {
|
|
36
|
+
days: Number;
|
|
37
|
+
path: string;
|
|
38
|
+
}
|
|
39
|
+
export interface ConsentEvent extends Record<string, string | undefined> {
|
|
40
|
+
security_storage?: ConsentEventOption;
|
|
41
|
+
functionality_storage?: ConsentEventOption;
|
|
42
|
+
personalization_storage?: ConsentEventOption;
|
|
43
|
+
analytics_storage?: ConsentEventOption;
|
|
44
|
+
ad_personalization?: ConsentEventOption;
|
|
45
|
+
ad_user_data?: ConsentEventOption;
|
|
46
|
+
ad_storage?: ConsentEventOption;
|
|
47
|
+
}
|
|
48
|
+
export interface CookieCompliancePopupProps {
|
|
49
|
+
className?: string;
|
|
50
|
+
children?: any;
|
|
51
|
+
acceptAllText?: string;
|
|
52
|
+
acceptSelectionText?: string;
|
|
53
|
+
onlyNecessaryText?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
cookieContentsShowMore?: string;
|
|
56
|
+
cookieContentsShowLess?: string;
|
|
57
|
+
manualText?: string;
|
|
58
|
+
manualHeader?: string;
|
|
59
|
+
onAgree?: Function;
|
|
60
|
+
showAcceptOnlyNeeded?: boolean;
|
|
61
|
+
manualButtonClassname?: string;
|
|
62
|
+
necessaryButtonInverted?: boolean;
|
|
63
|
+
cookieLevels?: Array<CookieLevel>;
|
|
64
|
+
defaultValues?: CategoryDefaultValues;
|
|
65
|
+
cookieDomain?: string;
|
|
66
|
+
cookieOptions?: CookieOptions;
|
|
67
|
+
version?: string;
|
|
68
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export var LocalConsentStatus = /*#__PURE__*/function (LocalConsentStatus) {
|
|
2
|
+
LocalConsentStatus["STATUS_DEFAULT"] = "-1";
|
|
3
|
+
LocalConsentStatus["STATUS_ONLY_NECESSARY"] = "0";
|
|
4
|
+
LocalConsentStatus["STATUS_NOT_YET_ANSWERED"] = "1";
|
|
5
|
+
LocalConsentStatus["STATUS_ACCEPTED"] = "2";
|
|
6
|
+
return LocalConsentStatus;
|
|
7
|
+
}({});
|
|
8
|
+
export var AvailableConsentPermissions = /*#__PURE__*/function (AvailableConsentPermissions) {
|
|
9
|
+
AvailableConsentPermissions["SECURITY_STORAGE"] = "security_storage";
|
|
10
|
+
AvailableConsentPermissions["FUNCTIONALITY_STORAGE"] = "functionality_storage";
|
|
11
|
+
AvailableConsentPermissions["PERSONALISATION_STORAGE"] = "personalization_storage";
|
|
12
|
+
AvailableConsentPermissions["ANALYTICS_STORAGE"] = "analytics_storage";
|
|
13
|
+
AvailableConsentPermissions["AD_PERSONALISATION"] = "ad_personalization";
|
|
14
|
+
AvailableConsentPermissions["AD_USER_DATA"] = "ad_user_data";
|
|
15
|
+
AvailableConsentPermissions["AD_STORAGE"] = "ad_storage";
|
|
16
|
+
return AvailableConsentPermissions;
|
|
17
|
+
}({});
|
|
18
|
+
export var ConsentEventOption = /*#__PURE__*/function (ConsentEventOption) {
|
|
19
|
+
ConsentEventOption["GRANTED"] = "granted";
|
|
20
|
+
ConsentEventOption["DENIED"] = "denied";
|
|
21
|
+
return ConsentEventOption;
|
|
22
|
+
}({});
|
|
@@ -98,3 +98,50 @@ $material-icon-styles: (
|
|
|
98
98
|
width: 1em;
|
|
99
99
|
@include icon-color(#000000);
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
/// gridIconToMaterialIcon
|
|
104
|
+
///
|
|
105
|
+
/// Mixin to overwrite old icon-implementations.
|
|
106
|
+
///
|
|
107
|
+
/// @param {String} $icon-name - name of the icon.
|
|
108
|
+
/// Needs to correspond with the file name of the icon.
|
|
109
|
+
///
|
|
110
|
+
/// @param {String} $style - Material Icon style
|
|
111
|
+
///
|
|
112
|
+
/// @param {Boolean} $custom - Are we overwwriting with a
|
|
113
|
+
/// custom icon?
|
|
114
|
+
///
|
|
115
|
+
/// @example scss
|
|
116
|
+
/// .icon-arrow {
|
|
117
|
+
/// @include gridIconToMaterialIcon('download');
|
|
118
|
+
/// }
|
|
119
|
+
///
|
|
120
|
+
/// @example scss
|
|
121
|
+
/// .icon-download {
|
|
122
|
+
/// @include gridIconToMaterialIcon($icon-name: 'custom_download', $custom: true);
|
|
123
|
+
/// }
|
|
124
|
+
///
|
|
125
|
+
@mixin gridIconToMaterialIcon(
|
|
126
|
+
$icon-name: null,
|
|
127
|
+
$style: 'outlined',
|
|
128
|
+
$custom: false,
|
|
129
|
+
) {
|
|
130
|
+
@if not $icon-name {
|
|
131
|
+
@error 'an icon name is required'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@if not $custom {
|
|
135
|
+
background: url('~@material-design-icons/svg/#{$style}/#{$icon-name}.svg');
|
|
136
|
+
} @else {
|
|
137
|
+
background: url('#{$custom-icon-path}/#{$icon-name}.svg');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
display: block;
|
|
141
|
+
width: 1em;
|
|
142
|
+
height: 1em;
|
|
143
|
+
background-color: transparent;
|
|
144
|
+
background-repeat: no-repeat;
|
|
145
|
+
background-position: 0 0;
|
|
146
|
+
background-size: 1em;
|
|
147
|
+
}
|
|
@@ -6,8 +6,9 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import c from 'classnames';
|
|
9
|
-
import '
|
|
9
|
+
import urlParse from 'url';
|
|
10
10
|
import { isValidImage, useImageLoader, calculateTargetSrc } from '../helpers';
|
|
11
|
+
import './style.scss';
|
|
11
12
|
|
|
12
13
|
// extend html img props
|
|
13
14
|
|
|
@@ -44,19 +45,30 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
|
|
|
44
45
|
if (!container) return;
|
|
45
46
|
var resizeObserver = new ResizeObserver(function (entries) {
|
|
46
47
|
var widthAfterResize = entries[0].contentRect.width;
|
|
48
|
+
var newSrcRequired = false;
|
|
47
49
|
if (image.width < widthAfterResize) {
|
|
48
50
|
var newTargetSrc = calculateTargetSrc(image.width, validatedSources, fallbackImage);
|
|
49
51
|
if (targetSrc !== newTargetSrc) {
|
|
50
52
|
setTargetSrc(newTargetSrc);
|
|
53
|
+
newSrcRequired = true;
|
|
51
54
|
}
|
|
52
55
|
} else {
|
|
53
56
|
var _newTargetSrc = calculateTargetSrc(widthAfterResize, validatedSources, fallbackImage);
|
|
54
57
|
if (targetSrc !== _newTargetSrc) {
|
|
55
58
|
setTargetSrc(_newTargetSrc);
|
|
59
|
+
newSrcRequired = true;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
if (status === 'PENDING') {
|
|
59
63
|
setStatus('INITIAL_BREAKPOINT_CALCULATED');
|
|
64
|
+
|
|
65
|
+
// We always load the smallest source. If that's also the source we need
|
|
66
|
+
// set INITIAL_LOADED directly.
|
|
67
|
+
// With caching turned on, the onLoad function on the img would only trigger once
|
|
68
|
+
// and thus never unblur the smallest
|
|
69
|
+
if (!newSrcRequired) {
|
|
70
|
+
setStatus('INITIAL_LOADED');
|
|
71
|
+
}
|
|
60
72
|
}
|
|
61
73
|
});
|
|
62
74
|
resizeObserver.observe(container);
|
|
@@ -68,7 +80,13 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
|
|
|
68
80
|
}, [fallbackImage, status, targetSrc, validatedSources]);
|
|
69
81
|
var loadedUrl = useImageLoader(fallbackImage, targetSrc, imageRef);
|
|
70
82
|
function onErrorFallback(e) {
|
|
71
|
-
|
|
83
|
+
// Make sure that both URLs are absolute URLs, so we can compare them.
|
|
84
|
+
// Otherwise this error callback will constantly be thrown.
|
|
85
|
+
var link = document.createElement('a');
|
|
86
|
+
link.href = e.target.src;
|
|
87
|
+
var link2 = document.createElement('a');
|
|
88
|
+
link2.href = fallbackImage;
|
|
89
|
+
if (link.href !== link2.href) {
|
|
72
90
|
e.target.src = fallbackImage;
|
|
73
91
|
}
|
|
74
92
|
}
|
|
@@ -86,7 +104,11 @@ var AdaptivePicture = function AdaptivePicture(_ref) {
|
|
|
86
104
|
if (_onLoad) {
|
|
87
105
|
_onLoad(e);
|
|
88
106
|
}
|
|
89
|
-
|
|
107
|
+
|
|
108
|
+
// To handle relative URLs
|
|
109
|
+
var current = urlParse.parse(e.target.src);
|
|
110
|
+
var target = urlParse.parse(targetSrc);
|
|
111
|
+
if (status === 'INITIAL_BREAKPOINT_CALCULATED' && current.pathname === target.pathname) {
|
|
90
112
|
setStatus('INITIAL_LOADED');
|
|
91
113
|
}
|
|
92
114
|
},
|
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { useEffect, useState } from 'react';
|
|
9
|
-
var breakpoints = [
|
|
9
|
+
var breakpoints = [256, 512, 1024, 2048];
|
|
10
10
|
var mimeTypes = {
|
|
11
11
|
'.gif': 'image/gif',
|
|
12
12
|
'.png': 'image/png',
|