@micha.bigler/ui-core-micha 4.17.0 → 4.18.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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.18.0 - UCM-BILL-10
4
+
5
+ `AccountPage` accepts an optional `billingOperator({ user, account }) => boolean` and passes it as the operator rule to
6
+ the billing users columns it builds when `billingUsers` is set, so status, badge and the "Ohne Abo" switch follow the
7
+ app's rule. Without the prop the superuser default stays; with `billingUsers` off nothing changes.
8
+
3
9
  ## 4.17.0 - UCM-BILL-9
4
10
 
5
11
  Users tab, every app: the billing access column is a short coloured status (`accountAccessText` now returns
package/README.md CHANGED
@@ -29,7 +29,9 @@ With billing in the account page, the user list shows two columns: "Zugang", a s
29
29
  "{Plan} · bis {Datum}", "Team · bis {Datum}", "Schreibgeschützt", "Betreiber"), and "Ohne Abo", the free-access switch
30
30
  without a visible label (only for free and read-only rows; "–" otherwise). Plan names come from the app's own catalogue
31
31
  (`getMe().plans`); a plan without a name shows "Abo", never its key. Operator rows default to `user.is_superuser`;
32
- `useBillingUsersColumn({ isOperator: ({ user, account }) => ... })` overrides that. The built-in delete is an icon button
32
+ `<AccountPage billingUsers billingOperator={({ user }) => user.is_superuser || user.role === 'admin'}>` (or
33
+ `useBillingUsersColumn({ isOperator })` directly) applies the app's own rule; a new function per render does not
34
+ refetch the accounts. The built-in delete is an icon button
33
35
  named "Löschen – {Name}", shown disabled on the own row; confirmation, permissions and app row actions are unchanged.
34
36
 
35
37
  ## Account section: plan choice on the app's own page
@@ -27,7 +27,12 @@ import { BulkInviteCsvTab } from '../components/BulkInviteCsvTab';
27
27
  import { fetchAuthPolicy, updateUserProfile } from '../auth/authApi'; // Ggf. Pfad anpassen
28
28
  import { defaultBillingApi } from '../billing/api';
29
29
  import { useBillingUsersColumn } from '../billing/useBillingUsersColumn';
30
- 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, billingUsers = false, }) {
30
+ /**
31
+ * `billingOperator({ user, account }) => boolean` (optional, UCM-BILL-10): the app's operator rule for the billing
32
+ * users columns built when `billingUsers` is set (status, badge and the "Ohne Abo" switch). Without it superusers are
33
+ * the operators. A new function on each render only recomputes the columns; it does not refetch the accounts.
34
+ */
35
+ 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, billingUsers = false, billingOperator, }) {
31
36
  var _a;
32
37
  const { t, i18n } = useTranslation();
33
38
  const { user, login, loading } = useContext(AuthContext);
@@ -37,7 +42,7 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
37
42
  const theme = useTheme();
38
43
  const isMobile = useMediaQuery(theme.breakpoints.down('md'));
39
44
  const billingApi = billingUsers && typeof billingUsers === 'object' ? billingUsers : defaultBillingApi;
40
- const billing = useBillingUsersColumn({ api: billingApi, enabled: Boolean(billingUsers) });
45
+ const billing = useBillingUsersColumn(Object.assign({ api: billingApi, enabled: Boolean(billingUsers) }, (billingOperator ? { isOperator: billingOperator } : {})));
41
46
  // 1. URL State Management
42
47
  const currentTabRaw = searchParams.get('tab') || 'profile';
43
48
  const currentTab = ['invite', 'bulk-invite-csv', 'access'].includes(currentTabRaw)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.17.0",
3
+ "version": "4.18.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {