@uncinc/uncinc-react-kitchen-sink 2.16.10 → 2.16.12
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/CookieWrapper/index.d.ts +8 -0
- package/dist/components/CookieWrapper/index.js +63 -0
- package/dist/components/CookieWrapper/style.scss +7 -0
- package/dist/components/GoogleConsentCookieBanner/index.js +0 -9
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { Button, Icon } from '..';
|
|
10
|
+
import useCookieStore from '../../hooks/useCookieStore';
|
|
11
|
+
import { COOKIE_CONSENT_CATEGORIES, COOKIE_CONSENT_STATE } from '../GoogleConsentCookieBanner';
|
|
12
|
+
import { LocalConsentStatus } from '../GoogleConsentCookieBanner/types';
|
|
13
|
+
import './style.scss';
|
|
14
|
+
var CookieWrapper = function CookieWrapper(_ref) {
|
|
15
|
+
var children = _ref.children,
|
|
16
|
+
url = _ref.url;
|
|
17
|
+
var _useTranslation = useTranslation(),
|
|
18
|
+
t = _useTranslation.t;
|
|
19
|
+
var _useCookieStore = useCookieStore(COOKIE_CONSENT_CATEGORIES),
|
|
20
|
+
_useCookieStore2 = _slicedToArray(_useCookieStore, 1),
|
|
21
|
+
categories = _useCookieStore2[0];
|
|
22
|
+
var _useCookieStore3 = useCookieStore(COOKIE_CONSENT_STATE),
|
|
23
|
+
_useCookieStore4 = _slicedToArray(_useCookieStore3, 2),
|
|
24
|
+
consent = _useCookieStore4[0],
|
|
25
|
+
setConsent = _useCookieStore4[1];
|
|
26
|
+
var consentStatus = categories && typeof categories === 'string' ? JSON.parse(categories).consent : null;
|
|
27
|
+
var editCookies = function editCookies() {
|
|
28
|
+
setConsent(JSON.stringify({
|
|
29
|
+
status: LocalConsentStatus.STATUS_EDITING,
|
|
30
|
+
version: '1.0.0'
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// If Analytical and Marketing cookies are not accepted, show the CookieWrapper,
|
|
35
|
+
// to prevent externally loaded content from placing cookies.
|
|
36
|
+
var blockContent = !consent || !categories || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.analytics_storage) !== 'granted' || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_personalization) !== 'granted' || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_user_data) !== 'granted' || (consentStatus === null || consentStatus === void 0 ? void 0 : consentStatus.ad_storage) !== 'granted';
|
|
37
|
+
if (blockContent) {
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "CookieWrapper"
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
41
|
+
flair: "outlined",
|
|
42
|
+
name: "cookie"
|
|
43
|
+
}), /*#__PURE__*/React.createElement("h3", {
|
|
44
|
+
className: "CookieWrapper__title"
|
|
45
|
+
}, t('cookie.wrapper.title', 'Cookies required')), /*#__PURE__*/React.createElement("p", {
|
|
46
|
+
className: "CookieWrapper__description"
|
|
47
|
+
}, t('cookie.wrapper.description', 'Analytics and Marketing cookies are required to display this content.')), /*#__PURE__*/React.createElement(Button, {
|
|
48
|
+
className: "CookieWrapper__edit",
|
|
49
|
+
primary: false,
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
return editCookies();
|
|
52
|
+
}
|
|
53
|
+
}, t('cookie.wrapper.button', 'Change cookiesettings')), url && /*#__PURE__*/React.createElement(Button, {
|
|
54
|
+
href: url,
|
|
55
|
+
className: "CookieWrapper__url",
|
|
56
|
+
primary: false,
|
|
57
|
+
target: "_blank",
|
|
58
|
+
rel: "noreferrer"
|
|
59
|
+
}, t('cookie.wrapper.url', 'Watch video in new tab')));
|
|
60
|
+
}
|
|
61
|
+
return children;
|
|
62
|
+
};
|
|
63
|
+
export default CookieWrapper;
|
|
@@ -267,15 +267,6 @@ var CookieCompliancePopup = function CookieCompliancePopup(props) {
|
|
|
267
267
|
'GoogleConsentCookieBanner--editing': isEditing
|
|
268
268
|
});
|
|
269
269
|
|
|
270
|
-
// if it is answered in the current session
|
|
271
|
-
// we still render the cookie but with the --hidden modifier,
|
|
272
|
-
// allowing consumers to apply an animation if desired.
|
|
273
|
-
// In other words, don't render only if a user has
|
|
274
|
-
// answered in a previous session.
|
|
275
|
-
if (isAnswered && !answeredInCurrentSession) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
270
|
// This function renders the different options of checkboxes,
|
|
280
271
|
// allowing us to add more checkboxes eventually.
|
|
281
272
|
var renderChoices = function renderChoices() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from "./Button";
|
|
2
|
+
export { default as Icon } from "./Icon";
|
|
2
3
|
export { default as WysiwygField } from "./WysiwygField";
|
|
3
4
|
export { default as MediaPlayer } from "./MediaPlayer";
|
|
4
5
|
export { default as FormAddressAutocomplete } from "./Form/AddressAutocomplete";
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Button } from './Button';
|
|
2
|
+
export { default as Icon } from './Icon';
|
|
2
3
|
export { default as WysiwygField } from './WysiwygField';
|
|
3
4
|
export { default as MediaPlayer } from './MediaPlayer';
|
|
4
5
|
export { default as FormAddressAutocomplete } from './Form/AddressAutocomplete';
|
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,7 @@ export { default as TitleWithText } from "./components/TitleWithText";
|
|
|
51
51
|
export { default as TableRender } from "./components/TableRender";
|
|
52
52
|
export { default as ApiAutocomplete } from "./components/ApiAutocomplete";
|
|
53
53
|
export { default as Cookie } from "./components/Cookie";
|
|
54
|
+
export { default as CookieWrapper } from "./components/CookieWrapper";
|
|
54
55
|
export { default as GoogleConsentCookieBanner } from "./components/GoogleConsentCookieBanner";
|
|
55
56
|
export { default as CookieCategoryContents } from "./components/GoogleConsentCookieBanner/CookieCategoryContents";
|
|
56
57
|
export { default as CookieCategoryContentsPartners } from "./components/GoogleConsentCookieBanner/CookieCategoryContentsPartners";
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ export { default as TableRender } from './components/TableRender';
|
|
|
58
58
|
// Organisms
|
|
59
59
|
export { default as ApiAutocomplete } from './components/ApiAutocomplete';
|
|
60
60
|
export { default as Cookie } from './components/Cookie';
|
|
61
|
+
export { default as CookieWrapper } from './components/CookieWrapper';
|
|
61
62
|
export { default as GoogleConsentCookieBanner } from './components/GoogleConsentCookieBanner';
|
|
62
63
|
export { default as CookieCategoryContents } from './components/GoogleConsentCookieBanner/CookieCategoryContents';
|
|
63
64
|
export { default as CookieCategoryContentsPartners } from './components/GoogleConsentCookieBanner/CookieCategoryContentsPartners';
|