@micha.bigler/ui-core-micha 4.33.1 → 4.34.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 +8 -0
- package/README.md +2 -1
- package/dist/pages/AccountPage.js +16 -3
- package/dist/privacy/PrivacyBanner.js +4 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.34.0 - UCM-PRIV-5
|
|
4
|
+
|
|
5
|
+
With `privacyMode="central"`, `AccountPage` now renders the privacy choices (the same panel as the settings dialog,
|
|
6
|
+
including the notice link) directly in the profile tab, below the form, when the host has a `PrivacyProvider`; the
|
|
7
|
+
profile form no longer shows its own notice-link block there. `PrivacyBanner` no longer moves focus to its title when it
|
|
8
|
+
first appears, so the title shows no focus ring on first load; it remains a labelled region whose buttons are reached in
|
|
9
|
+
the normal tab order. Escape still dismisses it. Consumers without `privacyMode="central"` and without a provider are unchanged.
|
|
10
|
+
|
|
3
11
|
## 4.33.1 - UCM-PRIV-4
|
|
4
12
|
|
|
5
13
|
`AccountPage` now accepts `privacyMode` (default `'legacy'`, unchanged) and forwards it to `ProfileComponent`. With
|
package/README.md
CHANGED
|
@@ -60,7 +60,8 @@ Adoption is explicit. `OnboardingProvider` and `ProfileComponent` / `ProfileStep
|
|
|
60
60
|
remove the legacy privacy and convenience-cookie prompts while keeping name completion and actual terms acceptance. The
|
|
61
61
|
default remains `privacyMode="legacy"` during rollout. `AccountPage` takes the same `privacyMode` prop (4.33.1) and
|
|
62
62
|
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.
|
|
63
|
+
statement text and never selects the central contract. In central mode (4.34.0) the profile tab also shows the privacy
|
|
64
|
+
choices inline when a `PrivacyProvider` is mounted. `CookieConsentStep` remains exported for compatibility and is
|
|
64
65
|
deprecated. The host manifest supplies actual controllers, purpose details, providers, storage and localized notice links;
|
|
65
66
|
empty optional configuration has no choice banner.
|
|
66
67
|
|
|
@@ -12,6 +12,8 @@ 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
|
+
import { usePrivacy } from '../privacy/PrivacyProvider';
|
|
15
17
|
import { SecurityComponent } from '../components/SecurityComponent';
|
|
16
18
|
import { UserListComponent } from '../components/UserListComponent';
|
|
17
19
|
import { UserInviteComponent } from '../components/UserInviteComponent';
|
|
@@ -33,12 +35,23 @@ import { useBillingUsersColumn } from '../billing/useBillingUsersColumn';
|
|
|
33
35
|
* the operators. A new function on each render only recomputes the columns; it does not refetch the accounts.
|
|
34
36
|
* `privacyMode` (optional, UCM-PRIV-4): `'legacy'` (default, unchanged) or `'central'`. `'central'` is forwarded to
|
|
35
37
|
* ProfileComponent: the profile drops the privacy-statement and convenience-cookie checkboxes and sends neither legacy
|
|
36
|
-
* field; name editing is unchanged
|
|
37
|
-
*
|
|
38
|
+
* field; name editing is unchanged. The profile tab then shows the privacy settings panel (the same choices as the
|
|
39
|
+
* settings dialog, incl. the notice link) below the form when the host has a PrivacyProvider. It never depends on
|
|
40
|
+
* provider presence for dropping the legacy controls, and stays central while the privacy manifest loads or fails.
|
|
41
|
+
* `showProfileStatements` only hides statement text.
|
|
38
42
|
* `groups` (optional): app-defined account navigation groups with `{ key, label, order?, tabs?, visible? }`. Labels
|
|
39
43
|
* may be strings or `(context) => string`; `tabs` assigns built-in tab values, and `visible(context)` can hide a group
|
|
40
44
|
* and its tabs. Without this prop, the default groups and placement are unchanged.
|
|
41
45
|
*/
|
|
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
|
+
}
|
|
42
55
|
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, }) {
|
|
43
56
|
var _a;
|
|
44
57
|
const { t, i18n } = useTranslation();
|
|
@@ -255,5 +268,5 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
|
|
|
255
268
|
const activeExtraTab = builtInTabValues.has(safeTab)
|
|
256
269
|
? null
|
|
257
270
|
: 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' && (
|
|
271
|
+
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
272
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React
|
|
2
|
+
import React 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';
|
|
@@ -31,17 +31,8 @@ export function PrivacyBanner() {
|
|
|
31
31
|
var _a, _b;
|
|
32
32
|
const privacy = usePrivacy();
|
|
33
33
|
const { t, i18n } = useTranslation();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
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]);
|
|
34
|
+
// The banner is nonmodal: it never takes focus on its own (the title would show a focus ring on first
|
|
35
|
+
// load); it stays reachable as a labelled region and through the normal tab order.
|
|
45
36
|
if (!(privacy === null || privacy === void 0 ? void 0 : privacy.bannerVisible))
|
|
46
37
|
return null;
|
|
47
38
|
const onKeyDown = (event) => {
|
|
@@ -55,6 +46,6 @@ export function PrivacyBanner() {
|
|
|
55
46
|
return (_jsx(Paper, { role: "region", "aria-labelledby": "privacy-banner-title",
|
|
56
47
|
// Stays mounted while the settings dialog is open (it sits above modals and would cover the dialog's
|
|
57
48
|
// 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",
|
|
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') })] })] }) }));
|
|
59
50
|
}
|
|
60
51
|
export default PrivacyBanner;
|