@micha.bigler/ui-core-micha 4.33.1 → 4.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.35.0 - UCM-PRIV-6
4
+
5
+ Removal, released as a minor because no consumer imports the removed names and all consumers pin exact versions: the
6
+ detailed privacy settings dialog is gone. `PrivacySettingsDialog` and `PrivacySettingsPanel` are no longer
7
+ exported, `UserMenu` no longer takes a `legal` prop and shows no legal or privacy entries, and `usePrivacy()` no longer
8
+ returns `settingsOpen` or `closeSettings`. The only privacy choices are the banner's two buttons ("Necessary only" /
9
+ "Allow all", applied to every optional purpose). `openSettings()` and `PrivacySettingsLink` keep their names and now
10
+ re-show that banner, so a choice can be changed later from the footer; they appear only when the app has optional
11
+ purposes (`usePrivacy().hasOptionalPurposes`). The banner has no "Settings" button and carries the privacy notice link.
12
+ `AccountPage` in `privacyMode="central"` shows the same two buttons in its profile section (replacing the 4.34.0 inline
13
+ panel). `PublicFooter` is one compact line (identity left, legal links and the settings entry right, wrapping on narrow
14
+ screens, `mt: auto` so it sits at the bottom of a column-flex page). Migration: remove `legal` from `UserMenu` call sites
15
+ and any header or menu entry that duplicates the footer; no consumer imported the removed exports.
16
+
17
+ ## 4.34.0 - UCM-PRIV-5
18
+
19
+ With `privacyMode="central"`, `AccountPage` now renders the privacy choices (the same panel as the settings dialog,
20
+ including the notice link) directly in the profile tab, below the form, when the host has a `PrivacyProvider`; the
21
+ profile form no longer shows its own notice-link block there. `PrivacyBanner` no longer moves focus to its title when it
22
+ first appears, so the title shows no focus ring on first load; it remains a labelled region whose buttons are reached in
23
+ the normal tab order. Escape still dismisses it. Consumers without `privacyMode="central"` and without a provider are unchanged.
24
+
3
25
  ## 4.33.1 - UCM-PRIV-4
4
26
 
5
27
  `AccountPage` now accepts `privacyMode` (default `'legacy'`, unchanged) and forwards it to `ProfileComponent`. With
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`, `UserMenu`'s
22
- `legal` prop, `PrivacySettingsLink` and `PrivacyNoticeLink`. Create the API once and pass it to the provider when the
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,13 @@ 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` on
36
- public pages, including login and registration, and pass the same `legal` configuration to `UserMenu` for authenticated
37
- workspaces. This keeps public legal links available without a provider and opens settings for the current app when adopted.
38
- `PrivacyFooterLinks` remains available for existing consumers; a public footer uses `PublicFooter` instead of it, never both. The provider owns the settings dialog. Register each app-owned
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; there are no
37
+ legal or privacy entries in headers or in the account menu. The account page (`privacyMode="central"`) shows the two
38
+ quick choices in its profile section. This keeps public legal links available without a provider. When an app has
39
+ optional purposes, the footer entry reopens the same banner with “Necessary only” and “Allow all”; either choice applies
40
+ to every optional purpose. A necessary-only app has no banner or settings entry. `PrivacyFooterLinks` remains available for existing consumers; a
41
+ public footer uses `PublicFooter` instead of it, never both. Register each app-owned
39
42
  optional adapter with `registerPrivacyService({ purposeId, serviceId, activate, deactivate, ownedStorage })`; gate imports,
40
43
  requests and callbacks with `useGrantedPurpose`, `guardedImport` or `createPrivacyGuard`. The package never loads vendors.
41
44
 
@@ -48,7 +51,6 @@ const legal = {
48
51
  };
49
52
 
50
53
  <PublicFooter brand={<MaanaBrand />} copyright={copyrightNode} {...legal} />
51
- <UserMenu legal={legal} />
52
54
  ```
53
55
 
54
56
  Central links use `/legal/<slug>?app=<registered-id>&lang=<document-locale>`; the package chooses a supported document
@@ -60,9 +62,10 @@ Adoption is explicit. `OnboardingProvider` and `ProfileComponent` / `ProfileStep
60
62
  remove the legacy privacy and convenience-cookie prompts while keeping name completion and actual terms acceptance. The
61
63
  default remains `privacyMode="legacy"` during rollout. `AccountPage` takes the same `privacyMode` prop (4.33.1) and
