authscape 1.0.700 → 1.0.704
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/index.js +241 -1
- package/package.json +1 -1
- package/src/components/AuthScapeApp.js +31 -0
- package/src/components/GDPRConsentDialog.js +238 -0
- package/dist/Container.module.css +0 -103
- package/dist/Item.module.css +0 -135
package/index.js
CHANGED
|
@@ -64,6 +64,22 @@ function AuthScapeApp(_ref) {
|
|
|
64
64
|
var queryRef = searchParams.get('ref');
|
|
65
65
|
var queryCode = searchParams.get('code');
|
|
66
66
|
var pathname = (0, _navigation.usePathname)();
|
|
67
|
+
(0, _react.useEffect)(function () {
|
|
68
|
+
var stored = localStorage.getItem("gdpr-consent");
|
|
69
|
+
if (stored) {
|
|
70
|
+
var prefs = JSON.parse(stored);
|
|
71
|
+
console.log("User previously consented:", prefs);
|
|
72
|
+
// optional: send to your backend
|
|
73
|
+
}
|
|
74
|
+
}, []);
|
|
75
|
+
var handleConsentAccepted = function handleConsentAccepted(prefs) {
|
|
76
|
+
console.log("Consent accepted:", prefs);
|
|
77
|
+
// optional: send to backend
|
|
78
|
+
};
|
|
79
|
+
var handleConsentRejected = function handleConsentRejected() {
|
|
80
|
+
console.log("Consent rejected");
|
|
81
|
+
// disable analytics scripts, etc.
|
|
82
|
+
};
|
|
67
83
|
var signInValidator = /*#__PURE__*/function () {
|
|
68
84
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryCode) {
|
|
69
85
|
var codeVerifier, headers, queryString, response, domainHost, redirectUri;
|
|
@@ -447,7 +463,23 @@ function AuthScapeApp(_ref) {
|
|
|
447
463
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_head["default"], null, /*#__PURE__*/_react["default"].createElement("meta", {
|
|
448
464
|
name: "viewport",
|
|
449
465
|
content: "width=device-width, initial-scale=0.86, maximum-scale=5.0, minimum-scale=0.86"
|
|
450
|
-
})), /*#__PURE__*/_react["default"].createElement(
|
|
466
|
+
})), /*#__PURE__*/_react["default"].createElement(GDPRConsentDialog, {
|
|
467
|
+
onAccept: handleConsentAccepted,
|
|
468
|
+
onReject: handleConsentRejected,
|
|
469
|
+
enableAnalytics: true,
|
|
470
|
+
enableMarketing: true,
|
|
471
|
+
additionalPrivacyFeatures: [{
|
|
472
|
+
id: "danceParty",
|
|
473
|
+
title: "Dance Party",
|
|
474
|
+
description: "Hello world this is about the feature",
|
|
475
|
+
checked: true
|
|
476
|
+
}, {
|
|
477
|
+
id: "frog",
|
|
478
|
+
title: "Able to see Frogs",
|
|
479
|
+
description: "Frogs will appear on your screen",
|
|
480
|
+
checked: true
|
|
481
|
+
}]
|
|
482
|
+
}), /*#__PURE__*/_react["default"].createElement(_styles.ThemeProvider, {
|
|
451
483
|
theme: muiTheme
|
|
452
484
|
}, frontEndLoadedState != null && frontEndLoadedState && pathname != "/signin-oidc" && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, layout != null && layout({
|
|
453
485
|
children: /*#__PURE__*/_react["default"].createElement(Component, _extends({}, pageProps, {
|
|
@@ -2331,6 +2363,214 @@ var FileUploader = exports.FileUploader = function FileUploader(_ref) {
|
|
|
2331
2363
|
};
|
|
2332
2364
|
"use strict";
|
|
2333
2365
|
|
|
2366
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2367
|
+
value: true
|
|
2368
|
+
});
|
|
2369
|
+
exports.GDPRConsentDialog = void 0;
|
|
2370
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
2371
|
+
var _material = require("@mui/material");
|
|
2372
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
2373
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
2374
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2375
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2376
|
+
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."); }
|
|
2377
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
2378
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
2379
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
2380
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
2381
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2382
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2383
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
2384
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
2385
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
2386
|
+
var GDPRConsentDialog = exports.GDPRConsentDialog = function GDPRConsentDialog(_ref) {
|
|
2387
|
+
var onAccept = _ref.onAccept,
|
|
2388
|
+
onReject = _ref.onReject,
|
|
2389
|
+
_ref$enableAnalytics = _ref.enableAnalytics,
|
|
2390
|
+
enableAnalytics = _ref$enableAnalytics === void 0 ? true : _ref$enableAnalytics,
|
|
2391
|
+
_ref$enableMarketing = _ref.enableMarketing,
|
|
2392
|
+
enableMarketing = _ref$enableMarketing === void 0 ? true : _ref$enableMarketing,
|
|
2393
|
+
_ref$additionalPrivac = _ref.additionalPrivacyFeatures,
|
|
2394
|
+
additionalPrivacyFeatures = _ref$additionalPrivac === void 0 ? [] : _ref$additionalPrivac;
|
|
2395
|
+
var initialPreferences = _objectSpread({
|
|
2396
|
+
necessary: true,
|
|
2397
|
+
analytics: enableAnalytics,
|
|
2398
|
+
marketing: enableMarketing
|
|
2399
|
+
}, Object.fromEntries(additionalPrivacyFeatures.map(function (item) {
|
|
2400
|
+
var _item$checked;
|
|
2401
|
+
return [item.id, (_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false];
|
|
2402
|
+
})));
|
|
2403
|
+
var _useState = (0, _react.useState)(false),
|
|
2404
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2405
|
+
open = _useState2[0],
|
|
2406
|
+
setOpen = _useState2[1];
|
|
2407
|
+
var _useState3 = (0, _react.useState)(false),
|
|
2408
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2409
|
+
customize = _useState4[0],
|
|
2410
|
+
setCustomize = _useState4[1];
|
|
2411
|
+
var _useState5 = (0, _react.useState)(initialPreferences),
|
|
2412
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
2413
|
+
preferences = _useState6[0],
|
|
2414
|
+
setPreferences = _useState6[1];
|
|
2415
|
+
(0, _react.useEffect)(function () {
|
|
2416
|
+
var savedConsent = localStorage.getItem("gdpr-consent");
|
|
2417
|
+
if (!savedConsent) {
|
|
2418
|
+
setOpen(true);
|
|
2419
|
+
}
|
|
2420
|
+
}, []);
|
|
2421
|
+
var saveConsentAndClose = function saveConsentAndClose(prefs) {
|
|
2422
|
+
localStorage.setItem("gdpr-consent", JSON.stringify(prefs));
|
|
2423
|
+
if (onAccept) onAccept(prefs);
|
|
2424
|
+
setOpen(false);
|
|
2425
|
+
};
|
|
2426
|
+
var handleAcceptAll = function handleAcceptAll() {
|
|
2427
|
+
var allPrefs = _objectSpread({
|
|
2428
|
+
necessary: true,
|
|
2429
|
+
analytics: enableAnalytics,
|
|
2430
|
+
marketing: enableMarketing
|
|
2431
|
+
}, Object.fromEntries(additionalPrivacyFeatures.map(function (item) {
|
|
2432
|
+
return [item.id, true];
|
|
2433
|
+
})));
|
|
2434
|
+
saveConsentAndClose(allPrefs);
|
|
2435
|
+
};
|
|
2436
|
+
var handleRejectAll = function handleRejectAll() {
|
|
2437
|
+
var rejectedPrefs = _objectSpread({
|
|
2438
|
+
necessary: true,
|
|
2439
|
+
analytics: false,
|
|
2440
|
+
marketing: false
|
|
2441
|
+
}, Object.fromEntries(additionalPrivacyFeatures.map(function (item) {
|
|
2442
|
+
return [item.id, false];
|
|
2443
|
+
})));
|
|
2444
|
+
localStorage.setItem("gdpr-consent", JSON.stringify(rejectedPrefs));
|
|
2445
|
+
if (onReject) onReject();
|
|
2446
|
+
setOpen(false);
|
|
2447
|
+
};
|
|
2448
|
+
var handleAcceptSelected = function handleAcceptSelected() {
|
|
2449
|
+
saveConsentAndClose(preferences);
|
|
2450
|
+
};
|
|
2451
|
+
var handleCheckboxChange = function handleCheckboxChange(key) {
|
|
2452
|
+
return function (event) {
|
|
2453
|
+
setPreferences(function (prev) {
|
|
2454
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, event.target.checked));
|
|
2455
|
+
});
|
|
2456
|
+
};
|
|
2457
|
+
};
|
|
2458
|
+
if (!open) return null;
|
|
2459
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Paper, {
|
|
2460
|
+
elevation: 4,
|
|
2461
|
+
sx: {
|
|
2462
|
+
position: "fixed",
|
|
2463
|
+
bottom: 0,
|
|
2464
|
+
left: 0,
|
|
2465
|
+
right: 0,
|
|
2466
|
+
p: 2,
|
|
2467
|
+
zIndex: 1300,
|
|
2468
|
+
backgroundColor: "#fff",
|
|
2469
|
+
borderTop: "1px solid #ccc"
|
|
2470
|
+
}
|
|
2471
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2472
|
+
display: "flex",
|
|
2473
|
+
flexDirection: "column",
|
|
2474
|
+
alignItems: "flex-start",
|
|
2475
|
+
gap: 2
|
|
2476
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Box, null, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2477
|
+
variant: "subtitle1",
|
|
2478
|
+
fontWeight: "bold"
|
|
2479
|
+
}, "We value your privacy"), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2480
|
+
variant: "body2"
|
|
2481
|
+
}, "We use cookies to enhance your experience, for analytics and marketing. You can accept all, reject all, or customize your preferences.")), /*#__PURE__*/_react["default"].createElement(_material.Collapse, {
|
|
2482
|
+
"in": customize
|
|
2483
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2484
|
+
mb: 2
|
|
2485
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2486
|
+
mb: 1
|
|
2487
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
2488
|
+
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
2489
|
+
checked: true,
|
|
2490
|
+
disabled: true
|
|
2491
|
+
}),
|
|
2492
|
+
label: "Necessary (always required)"
|
|
2493
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2494
|
+
variant: "caption",
|
|
2495
|
+
color: "textSecondary",
|
|
2496
|
+
sx: {
|
|
2497
|
+
ml: 4
|
|
2498
|
+
}
|
|
2499
|
+
}, "Required to enable core site functionality such as security, authentication, and accessibility.")), enableAnalytics && /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2500
|
+
mb: 1
|
|
2501
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
2502
|
+
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
2503
|
+
checked: preferences.analytics,
|
|
2504
|
+
onChange: handleCheckboxChange("analytics")
|
|
2505
|
+
}),
|
|
2506
|
+
label: "Analytics"
|
|
2507
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2508
|
+
variant: "caption",
|
|
2509
|
+
color: "textSecondary",
|
|
2510
|
+
sx: {
|
|
2511
|
+
ml: 4
|
|
2512
|
+
}
|
|
2513
|
+
}, "Helps us understand how you use our site so we can improve it. For example, tracking page visits or feature usage.")), enableMarketing && /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2514
|
+
mb: 1
|
|
2515
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
2516
|
+
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
2517
|
+
checked: preferences.marketing,
|
|
2518
|
+
onChange: handleCheckboxChange("marketing")
|
|
2519
|
+
}),
|
|
2520
|
+
label: "Marketing"
|
|
2521
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2522
|
+
variant: "caption",
|
|
2523
|
+
color: "textSecondary",
|
|
2524
|
+
sx: {
|
|
2525
|
+
ml: 4
|
|
2526
|
+
}
|
|
2527
|
+
}, "Allows us to show personalized ads and promotions based on your behavior and interactions.")), additionalPrivacyFeatures.map(function (feature) {
|
|
2528
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2529
|
+
key: feature.id,
|
|
2530
|
+
mb: 1
|
|
2531
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.FormControlLabel, {
|
|
2532
|
+
control: /*#__PURE__*/_react["default"].createElement(_material.Checkbox, {
|
|
2533
|
+
checked: preferences[feature.id] || false,
|
|
2534
|
+
onChange: handleCheckboxChange(feature.id)
|
|
2535
|
+
}),
|
|
2536
|
+
label: feature.title
|
|
2537
|
+
}), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
2538
|
+
variant: "caption",
|
|
2539
|
+
color: "textSecondary",
|
|
2540
|
+
sx: {
|
|
2541
|
+
ml: 4
|
|
2542
|
+
}
|
|
2543
|
+
}, feature.description));
|
|
2544
|
+
}))), /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
2545
|
+
display: "flex",
|
|
2546
|
+
gap: 1,
|
|
2547
|
+
flexWrap: "wrap"
|
|
2548
|
+
}, !customize ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2549
|
+
variant: "contained",
|
|
2550
|
+
color: "primary",
|
|
2551
|
+
onClick: handleAcceptAll
|
|
2552
|
+
}, "Accept All"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2553
|
+
variant: "outlined",
|
|
2554
|
+
color: "error",
|
|
2555
|
+
onClick: handleRejectAll
|
|
2556
|
+
}, "Reject All"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2557
|
+
variant: "text",
|
|
2558
|
+
onClick: function onClick() {
|
|
2559
|
+
return setCustomize(true);
|
|
2560
|
+
}
|
|
2561
|
+
}, "Customize Preferences")) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2562
|
+
variant: "contained",
|
|
2563
|
+
color: "primary",
|
|
2564
|
+
onClick: handleAcceptSelected
|
|
2565
|
+
}, "Save Preferences"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
2566
|
+
variant: "text",
|
|
2567
|
+
onClick: function onClick() {
|
|
2568
|
+
return setCustomize(false);
|
|
2569
|
+
}
|
|
2570
|
+
}, "Cancel")))));
|
|
2571
|
+
};
|
|
2572
|
+
"use strict";
|
|
2573
|
+
|
|
2334
2574
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2335
2575
|
Object.defineProperty(exports, "__esModule", {
|
|
2336
2576
|
value: true
|
package/package.json
CHANGED
|
@@ -32,6 +32,26 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
|
|
|
32
32
|
|
|
33
33
|
const pathname = usePathname();
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const stored = localStorage.getItem("gdpr-consent");
|
|
38
|
+
if (stored) {
|
|
39
|
+
const prefs = JSON.parse(stored);
|
|
40
|
+
console.log("User previously consented:", prefs);
|
|
41
|
+
// optional: send to your backend
|
|
42
|
+
}
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
const handleConsentAccepted = (prefs) => {
|
|
46
|
+
console.log("Consent accepted:", prefs);
|
|
47
|
+
// optional: send to backend
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const handleConsentRejected = () => {
|
|
51
|
+
console.log("Consent rejected");
|
|
52
|
+
// disable analytics scripts, etc.
|
|
53
|
+
};
|
|
54
|
+
|
|
35
55
|
const signInValidator = async (queryCode) => {
|
|
36
56
|
|
|
37
57
|
if (queryCodeUsed.current != queryCode)
|
|
@@ -472,6 +492,17 @@ export function AuthScapeApp ({Component, layout, loadingLayout, pageProps, muiT
|
|
|
472
492
|
|
|
473
493
|
</Head>
|
|
474
494
|
|
|
495
|
+
<GDPRConsentDialog
|
|
496
|
+
onAccept={handleConsentAccepted}
|
|
497
|
+
onReject={handleConsentRejected}
|
|
498
|
+
enableAnalytics={true}
|
|
499
|
+
enableMarketing={true}
|
|
500
|
+
additionalPrivacyFeatures={[
|
|
501
|
+
{id: "danceParty", title: "Dance Party", description: "Hello world this is about the feature", checked: true },
|
|
502
|
+
{id: "frog", title: "Able to see Frogs", description: "Frogs will appear on your screen", checked: true }
|
|
503
|
+
]}
|
|
504
|
+
/>
|
|
505
|
+
|
|
475
506
|
<ThemeProvider theme={muiTheme}>
|
|
476
507
|
{frontEndLoadedState != null && frontEndLoadedState && pathname != "/signin-oidc" &&
|
|
477
508
|
<>
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
Checkbox,
|
|
6
|
+
FormControlLabel,
|
|
7
|
+
Typography,
|
|
8
|
+
Paper,
|
|
9
|
+
Collapse,
|
|
10
|
+
} from "@mui/material";
|
|
11
|
+
|
|
12
|
+
export const GDPRConsentDialog = ({
|
|
13
|
+
onAccept,
|
|
14
|
+
onReject,
|
|
15
|
+
enableAnalytics = true,
|
|
16
|
+
enableMarketing = true,
|
|
17
|
+
additionalPrivacyFeatures = []
|
|
18
|
+
}) => {
|
|
19
|
+
const initialPreferences = {
|
|
20
|
+
necessary: true,
|
|
21
|
+
analytics: enableAnalytics,
|
|
22
|
+
marketing: enableMarketing,
|
|
23
|
+
...Object.fromEntries(
|
|
24
|
+
additionalPrivacyFeatures.map((item) => [item.id, item.checked ?? false])
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const [open, setOpen] = useState(false);
|
|
29
|
+
const [customize, setCustomize] = useState(false);
|
|
30
|
+
const [preferences, setPreferences] = useState(initialPreferences);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const savedConsent = localStorage.getItem("gdpr-consent");
|
|
34
|
+
if (!savedConsent) {
|
|
35
|
+
setOpen(true);
|
|
36
|
+
}
|
|
37
|
+
}, []);
|
|
38
|
+
|
|
39
|
+
const saveConsentAndClose = (prefs) => {
|
|
40
|
+
localStorage.setItem("gdpr-consent", JSON.stringify(prefs));
|
|
41
|
+
if (onAccept) onAccept(prefs);
|
|
42
|
+
setOpen(false);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleAcceptAll = () => {
|
|
46
|
+
const allPrefs = {
|
|
47
|
+
necessary: true,
|
|
48
|
+
analytics: enableAnalytics,
|
|
49
|
+
marketing: enableMarketing,
|
|
50
|
+
...Object.fromEntries(
|
|
51
|
+
additionalPrivacyFeatures.map((item) => [item.id, true])
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
saveConsentAndClose(allPrefs);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const handleRejectAll = () => {
|
|
58
|
+
const rejectedPrefs = {
|
|
59
|
+
necessary: true,
|
|
60
|
+
analytics: false,
|
|
61
|
+
marketing: false,
|
|
62
|
+
...Object.fromEntries(
|
|
63
|
+
additionalPrivacyFeatures.map((item) => [item.id, false])
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
localStorage.setItem("gdpr-consent", JSON.stringify(rejectedPrefs));
|
|
67
|
+
if (onReject) onReject();
|
|
68
|
+
setOpen(false);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleAcceptSelected = () => {
|
|
72
|
+
saveConsentAndClose(preferences);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleCheckboxChange = (key) => (event) => {
|
|
76
|
+
setPreferences((prev) => ({
|
|
77
|
+
...prev,
|
|
78
|
+
[key]: event.target.checked,
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
if (!open) return null;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Paper
|
|
86
|
+
elevation={4}
|
|
87
|
+
sx={{
|
|
88
|
+
position: "fixed",
|
|
89
|
+
bottom: 0,
|
|
90
|
+
left: 0,
|
|
91
|
+
right: 0,
|
|
92
|
+
p: 2,
|
|
93
|
+
zIndex: 1300,
|
|
94
|
+
backgroundColor: "#fff",
|
|
95
|
+
borderTop: "1px solid #ccc",
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<Box
|
|
99
|
+
display="flex"
|
|
100
|
+
flexDirection="column"
|
|
101
|
+
alignItems="flex-start"
|
|
102
|
+
gap={2}
|
|
103
|
+
>
|
|
104
|
+
<Box>
|
|
105
|
+
<Typography variant="subtitle1" fontWeight="bold">
|
|
106
|
+
We value your privacy
|
|
107
|
+
</Typography>
|
|
108
|
+
<Typography variant="body2">
|
|
109
|
+
We use cookies to enhance your experience, for analytics and
|
|
110
|
+
marketing. You can accept all, reject all, or customize your
|
|
111
|
+
preferences.
|
|
112
|
+
</Typography>
|
|
113
|
+
</Box>
|
|
114
|
+
|
|
115
|
+
<Collapse in={customize}>
|
|
116
|
+
<Box mb={2}>
|
|
117
|
+
<Box mb={1}>
|
|
118
|
+
<FormControlLabel
|
|
119
|
+
control={<Checkbox checked disabled />}
|
|
120
|
+
label="Necessary (always required)"
|
|
121
|
+
/>
|
|
122
|
+
<br/>
|
|
123
|
+
<Typography variant="caption" color="textSecondary" sx={{ ml: 4 }}>
|
|
124
|
+
Required to enable core site functionality such as security,
|
|
125
|
+
authentication, and accessibility.
|
|
126
|
+
</Typography>
|
|
127
|
+
</Box>
|
|
128
|
+
|
|
129
|
+
{enableAnalytics && (
|
|
130
|
+
<Box mb={1}>
|
|
131
|
+
<FormControlLabel
|
|
132
|
+
control={
|
|
133
|
+
<Checkbox
|
|
134
|
+
checked={preferences.analytics}
|
|
135
|
+
onChange={handleCheckboxChange("analytics")}
|
|
136
|
+
/>
|
|
137
|
+
}
|
|
138
|
+
label="Analytics"
|
|
139
|
+
/>
|
|
140
|
+
<br/>
|
|
141
|
+
<Typography
|
|
142
|
+
variant="caption"
|
|
143
|
+
color="textSecondary"
|
|
144
|
+
sx={{ ml: 4 }}
|
|
145
|
+
>
|
|
146
|
+
Helps us understand how you use our site so we can improve it.
|
|
147
|
+
For example, tracking page visits or feature usage.
|
|
148
|
+
</Typography>
|
|
149
|
+
</Box>
|
|
150
|
+
)}
|
|
151
|
+
|
|
152
|
+
{enableMarketing && (
|
|
153
|
+
<Box mb={1}>
|
|
154
|
+
<FormControlLabel
|
|
155
|
+
control={
|
|
156
|
+
<Checkbox
|
|
157
|
+
checked={preferences.marketing}
|
|
158
|
+
onChange={handleCheckboxChange("marketing")}
|
|
159
|
+
/>
|
|
160
|
+
}
|
|
161
|
+
label="Marketing"
|
|
162
|
+
/>
|
|
163
|
+
<br/>
|
|
164
|
+
<Typography
|
|
165
|
+
variant="caption"
|
|
166
|
+
color="textSecondary"
|
|
167
|
+
sx={{ ml: 4 }}
|
|
168
|
+
>
|
|
169
|
+
Allows us to show personalized ads and promotions based on your
|
|
170
|
+
behavior and interactions.
|
|
171
|
+
</Typography>
|
|
172
|
+
</Box>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{additionalPrivacyFeatures.map((feature) => (
|
|
176
|
+
<Box key={feature.id} mb={1}>
|
|
177
|
+
<FormControlLabel
|
|
178
|
+
control={
|
|
179
|
+
<Checkbox
|
|
180
|
+
checked={preferences[feature.id] || false}
|
|
181
|
+
onChange={handleCheckboxChange(feature.id)}
|
|
182
|
+
/>
|
|
183
|
+
}
|
|
184
|
+
label={feature.title}
|
|
185
|
+
/>
|
|
186
|
+
<br/>
|
|
187
|
+
<Typography
|
|
188
|
+
variant="caption"
|
|
189
|
+
color="textSecondary"
|
|
190
|
+
sx={{ ml: 4 }}
|
|
191
|
+
>
|
|
192
|
+
{feature.description}
|
|
193
|
+
</Typography>
|
|
194
|
+
</Box>
|
|
195
|
+
))}
|
|
196
|
+
</Box>
|
|
197
|
+
</Collapse>
|
|
198
|
+
|
|
199
|
+
<Box display="flex" gap={1} flexWrap="wrap">
|
|
200
|
+
{!customize ? (
|
|
201
|
+
<>
|
|
202
|
+
<Button
|
|
203
|
+
variant="contained"
|
|
204
|
+
color="primary"
|
|
205
|
+
onClick={handleAcceptAll}
|
|
206
|
+
>
|
|
207
|
+
Accept All
|
|
208
|
+
</Button>
|
|
209
|
+
<Button
|
|
210
|
+
variant="outlined"
|
|
211
|
+
color="error"
|
|
212
|
+
onClick={handleRejectAll}
|
|
213
|
+
>
|
|
214
|
+
Reject All
|
|
215
|
+
</Button>
|
|
216
|
+
<Button variant="text" onClick={() => setCustomize(true)}>
|
|
217
|
+
Customize Preferences
|
|
218
|
+
</Button>
|
|
219
|
+
</>
|
|
220
|
+
) : (
|
|
221
|
+
<>
|
|
222
|
+
<Button
|
|
223
|
+
variant="contained"
|
|
224
|
+
color="primary"
|
|
225
|
+
onClick={handleAcceptSelected}
|
|
226
|
+
>
|
|
227
|
+
Save Preferences
|
|
228
|
+
</Button>
|
|
229
|
+
<Button variant="text" onClick={() => setCustomize(false)}>
|
|
230
|
+
Cancel
|
|
231
|
+
</Button>
|
|
232
|
+
</>
|
|
233
|
+
)}
|
|
234
|
+
</Box>
|
|
235
|
+
</Box>
|
|
236
|
+
</Paper>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
.Container {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
grid-auto-rows: max-content;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
appearance: none;
|
|
8
|
-
outline: none;
|
|
9
|
-
min-width: 350px;
|
|
10
|
-
margin: 10px;
|
|
11
|
-
border-radius: 5px;
|
|
12
|
-
min-height: 200px;
|
|
13
|
-
transition: background-color 350ms ease;
|
|
14
|
-
background-color: rgba(246, 246, 246, 1);
|
|
15
|
-
border: 1px solid rgba(0, 0, 0, 0.05);
|
|
16
|
-
font-size: 1em;
|
|
17
|
-
|
|
18
|
-
.ul {
|
|
19
|
-
display: grid;
|
|
20
|
-
grid-gap: 10px;
|
|
21
|
-
grid-template-columns: repeat(var(--columns, 1), 1fr);
|
|
22
|
-
list-style: none;
|
|
23
|
-
padding: 20px;
|
|
24
|
-
margin: 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&.scrollable {
|
|
28
|
-
.ul {
|
|
29
|
-
overflow-y: auto;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.placeholder {
|
|
34
|
-
justify-content: center;
|
|
35
|
-
align-items: center;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
color: rgba(0, 0, 0, 0.5);
|
|
38
|
-
background-color: transparent;
|
|
39
|
-
border-style: dashed;
|
|
40
|
-
border-color: rgba(0, 0, 0, 0.08);
|
|
41
|
-
|
|
42
|
-
/* &:hover {
|
|
43
|
-
border-color: rgba(0, 0, 0, 0.15);
|
|
44
|
-
} */
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.hover {
|
|
48
|
-
background-color: rgb(235, 235, 235, 1);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&.unstyled {
|
|
52
|
-
overflow: visible;
|
|
53
|
-
background-color: transparent !important;
|
|
54
|
-
border: none !important;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&.horizontal {
|
|
58
|
-
width: 100%;
|
|
59
|
-
|
|
60
|
-
.ul {
|
|
61
|
-
grid-auto-flow: column;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.shadow {
|
|
66
|
-
box-shadow: 0 1px 10px 0 rgba(34, 33, 81, 0.1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* &:focus-visible {
|
|
70
|
-
border-color: transparent;
|
|
71
|
-
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0), 0 0px 0px 2px #4c9ffe;
|
|
72
|
-
} */
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.Header {
|
|
76
|
-
display: flex;
|
|
77
|
-
padding: 5px 20px;
|
|
78
|
-
padding-right: 8px;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: space-between;
|
|
81
|
-
background-color: #fff;
|
|
82
|
-
border-top-left-radius: 5px;
|
|
83
|
-
border-top-right-radius: 5px;
|
|
84
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
85
|
-
|
|
86
|
-
/* &:hover {
|
|
87
|
-
.Actions > * {
|
|
88
|
-
opacity: 1 !important;
|
|
89
|
-
}
|
|
90
|
-
} */
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/* .Actions {
|
|
94
|
-
display: flex;
|
|
95
|
-
|
|
96
|
-
> *:first-child:not(:last-child) {
|
|
97
|
-
opacity: 0;
|
|
98
|
-
|
|
99
|
-
&:focus-visible {
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
} */
|
package/dist/Item.module.css
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
@keyframes pop {
|
|
2
|
-
0% {
|
|
3
|
-
transform: scale(1);
|
|
4
|
-
box-shadow: var(--box-shadow);
|
|
5
|
-
}
|
|
6
|
-
100% {
|
|
7
|
-
transform: scale(var(--scale));
|
|
8
|
-
box-shadow: var(--box-shadow-picked-up);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@keyframes fadeIn {
|
|
13
|
-
0% {
|
|
14
|
-
opacity: 0;
|
|
15
|
-
}
|
|
16
|
-
100% {
|
|
17
|
-
opacity: 1;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.Wrapper {
|
|
22
|
-
display: flex;
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0)
|
|
25
|
-
scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
|
|
26
|
-
transform-origin: 0 0;
|
|
27
|
-
touch-action: manipulation;
|
|
28
|
-
|
|
29
|
-
&.fadeIn {
|
|
30
|
-
animation: fadeIn 500ms ease;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.dragOverlay {
|
|
34
|
-
--scale: 1.05;
|
|
35
|
-
--box-shadow: $box-shadow;
|
|
36
|
-
--box-shadow-picked-up: $box-shadow-border,
|
|
37
|
-
-1px 0 15px 0 rgba(34, 33, 81, 0.01),
|
|
38
|
-
0px 15px 15px 0 rgba(34, 33, 81, 0.25);
|
|
39
|
-
z-index: 999;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.Item {
|
|
44
|
-
position: relative;
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-grow: 1;
|
|
47
|
-
align-items: center;
|
|
48
|
-
padding: 18px 20px;
|
|
49
|
-
background-color: #fff;
|
|
50
|
-
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
51
|
-
outline: none;
|
|
52
|
-
border-radius: calc(4px / var(--scale-x, 1));
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
list-style: none;
|
|
55
|
-
transform-origin: 50% 50%;
|
|
56
|
-
|
|
57
|
-
-webkit-tap-highlight-color: transparent;
|
|
58
|
-
|
|
59
|
-
color: #333;
|
|
60
|
-
font-weight: 400;
|
|
61
|
-
font-size: 1rem;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
|
|
64
|
-
transform: scale(var(--scale, 1));
|
|
65
|
-
transition: box-shadow 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
|
|
66
|
-
|
|
67
|
-
/* &:focus-visible {
|
|
68
|
-
box-shadow: 0 0px 4px 1px #4c9ffe, 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
69
|
-
} */
|
|
70
|
-
|
|
71
|
-
&:not(.withHandle) {
|
|
72
|
-
touch-action: manipulation;
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&.dragging:not(.dragOverlay) {
|
|
77
|
-
opacity: var(--dragging-opacity, 0.5);
|
|
78
|
-
z-index: 0;
|
|
79
|
-
|
|
80
|
-
/* &:focus {
|
|
81
|
-
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
82
|
-
} */
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&.disabled {
|
|
86
|
-
color: #999;
|
|
87
|
-
background-color: #f1f1f1;
|
|
88
|
-
/* &:focus {
|
|
89
|
-
box-shadow: 0 0px 4px 1px rgba(0, 0, 0, 0.1), 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
90
|
-
} */
|
|
91
|
-
cursor: not-allowed;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&.dragOverlay {
|
|
95
|
-
cursor: inherit;
|
|
96
|
-
/* box-shadow: 0 0px 6px 2px $focused-outline-color; */
|
|
97
|
-
animation: pop 200ms cubic-bezier(0.18, 0.67, 0.6, 1.22);
|
|
98
|
-
transform: scale(var(--scale));
|
|
99
|
-
box-shadow: var(--box-shadow-picked-up);
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&.color:before {
|
|
104
|
-
content: '';
|
|
105
|
-
position: absolute;
|
|
106
|
-
top: 50%;
|
|
107
|
-
transform: translateY(-50%);
|
|
108
|
-
left: 0;
|
|
109
|
-
height: 100%;
|
|
110
|
-
width: 3px;
|
|
111
|
-
display: block;
|
|
112
|
-
border-top-left-radius: 3px;
|
|
113
|
-
border-bottom-left-radius: 3px;
|
|
114
|
-
background-color: var(--color);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* &:hover {
|
|
118
|
-
.Remove {
|
|
119
|
-
visibility: visible;
|
|
120
|
-
}
|
|
121
|
-
} */
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.Remove {
|
|
125
|
-
visibility: hidden;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.Actions {
|
|
129
|
-
display: flex;
|
|
130
|
-
align-self: flex-start;
|
|
131
|
-
margin-top: -12px;
|
|
132
|
-
margin-left: auto;
|
|
133
|
-
margin-bottom: -15px;
|
|
134
|
-
margin-right: -10px;
|
|
135
|
-
}
|