@uncinc/uncinc-react-kitchen-sink 2.8.4 → 2.8.9
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/Cookie/Checkbox/style.scss +0 -1
- package/dist/components/Dialog/DialogDrawerStory/index.d.ts +3 -0
- package/dist/components/Dialog/DialogDrawerStory/index.js +81 -0
- package/dist/components/Dialog/DialogDrawerStory/story.scss +39 -0
- package/dist/components/Dialog/DialogHookStory/index.js +63 -12
- package/dist/components/Dialog/index.d.ts +10 -0
- package/dist/components/Dialog/index.js +39 -8
- package/dist/components/Dialog/style.scss +1 -2
- package/dist/components/Download/index.d.ts +1 -1
- 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 +338 -0
- package/dist/components/GoogleConsentCookieBanner/style.scss +105 -0
- package/dist/components/GoogleConsentCookieBanner/types.d.ts +67 -0
- package/dist/components/GoogleConsentCookieBanner/types.js +22 -0
- package/dist/components/Icon/style.scss +53 -53
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/SearchKit/SearchPage/index.js +1 -1
- package/dist/components/Tag/index.d.ts +5 -3
- package/dist/components/Tag/index.js +45 -19
- package/dist/components/Tag/style.scss +3 -3
- package/dist/config/i18next/locales/nl.json +33 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/organisms/Downloads/index.d.ts +1 -1
- package/dist/organisms/Text/index.d.ts +3 -2
- package/dist/organisms/Text/index.js +3 -2
- package/package.json +13 -11
|
@@ -0,0 +1,338 @@
|
|
|
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
|
+
if (!window.dataLayer) {
|
|
100
|
+
window.dataLayer = window.dataLayer || [];
|
|
101
|
+
}
|
|
102
|
+
if (!window.gtag) {
|
|
103
|
+
window.gtag = function () {
|
|
104
|
+
window.dataLayer.push(arguments.length <= 0 ? undefined : arguments[0]);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// This is an internal state to check whether we should show the options.
|
|
109
|
+
var _useState = useState(false),
|
|
110
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
111
|
+
manualChoiceVisible = _useState2[0],
|
|
112
|
+
setManualChoiceVisible = _useState2[1];
|
|
113
|
+
// This is an internal state to check whether the user has answered in the current session.
|
|
114
|
+
// It is either null (because we don't know if it was already in the cookies) or true
|
|
115
|
+
var _useState3 = useState(null),
|
|
116
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
117
|
+
answeredInCurrentSession = _useState4[0],
|
|
118
|
+
setAnsweredInCurrentSession = _useState4[1];
|
|
119
|
+
|
|
120
|
+
// Cookie stating if the cookie has already been accepted. Uses the following states:
|
|
121
|
+
// null: unknown
|
|
122
|
+
// STATUS DECLINED (0 as cookie value)
|
|
123
|
+
// STATUS NOT YET ANSWERED (1 as cookie value)
|
|
124
|
+
// STATUS ACCEPTED_ALL (2 as cookie value)
|
|
125
|
+
var _useCookie = useCookie(COOKIE_CONSENT_STATE, LocalConsentStatus.STATUS_DEFAULT),
|
|
126
|
+
_useCookie2 = _slicedToArray(_useCookie, 2),
|
|
127
|
+
didConsent = _useCookie2[0],
|
|
128
|
+
setDidConsent = _useCookie2[1];
|
|
129
|
+
var categories = cookieLevels.map(function (item) {
|
|
130
|
+
return item.value;
|
|
131
|
+
});
|
|
132
|
+
var defaultState = categories.reduce(function (prev, category) {
|
|
133
|
+
// eslint-disable-next-line valid-typeof
|
|
134
|
+
var newPartialState = prev;
|
|
135
|
+
if (defaultValues[category] !== undefined) {
|
|
136
|
+
newPartialState[category] = defaultValues[category];
|
|
137
|
+
} else {
|
|
138
|
+
newPartialState[category] = true;
|
|
139
|
+
}
|
|
140
|
+
return newPartialState;
|
|
141
|
+
}, {});
|
|
142
|
+
|
|
143
|
+
// Default choices for select, this way we can locally manage the state of the form.
|
|
144
|
+
var _useState5 = useState(defaultState),
|
|
145
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
146
|
+
choicesSelected = _useState6[0],
|
|
147
|
+
setChoicesSelected = _useState6[1];
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
// We now know the value of the cookie. If there is no cookie set,
|
|
150
|
+
// immediately set the didConsent state to STATUS_NOT_YET_ANSWERED.
|
|
151
|
+
if (didConsent === LocalConsentStatus.STATUS_DEFAULT) {
|
|
152
|
+
setDidConsent(JSON.stringify({
|
|
153
|
+
status: LocalConsentStatus.STATUS_NOT_YET_ANSWERED,
|
|
154
|
+
version: version
|
|
155
|
+
}), cookieOptions);
|
|
156
|
+
}
|
|
157
|
+
}, [didConsent, cookieOptions, setDidConsent]);
|
|
158
|
+
var isLoading = didConsent === undefined;
|
|
159
|
+
var didConsentContent = typeof didConsent === 'string' && didConsent.length > 0 ? JSON.parse(didConsent) : null;
|
|
160
|
+
var isPrompting = (didConsentContent === null || didConsentContent === void 0 ? void 0 : didConsentContent.status) === LocalConsentStatus.STATUS_NOT_YET_ANSWERED;
|
|
161
|
+
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;
|
|
162
|
+
|
|
163
|
+
// This function expands the notification to show the options.
|
|
164
|
+
var displayConsentChoices = function displayConsentChoices(e) {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
setManualChoiceVisible(true);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// Build an object of passed consent, send that to google via "update"
|
|
170
|
+
// Set the cookie containing the consent categories and version
|
|
171
|
+
var handleGoogleConsent = function handleGoogleConsent() {
|
|
172
|
+
var selectedConsent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
173
|
+
var selectedCategories = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
174
|
+
var consentEventObject = {};
|
|
175
|
+
Object.values(AvailableConsentPermissions).forEach(function (consentOption) {
|
|
176
|
+
consentEventObject[consentOption] = selectedConsent.indexOf(consentOption) > -1 ? 'granted' : 'denied';
|
|
177
|
+
});
|
|
178
|
+
window.gtag('consent', 'update', consentEventObject);
|
|
179
|
+
window.gtag('event', CONSENT_UPDATE_EVENT);
|
|
180
|
+
Cookies.set(COOKIE_CONSENT_CATEGORIES, JSON.stringify({
|
|
181
|
+
categories: selectedCategories,
|
|
182
|
+
consent: consentEventObject
|
|
183
|
+
}), {
|
|
184
|
+
expires: cookieOptions.days,
|
|
185
|
+
domain: cookieDomain
|
|
186
|
+
});
|
|
187
|
+
setDidConsent(JSON.stringify({
|
|
188
|
+
status: LocalConsentStatus.STATUS_ACCEPTED,
|
|
189
|
+
version: version
|
|
190
|
+
}), cookieOptions);
|
|
191
|
+
setAnsweredInCurrentSession(true);
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// On agree clicked, send consent for categories to Google
|
|
195
|
+
// Update cookie and fire agree callback
|
|
196
|
+
var onInternalAgree = function onInternalAgree(choices) {
|
|
197
|
+
var selectedCategories = Object.keys(choices).filter(function (key) {
|
|
198
|
+
return choices[key];
|
|
199
|
+
});
|
|
200
|
+
var selectedConsent = [];
|
|
201
|
+
cookieLevels.forEach(function (cookieLevel) {
|
|
202
|
+
if (selectedCategories.indexOf(cookieLevel.value) > -1) {
|
|
203
|
+
selectedConsent = selectedConsent.concat(cookieLevel.consentOptions);
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
handleGoogleConsent(selectedConsent, selectedCategories);
|
|
207
|
+
onAgree({
|
|
208
|
+
selectedCategories: selectedCategories,
|
|
209
|
+
consent: selectedConsent
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// Function for accepting al categories at once.
|
|
214
|
+
var onConsentAll = function onConsentAll() {
|
|
215
|
+
var allCategoriesSelected = categories.reduce(function (prev, category) {
|
|
216
|
+
var newPartialState = prev;
|
|
217
|
+
newPartialState[category] = true;
|
|
218
|
+
return newPartialState;
|
|
219
|
+
}, {});
|
|
220
|
+
onInternalAgree(allCategoriesSelected);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// This function is fired when the accept button is pressed.
|
|
224
|
+
// Also has eventual support for a false case.
|
|
225
|
+
var onConsent = function onConsent(onlyNecessary) {
|
|
226
|
+
return function () {
|
|
227
|
+
if (onlyNecessary === true) {
|
|
228
|
+
onInternalAgree(defaultValues);
|
|
229
|
+
} else {
|
|
230
|
+
onInternalAgree(choicesSelected);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// This function sets the value of the checkmark in the form state.
|
|
236
|
+
var handleChoiceState = function handleChoiceState(event) {
|
|
237
|
+
var _ref = event.target,
|
|
238
|
+
value = _ref.value,
|
|
239
|
+
checked = _ref.checked;
|
|
240
|
+
setChoicesSelected(_objectSpread(_objectSpread({}, choicesSelected), {}, _defineProperty({}, value, checked)));
|
|
241
|
+
};
|
|
242
|
+
var classes = classNames('GoogleConsentCookieBanner', className, {
|
|
243
|
+
'GoogleConsentCookieBanner--prompting': isPrompting,
|
|
244
|
+
'GoogleConsentCookieBanner--loading': isLoading,
|
|
245
|
+
'GoogleConsentCookieBanner--answered': isAnswered,
|
|
246
|
+
// answering refers to the fact that the user has answered in the current session.
|
|
247
|
+
'GoogleConsentCookieBanner--answering': answeredInCurrentSession,
|
|
248
|
+
'GoogleConsentCookieBanner--hidden': isAnswered
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// if it is answered in the current session
|
|
252
|
+
// we still render the cookie but with the --hidden modifier,
|
|
253
|
+
// allowing consumers to apply an animation if desired.
|
|
254
|
+
// In other words, don't render only if a user has
|
|
255
|
+
// answered in a previous session.
|
|
256
|
+
if (isAnswered && !answeredInCurrentSession) {
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// This function renders the different options of checkboxes,
|
|
261
|
+
// allowing us to add more checkboxes eventually.
|
|
262
|
+
var renderChoices = function renderChoices() {
|
|
263
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, cookieLevels.map(function (choice) {
|
|
264
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
265
|
+
className: "GoogleConsentCookieBanner__category",
|
|
266
|
+
key: choice.value
|
|
267
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
268
|
+
className: "CheckboxContainer"
|
|
269
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
270
|
+
name: "cookie-categories",
|
|
271
|
+
id: "cookie-category-".concat(choice.value),
|
|
272
|
+
onChange: handleChoiceState,
|
|
273
|
+
label: choice.label,
|
|
274
|
+
subLabel: choice.subLabel,
|
|
275
|
+
value: choice.value,
|
|
276
|
+
checked: choicesSelected[choice.value],
|
|
277
|
+
disabled: choice.disabled
|
|
278
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
279
|
+
className: "GoogleConsentCookieBanner__category__description"
|
|
280
|
+
}, choice.description), choice.contents && typeof choice.contents === 'function' && /*#__PURE__*/React.createElement(Accordion, null, /*#__PURE__*/React.createElement(AccordionItemVariant, {
|
|
281
|
+
title: "",
|
|
282
|
+
buttonOpened: cookieContentsShowLess,
|
|
283
|
+
buttonClosed: cookieContentsShowMore,
|
|
284
|
+
onClick: function onClick() {}
|
|
285
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
className: "GoogleConsentCookieBanner__category__description"
|
|
287
|
+
}, choice.contents()))));
|
|
288
|
+
}));
|
|
289
|
+
};
|
|
290
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
291
|
+
className: classes
|
|
292
|
+
}, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement("div", {
|
|
293
|
+
className: "GoogleConsentCookieBanner__content ".concat(manualChoiceVisible ? 'GoogleConsentCookieBanner__content--full-height' : '')
|
|
294
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
295
|
+
className: "row"
|
|
296
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: "col-12 GoogleConsentCookieBanner__content_header"
|
|
298
|
+
}, title && /*#__PURE__*/React.createElement("h3", null, title))), !manualChoiceVisible ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
299
|
+
className: "row"
|
|
300
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: "col-12 GoogleConsentCookieBanner__content__message"
|
|
302
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
303
|
+
className: "col-12 GoogleConsentCookieBanner__content__buttons"
|
|
304
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
305
|
+
id: "complete-agree",
|
|
306
|
+
className: "Button--cta",
|
|
307
|
+
primary: true,
|
|
308
|
+
onClick: onConsentAll
|
|
309
|
+
}, acceptAllText), showAcceptOnlyNeeded && /*#__PURE__*/React.createElement(Button, {
|
|
310
|
+
id: "only-necessary-agree",
|
|
311
|
+
className: "Button--cta",
|
|
312
|
+
inverted: true,
|
|
313
|
+
onClick: onConsent(true)
|
|
314
|
+
}, onlyNecessaryText), /*#__PURE__*/React.createElement("button", {
|
|
315
|
+
type: "button",
|
|
316
|
+
className: "GoogleConsentCookieBanner__content__buttons__manual GoogleConsentCookieBanner__content__buttons__manual-agree ".concat(manualButtonClassname),
|
|
317
|
+
onClick: function onClick(e) {
|
|
318
|
+
displayConsentChoices(e);
|
|
319
|
+
}
|
|
320
|
+
}, manualText)))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
321
|
+
className: "GoogleConsentCookieBanner__content__message"
|
|
322
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
323
|
+
className: "GoogleConsentCookieBanner__checkboxes-container"
|
|
324
|
+
}, manualHeader && /*#__PURE__*/React.createElement("div", {
|
|
325
|
+
className: "manualHeader"
|
|
326
|
+
}, manualHeader), renderChoices())), /*#__PURE__*/React.createElement("div", {
|
|
327
|
+
className: "GoogleConsentCookieBanner__content__buttons"
|
|
328
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
329
|
+
className: "Button--cta",
|
|
330
|
+
primary: true,
|
|
331
|
+
onClick: onConsent(false)
|
|
332
|
+
}, acceptSelectionText), /*#__PURE__*/React.createElement(Button, {
|
|
333
|
+
className: "Button--cta",
|
|
334
|
+
inverted: true,
|
|
335
|
+
onClick: onConsentAll
|
|
336
|
+
}, acceptAllText))))));
|
|
337
|
+
};
|
|
338
|
+
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,67 @@
|
|
|
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
|
+
cookieLevels?: Array<CookieLevel>;
|
|
63
|
+
defaultValues?: CategoryDefaultValues;
|
|
64
|
+
cookieDomain?: string;
|
|
65
|
+
cookieOptions?: CookieOptions;
|
|
66
|
+
version?: string;
|
|
67
|
+
}
|
|
@@ -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
|
+
}({});
|
|
@@ -7,36 +7,36 @@
|
|
|
7
7
|
$custom-icon-path: '' !default;
|
|
8
8
|
|
|
9
9
|
$material-icon-names: (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
arrow_forward,
|
|
11
|
+
chevron_right,
|
|
12
|
+
download,
|
|
13
|
+
filter_list,
|
|
14
|
+
info,
|
|
15
|
+
check,
|
|
16
|
+
radio,
|
|
17
|
+
) !default;
|
|
18
18
|
|
|
19
19
|
$material-icon-styles: (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
filled,
|
|
21
|
+
outlined,
|
|
22
|
+
round,
|
|
23
|
+
sharp,
|
|
24
|
+
two-tone
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
@mixin icon-color($color: #000000, $opacity: 1) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
$r: calc(color.red($color) / 255);
|
|
29
|
+
$g: calc(color.green($color) / 255);
|
|
30
|
+
$b: calc(color.blue($color) / 255);
|
|
31
|
+
$a: $opacity;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
// grayscale fallback if SVG from data url is not supported
|
|
34
|
+
$lightness: color.lightness($color);
|
|
35
|
+
filter: saturate(0%) brightness(0%) invert($lightness) opacity($opacity);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
// color filter
|
|
38
|
+
$svg-filter-id: "recolor";
|
|
39
|
+
filter: url('data:image/svg+xml;utf8,\
|
|
40
40
|
<svg xmlns="http://www.w3.org/2000/svg">\
|
|
41
41
|
<filter id="#{$svg-filter-id}" color-interpolation-filters="sRGB">\
|
|
42
42
|
<feColorMatrix type="matrix" values="\
|
|
@@ -51,36 +51,18 @@ $material-icon-styles: (
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
@mixin unset-icon-color() {
|
|
54
|
-
|
|
54
|
+
filter: none;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
@mixin generateMaterialIconClasses() {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
@for $styleIndex from 1 through length($material-icon-styles) {
|
|
59
|
+
$style: list.nth($material-icon-styles, $styleIndex);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
@for $nameIndex from 1 through length($material-icon-names) {
|
|
62
|
+
$name: list.nth($material-icon-names, $nameIndex);
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
font-size: 100%;
|
|
67
|
-
vertical-align: middle;
|
|
68
|
-
text-indent: -9999px;
|
|
69
|
-
overflow: hidden;
|
|
70
|
-
background-position: 0 0;
|
|
71
|
-
background-size: 1em;
|
|
72
|
-
background-repeat: no-repeat;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@mixin generateCustomIconClasses() {
|
|
79
|
-
@for $nameIndex from 1 through length($custom-icon-names) {
|
|
80
|
-
$name: list.nth($custom-icon-names, $nameIndex);
|
|
81
|
-
|
|
82
|
-
.Icon-#{$name} {
|
|
83
|
-
background: url('#{$custom-icon-path}/#{$name}.svg');
|
|
64
|
+
.Icon-#{$style}-#{$name} {
|
|
65
|
+
background: url('~@material-design-icons/svg/#{$style}/#{$name}.svg');
|
|
84
66
|
font-size: 100%;
|
|
85
67
|
vertical-align: middle;
|
|
86
68
|
text-indent: -9999px;
|
|
@@ -91,10 +73,28 @@ $material-icon-styles: (
|
|
|
91
73
|
}
|
|
92
74
|
}
|
|
93
75
|
}
|
|
94
|
-
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@mixin generateCustomIconClasses() {
|
|
79
|
+
@for $nameIndex from 1 through length($custom-icon-names) {
|
|
80
|
+
$name: list.nth($custom-icon-names, $nameIndex);
|
|
81
|
+
|
|
82
|
+
.Icon-#{$name} {
|
|
83
|
+
background: url('#{$custom-icon-path}/#{$name}.svg');
|
|
84
|
+
font-size: 100%;
|
|
85
|
+
vertical-align: middle;
|
|
86
|
+
text-indent: -9999px;
|
|
87
|
+
overflow: hidden;
|
|
88
|
+
background-position: 0 0;
|
|
89
|
+
background-size: 1em;
|
|
90
|
+
background-repeat: no-repeat;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
95
|
|
|
96
96
|
.Icon {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
97
|
+
height: 1em;
|
|
98
|
+
width: 1em;
|
|
99
|
+
@include icon-color(#000000);
|
|
100
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function Pagination({ currentPage, totalPages, pageRangeDisplayed, marginPagesDisplayed, setCurrentPage, previousLabel, nextLabel, containerClassName, disabledClassName, activeClassName, breakClassName, showWhenOnePage, controlled, scrollToTop, scrollToTopOffset, scrollToTopBehavior }: {
|
|
1
|
+
export function Pagination({ currentPage, totalPages, pageRangeDisplayed, marginPagesDisplayed, setCurrentPage, previousLabel, nextLabel, containerClassName, disabledClassName, activeClassName, breakClassName, showWhenOnePage, controlled, scrollToTop, scrollToTopOffset, scrollToTopBehavior, }: {
|
|
2
2
|
currentPage: any;
|
|
3
3
|
totalPages: any;
|
|
4
4
|
pageRangeDisplayed: any;
|