@micha.bigler/ui-core-micha 4.34.0 → 4.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +12 -9
- package/dist/auth/UserMenu.js +2 -12
- package/dist/i18n/privacyTranslations.js +0 -17
- package/dist/index.js +0 -1
- package/dist/pages/AccountPage.js +17 -13
- package/dist/privacy/PrivacyBanner.js +13 -7
- package/dist/privacy/PrivacyFooterLinks.js +2 -2
- package/dist/privacy/PrivacyProvider.js +20 -12
- package/dist/privacy/PrivacySettingsLink.js +1 -1
- package/dist/privacy/PublicFooter.js +28 -30
- package/dist/theme/kitSxRegistry.js +1 -5
- package/package.json +1 -1
- package/dist/privacy/PrivacySettings.js +0 -89
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.35.1 - UCM-PRIV-6
|
|
4
|
+
|
|
5
|
+
`PublicFooter` is compact on phones: below the `sm` breakpoint the identity block (logo, tagline, copyright) is hidden,
|
|
6
|
+
the links sit in one centred, tightly spaced wrapping row (smaller type, 28 px rows), so the footer no longer takes
|
|
7
|
+
three tall rows. From `sm` up it stays one line. No API change.
|
|
8
|
+
|
|
9
|
+
## 4.35.0 - UCM-PRIV-6
|
|
10
|
+
|
|
11
|
+
Removal, released as a minor because no consumer imports the removed names and all consumers pin exact versions: the
|
|
12
|
+
detailed privacy settings dialog is gone. `PrivacySettingsDialog` and `PrivacySettingsPanel` are no longer
|
|
13
|
+
exported, `UserMenu` no longer takes a `legal` prop and shows no legal or privacy entries, and `usePrivacy()` no longer
|
|
14
|
+
returns `settingsOpen` or `closeSettings`. The only privacy choices are the banner's two buttons ("Necessary only" /
|
|
15
|
+
"Allow all", applied to every optional purpose). `openSettings()` and `PrivacySettingsLink` keep their names and now
|
|
16
|
+
re-show that banner, so a choice can be changed later from the footer; they appear only when the app has optional
|
|
17
|
+
purposes (`usePrivacy().hasOptionalPurposes`). The banner has no "Settings" button and carries the privacy notice link.
|
|
18
|
+
`AccountPage` in `privacyMode="central"` shows the same two buttons in its profile section (replacing the 4.34.0 inline
|
|
19
|
+
panel). `PublicFooter` is one compact line (identity left, legal links and the settings entry right, wrapping on narrow
|
|
20
|
+
screens, `mt: auto` so it sits at the bottom of a column-flex page). Migration: remove `legal` from `UserMenu` call sites
|
|
21
|
+
and any header or menu entry that duplicates the footer; no consumer imported the removed exports.
|
|
22
|
+
|
|
3
23
|
## 4.34.0 - UCM-PRIV-5
|
|
4
24
|
|
|
5
25
|
With `privacyMode="central"`, `AccountPage` now renders the privacy choices (the same panel as the settings dialog,
|
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ The privacy and cookie consent controls and their submitted values remain availa
|
|
|
18
18
|
|
|
19
19
|
## Shared privacy choices (opt-in)
|
|
20
20
|
|
|
21
|
-
Hosts using `django-core-micha` >= 3.22.0 can adopt `PrivacyProvider`, `PrivacyBanner`, `PublicFooter`,
|
|
22
|
-
`
|
|
21
|
+
Hosts using `django-core-micha` >= 3.22.0 can adopt `PrivacyProvider`, `PrivacyBanner`, `PublicFooter`,
|
|
22
|
+
`PrivacySettingsLink` and `PrivacyNoticeLink`. Create the API once and pass it to the provider when the
|
|
23
23
|
host mounts the privacy routes elsewhere:
|
|
24
24
|
|
|
25
25
|
```jsx
|
|
@@ -32,10 +32,14 @@ const privacyApi = createPrivacyApi({}, { apiBase: '/api/privacy/', csrfUrl: '/a
|
|
|
32
32
|
</PrivacyProvider>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Place `PrivacyProvider` above the router content and render one `PrivacyBanner` in the app shell. Use `PublicFooter`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
Place `PrivacyProvider` above the router content and render one `PrivacyBanner` in the app shell. Use `PublicFooter` as
|
|
36
|
+
the one compact line at the end of every page, public and authenticated, including login and registration (on phones
|
|
37
|
+
the `brand` and `copyright` nodes are not shown, so never make the footer the only route to something they link); there are no
|
|
38
|
+
legal or privacy entries in headers or in the account menu. The account page (`privacyMode="central"`) shows the two
|
|
39
|
+
quick choices in its profile section. This keeps public legal links available without a provider. When an app has
|
|
40
|
+
optional purposes, the footer entry reopens the same banner with “Necessary only” and “Allow all”; either choice applies
|
|
41
|
+
to every optional purpose. A necessary-only app has no banner or settings entry. `PrivacyFooterLinks` remains available for existing consumers; a
|
|
42
|
+
public footer uses `PublicFooter` instead of it, never both. Register each app-owned
|
|
39
43
|
optional adapter with `registerPrivacyService({ purposeId, serviceId, activate, deactivate, ownedStorage })`; gate imports,
|
|
40
44
|
requests and callbacks with `useGrantedPurpose`, `guardedImport` or `createPrivacyGuard`. The package never loads vendors.
|
|
41
45
|
|
|
@@ -48,7 +52,6 @@ const legal = {
|
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
<PublicFooter brand={<MaanaBrand />} copyright={copyrightNode} {...legal} />
|
|
51
|
-
<UserMenu legal={legal} />
|
|
52
55
|
```
|
|
53
56
|
|
|
54
57
|
Central links use `/legal/<slug>?app=<registered-id>&lang=<document-locale>`; the package chooses a supported document
|
|
@@ -62,8 +65,8 @@ default remains `privacyMode="legacy"` during rollout. `AccountPage` takes the s
|
|
|
62
65
|
forwards it to its profile tab; pass `privacyMode="central"` there too, because `showProfileStatements={false}` only hides
|
|
63
66
|
statement text and never selects the central contract. In central mode (4.34.0) the profile tab also shows the privacy
|
|
64
67
|
choices inline when a `PrivacyProvider` is mounted. `CookieConsentStep` remains exported for compatibility and is
|
|
65
|
-
deprecated. The host manifest supplies
|
|
66
|
-
|
|
68
|
+
deprecated. The host manifest supplies purposes and localized notice links; empty optional configuration has no choice
|
|
69
|
+
banner or settings entry.
|
|
67
70
|
|
|
68
71
|
## Account page: extra tabs in a navigation group
|
|
69
72
|
|
package/dist/auth/UserMenu.js
CHANGED
|
@@ -5,8 +5,6 @@ import { useTheme } from '@mui/material/styles';
|
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { AuthContext } from './AuthContext';
|
|
7
7
|
import { calculateContrastRatio } from '../theme';
|
|
8
|
-
import { usePrivacy } from '../privacy/PrivacyProvider';
|
|
9
|
-
import { useLegalEntries } from '../privacy/legalEntries';
|
|
10
8
|
function getInitials(user) {
|
|
11
9
|
var _a, _b, _c, _d, _e, _f;
|
|
12
10
|
if (!user)
|
|
@@ -23,11 +21,9 @@ function getDisplayName(user) {
|
|
|
23
21
|
const name = `${user.first_name || ''} ${user.last_name || ''}`.trim();
|
|
24
22
|
return name || user.username || '';
|
|
25
23
|
}
|
|
26
|
-
export function UserMenu({ resolveLink, items = [], profileLink = '/account', avatarSrc
|
|
24
|
+
export function UserMenu({ resolveLink, items = [], profileLink = '/account', avatarSrc }) {
|
|
27
25
|
const { t } = useTranslation();
|
|
28
26
|
const { user, logout } = useContext(AuthContext);
|
|
29
|
-
const privacy = usePrivacy();
|
|
30
|
-
const legalEntries = useLegalEntries(legal || {});
|
|
31
27
|
const theme = useTheme();
|
|
32
28
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
33
29
|
const open = Boolean(anchorEl);
|
|
@@ -64,12 +60,6 @@ export function UserMenu({ resolveLink, items = [], profileLink = '/account', av
|
|
|
64
60
|
fontSize: '0.8rem',
|
|
65
61
|
bgcolor: avatarBackground,
|
|
66
62
|
color: avatarText,
|
|
67
|
-
}, children: avatarSrc ? null : getInitials(user) }) }), _jsxs(Menu, { anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'bottom' }, onClose: handleClose, open: open, transformOrigin: { horizontal: 'right', vertical: 'top' }, children: [_jsxs(Box, { sx: { minWidth: 240, px: 2, py: 1 }, children: [_jsx(Typography, { variant: "subtitle1", noWrap: true, children: getDisplayName(user) }), (user === null || user === void 0 ? void 0 : user.email) && user.email !== getDisplayName(user) && (_jsx(Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: user.email }))] }), _jsx(Divider, {}), _jsx(MenuItem, { onClick: handleProfile, children: t('UserMenu.PROFILE') }), items.length > 0 && _jsx(Divider, {}), items.map((item) => (_jsx(MenuItem, { onClick: () => handleItemSelect(item), children: item.label }, item.id))),
|
|
68
|
-
_jsx(Divider, {}, "legal-divider"),
|
|
69
|
-
...legalEntries.map(({ id, label, href }) => (_jsx(MenuItem, { component: "a", href: href, onClick: handleClose, children: label }, `legal-${id}`))),
|
|
70
|
-
...(legal.showSettings !== false && privacy && privacy.status !== 'unconfigured'
|
|
71
|
-
? [_jsx(MenuItem, { onClick: () => { handleClose(); privacy.openSettings(); }, children: t('Privacy.LEGAL_SETTINGS') }, "legal-settings")]
|
|
72
|
-
: []),
|
|
73
|
-
]) : null, _jsx(Divider, {}), _jsx(MenuItem, { onClick: handleLogout, children: t('UserMenu.LOGOUT') })] })] }));
|
|
63
|
+
}, children: avatarSrc ? null : getInitials(user) }) }), _jsxs(Menu, { anchorEl: anchorEl, anchorOrigin: { horizontal: 'right', vertical: 'bottom' }, onClose: handleClose, open: open, transformOrigin: { horizontal: 'right', vertical: 'top' }, children: [_jsxs(Box, { sx: { minWidth: 240, px: 2, py: 1 }, children: [_jsx(Typography, { variant: "subtitle1", noWrap: true, children: getDisplayName(user) }), (user === null || user === void 0 ? void 0 : user.email) && user.email !== getDisplayName(user) && (_jsx(Typography, { variant: "body2", color: "text.secondary", noWrap: true, children: user.email }))] }), _jsx(Divider, {}), _jsx(MenuItem, { onClick: handleProfile, children: t('UserMenu.PROFILE') }), items.length > 0 && _jsx(Divider, {}), items.map((item) => (_jsx(MenuItem, { onClick: () => handleItemSelect(item), children: item.label }, item.id))), _jsx(Divider, {}), _jsx(MenuItem, { onClick: handleLogout, children: t('UserMenu.LOGOUT') })] })] }));
|
|
74
64
|
}
|
|
75
65
|
export default UserMenu;
|
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
export const privacyTranslations = {
|
|
2
2
|
'Privacy.CHOICE_TITLE': { de: 'Datenschutzauswahl', fr: 'Choix de confidentialité', en: 'Privacy choices', sw: 'Chaguo za faragha' },
|
|
3
3
|
'Privacy.CHANGE_ANYTIME': { de: 'Sie können Ihre Auswahl jederzeit hier ändern.', fr: 'Vous pouvez modifier votre choix ici à tout moment.', en: 'You can change your choice here at any time.', sw: 'Unaweza kubadilisha chaguo lako hapa wakati wowote.' },
|
|
4
|
-
'Privacy.CONTROLLER': { de: 'Verantwortliche Stelle', fr: 'Responsable du traitement', en: 'Data controller', sw: 'Mdhibiti wa data' },
|
|
5
4
|
'Privacy.CLOSE': { de: 'Schliessen', fr: 'Fermer', en: 'Close', sw: 'Funga' },
|
|
6
5
|
'Privacy.NECESSARY_ONLY': { de: 'Nur notwendige Funktionen', fr: 'Fonctions nécessaires uniquement', en: 'Necessary only', sw: 'Muhimu pekee' },
|
|
7
6
|
'Privacy.ALLOW_ALL': { de: 'Alle erlauben', fr: 'Tout autoriser', en: 'Allow all', sw: 'Ruhusu yote' },
|
|
8
7
|
'Privacy.SETTINGS': { de: 'Einstellungen', fr: 'Paramètres', en: 'Settings', sw: 'Mipangilio' },
|
|
9
8
|
'Privacy.SETTINGS_TITLE': { de: 'Datenschutzeinstellungen', fr: 'Paramètres de confidentialité', en: 'Privacy settings', sw: 'Mipangilio ya faragha' },
|
|
10
|
-
'Privacy.ALWAYS_ACTIVE': { de: 'Immer aktiv', fr: 'Toujours actives', en: 'Always active', sw: 'Huwashwa kila wakati' },
|
|
11
|
-
'Privacy.REQUIRED_INFORMATION': { de: 'Für Anmeldung, Sicherheit und ausdrücklich angeforderte Funktionen.', fr: 'Pour la connexion, la sécurité et les fonctions expressément demandées.', en: 'For sign-in, security and functions you explicitly request.', sw: 'Kwa kuingia, usalama na vitendaji unavyoomba waziwazi.' },
|
|
12
9
|
'Privacy.NECESSARY_ONLY_ACTIVE': { de: 'Nur notwendige Funktionen sind aktiv.', fr: 'Seules les fonctions nécessaires sont actives.', en: 'Only necessary functions are active.', sw: 'Vitendaji muhimu pekee ndivyo vinavyotumika.' },
|
|
13
|
-
'Privacy.NO_OPTIONAL': { de: 'Diese App verwendet nur notwendige Funktionen.', fr: 'Cette application utilise uniquement les fonctions nécessaires.', en: 'This app uses only necessary functions.', sw: 'Programu hii hutumia vitendaji muhimu pekee.' },
|
|
14
10
|
'Privacy.SAVED': { de: 'Ihre Auswahl ist gespeichert.', fr: 'Votre choix a été enregistré.', en: 'Your selection has been saved.', sw: 'Chaguo lako limehifadhiwa.' },
|
|
15
11
|
'Privacy.SAVE_ERROR': { de: 'Speichern derzeit nicht möglich. Optionale Dienste bleiben ausgeschaltet.', fr: 'Enregistrement impossible pour le moment. Les services facultatifs restent désactivés.', en: 'Unable to save right now. Optional services remain off.', sw: 'Haiwezekani kuhifadhi kwa sasa. Huduma za hiari zitaendelea kuzimwa.' },
|
|
16
12
|
'Privacy.SAVE_ERROR_WITH_GRANTS': { de: 'Speichern derzeit nicht möglich. Die Änderung ist nicht gespeichert; widerrufene Dienste bleiben auf dieser Seite ausgeschaltet.', fr: 'Enregistrement impossible pour le moment. La modification n’est pas enregistrée ; les services retirés restent désactivés sur cette page.', en: 'Unable to save right now. The change is not stored; withdrawn services remain off on this page.', sw: 'Haiwezekani kuhifadhi kwa sasa. Mabadiliko hayajahifadhiwa; huduma zilizoondolewa zitaendelea kuzimwa kwenye ukurasa huu.' },
|
|
17
13
|
'Privacy.NOTICE_LINK': { de: 'Datenschutzerklärung', fr: 'Politique de confidentialité', en: 'Privacy notice', sw: 'Taarifa ya faragha' },
|
|
18
|
-
'Privacy.NOTICE_EXPLANATION': { de: 'Welche Daten wir wofür verwenden, steht in der Datenschutzerklärung.', fr: 'Notre avis de confidentialité explique quelles données nous utilisons et pourquoi.', en: 'Our privacy notice explains which data we use and why.', sw: 'Taarifa yetu ya faragha inaeleza data tunayotumia na sababu zake.' },
|
|
19
|
-
'Privacy.PROVIDER_STORAGE_DETAIL': { de: 'Anbieter: {{provider}}. Speicherart und Laufzeit werden für die tatsächlich eingesetzten Funktionen ausgewiesen.', fr: 'Fournisseur : {{provider}}. Le type de stockage et sa durée sont indiqués pour les fonctions réellement utilisées.', en: 'Provider: {{provider}}. Storage types and duration are listed for the functions actually used.', sw: 'Mtoa huduma: {{provider}}. Aina na muda wa hifadhi vimeorodheshwa kwa vitendaji vinavyotumika.' },
|
|
20
|
-
'Privacy.SERVER_RETENTION': { de: 'Aufbewahrung auf dem Server: {{retention}}', fr: 'Conservation sur le serveur : {{retention}}', en: 'Server retention: {{retention}}', sw: 'Muda wa kuhifadhi kwenye seva: {{retention}}' },
|
|
21
|
-
'Privacy.DATA_CATEGORIES': { de: 'Datenkategorien: {{values}}', fr: 'Catégories de données : {{values}}', en: 'Data categories: {{values}}', sw: 'Aina za data: {{values}}' },
|
|
22
|
-
'Privacy.RECIPIENTS': { de: 'Empfänger: {{values}}', fr: 'Destinataires : {{values}}', en: 'Recipients: {{values}}', sw: 'Wapokeaji: {{values}}' },
|
|
23
|
-
'Privacy.TRANSFERS': { de: 'Übermittlungen: {{values}}', fr: 'Transferts : {{values}}', en: 'Transfers: {{values}}', sw: 'Uhamisho: {{values}}' },
|
|
24
|
-
'Privacy.NECESSARY_STORAGE': { de: 'Notwendiger Speicher', fr: 'Stockage nécessaire', en: 'Necessary storage', sw: 'Hifadhi muhimu' },
|
|
25
|
-
'Privacy.DETAILS': { de: 'Details', fr: 'Détails', en: 'Details', sw: 'Maelezo' },
|
|
26
|
-
'Privacy.SAVE': { de: 'Auswahl speichern', fr: 'Enregistrer le choix', en: 'Save selection', sw: 'Hifadhi chaguo' },
|
|
27
|
-
'Privacy.SAVING': { de: 'Wird gespeichert …', fr: 'Enregistrement…', en: 'Saving…', sw: 'Inahifadhi…' },
|
|
28
|
-
'Privacy.RETRY': { de: 'Erneut versuchen', fr: 'Réessayer', en: 'Retry', sw: 'Jaribu tena' },
|
|
29
14
|
'Privacy.NECESSARY_ALWAYS_ACTIVE': { de: 'Notwendige Funktionen sind immer aktiv.', fr: 'Les fonctions nécessaires sont toujours actives.', en: 'Necessary functions are always active.', sw: 'Vitendaji muhimu huwa vimewashwa kila wakati.' },
|
|
30
15
|
'Privacy.FOOTER_NAV': { de: 'Rechtliches und Datenschutz', fr: 'Mentions légales et confidentialité', en: 'Legal and privacy', sw: 'Kisheria na faragha' },
|
|
31
16
|
'Privacy.FOOTER_PRIVACY': { de: 'Datenschutzerklärung', fr: 'Politique de confidentialité', en: 'Privacy notice', sw: 'Taarifa ya faragha' },
|
|
@@ -39,6 +24,4 @@ export const privacyTranslations = {
|
|
|
39
24
|
'Privacy.LEGAL_IMPRINT': { de: 'Impressum', fr: 'Mentions légales', en: 'Imprint', sw: 'Taarifa za kisheria' },
|
|
40
25
|
'Privacy.LEGAL_CONTRACT_CANCEL': { de: 'Verträge hier kündigen', fr: 'Résilier des contrats ici', en: 'Cancel contracts here', sw: 'Sitisha mikataba hapa' },
|
|
41
26
|
'Privacy.LEGAL_SETTINGS': { de: 'Datenschutzeinstellungen', fr: 'Paramètres de confidentialité', en: 'Privacy settings', sw: 'Mipangilio ya faragha' },
|
|
42
|
-
'Privacy.LOADING': { de: 'Datenschutzeinstellungen werden geladen.', fr: 'Chargement des paramètres de confidentialité.', en: 'Loading privacy settings.', sw: 'Inapakia mipangilio ya faragha.' },
|
|
43
|
-
'Privacy.UNAVAILABLE': { de: 'Datenschutzeinstellungen sind derzeit nicht verfügbar. Optionale Dienste bleiben ausgeschaltet.', fr: 'Les paramètres de confidentialité sont indisponibles. Les services facultatifs restent désactivés.', en: 'Privacy settings are unavailable right now. Optional services remain off.', sw: 'Mipangilio ya faragha haipatikani sasa. Huduma za hiari zitaendelea kuzimwa.' },
|
|
44
27
|
};
|
package/dist/index.js
CHANGED
|
@@ -129,7 +129,6 @@ export { createUiCoreTranslations, uiCoreTranslations } from './i18n/uiCoreTrans
|
|
|
129
129
|
export { PrivacyProvider, usePrivacy } from './privacy/PrivacyProvider';
|
|
130
130
|
export { createPrivacyApi, defaultPrivacyApi } from './privacy/privacyApi';
|
|
131
131
|
export { PrivacyBanner } from './privacy/PrivacyBanner';
|
|
132
|
-
export { PrivacySettingsDialog, PrivacySettingsPanel } from './privacy/PrivacySettings';
|
|
133
132
|
export { PrivacySettingsLink } from './privacy/PrivacySettingsLink';
|
|
134
133
|
export { PrivacyFooterLinks, buildLegalReaderUrl, legalDocumentLanguage } from './privacy/PrivacyFooterLinks';
|
|
135
134
|
export { PublicFooter } from './privacy/PublicFooter';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { useSearchParams } from 'react-router-dom';
|
|
4
|
-
import { Box, Typography, Alert, CircularProgress, Paper, Stack, useMediaQuery, } from '@mui/material';
|
|
4
|
+
import { Box, Button, Typography, Alert, CircularProgress, Paper, Stack, useMediaQuery, } from '@mui/material';
|
|
5
5
|
import { useTheme } from '@mui/material/styles';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { resolveErrorText } from '../utils/resolveErrorText';
|
|
@@ -12,7 +12,6 @@ export const ACCOUNT_PAGE_SECTION_PAPER_SX = { p: 2.5 };
|
|
|
12
12
|
import { WidePage } from '../layout/PageLayout';
|
|
13
13
|
import { SectionNav } from '../layout/SectionNav';
|
|
14
14
|
import { ProfileComponent } from '../components/ProfileComponent';
|
|
15
|
-
import { PrivacySettingsPanel } from '../privacy/PrivacySettings';
|
|
16
15
|
import { usePrivacy } from '../privacy/PrivacyProvider';
|
|
17
16
|
import { SecurityComponent } from '../components/SecurityComponent';
|
|
18
17
|
import { UserListComponent } from '../components/UserListComponent';
|
|
@@ -29,29 +28,34 @@ import { BulkInviteCsvTab } from '../components/BulkInviteCsvTab';
|
|
|
29
28
|
import { fetchAuthPolicy, updateUserProfile } from '../auth/authApi'; // Ggf. Pfad anpassen
|
|
30
29
|
import { defaultBillingApi } from '../billing/api';
|
|
31
30
|
import { useBillingUsersColumn } from '../billing/useBillingUsersColumn';
|
|
31
|
+
// Central mode: the same two privacy choices as the banner, directly on the account page. Footer and menu entries
|
|
32
|
+
// reopen that banner. Renders nothing without a ready privacy provider or when the app has no optional purpose.
|
|
33
|
+
function AccountPrivacySection() {
|
|
34
|
+
const privacy = usePrivacy();
|
|
35
|
+
const { t } = useTranslation();
|
|
36
|
+
if (!privacy || privacy.status !== 'ready' || !privacy.manifest)
|
|
37
|
+
return null;
|
|
38
|
+
const purposes = (privacy.manifest.purposes || []).filter((purpose) => !purpose.required);
|
|
39
|
+
if (purposes.length === 0)
|
|
40
|
+
return null;
|
|
41
|
+
const saving = privacy.saveState === 'saving';
|
|
42
|
+
const onlyNecessary = purposes.every((purpose) => { var _a, _b, _c; return ((_c = (_b = (_a = privacy.choices) === null || _a === void 0 ? void 0 : _a.choices) === null || _b === void 0 ? void 0 : _b[purpose.id]) === null || _c === void 0 ? void 0 : _c.state) === 'refused'; });
|
|
43
|
+
return (_jsxs(Box, { sx: { mt: 3, maxWidth: 600 }, children: [_jsx(Typography, { variant: "subtitle1", component: "h2", gutterBottom: true, children: t('Privacy.SETTINGS_TITLE') }), _jsxs(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 1.25, children: [_jsx(Button, { type: "button", variant: "contained", size: "medium", disabled: saving, onClick: () => privacy.necessaryOnly('settings'), children: t('Privacy.NECESSARY_ONLY') }), _jsx(Button, { type: "button", variant: "contained", size: "medium", disabled: saving, onClick: () => privacy.acceptAll('settings'), children: t('Privacy.ALLOW_ALL') })] }), privacy.saveState === 'saved' && (_jsx(Typography, { role: "status", variant: "body2", sx: { mt: 1 }, children: onlyNecessary ? t('Privacy.NECESSARY_ONLY_ACTIVE') : t('Privacy.SAVED') })), privacy.saveState === 'error' && (_jsx(Typography, { role: "alert", color: "error", variant: "body2", sx: { mt: 1 }, children: t('Privacy.SAVE_ERROR') }))] }));
|
|
44
|
+
}
|
|
32
45
|
/**
|
|
33
46
|
* `billingOperator({ user, account }) => boolean` (optional, UCM-BILL-10): the app's operator rule for the billing
|
|
34
47
|
* users columns built when `billingUsers` is set (status, badge and the "Ohne Abo" switch). Without it superusers are
|
|
35
48
|
* the operators. A new function on each render only recomputes the columns; it does not refetch the accounts.
|
|
36
49
|
* `privacyMode` (optional, UCM-PRIV-4): `'legacy'` (default, unchanged) or `'central'`. `'central'` is forwarded to
|
|
37
50
|
* ProfileComponent: the profile drops the privacy-statement and convenience-cookie checkboxes and sends neither legacy
|
|
38
|
-
* field; name editing is unchanged. The profile tab then shows the privacy
|
|
39
|
-
*
|
|
51
|
+
* field; name editing is unchanged. The profile tab then shows the two quick privacy choices (necessary only / allow
|
|
52
|
+
* all, as in the banner) below the form when the host has a ready PrivacyProvider with optional purposes. It never depends on
|
|
40
53
|
* provider presence for dropping the legacy controls, and stays central while the privacy manifest loads or fails.
|
|
41
54
|
* `showProfileStatements` only hides statement text.
|
|
42
55
|
* `groups` (optional): app-defined account navigation groups with `{ key, label, order?, tabs?, visible? }`. Labels
|
|
43
56
|
* may be strings or `(context) => string`; `tabs` assigns built-in tab values, and `visible(context)` can hide a group
|
|
44
57
|
* and its tabs. Without this prop, the default groups and placement are unchanged.
|
|
45
58
|
*/
|
|
46
|
-
// Central mode: the privacy choices live on the account page itself (the same panel the settings dialog
|
|
47
|
-
// shows), not behind a link. Renders nothing when the host has no privacy provider or no manifest.
|
|
48
|
-
function AccountPrivacySection() {
|
|
49
|
-
const privacy = usePrivacy();
|
|
50
|
-
const { t } = useTranslation();
|
|
51
|
-
if (!privacy || privacy.status === 'unconfigured')
|
|
52
|
-
return null;
|
|
53
|
-
return (_jsxs(Box, { sx: { mt: 3, maxWidth: 600 }, children: [_jsx(Typography, { variant: "subtitle1", component: "h2", gutterBottom: true, children: t('Privacy.SETTINGS_TITLE') }), _jsx(PrivacySettingsPanel, {})] }));
|
|
54
|
-
}
|
|
55
59
|
export function AccountPage({ userListExtraColumns = [], userListExtraRowActions = [], userListExtraContext = null, userListRefreshTrigger = 0, userListCanEditUser = null, userListShowNewColumn = true, userListShowSuccessfulLoginColumn = true, userListShowRoleColumn = true, userListOnChangeRole = null, userListShowDeleteAction = true, userListCanDeleteUser = null, userListOnDeleteUser = null, showBulkInviteCsvTab = false, bulkInviteCsvProps = {}, extraTabs = [], showProfileStatements = true, privacyMode = 'legacy', billingUsers = false, billingOperator, groups: groupsProp, }) {
|
|
56
60
|
var _a;
|
|
57
61
|
const { t, i18n } = useTranslation();
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import { Box, Button, Paper, Stack, Typography } from '@mui/material';
|
|
4
4
|
import CloseIcon from '@mui/icons-material/Close';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { usePrivacy } from './PrivacyProvider';
|
|
7
|
+
import { PrivacyNoticeLink } from './PrivacyNoticeLink';
|
|
7
8
|
function localized(value, language) {
|
|
8
9
|
if (!value || typeof value !== 'object')
|
|
9
10
|
return '';
|
|
@@ -31,8 +32,16 @@ export function PrivacyBanner() {
|
|
|
31
32
|
var _a, _b;
|
|
32
33
|
const privacy = usePrivacy();
|
|
33
34
|
const { t, i18n } = useTranslation();
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const firstChoiceRef = useRef(null);
|
|
36
|
+
const reopenedByUser = Boolean((privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible) && privacy.bannerReopened);
|
|
37
|
+
// The banner is nonmodal: it never takes focus when it first appears (no focus ring on the title at load).
|
|
38
|
+
// When the user reopens it from the footer or another entry, focus moves to its first choice button, because the
|
|
39
|
+
// banner sits before the page content in the DOM and Tab would otherwise skip past it.
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
if (reopenedByUser)
|
|
43
|
+
(_a = firstChoiceRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
44
|
+
}, [reopenedByUser]);
|
|
36
45
|
if (!(privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible))
|
|
37
46
|
return null;
|
|
38
47
|
const onKeyDown = (event) => {
|
|
@@ -43,9 +52,6 @@ export function PrivacyBanner() {
|
|
|
43
52
|
};
|
|
44
53
|
const purposes = ((_b = (_a = privacy.manifest) === null || _a === void 0 ? void 0 : _a.purposes) === null || _b === void 0 ? void 0 : _b.filter((purpose) => !purpose.required)) || [];
|
|
45
54
|
const hasOtherGrant = purposes.some((purpose) => { var _a, _b, _c; return ((_c = (_b = (_a = privacy.choices) === null || _a === void 0 ? void 0 : _a.choices) === null || _b === void 0 ? void 0 : _b[purpose.id]) === null || _c === void 0 ? void 0 : _c.state) === 'granted'; });
|
|
46
|
-
return (_jsx(Paper, { role: "region", "aria-labelledby": "privacy-banner-title",
|
|
47
|
-
// Stays mounted while the settings dialog is open (it sits above modals and would cover the dialog's
|
|
48
|
-
// actions) so the dialog can return focus to the Settings button that opened it.
|
|
49
|
-
hidden: privacy.settingsOpen, onKeyDown: onKeyDown, elevation: 8, sx: PRIVACY_BANNER_PAPER_SX, children: _jsxs(Box, { sx: { maxWidth: 960, mx: 'auto' }, children: [_jsxs(Stack, { direction: "row", alignItems: "flex-start", justifyContent: "space-between", spacing: 2, children: [_jsxs(Box, { children: [_jsx(Typography, { id: "privacy-banner-title", component: "h2", variant: "h6", children: t('Privacy.CHOICE_TITLE') }), _jsxs(Typography, { variant: "body2", color: "text.secondary", sx: { mt: 0.75 }, children: [t('Privacy.NECESSARY_ALWAYS_ACTIVE'), " ", t('Privacy.CHANGE_ANYTIME')] })] }), _jsx(Button, { type: "button", "aria-label": t('Privacy.CLOSE'), onClick: privacy.dismissBanner, sx: PRIVACY_BANNER_CLOSE_SX, children: _jsx(CloseIcon, { "aria-hidden": "true" }) })] }), _jsx(Stack, { spacing: 1.25, sx: { mt: 1.5 }, children: purposes.map((purpose) => (_jsxs(Box, { children: [localized(purpose.label, i18n.language) && _jsx(Typography, { variant: "subtitle2", children: localized(purpose.label, i18n.language) }), localized(purpose.summary, i18n.language) && (_jsx(Typography, { variant: "body2", color: "text.secondary", children: localized(purpose.summary, i18n.language) }))] }, purpose.id))) }), privacy.saveState === 'error' && (_jsx(Typography, { role: "alert", color: "error", variant: "body2", sx: { mt: 1.5 }, children: t(hasOtherGrant ? 'Privacy.SAVE_ERROR_WITH_GRANTS' : 'Privacy.SAVE_ERROR') })), _jsxs(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 1.25, sx: { mt: 2 }, children: [_jsx(Button, { type: "button", variant: "contained", size: "medium", disabled: privacy.saveState === 'saving', onClick: () => privacy.necessaryOnly('banner'), children: t('Privacy.NECESSARY_ONLY') }), _jsx(Button, { type: "button", variant: "contained", size: "medium", disabled: privacy.saveState === 'saving', onClick: () => privacy.acceptAll('banner'), children: t('Privacy.ALLOW_ALL') }), _jsx(Button, { type: "button", variant: "text", onClick: privacy.openSettings, children: t('Privacy.SETTINGS') })] })] }) }));
|
|
55
|
+
return (_jsx(Paper, { role: "region", "aria-labelledby": "privacy-banner-title", onKeyDown: onKeyDown, elevation: 8, sx: PRIVACY_BANNER_PAPER_SX, children: _jsxs(Box, { sx: { maxWidth: 960, mx: 'auto' }, children: [_jsxs(Stack, { direction: "row", alignItems: "flex-start", justifyContent: "space-between", spacing: 2, children: [_jsxs(Box, { children: [_jsx(Typography, { id: "privacy-banner-title", component: "h2", variant: "h6", children: t('Privacy.CHOICE_TITLE') }), _jsxs(Typography, { variant: "body2", color: "text.secondary", sx: { mt: 0.75 }, children: [t('Privacy.NECESSARY_ALWAYS_ACTIVE'), " ", t('Privacy.CHANGE_ANYTIME')] }), _jsx(PrivacyNoticeLink, {})] }), _jsx(Button, { type: "button", "aria-label": t('Privacy.CLOSE'), onClick: privacy.dismissBanner, sx: PRIVACY_BANNER_CLOSE_SX, children: _jsx(CloseIcon, { "aria-hidden": "true" }) })] }), _jsx(Stack, { spacing: 1.25, sx: { mt: 1.5 }, children: purposes.map((purpose) => (_jsxs(Box, { children: [localized(purpose.label, i18n.language) && _jsx(Typography, { variant: "subtitle2", children: localized(purpose.label, i18n.language) }), localized(purpose.summary, i18n.language) && (_jsx(Typography, { variant: "body2", color: "text.secondary", children: localized(purpose.summary, i18n.language) }))] }, purpose.id))) }), privacy.saveState === 'error' && (_jsx(Typography, { role: "alert", color: "error", variant: "body2", sx: { mt: 1.5 }, children: t(hasOtherGrant ? 'Privacy.SAVE_ERROR_WITH_GRANTS' : 'Privacy.SAVE_ERROR') })), _jsxs(Stack, { direction: { xs: 'column', sm: 'row' }, spacing: 1.25, sx: { mt: 2 }, children: [_jsx(Button, { ref: firstChoiceRef, type: "button", variant: "contained", size: "medium", disabled: privacy.saveState === 'saving', onClick: () => privacy.necessaryOnly('banner'), children: t('Privacy.NECESSARY_ONLY') }), _jsx(Button, { type: "button", variant: "contained", size: "medium", disabled: privacy.saveState === 'saving', onClick: () => privacy.acceptAll('banner'), children: t('Privacy.ALLOW_ALL') })] })] }) }));
|
|
50
56
|
}
|
|
51
57
|
export default PrivacyBanner;
|
|
@@ -48,8 +48,8 @@ export function buildLegalReaderUrl({ origin, slug, appId, lang }) {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Persistent legal footer entries: Privacy notice and Terms (static reader links) plus the local
|
|
51
|
-
* "Privacy settings" action. The settings action
|
|
52
|
-
*
|
|
51
|
+
* "Privacy settings" action. The settings action reopens THIS app's choice banner (never the reader's) and appears
|
|
52
|
+
* only when the host has a ready manifest with optional purposes; the legal links are always rendered.
|
|
53
53
|
*/
|
|
54
54
|
export function PrivacyFooterLinks(_a) {
|
|
55
55
|
var { legalOrigin, appId, documents = ['privacy', 'terms'], fallbackLanguage = 'en', showSettings = true, sx } = _a, props = __rest(_a, ["legalOrigin", "appId", "documents", "fallbackLanguage", "showSettings", "sx"]);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { createPrivacyApi, defaultPrivacyApi } from './privacyApi';
|
|
5
5
|
import { setPrivacyState } from './serviceRegistry';
|
|
6
|
-
import { PrivacySettingsDialog } from './PrivacySettings';
|
|
7
6
|
const PrivacyContext = createContext(null);
|
|
8
7
|
const OPTIONAL_STATES = new Set(['granted', 'refused']);
|
|
9
8
|
function errorCode(error) {
|
|
@@ -131,7 +130,7 @@ export function PrivacyProvider({ children, api: apiOverride, apiBase = '/api/pr
|
|
|
131
130
|
const [pendingFailed, setPendingFailed] = useState(false);
|
|
132
131
|
const [saveState, setSaveState] = useState('idle');
|
|
133
132
|
const [error, setError] = useState(null);
|
|
134
|
-
const [
|
|
133
|
+
const [reopened, setReopened] = useState(false);
|
|
135
134
|
const [bannerDismissed, setBannerDismissed] = useState(false);
|
|
136
135
|
const manifestRef = useRef(null);
|
|
137
136
|
const choicesRef = useRef(null);
|
|
@@ -418,7 +417,11 @@ export function PrivacyProvider({ children, api: apiOverride, apiBase = '/api/pr
|
|
|
418
417
|
const needsDecision = status === 'ready' && optionalPurposes.some((purpose) => { var _a, _b; return ((_b = (_a = choices === null || choices === void 0 ? void 0 : choices.choices) === null || _a === void 0 ? void 0 : _a[purpose.id]) === null || _b === void 0 ? void 0 : _b.state) === 'unset'; });
|
|
419
418
|
const hasPendingDecision = Boolean(pendingRef.current) && (saveState === 'saving' || pendingFailed);
|
|
420
419
|
const bannerVisible = status === 'ready' && optionalPurposes.length > 0
|
|
421
|
-
&& (needsDecision || hasPendingDecision) && !bannerDismissed;
|
|
420
|
+
&& (needsDecision || hasPendingDecision || reopened) && !bannerDismissed;
|
|
421
|
+
useEffect(() => {
|
|
422
|
+
if (saveState === 'saved')
|
|
423
|
+
setReopened(false);
|
|
424
|
+
}, [saveState]);
|
|
422
425
|
const hasGrant = useCallback((purposeId, serviceId) => {
|
|
423
426
|
var _a, _b, _c, _d, _e, _f;
|
|
424
427
|
if (status !== 'ready')
|
|
@@ -438,15 +441,22 @@ export function PrivacyProvider({ children, api: apiOverride, apiBase = '/api/pr
|
|
|
438
441
|
const selections = Object.fromEntries(optionalPurposes.map((purpose) => [purpose.id, 'refused']));
|
|
439
442
|
return save(selections, channel);
|
|
440
443
|
}, [optionalPurposes, save]);
|
|
441
|
-
const openSettings = useCallback(() =>
|
|
442
|
-
|
|
443
|
-
|
|
444
|
+
const openSettings = useCallback(() => {
|
|
445
|
+
setBannerDismissed(false);
|
|
446
|
+
setReopened(true);
|
|
447
|
+
}, []);
|
|
448
|
+
const dismissBanner = useCallback(() => {
|
|
449
|
+
setBannerDismissed(true);
|
|
450
|
+
setReopened(false);
|
|
451
|
+
}, []);
|
|
444
452
|
const value = useMemo(() => ({
|
|
445
453
|
status,
|
|
446
454
|
manifest,
|
|
447
455
|
choices,
|
|
456
|
+
hasOptionalPurposes: optionalPurposes.length > 0,
|
|
448
457
|
needsDecision,
|
|
449
458
|
bannerVisible,
|
|
459
|
+
bannerReopened: reopened,
|
|
450
460
|
saveState,
|
|
451
461
|
error,
|
|
452
462
|
hasGrant,
|
|
@@ -454,15 +464,13 @@ export function PrivacyProvider({ children, api: apiOverride, apiBase = '/api/pr
|
|
|
454
464
|
acceptAll,
|
|
455
465
|
necessaryOnly,
|
|
456
466
|
retry,
|
|
457
|
-
settingsOpen,
|
|
458
467
|
openSettings,
|
|
459
|
-
closeSettings,
|
|
460
468
|
dismissBanner,
|
|
461
469
|
}), [
|
|
462
|
-
status, manifest, choices, needsDecision, bannerVisible, saveState, error, hasGrant,
|
|
463
|
-
save, acceptAll, necessaryOnly, retry,
|
|
470
|
+
status, manifest, choices, optionalPurposes.length, needsDecision, bannerVisible, reopened, saveState, error, hasGrant,
|
|
471
|
+
save, acceptAll, necessaryOnly, retry, openSettings, dismissBanner,
|
|
464
472
|
]);
|
|
465
|
-
return (
|
|
473
|
+
return (_jsx(PrivacyContext.Provider, { value: value, children: children }));
|
|
466
474
|
}
|
|
467
475
|
export function usePrivacy() {
|
|
468
476
|
return useContext(PrivacyContext);
|
|
@@ -18,7 +18,7 @@ export function PrivacySettingsLink(_a) {
|
|
|
18
18
|
var { children } = _a, props = __rest(_a, ["children"]);
|
|
19
19
|
const privacy = usePrivacy();
|
|
20
20
|
const { t } = useTranslation();
|
|
21
|
-
if (!privacy || privacy.status
|
|
21
|
+
if (!privacy || privacy.status !== 'ready' || !privacy.hasOptionalPurposes)
|
|
22
22
|
return null;
|
|
23
23
|
return (_jsx(Link, Object.assign({ component: "button", type: "button", onClick: privacy.openSettings }, props, { children: children || t('Privacy.SETTINGS') })));
|
|
24
24
|
}
|
|
@@ -17,29 +17,34 @@ import { useTranslation } from 'react-i18next';
|
|
|
17
17
|
import { usePrivacy } from './PrivacyProvider';
|
|
18
18
|
import { PrivacySettingsLink } from './PrivacySettingsLink';
|
|
19
19
|
import { useLegalEntries } from './legalEntries';
|
|
20
|
+
// One compact line at the end of the page: identity on the left, legal links and the privacy settings entry on the
|
|
21
|
+
// right. It wraps on narrow screens instead of growing into blocks. `mt: auto` lets it sit at the bottom of a
|
|
22
|
+
// column-flex page without any extra layout in the host.
|
|
20
23
|
export const PUBLIC_FOOTER_ROOT_SX = {
|
|
21
24
|
boxSizing: 'border-box',
|
|
22
25
|
width: '100%',
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
mt: 'auto',
|
|
23
28
|
borderTop: 1,
|
|
24
29
|
borderColor: 'divider',
|
|
25
30
|
px: { xs: 2, sm: 4 },
|
|
26
|
-
|
|
27
|
-
pb: 2.5,
|
|
31
|
+
py: { xs: 0.5, sm: 1 },
|
|
28
32
|
bgcolor: 'background.paper',
|
|
29
|
-
};
|
|
30
|
-
export const PUBLIC_FOOTER_TOP_ROW_SX = {
|
|
31
33
|
display: 'flex',
|
|
32
|
-
|
|
33
|
-
alignItems:
|
|
34
|
-
justifyContent: 'space-between',
|
|
35
|
-
|
|
34
|
+
flexWrap: 'wrap',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: { xs: 'center', sm: 'space-between' },
|
|
37
|
+
columnGap: 3,
|
|
38
|
+
rowGap: 0,
|
|
36
39
|
};
|
|
40
|
+
// On a phone the identity (logo, tagline, copyright) is dropped: the header already carries the brand and the
|
|
41
|
+
// footer stays a compact row of links.
|
|
37
42
|
export const PUBLIC_FOOTER_IDENTITY_SX = {
|
|
38
|
-
display: 'flex',
|
|
39
|
-
|
|
40
|
-
gap:
|
|
43
|
+
display: { xs: 'none', sm: 'flex' },
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
gap: 1.25,
|
|
41
46
|
flexShrink: 0,
|
|
42
|
-
|
|
47
|
+
minHeight: 32,
|
|
43
48
|
};
|
|
44
49
|
export const PUBLIC_FOOTER_COPYRIGHT_SX = {
|
|
45
50
|
color: 'text.secondary',
|
|
@@ -47,19 +52,20 @@ export const PUBLIC_FOOTER_COPYRIGHT_SX = {
|
|
|
47
52
|
lineHeight: 1.4,
|
|
48
53
|
};
|
|
49
54
|
export const PUBLIC_FOOTER_NAV_SX = {
|
|
50
|
-
display:
|
|
51
|
-
gridTemplateColumns: { xs: 'repeat(2, minmax(0, 1fr))', sm: 'none' },
|
|
52
|
-
justifyContent: { xs: 'start', sm: 'flex-end' },
|
|
55
|
+
display: 'flex',
|
|
53
56
|
flexWrap: 'wrap',
|
|
57
|
+
justifyContent: { xs: 'center', sm: 'flex-end' },
|
|
54
58
|
alignItems: 'center',
|
|
55
|
-
|
|
59
|
+
columnGap: { xs: 1.5, sm: 2.75 },
|
|
60
|
+
rowGap: 0,
|
|
56
61
|
minWidth: 0,
|
|
62
|
+
width: { xs: '100%', sm: 'auto' },
|
|
57
63
|
};
|
|
58
64
|
export const PUBLIC_FOOTER_LEGAL_LINK_SX = {
|
|
59
65
|
display: 'inline-flex',
|
|
60
66
|
alignItems: 'center',
|
|
61
67
|
minWidth: 0,
|
|
62
|
-
minHeight: { xs:
|
|
68
|
+
minHeight: { xs: 28, sm: 32 },
|
|
63
69
|
color: 'text.secondary',
|
|
64
70
|
fontSize: { xs: '0.75rem', sm: '0.8125rem' },
|
|
65
71
|
lineHeight: 1.35,
|
|
@@ -70,22 +76,14 @@ export const PUBLIC_FOOTER_LEGAL_LINK_SX = {
|
|
|
70
76
|
textDecoration: 'underline',
|
|
71
77
|
},
|
|
72
78
|
};
|
|
73
|
-
export const PUBLIC_FOOTER_SETTINGS_ROW_SX = {
|
|
74
|
-
display: 'flex',
|
|
75
|
-
justifyContent: { xs: 'flex-start', sm: 'flex-end' },
|
|
76
|
-
mt: { xs: 2, sm: 1 },
|
|
77
|
-
pt: { xs: 1.5, sm: 0 },
|
|
78
|
-
borderTop: { xs: '1px solid', sm: 0 },
|
|
79
|
-
borderColor: 'divider',
|
|
80
|
-
};
|
|
81
79
|
export const PUBLIC_FOOTER_SETTINGS_LINK_SX = {
|
|
82
80
|
display: 'inline-flex',
|
|
83
81
|
alignItems: 'center',
|
|
84
|
-
gap:
|
|
85
|
-
minHeight: { xs:
|
|
82
|
+
gap: 0.75,
|
|
83
|
+
minHeight: { xs: 28, sm: 32 },
|
|
86
84
|
px: 0,
|
|
87
85
|
color: 'primary.main',
|
|
88
|
-
fontSize: '0.8125rem',
|
|
86
|
+
fontSize: { xs: '0.75rem', sm: '0.8125rem' },
|
|
89
87
|
textDecoration: 'none',
|
|
90
88
|
'&:hover': { textDecoration: 'underline' },
|
|
91
89
|
};
|
|
@@ -95,7 +93,7 @@ export function PublicFooter(_a) {
|
|
|
95
93
|
const privacy = usePrivacy();
|
|
96
94
|
const entries = useLegalEntries({ legalOrigin, appId, documents, extraLinks, fallbackLanguage });
|
|
97
95
|
const { className, sx } = props, footerProps = __rest(props, ["className", "sx"]);
|
|
98
|
-
const canOpenSettings = showSettings && privacy
|
|
99
|
-
return (_jsxs(Box, Object.assign({}, footerProps, { component: "footer", className: className, sx: sx ? [PUBLIC_FOOTER_ROOT_SX, sx] : PUBLIC_FOOTER_ROOT_SX, children: [_jsxs(Box, { sx:
|
|
96
|
+
const canOpenSettings = showSettings && (privacy === null || privacy === void 0 ? void 0 : privacy.status) === 'ready' && privacy.hasOptionalPurposes;
|
|
97
|
+
return (_jsxs(Box, Object.assign({}, footerProps, { component: "footer", className: className, sx: sx ? [PUBLIC_FOOTER_ROOT_SX, sx] : PUBLIC_FOOTER_ROOT_SX, children: [_jsxs(Box, { sx: PUBLIC_FOOTER_IDENTITY_SX, children: [brand, copyright !== undefined && copyright !== null ? (_jsx(Typography, { component: "small", sx: PUBLIC_FOOTER_COPYRIGHT_SX, children: copyright })) : null] }), _jsxs(Box, { component: "nav", "aria-label": t('Privacy.FOOTER_NAV'), sx: PUBLIC_FOOTER_NAV_SX, children: [entries.map(({ id, label, href }) => (_jsx(Link, { href: href, underline: "none", sx: PUBLIC_FOOTER_LEGAL_LINK_SX, children: label }, id))), canOpenSettings ? (_jsxs(PrivacySettingsLink, { sx: PUBLIC_FOOTER_SETTINGS_LINK_SX, children: [_jsx(TuneIcon, { fontSize: "small", "aria-hidden": "true" }), t('Privacy.LEGAL_SETTINGS')] })) : null] })] })));
|
|
100
98
|
}
|
|
101
99
|
export default PublicFooter;
|
|
@@ -36,7 +36,7 @@ import { PROFILE_STEP_CHECKBOX_SX, PROFILE_STEP_OPTION_SX } from '../components/
|
|
|
36
36
|
import { SETUP_WIZARD_CARD_SX } from '../onboarding/SetupWizardShell';
|
|
37
37
|
import { REAUTH_MODAL_ALERT_SX, REAUTH_MODAL_TEXT_FIELD_SX } from '../auth/ReauthModal';
|
|
38
38
|
import { PRIVACY_BANNER_CLOSE_SX, PRIVACY_BANNER_PAPER_SX } from '../privacy/PrivacyBanner';
|
|
39
|
-
import { PUBLIC_FOOTER_COPYRIGHT_SX, PUBLIC_FOOTER_IDENTITY_SX, PUBLIC_FOOTER_LEGAL_LINK_SX, PUBLIC_FOOTER_NAV_SX, PUBLIC_FOOTER_ROOT_SX, PUBLIC_FOOTER_SETTINGS_LINK_SX,
|
|
39
|
+
import { PUBLIC_FOOTER_COPYRIGHT_SX, PUBLIC_FOOTER_IDENTITY_SX, PUBLIC_FOOTER_LEGAL_LINK_SX, PUBLIC_FOOTER_NAV_SX, PUBLIC_FOOTER_ROOT_SX, PUBLIC_FOOTER_SETTINGS_LINK_SX, } from '../privacy/PublicFooter';
|
|
40
40
|
import { createKitSxEntry } from './kitSxEntry';
|
|
41
41
|
import { ACCESS_ENDED_BANNER_ALERT_SX } from '../billing/AccessEndedBanner';
|
|
42
42
|
import { BILLING_ACCESS_BADGE_SX } from '../billing/BillingAccessCell';
|
|
@@ -56,12 +56,10 @@ const SX_EXPORTS = {
|
|
|
56
56
|
PRIVACY_BANNER_CLOSE_SX,
|
|
57
57
|
PRIVACY_BANNER_PAPER_SX,
|
|
58
58
|
PUBLIC_FOOTER_ROOT_SX,
|
|
59
|
-
PUBLIC_FOOTER_TOP_ROW_SX,
|
|
60
59
|
PUBLIC_FOOTER_IDENTITY_SX,
|
|
61
60
|
PUBLIC_FOOTER_COPYRIGHT_SX,
|
|
62
61
|
PUBLIC_FOOTER_NAV_SX,
|
|
63
62
|
PUBLIC_FOOTER_LEGAL_LINK_SX,
|
|
64
|
-
PUBLIC_FOOTER_SETTINGS_ROW_SX,
|
|
65
63
|
PUBLIC_FOOTER_SETTINGS_LINK_SX,
|
|
66
64
|
ACCESS_CODE_ACTION_SX,
|
|
67
65
|
ACCESS_ENDED_BANNER_ALERT_SX,
|
|
@@ -189,12 +187,10 @@ export const KIT_COMPONENT_SX_REGISTRY = [
|
|
|
189
187
|
entry('PrivacyBanner.paper', 'MuiPaper', PRIVACY_BANNER_PAPER_SX),
|
|
190
188
|
entry('PrivacyBanner.close', 'MuiButton', PRIVACY_BANNER_CLOSE_SX),
|
|
191
189
|
entry('PublicFooter.root', 'MuiBox', PUBLIC_FOOTER_ROOT_SX),
|
|
192
|
-
entry('PublicFooter.topRow', 'MuiBox', PUBLIC_FOOTER_TOP_ROW_SX),
|
|
193
190
|
entry('PublicFooter.identity', 'MuiBox', PUBLIC_FOOTER_IDENTITY_SX),
|
|
194
191
|
entry('PublicFooter.copyright', 'MuiTypography', PUBLIC_FOOTER_COPYRIGHT_SX),
|
|
195
192
|
entry('PublicFooter.nav', 'MuiBox', PUBLIC_FOOTER_NAV_SX),
|
|
196
193
|
entry('PublicFooter.legalLink', 'MuiLink', PUBLIC_FOOTER_LEGAL_LINK_SX),
|
|
197
|
-
entry('PublicFooter.settingsRow', 'MuiBox', PUBLIC_FOOTER_SETTINGS_ROW_SX),
|
|
198
194
|
entry('PublicFooter.settingsLink', 'MuiLink', PUBLIC_FOOTER_SETTINGS_LINK_SX),
|
|
199
195
|
entry('AccessCodeManager.action', 'MuiButton', ACCESS_CODE_ACTION_SX),
|
|
200
196
|
entry('AccessCodeManager.primaryAction', 'MuiButton', ACCESS_CODE_PRIMARY_ACTION_SX),
|
package/package.json
CHANGED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { Accordion, AccordionDetails, AccordionSummary, Alert, Box, Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, Stack, Typography, } from '@mui/material';
|
|
4
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { usePrivacy } from './PrivacyProvider';
|
|
7
|
-
import { PrivacyNoticeLink } from './PrivacyNoticeLink';
|
|
8
|
-
function localized(value, language) {
|
|
9
|
-
if (!value || typeof value !== 'object')
|
|
10
|
-
return '';
|
|
11
|
-
const normalized = String(language || '').replace('_', '-').toLowerCase();
|
|
12
|
-
const exact = Object.keys(value).find((key) => key.toLowerCase() === normalized);
|
|
13
|
-
if (exact)
|
|
14
|
-
return value[exact];
|
|
15
|
-
const base = normalized.split('-')[0];
|
|
16
|
-
const match = Object.keys(value).find((key) => key.toLowerCase() === base)
|
|
17
|
-
|| Object.keys(value).find((key) => key.toLowerCase().split('-')[0] === base);
|
|
18
|
-
return value[match || Object.keys(value)[0]] || '';
|
|
19
|
-
}
|
|
20
|
-
function storageText(storage) {
|
|
21
|
-
if (!storage || typeof storage !== 'object')
|
|
22
|
-
return '';
|
|
23
|
-
return [storage.kind, storage.name, storage.scope, storage.lifetime].filter(Boolean).join(' · ');
|
|
24
|
-
}
|
|
25
|
-
function ServiceDetails({ purpose, locale, t }) {
|
|
26
|
-
const services = purpose.services || [];
|
|
27
|
-
const justification = typeof purpose.justification === 'string'
|
|
28
|
-
? purpose.justification
|
|
29
|
-
: localized(purpose.justification, locale);
|
|
30
|
-
return (_jsxs(Stack, { spacing: 1, children: [justification && _jsx(Typography, { variant: "body2", children: justification }), services.map((service) => { var _a, _b, _c, _d; return (_jsxs(Box, { children: [service.provider && (_jsx(Typography, { variant: "body2", children: t('Privacy.PROVIDER_STORAGE_DETAIL', { provider: service.provider }) })), ((_a = service.browser_storage) === null || _a === void 0 ? void 0 : _a.length) > 0 && (_jsx(Box, { component: "ul", sx: { my: 0.5, pl: 3 }, children: service.browser_storage.map((storage, index) => (_jsx("li", { children: _jsx(Typography, { variant: "body2", children: storageText(storage) }) }, `${service.id}-storage-${index}`))) })), service.server_retention && (_jsx(Typography, { variant: "body2", children: t('Privacy.SERVER_RETENTION', { retention: service.server_retention }) })), ((_b = service.data_categories) === null || _b === void 0 ? void 0 : _b.length) > 0 && (_jsx(Typography, { variant: "body2", children: t('Privacy.DATA_CATEGORIES', { values: service.data_categories.join(', ') }) })), ((_c = service.recipients) === null || _c === void 0 ? void 0 : _c.length) > 0 && (_jsx(Typography, { variant: "body2", children: t('Privacy.RECIPIENTS', { values: service.recipients.join(', ') }) })), ((_d = service.transfers) === null || _d === void 0 ? void 0 : _d.length) > 0 && (_jsx(Typography, { variant: "body2", children: t('Privacy.TRANSFERS', { values: service.transfers.join(', ') }) }))] }, service.id)); })] }));
|
|
31
|
-
}
|
|
32
|
-
function NecessaryStorage({ storage, t }) {
|
|
33
|
-
if (!Array.isArray(storage) || storage.length === 0)
|
|
34
|
-
return null;
|
|
35
|
-
return (_jsxs(Box, { children: [_jsx(Typography, { variant: "subtitle2", children: t('Privacy.NECESSARY_STORAGE') }), _jsx(Box, { component: "ul", sx: { my: 0.5, pl: 3 }, children: storage.map((item, index) => (_jsx("li", { children: _jsx(Typography, { variant: "body2", children: storageText(item) }) }, `necessary-storage-${index}`))) })] }));
|
|
36
|
-
}
|
|
37
|
-
export function PrivacySettingsPanel({ onClose }) {
|
|
38
|
-
var _a;
|
|
39
|
-
const privacy = usePrivacy();
|
|
40
|
-
const { t, i18n } = useTranslation();
|
|
41
|
-
const [draft, setDraft] = useState({});
|
|
42
|
-
const [saving, setSaving] = useState(false);
|
|
43
|
-
const manifest = privacy === null || privacy === void 0 ? void 0 : privacy.manifest;
|
|
44
|
-
const purposes = useMemo(() => { var _a; return ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.purposes) === null || _a === void 0 ? void 0 : _a.filter((purpose) => !purpose.required)) || []; }, [manifest]);
|
|
45
|
-
const required = useMemo(() => { var _a; return ((_a = manifest === null || manifest === void 0 ? void 0 : manifest.purposes) === null || _a === void 0 ? void 0 : _a.filter((purpose) => purpose.required)) || []; }, [manifest]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if ((privacy === null || privacy === void 0 ? void 0 : privacy.status) !== 'ready')
|
|
48
|
-
return;
|
|
49
|
-
const nextDraft = {};
|
|
50
|
-
purposes.forEach((purpose) => {
|
|
51
|
-
var _a, _b, _c;
|
|
52
|
-
nextDraft[purpose.id] = ((_c = (_b = (_a = privacy.choices) === null || _a === void 0 ? void 0 : _a.choices) === null || _b === void 0 ? void 0 : _b[purpose.id]) === null || _c === void 0 ? void 0 : _c.state) === 'granted';
|
|
53
|
-
});
|
|
54
|
-
setDraft(nextDraft);
|
|
55
|
-
}, [privacy === null || privacy === void 0 ? void 0 : privacy.status, privacy === null || privacy === void 0 ? void 0 : privacy.choices, purposes]);
|
|
56
|
-
if (!privacy || privacy.status === 'unconfigured')
|
|
57
|
-
return null;
|
|
58
|
-
if (privacy.status === 'loading') {
|
|
59
|
-
return _jsx(Typography, { role: "status", children: t('Privacy.LOADING') });
|
|
60
|
-
}
|
|
61
|
-
if (privacy.status === 'error' || !manifest) {
|
|
62
|
-
return (_jsxs(Stack, { spacing: 1.5, children: [_jsx(Alert, { severity: "error", role: "alert", children: t('Privacy.UNAVAILABLE') }), _jsx(Button, { type: "button", variant: "outlined", onClick: privacy.retry, children: t('Privacy.RETRY') })] }));
|
|
63
|
-
}
|
|
64
|
-
const locale = i18n.language;
|
|
65
|
-
const hasOtherGrant = purposes.some((purpose) => { var _a, _b, _c; return ((_c = (_b = (_a = privacy.choices) === null || _a === void 0 ? void 0 : _a.choices) === null || _b === void 0 ? void 0 : _b[purpose.id]) === null || _c === void 0 ? void 0 : _c.state) === 'granted'; });
|
|
66
|
-
const onlyNecessaryActive = purposes.length > 0 && purposes.every((purpose) => { var _a, _b, _c; return ((_c = (_b = (_a = privacy.choices) === null || _a === void 0 ? void 0 : _a.choices) === null || _b === void 0 ? void 0 : _b[purpose.id]) === null || _c === void 0 ? void 0 : _c.state) === 'refused'; });
|
|
67
|
-
const setPurpose = (purposeId, checked) => setDraft((previous) => (Object.assign(Object.assign({}, previous), { [purposeId]: checked })));
|
|
68
|
-
const save = async () => {
|
|
69
|
-
setSaving(true);
|
|
70
|
-
try {
|
|
71
|
-
await privacy.save(Object.fromEntries(purposes.map((purpose) => [
|
|
72
|
-
purpose.id,
|
|
73
|
-
draft[purpose.id] ? 'granted' : 'refused',
|
|
74
|
-
])), 'settings');
|
|
75
|
-
}
|
|
76
|
-
finally {
|
|
77
|
-
setSaving(false);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
return (_jsxs(Stack, { spacing: 2, children: [_jsx(Typography, { variant: "body2", children: t('Privacy.CHANGE_ANYTIME') }), ((_a = manifest.controller) === null || _a === void 0 ? void 0 : _a.name) && (_jsxs(Typography, { variant: "body2", children: [_jsxs("strong", { children: [t('Privacy.CONTROLLER'), ":"] }), " ", manifest.controller.name, manifest.controller.contact ? ` · ${manifest.controller.contact}` : ''] })), purposes.length === 0 && _jsx(Typography, { children: t('Privacy.NO_OPTIONAL') }), required.length > 0 && (_jsxs(Box, { children: [_jsx(Typography, { variant: "subtitle1", children: t('Privacy.ALWAYS_ACTIVE') }), _jsx(Typography, { variant: "body2", color: "text.secondary", children: t('Privacy.REQUIRED_INFORMATION') }), _jsx(Stack, { spacing: 1, sx: { mt: 1 }, children: required.map((purpose) => (_jsxs(Accordion, { disableGutters: true, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ExpandMoreIcon, {}), children: _jsx(Typography, { fontWeight: 600, children: localized(purpose.label, locale) }) }), _jsxs(AccordionDetails, { children: [localized(purpose.summary, locale) && _jsx(Typography, { variant: "body2", sx: { mb: 1 }, children: localized(purpose.summary, locale) }), _jsx(ServiceDetails, { purpose: purpose, locale: locale, t: t })] })] }, purpose.id))) })] })), purposes.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Stack, { spacing: 1, children: purposes.map((purpose) => (_jsxs(Box, { sx: { borderBottom: 1, borderColor: 'divider', pb: 1 }, children: [_jsx(FormControlLabel, { control: (_jsx(Checkbox, { checked: Boolean(draft[purpose.id]), onChange: (event) => setPurpose(purpose.id, event.target.checked), disabled: saving || privacy.saveState === 'saving' })), label: localized(purpose.label, locale) }), localized(purpose.summary, locale) && (_jsx(Typography, { variant: "body2", color: "text.secondary", sx: { ml: 4 }, children: localized(purpose.summary, locale) })), _jsxs(Accordion, { disableGutters: true, elevation: 0, sx: { mt: 0.5 }, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ExpandMoreIcon, {}), children: _jsx(Typography, { variant: "body2", children: t('Privacy.DETAILS') }) }), _jsx(AccordionDetails, { children: _jsx(ServiceDetails, { purpose: purpose, locale: locale, t: t }) })] })] }, purpose.id))) }), privacy.saveState === 'error' && (_jsx(Alert, { severity: "error", role: "alert", children: t(hasOtherGrant ? 'Privacy.SAVE_ERROR_WITH_GRANTS' : 'Privacy.SAVE_ERROR') })), privacy.saveState === 'saved' && (_jsx(Alert, { severity: "success", role: "status", children: onlyNecessaryActive ? t('Privacy.NECESSARY_ONLY_ACTIVE') : t('Privacy.SAVED') })), _jsxs(Stack, { direction: "row", spacing: 1, flexWrap: "wrap", children: [_jsx(Button, { type: "button", variant: "contained", disabled: saving || privacy.saveState === 'saving', onClick: save, children: saving || privacy.saveState === 'saving' ? t('Privacy.SAVING') : t('Privacy.SAVE') }), privacy.saveState === 'error' && (_jsx(Button, { type: "button", variant: "outlined", disabled: saving, onClick: privacy.retry, children: t('Privacy.RETRY') }))] })] })), _jsx(NecessaryStorage, { storage: manifest.necessary_storage, t: t }), _jsxs(Box, { children: [_jsxs(Typography, { variant: "body2", component: "span", children: [t('Privacy.NOTICE_EXPLANATION'), " "] }), _jsx(PrivacyNoticeLink, {})] }), onClose && _jsx(Button, { type: "button", onClick: onClose, children: t('Privacy.CLOSE') })] }));
|
|
81
|
-
}
|
|
82
|
-
export function PrivacySettingsDialog() {
|
|
83
|
-
const privacy = usePrivacy();
|
|
84
|
-
const { t } = useTranslation();
|
|
85
|
-
if (!privacy || privacy.status === 'unconfigured' || !privacy.settingsOpen)
|
|
86
|
-
return null;
|
|
87
|
-
return (_jsxs(Dialog, { open: true, onClose: privacy.closeSettings, "aria-labelledby": "privacy-settings-title", fullWidth: true, maxWidth: "sm", children: [_jsx(DialogTitle, { id: "privacy-settings-title", children: t('Privacy.SETTINGS_TITLE') }), _jsx(DialogContent, { dividers: true, children: _jsx(PrivacySettingsPanel, {}) }), _jsx(DialogActions, { children: _jsx(Button, { type: "button", onClick: privacy.closeSettings, children: t('Privacy.CLOSE') }) })] }));
|
|
88
|
-
}
|
|
89
|
-
export default PrivacySettingsDialog;
|