62
64
  forwards it to its profile tab; pass `privacyMode="central"` there too, because `showProfileStatements={false}` only hides
63
- statement text and never selects the central contract. `CookieConsentStep` remains exported for compatibility and is
64
- deprecated. The host manifest supplies actual controllers, purpose details, providers, storage and localized notice links;
65
- empty optional configuration has no choice banner.
65
+ statement text and never selects the central contract. In central mode (4.34.0) the profile tab also shows the privacy
66
+ choices inline when a `PrivacyProvider` is mounted. `CookieConsentStep` remains exported for compatibility and is
67
+ deprecated. The host manifest supplies purposes and localized notice links; empty optional configuration has no choice
68
+ banner or settings entry.
66
69
 
67
70
  ## Account page: extra tabs in a navigation group
68
71
 
@@ -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, legal }) {
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))), legal !== undefined && legal !== null ? ([
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,6 +12,7 @@ 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 { usePrivacy } from '../privacy/PrivacyProvider';
15
16
  import { SecurityComponent } from '../components/SecurityComponent';
16
17
  import { UserListComponent } from '../components/UserListComponent';
17
18
  import { UserInviteComponent } from '../components/UserInviteComponent';
@@ -27,14 +28,30 @@ import { BulkInviteCsvTab } from '../components/BulkInviteCsvTab';
27
28
  import { fetchAuthPolicy, updateUserProfile } from '../auth/authApi'; // Ggf. Pfad anpassen
28
29
  import { defaultBillingApi } from '../billing/api';
29
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
+ }
30
45
  /**
31
46
  * `billingOperator({ user, account }) => boolean` (optional, UCM-BILL-10): the app's operator rule for the billing
32
47
  * users columns built when `billingUsers` is set (status, badge and the "Ohne Abo" switch). Without it superusers are
33
48
  * the operators. A new function on each render only recomputes the columns; it does not refetch the accounts.
34
49
  * `privacyMode` (optional, UCM-PRIV-4): `'legacy'` (default, unchanged) or `'central'`. `'central'` is forwarded to
35
50
  * ProfileComponent: the profile drops the privacy-statement and convenience-cookie checkboxes and sends neither legacy
36
- * field; name editing is unchanged and the central privacy notice link is shown. It never depends on provider presence,
37
- * and stays central while the privacy manifest loads or fails. `showProfileStatements` only hides statement text.
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
53
+ * provider presence for dropping the legacy controls, and stays central while the privacy manifest loads or fails.
54
+ * `showProfileStatements` only hides statement text.
38
55
  * `groups` (optional): app-defined account navigation groups with `{ key, label, order?, tabs?, visible? }`. Labels
39
56
  * may be strings or `(context) => string`; `tabs` assigns built-in tab values, and `visible(context)` can hide a group
40
57
  * and its tabs. Without this prop, the default groups and placement are unchanged.
@@ -255,5 +272,5 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
255
272
  const activeExtraTab = builtInTabValues.has(safeTab)
256
273
  ? null
257
274
  : extraTabs.find((tab) => tab.value === safeTab);
258
- return (_jsxs(WidePage, { title: t('Account.TITLE', 'Account & Administration'), children: [_jsx("title", { children: `${t('Account.PAGE_TITLE', 'Account')} – ${user.email}` }), _jsxs(SectionNav, { mode: isMobile ? 'mobile' : 'desktop', groups: groups, activeKey: safeTab, onSelect: (key) => handleTabChange(null, key), children: [safeTab === 'profile' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(ProfileComponent, { onSubmit: handleProfileSubmit, showName: true, showPrivacy: true, showCookies: true, showStatements: showProfileStatements, privacyMode: privacyMode }) })), safeTab === 'security' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(SecurityComponent, { fromRecovery: fromRecovery, fromWeakLogin: fromWeakLogin }) })), safeTab === 'users' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(UserListComponent, { roles: activeRoles, currentUser: user, extraColumns: [...userListExtraColumns, ...billing.extraColumns], extraRowActions: userListExtraRowActions, extraContext: userListExtraContext, refreshTrigger: userListRefreshTrigger, canEditUser: userListCanEditUser, showNewColumn: userListShowNewColumn, showSuccessfulLoginColumn: userListShowSuccessfulLoginColumn, showRoleColumn: userListShowRoleColumn, onChangeRole: userListOnChangeRole, showDeleteAction: userListShowDeleteAction, canDeleteUser: userListCanDeleteUser, onDeleteUser: userListOnDeleteUser }) })), safeTab === 'invite' && (_jsx(Box, { sx: { mt: 2 }, children: _jsxs(Stack, { spacing: 2.5, children: [canViewAuthPolicy && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AuthFactorRequirementCard, { canEdit: canWriteAuthPolicy, policy: authPolicy }) })), canViewAuthPolicy && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(RegistrationMethodsManager, { policy: authPolicy, error: authPolicyError, onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canSendInvites && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_admin_invite) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(UserInviteComponent, {}) })), canManageAccessCodes && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_access_code) && (_jsxs(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: [_jsx(Typography, { variant: "h6", gutterBottom: true, children: t('Auth.ACCESS_CODE_MANAGER_TITLE', 'Access Codes') }), _jsx(Typography, { variant: "body2", sx: { mb: 2, color: 'text.secondary' }, children: t('Account.ACCESS_CODES_HINT', 'Manage access codes for self-registration.') }), _jsx(AccessCodeManager, {})] })), canManageAccessCodes && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_access_code) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AccessCodeSingleUseToggle, { canEdit: canWriteAuthPolicy, policy: authPolicy, onPolicyChange: setAuthPolicy }) })), canSendInvites && showBulkInviteCsvTab && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_admin_invite) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(BulkInviteCsvTab, Object.assign({}, bulkInviteCsvProps)) })), canViewAuthPolicy && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_email_domain) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AllowedEmailDomainsManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_email_domain), domains: (authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allowed_email_domains) || [], onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canViewAuthPolicy && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(QrSignupValidityManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr), expiryDays: authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.signup_qr_expiry_days, onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canManageSignupQr && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(QrSignupManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr), expiryDays: authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.signup_qr_expiry_days }) }))] }) })), safeTab === 'support' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(SupportRecoveryRequestsTab, {}) })), activeExtraTab && (_jsx(Box, { sx: { mt: 2 }, children: (_a = activeExtraTab.render) === null || _a === void 0 ? void 0 : _a.call(activeExtraTab, { user, perms, isSuperUser, t }) }))] })] }));
275
+ return (_jsxs(WidePage, { title: t('Account.TITLE', 'Account & Administration'), children: [_jsx("title", { children: `${t('Account.PAGE_TITLE', 'Account')} – ${user.email}` }), _jsxs(SectionNav, { mode: isMobile ? 'mobile' : 'desktop', groups: groups, activeKey: safeTab, onSelect: (key) => handleTabChange(null, key), children: [safeTab === 'profile' && (_jsxs(Box, { sx: { mt: 2 }, children: [_jsx(ProfileComponent, { onSubmit: handleProfileSubmit, showName: true, showPrivacy: privacyMode !== 'central', showCookies: privacyMode !== 'central', showStatements: showProfileStatements, privacyMode: privacyMode }), privacyMode === 'central' && _jsx(AccountPrivacySection, {})] })), safeTab === 'security' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(SecurityComponent, { fromRecovery: fromRecovery, fromWeakLogin: fromWeakLogin }) })), safeTab === 'users' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(UserListComponent, { roles: activeRoles, currentUser: user, extraColumns: [...userListExtraColumns, ...billing.extraColumns], extraRowActions: userListExtraRowActions, extraContext: userListExtraContext, refreshTrigger: userListRefreshTrigger, canEditUser: userListCanEditUser, showNewColumn: userListShowNewColumn, showSuccessfulLoginColumn: userListShowSuccessfulLoginColumn, showRoleColumn: userListShowRoleColumn, onChangeRole: userListOnChangeRole, showDeleteAction: userListShowDeleteAction, canDeleteUser: userListCanDeleteUser, onDeleteUser: userListOnDeleteUser }) })), safeTab === 'invite' && (_jsx(Box, { sx: { mt: 2 }, children: _jsxs(Stack, { spacing: 2.5, children: [canViewAuthPolicy && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AuthFactorRequirementCard, { canEdit: canWriteAuthPolicy, policy: authPolicy }) })), canViewAuthPolicy && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(RegistrationMethodsManager, { policy: authPolicy, error: authPolicyError, onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canSendInvites && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_admin_invite) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(UserInviteComponent, {}) })), canManageAccessCodes && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_access_code) && (_jsxs(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: [_jsx(Typography, { variant: "h6", gutterBottom: true, children: t('Auth.ACCESS_CODE_MANAGER_TITLE', 'Access Codes') }), _jsx(Typography, { variant: "body2", sx: { mb: 2, color: 'text.secondary' }, children: t('Account.ACCESS_CODES_HINT', 'Manage access codes for self-registration.') }), _jsx(AccessCodeManager, {})] })), canManageAccessCodes && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_access_code) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AccessCodeSingleUseToggle, { canEdit: canWriteAuthPolicy, policy: authPolicy, onPolicyChange: setAuthPolicy }) })), canSendInvites && showBulkInviteCsvTab && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_admin_invite) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(BulkInviteCsvTab, Object.assign({}, bulkInviteCsvProps)) })), canViewAuthPolicy && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_email_domain) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(AllowedEmailDomainsManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_email_domain), domains: (authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allowed_email_domains) || [], onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canViewAuthPolicy && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(QrSignupValidityManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr), expiryDays: authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.signup_qr_expiry_days, onPolicyChange: setAuthPolicy, canEdit: canWriteAuthPolicy }) })), canManageSignupQr && Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr) && (_jsx(Paper, { variant: "outlined", sx: ACCOUNT_PAGE_SECTION_PAPER_SX, children: _jsx(QrSignupManager, { enabled: Boolean(authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.allow_self_signup_qr), expiryDays: authPolicy === null || authPolicy === void 0 ? void 0 : authPolicy.signup_qr_expiry_days }) }))] }) })), safeTab === 'support' && (_jsx(Box, { sx: { mt: 2 }, children: _jsx(SupportRecoveryRequestsTab, {}) })), activeExtraTab && (_jsx(Box, { sx: { mt: 2 }, children: (_a = activeExtraTab.render) === null || _a === void 0 ? void 0 : _a.call(activeExtraTab, { user, perms, isSuperUser, t }) }))] })] }));
259
276
  }
@@ -4,6 +4,7 @@ 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,17 +32,16 @@ export function PrivacyBanner() {
31
32
  var _a, _b;
32
33
  const privacy = usePrivacy();
33
34
  const { t, i18n } = useTranslation();
34
- const headingRef = useRef(null);
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.
35
40
  useEffect(() => {
36
41
  var _a;
37
- if (!(privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible))
38
- return;
39
- // The banner is nonmodal and loads asynchronously: move focus only when nothing else holds it,
40
- // so it never interrupts someone who is already using the page.
41
- const active = typeof document !== 'undefined' ? document.activeElement : null;
42
- if (!active || active === document.body)
43
- (_a = headingRef.current) === null || _a === void 0 ? void 0 : _a.focus();
44
- }, [privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible]);
42
+ if (reopenedByUser)
43
+ (_a = firstChoiceRef.current) === null || _a === void 0 ? void 0 : _a.focus();
44
+ }, [reopenedByUser]);
45
45
  if (!(privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible))
46
46
  return null;
47
47
  const onKeyDown = (event) => {
@@ -52,9 +52,6 @@ export function PrivacyBanner() {
52
52
  };
53
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)) || [];
54
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'; });
55
- return (_jsx(Paper, { role: "region", "aria-labelledby": "privacy-banner-title",
56
- // Stays mounted while the settings dialog is open (it sits above modals and would cover the dialog's
57
- // actions) so the dialog can return focus to the Settings button that opened it.
58
- 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", tabIndex: -1, ref: headingRef, 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') })] })] }) }));
59
56
  }
60
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 opens THIS app's shared settings (never the reader's) and is
52
- * hidden only when the host has not adopted the privacy module; the legal links are always rendered.
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, jsxs as _jsxs } from "react/jsx-runtime";
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 [settingsOpen, setSettingsOpen] = useState(false);
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(() => setSettingsOpen(true), []);
442
- const closeSettings = useCallback(() => setSettingsOpen(false), []);
443
- const dismissBanner = useCallback(() => setBannerDismissed(true), []);
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, settingsOpen, openSettings, closeSettings, dismissBanner,
470
+ status, manifest, choices, optionalPurposes.length, needsDecision, bannerVisible, reopened, saveState, error, hasGrant,
471
+ save, acceptAll, necessaryOnly, retry, openSettings, dismissBanner,
464
472
  ]);
465
- return (_jsxs(PrivacyContext.Provider, { value: value, children: [children, _jsx(PrivacySettingsDialog, {})] }));
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 === 'unconfigured')
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,32 @@ 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
- pt: 3,
27
- pb: 2.5,
31
+ py: 1,
28
32
  bgcolor: 'background.paper',
29
- };
30
- export const PUBLIC_FOOTER_TOP_ROW_SX = {
31
33
  display: 'flex',
32
- flexDirection: { xs: 'column', sm: 'row' },
33
- alignItems: { xs: 'stretch', sm: 'center' },
34
+ flexWrap: 'wrap',
35
+ alignItems: 'center',
34
36
  justifyContent: 'space-between',
35
- gap: { xs: 0, sm: 3 },
37
+ columnGap: 3,
38
+ rowGap: 0,
36
39
  };
37
40
  export const PUBLIC_FOOTER_IDENTITY_SX = {
38
41
  display: 'flex',
39
- flexDirection: 'column',
40
- gap: 0.5,
42
+ alignItems: 'center',
43
+ gap: 1.25,
41
44
  flexShrink: 0,
42
- mb: { xs: 2, sm: 0 },
45
+ minHeight: { xs: 36, sm: 32 },
43
46
  };
44
47
  export const PUBLIC_FOOTER_COPYRIGHT_SX = {
45
48
  color: 'text.secondary',
@@ -47,21 +50,21 @@ export const PUBLIC_FOOTER_COPYRIGHT_SX = {
47
50
  lineHeight: 1.4,
48
51
  };
49
52
  export const PUBLIC_FOOTER_NAV_SX = {
50
- display: { xs: 'grid', sm: 'flex' },
51
- gridTemplateColumns: { xs: 'repeat(2, minmax(0, 1fr))', sm: 'none' },
52
- justifyContent: { xs: 'start', sm: 'flex-end' },
53
+ display: 'flex',
53
54
  flexWrap: 'wrap',
55
+ justifyContent: 'flex-end',
54
56
  alignItems: 'center',
55
- gap: { xs: '4px 16px', sm: '8px 22px' },
57
+ columnGap: { xs: 2, sm: 2.75 },
58
+ rowGap: 0,
56
59
  minWidth: 0,
57
60
  };
58
61
  export const PUBLIC_FOOTER_LEGAL_LINK_SX = {
59
62
  display: 'inline-flex',
60
63
  alignItems: 'center',
61
64
  minWidth: 0,
62
- minHeight: { xs: 44, sm: 36 },
65
+ minHeight: { xs: 40, sm: 32 },
63
66
  color: 'text.secondary',
64
- fontSize: { xs: '0.75rem', sm: '0.8125rem' },
67
+ fontSize: '0.8125rem',
65
68
  lineHeight: 1.35,
66
69
  overflowWrap: 'anywhere',
67
70
  textDecoration: 'none',
@@ -70,19 +73,11 @@ export const PUBLIC_FOOTER_LEGAL_LINK_SX = {
70
73
  textDecoration: 'underline',
71
74
  },
72
75
  };
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
76
  export const PUBLIC_FOOTER_SETTINGS_LINK_SX = {
82
77
  display: 'inline-flex',
83
78
  alignItems: 'center',
84
- gap: 1,
85
- minHeight: { xs: 44, sm: 36 },
79
+ gap: 0.75,
80
+ minHeight: { xs: 40, sm: 32 },
86
81
  px: 0,
87
82
  color: 'primary.main',
88
83
  fontSize: '0.8125rem',
@@ -95,7 +90,7 @@ export function PublicFooter(_a) {
95
90
  const privacy = usePrivacy();
96
91
  const entries = useLegalEntries({ legalOrigin, appId, documents, extraLinks, fallbackLanguage });
97
92
  const { className, sx } = props, footerProps = __rest(props, ["className", "sx"]);
98
- const canOpenSettings = showSettings && privacy && privacy.status !== 'unconfigured';
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: PUBLIC_FOOTER_TOP_ROW_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] }), _jsx(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 ? (_jsx(Box, { sx: PUBLIC_FOOTER_SETTINGS_ROW_SX, children: _jsxs(PrivacySettingsLink, { sx: PUBLIC_FOOTER_SETTINGS_LINK_SX, children: [_jsx(TuneIcon, { fontSize: "small", "aria-hidden": "true" }), t('Privacy.LEGAL_SETTINGS')] }) })) : null] })));
93
+ const canOpenSettings = showSettings && (privacy === null || privacy === void 0 ? void 0 : privacy.status) === 'ready' && privacy.hasOptionalPurposes;
94
+ 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
95
  }
101
96
  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, PUBLIC_FOOTER_SETTINGS_ROW_SX, PUBLIC_FOOTER_TOP_ROW_SX, } from '../privacy/PublicFooter';
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.33.1",
3
+ "version": "4.35.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {
@@ -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;