@micha.bigler/ui-core-micha 4.9.0 → 4.11.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,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.11.0 - UCM-BILL-7
4
+
5
+ An entry of `AccountPage`'s `extraTabs` accepts an optional `group` naming one of the kit's navigation groups:
6
+ `my-account` (Profil, Sicherheit), `management` (Benutzer, Einladen) or `help` (Support). With it the tab appears in
7
+ that group after the kit's own tabs (in the order of `extraTabs`), in the desktop sidebar and in the phone navigation;
8
+ without `group`, or with `more` or an unknown value, it stays in "Weitere" as before. The kit's own tabs, their order
9
+ and labels are unchanged.
10
+
11
+ ## 4.10.0 - UCM-BILL-6
12
+
13
+ The account section matches the Maana prototype in three places, against `django-core-micha` >= 3.13.0 (DCM-BILL-6).
14
+ The token balance is broken down by origin in a small table "Herkunft / verbleibend / gültig": one row per grant
15
+ (Kontingent, Paket, Gutschrift, Test-Guthaben, by `tokens.grants[].origin`) and the team pool (`tokens.pool`, "Team-Pool"),
16
+ each with the remaining amount, "verfällt am {Datum}" or "verfällt nicht" and a thin bar of the remaining share (on a
17
+ phone the validity moves under the row). A seat holder sees "Platz im Team-Paket von {Name}" (`seat.payer_name`) under
18
+ "Team-Platz bis {Datum}". The section "Käufe" lists every purchase of the withdrawal list: eligible ones with "Vertrag
19
+ hier widerrufen" and "bis {Datum}", withdrawn ones with "Widerrufen am {Datum}", ones past the period with
20
+ "Widerrufsfrist abgelaufen", other reasons without an action. With an older dcm (no `origin`, `pool` or `payer_name`)
21
+ the section shows today's display. New keys `Billing.ORIGIN_*`, `EXPIRES_ON`, `NEVER_EXPIRES`, `ORIGIN_LINE`,
22
+ `SEAT_PAYER`, `PURCHASES`, `WITHDRAWN_ON`, `WITHDRAWAL_PERIOD_OVER` (de, de_informal, en, fr, sw).
23
+
3
24
  ## 4.9.0 - UCM-BILL-5
4
25
 
5
26
  Informal German for the whole billing surface: every `Billing.*` key now has a `de_informal` value (the "du" form where
package/README.md CHANGED
@@ -16,6 +16,13 @@ Spread `uiCoreTranslations` into the default i18n namespace as the supported agg
16
16
  offer privacy/cookie statement text endpoints; this hides their panels and prevents their requests.
17
17
  The privacy and cookie consent controls and their submitted values remain available.
18
18
 
19
+ ## Account page: extra tabs in a navigation group
20
+
21
+ An entry of `AccountPage`'s `extraTabs` (`{ value, label, content, visible? }`) may carry an optional `group` naming one of
22
+ the kit's navigation groups: `my-account` (Profile, Security), `management` (Users, Invite) or `help` (Support). The tab
23
+ then appears in that group after the kit's own tabs, in the order of `extraTabs`, in the desktop sidebar and in the
24
+ phone navigation. Without `group`, or with `more` or an unknown value, it stays in "More" as before.
25
+
19
26
  ## Consumer integration check
20
27
 
21
28
  ```js
@@ -10,6 +10,7 @@ import { PlanPicker } from './PlanPicker';
10
10
  import { TokenBalanceBadge } from './TokenBalanceBadge';
11
11
  import { AccessEndedBanner } from './AccessEndedBanner';
12
12
  import { WithdrawalSection } from './WithdrawalSection';
13
+ import { TokenOriginTable } from './TokenOriginTable';
13
14
  export const SUBSCRIPTION_SECTION_ALERT_SX = { width: '100%' };
14
15
  export const SUBSCRIPTION_SECTION_SEAT_SELECT_SX = { flex: '1 1 auto', minWidth: 0 };
15
16
  // The seat button keeps its width and its single line next to a shrinking select (375 px).
@@ -111,11 +112,7 @@ export function SubscriptionSection({ api = defaultBillingApi, redirect = (url)
111
112
  return selectedSeatCandidate ? api.addSeat({ userId: selectedSeatCandidate.id }) : undefined;
112
113
  }
113
114
  return seatInput.includes('@') ? api.addSeat({ email: seatInput.trim() }) : api.addSeat({ userId: seatInput.trim() });
114
- }), children: t('Billing.SEATS_ADD') })] }), seatError && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: typeof seatError === 'string' ? t(seatError) : t('Billing.ERROR_LOAD') })] }), actionError && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: t(actionError) }), me.seat && typeof me.seat === 'object' && formatDate(me.seat.ends_at, i18n.language) && _jsx(Typography, { children: t('Billing.OP_SEAT_UNTIL', { date: formatDate(me.seat.ends_at, i18n.language) }) })] }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { children: t('Billing.BALANCE_LABEL') }), _jsx(TokenBalanceBadge, { balance: tokens.balance })] }), _jsx(Typography, { children: t('Billing.BALANCE', { tokens: formatTokens(tokens.balance, i18n.language) }) }), Array.isArray(tokens.grants) && tokens.grants.length > 0 && _jsx(Stack, { spacing: 0.5, children: tokens.grants.map((grant, index) => {
115
- if (!['plan', 'package'].includes(grant === null || grant === void 0 ? void 0 : grant.source) || !Number.isInteger(grant.amount) || !Number.isInteger(grant.remaining))
116
- return null;
117
- return _jsxs(Stack, { spacing: 0.25, children: [_jsxs(Typography, { children: [t(grant.source === 'plan' ? 'Billing.OP_GRANT_PLAN' : 'Billing.OP_GRANT_PACKAGE'), ": ", formatTokens(grant.amount, i18n.language)] }), _jsxs(Typography, { children: [formatTokens(grant.remaining, i18n.language), " ", t('Billing.OP_REMAINING')] }), formatDate(grant.expires_at, i18n.language) && _jsx(Typography, { children: t('Billing.OP_VALID_UNTIL', { date: formatDate(grant.expires_at, i18n.language) }) })] }, `${grant.source}-${grant.expires_at || 'never'}-${index}`);
118
- }) }), packagePlans.length > 0 && _jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { variant: "h6", children: t('Billing.BUY_PACKAGE') }), packagePlans.map((plan) => _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsxs(Typography, { children: [formatPrice(plan.amount_cents, i18n.language), " \u00B7 ", t('Billing.PACKAGE_TOKENS', { tokens: formatTokens(plan.tokens, i18n.language) })] }), _jsx(Button, { disabled: busy, onClick: () => safeRedirect(() => api.startCheckout(plan.key), 'Billing.ERROR_CHECKOUT'), children: t('Billing.PACKAGE_BUY') })] }, plan.key))] }), withdrawal && _jsx(WithdrawalSection, { api: api, plans: me.plans, sessionWithdrawals: withdrawnPurchases, onWithdrawn: (result, purchase) => {
115
+ }), children: t('Billing.SEATS_ADD') })] }), seatError && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: typeof seatError === 'string' ? t(seatError) : t('Billing.ERROR_LOAD') })] }), actionError && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: t(actionError) }), me.seat && typeof me.seat === 'object' && formatDate(me.seat.ends_at, i18n.language) && _jsxs(Stack, { spacing: 0.25, children: [_jsx(Typography, { children: t('Billing.OP_SEAT_UNTIL', { date: formatDate(me.seat.ends_at, i18n.language) }) }), typeof me.seat.payer_name === 'string' && me.seat.payer_name.trim() && _jsx(Typography, { color: "text.secondary", children: t('Billing.SEAT_PAYER', { name: me.seat.payer_name }) })] })] }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Typography, { children: t('Billing.BALANCE_LABEL') }), _jsx(TokenBalanceBadge, { balance: tokens.balance })] }), _jsx(Typography, { children: t('Billing.BALANCE', { tokens: formatTokens(tokens.balance, i18n.language) }) }), _jsx(TokenOriginTable, { tokens: tokens }), packagePlans.length > 0 && _jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { variant: "h6", children: t('Billing.BUY_PACKAGE') }), packagePlans.map((plan) => _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsxs(Typography, { children: [formatPrice(plan.amount_cents, i18n.language), " \u00B7 ", t('Billing.PACKAGE_TOKENS', { tokens: formatTokens(plan.tokens, i18n.language) })] }), _jsx(Button, { disabled: busy, onClick: () => safeRedirect(() => api.startCheckout(plan.key), 'Billing.ERROR_CHECKOUT'), children: t('Billing.PACKAGE_BUY') })] }, plan.key))] }), withdrawal && _jsx(WithdrawalSection, { api: api, plans: me.plans, sessionWithdrawals: withdrawnPurchases, onWithdrawn: (result, purchase) => {
119
116
  if ((purchase === null || purchase === void 0 ? void 0 : purchase.id) != null)
120
117
  setWithdrawnPurchases((current) => (Object.assign(Object.assign({}, current), { [purchase.id]: { result, purchase } })));
121
118
  reload();
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Box, Typography } from '@mui/material';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { formatDate, formatTokens } from './format';
6
+ import { BILLING_TOKEN_ORIGINS } from './wire';
7
+ const ORIGIN_KEYS = {
8
+ plan: 'Billing.OP_GRANT_PLAN',
9
+ package: 'Billing.OP_GRANT_PACKAGE',
10
+ credit: 'Billing.ORIGIN_credit',
11
+ trial: 'Billing.ORIGIN_trial',
12
+ };
13
+ const nonNegativeInteger = (value) => Number.isInteger(value) && value >= 0;
14
+ function validPool(pool) {
15
+ return pool && typeof pool === 'object'
16
+ && typeof pool.plan_key === 'string' && typeof pool.plan_name === 'string'
17
+ && (pool.expires_at == null || typeof pool.expires_at === 'string')
18
+ && nonNegativeInteger(pool.amount) && nonNegativeInteger(pool.remaining);
19
+ }
20
+ function OriginGrid({ rows, t, language }) {
21
+ return _jsxs(Box, { role: "table", "aria-label": t('Billing.ORIGIN_HEADER'), sx: { display: 'grid', gridTemplateColumns: { xs: 'minmax(0, 1fr) auto', sm: 'minmax(0, 1fr) auto auto' }, columnGap: 2, rowGap: 0.5, alignItems: 'baseline', fontSize: '0.8125rem' }, children: [_jsxs(Box, { role: "row", sx: { display: 'contents' }, children: [_jsx(Typography, { role: "columnheader", variant: "caption", children: t('Billing.ORIGIN_HEADER') }), _jsx(Box, { role: "columnheader", component: "span", sx: { textAlign: 'right', color: 'text.secondary', fontSize: '0.75rem' }, children: t('Billing.OP_REMAINING') }), _jsx(Box, { role: "columnheader", component: "span", sx: { display: { xs: 'none', sm: 'block' }, textAlign: 'right', color: 'text.secondary', fontSize: '0.75rem' }, children: t('Billing.VALID_HEADER') })] }), rows.map((row) => {
22
+ const share = row.amount === 0 ? 0 : Math.max(0, Math.min(1, row.remaining / row.amount));
23
+ const expiry = formatDate(row.expires_at, language);
24
+ return _jsxs(Box, { role: "row", sx: { display: 'contents' }, children: [_jsx(Typography, { role: "cell", children: t(row.nameKey, row.nameValues) }), _jsx(Box, { role: "cell", component: "span", sx: { textAlign: 'right', fontVariantNumeric: 'tabular-nums' }, children: formatTokens(row.remaining, language) }), _jsx(Box, { role: "cell", component: "span", sx: { gridColumn: { xs: '1 / -1', sm: 'auto' }, color: 'text.secondary', textAlign: { xs: 'left', sm: 'right' }, mt: { xs: -0.5, sm: 0 } }, children: row.expires_at == null ? t('Billing.NEVER_EXPIRES') : expiry ? t('Billing.EXPIRES_ON', { date: expiry }) : '' }), row.amount > 0 && _jsx(Box, { role: "cell", sx: { gridColumn: '1 / -1' }, children: _jsx(Box, { role: "img", "aria-label": `${formatTokens(row.remaining, language)} / ${formatTokens(row.amount, language)}`, sx: { gridColumn: '1 / -1', height: 6, borderRadius: 3, bgcolor: (theme) => theme.palette.action.hover, overflow: 'hidden', mb: 0.75 }, children: _jsx(Box, { style: { width: `${share * 100}%`, height: '100%' }, sx: { bgcolor: 'primary.main' } }) }) })] }, row.key);
25
+ })] });
26
+ }
27
+ export function TokenOriginTable({ tokens, sx }) {
28
+ var _a;
29
+ const { t, i18n } = useTranslation();
30
+ const grants = Array.isArray(tokens === null || tokens === void 0 ? void 0 : tokens.grants) ? tokens.grants : [];
31
+ const hasLegacyGrant = grants.some((grant) => !BILLING_TOKEN_ORIGINS.includes(grant === null || grant === void 0 ? void 0 : grant.origin));
32
+ if (hasLegacyGrant)
33
+ return grants.length > 0 ? _jsx(Box, { sx: sx, children: grants.map((grant, index) => {
34
+ if (!['plan', 'package'].includes(grant === null || grant === void 0 ? void 0 : grant.source) || !nonNegativeInteger(grant.amount) || !nonNegativeInteger(grant.remaining))
35
+ return null;
36
+ return _jsxs(Box, { sx: { mb: 0.5 }, children: [_jsxs(Typography, { children: [t(grant.source === 'plan' ? 'Billing.OP_GRANT_PLAN' : 'Billing.OP_GRANT_PACKAGE'), ": ", formatTokens(grant.amount, i18n.language)] }), _jsxs(Typography, { children: [formatTokens(grant.remaining, i18n.language), " ", t('Billing.OP_REMAINING')] }), formatDate(grant.expires_at, i18n.language) && _jsx(Typography, { children: t('Billing.OP_VALID_UNTIL', { date: formatDate(grant.expires_at, i18n.language) }) })] }, `${grant.source}-${grant.expires_at || 'never'}-${index}`);
37
+ }) }) : null;
38
+ const rows = grants.filter((grant) => nonNegativeInteger(grant === null || grant === void 0 ? void 0 : grant.amount) && nonNegativeInteger(grant === null || grant === void 0 ? void 0 : grant.remaining))
39
+ .map((grant, index) => { var _a; return ({
40
+ key: `grant-${index}`,
41
+ amount: grant.amount,
42
+ remaining: grant.remaining,
43
+ expires_at: (_a = grant.expires_at) !== null && _a !== void 0 ? _a : null,
44
+ nameKey: 'Billing.ORIGIN_LINE',
45
+ nameValues: { name: t(ORIGIN_KEYS[grant.origin]), amount: formatTokens(grant.amount, i18n.language) },
46
+ }); });
47
+ if (validPool(tokens === null || tokens === void 0 ? void 0 : tokens.pool))
48
+ rows.push({
49
+ key: 'pool', amount: tokens.pool.amount, remaining: tokens.pool.remaining,
50
+ expires_at: (_a = tokens.pool.expires_at) !== null && _a !== void 0 ? _a : null,
51
+ nameKey: 'Billing.ORIGIN_LINE',
52
+ nameValues: { name: t('Billing.ORIGIN_pool'), amount: formatTokens(tokens.pool.amount, i18n.language) },
53
+ });
54
+ if (!rows.length)
55
+ return null;
56
+ return _jsx(OriginGrid, { rows: rows, t: t, language: i18n.language });
57
+ }
58
+ export default TokenOriginTable;
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { Alert, Button, Stack, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { formatDate, formatDateTime } from './format';
5
+ import { formatDate, formatDateTime, formatPrice } from './format';
6
6
  import { WithdrawalDialog } from './WithdrawalDialog';
7
7
  export const WITHDRAWAL_SECTION_ALERT_SX = { width: '100%' };
8
8
  const is404 = (error) => { var _a; return ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 404; };
@@ -48,12 +48,24 @@ export function WithdrawalSection({ api, plans = [], onWithdrawn, sessionWithdra
48
48
  setReload((count) => count + 1);
49
49
  };
50
50
  const successful = Object.assign(Object.assign({}, sessionWithdrawals), withdrawn);
51
- const eligible = purchases.filter((item) => (item === null || item === void 0 ? void 0 : item.eligible) === true && item.withdrawn_at == null && !successful[item.id]);
52
51
  if (loadError)
53
52
  return _jsxs(Stack, { sx: sx, spacing: 1, children: [_jsx(Alert, { severity: "error", sx: WITHDRAWAL_SECTION_ALERT_SX, children: t('Billing.WITHDRAWAL_LOAD_ERROR') }), _jsx(Button, { onClick: () => setReload((count) => count + 1), children: t('Billing.RETRY') }), Object.entries(successful).map(([id, entry]) => { var _a; return _jsxs(Stack, { spacing: 0.5, role: "status", children: [_jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE') }), _jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE_DETAIL', { date: formatDateTime((_a = ((entry === null || entry === void 0 ? void 0 : entry.result) || entry)) === null || _a === void 0 ? void 0 : _a.withdrawn_at, i18n.language) }) })] }, id); })] });
54
- if (!eligible.length && !Object.keys(successful).length)
53
+ if (!purchases.length && !Object.keys(successful).length)
55
54
  return null;
56
55
  const findPlan = (key) => { var _a; return ((_a = plans.find((plan) => (plan === null || plan === void 0 ? void 0 : plan.key) === key)) === null || _a === void 0 ? void 0 : _a.name) || key; };
57
- return _jsxs(Stack, { sx: sx, spacing: 1, children: [eligible.map((purchase) => _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", children: [_jsx(Typography, { children: findPlan(purchase.plan_key) }), _jsx(Typography, { children: formatDate(purchase.purchased_at, i18n.language) }), _jsx(Typography, { children: t('Billing.WITHDRAWAL_UNTIL', { date: formatDate(deadline(purchase), i18n.language) }) }), _jsx(Button, { onClick: () => setSelected(purchase), children: t('Billing.WITHDRAWAL_BUTTON') })] }, purchase.id)), Object.entries(successful).map(([id, entry]) => { var _a; return _jsxs(Stack, { spacing: 0.5, role: "status", children: [_jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE') }), _jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE_DETAIL', { date: formatDateTime((_a = ((entry === null || entry === void 0 ? void 0 : entry.result) || entry)) === null || _a === void 0 ? void 0 : _a.withdrawn_at, i18n.language) }) })] }, id); }), _jsx(WithdrawalDialog, { open: Boolean(selected), purchase: selected, api: api, onClose: () => setSelected(null), onWithdrawn: (result) => selected && handleWithdrawn(selected.id, result) })] });
56
+ return _jsxs(Stack, { sx: sx, spacing: 1, children: [_jsx(Typography, { variant: "h6", children: t('Billing.PURCHASES') }), purchases.map((purchase) => {
57
+ var _a;
58
+ const success = successful[purchase.id];
59
+ const withdrawnAt = purchase.withdrawn_at || (success && ((_a = ((success === null || success === void 0 ? void 0 : success.result) || success)) === null || _a === void 0 ? void 0 : _a.withdrawn_at));
60
+ const deadlineText = formatDate(deadline(purchase), i18n.language);
61
+ let status = null;
62
+ if (withdrawnAt)
63
+ status = _jsx(Typography, { color: "text.secondary", children: t('Billing.WITHDRAWN_ON', { date: formatDate(withdrawnAt, i18n.language) }) });
64
+ else if (purchase.eligible === true)
65
+ status = _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", children: [_jsx(Button, { onClick: () => setSelected(purchase), children: t('Billing.WITHDRAWAL_BUTTON') }), deadlineText && _jsx(Typography, { color: "text.secondary", children: t('Billing.WITHDRAWAL_UNTIL', { date: deadlineText }) })] });
66
+ else if (purchase.reason === 'period_over')
67
+ status = _jsx(Typography, { color: "text.secondary", children: t('Billing.WITHDRAWAL_PERIOD_OVER') });
68
+ return _jsxs(Stack, { direction: "row", spacing: 1, justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", sx: { borderBottom: '1px solid', borderColor: 'divider', py: 1 }, children: [_jsxs(Stack, { sx: { minWidth: 0, flex: '1 1 auto' }, children: [_jsx(Typography, { children: findPlan(purchase.plan_key) }), _jsxs(Typography, { variant: "body2", color: "text.secondary", children: [formatDate(purchase.purchased_at, i18n.language), " \u00B7 ", formatPrice(purchase.amount_paid_cents, i18n.language, purchase.currency)] })] }), status] }, purchase.id);
69
+ }), Object.entries(successful).map(([id, entry]) => { var _a; return _jsxs(Stack, { spacing: 0.5, role: "status", children: [_jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE') }), _jsx(Typography, { children: t('Billing.WITHDRAWAL_DONE_DETAIL', { date: formatDateTime((_a = ((entry === null || entry === void 0 ? void 0 : entry.result) || entry)) === null || _a === void 0 ? void 0 : _a.withdrawn_at, i18n.language) }) })] }, id); }), _jsx(WithdrawalDialog, { open: Boolean(selected), purchase: selected, api: api, onClose: () => setSelected(null), onWithdrawn: (result) => selected && handleWithdrawn(selected.id, result) })] });
58
70
  }
59
71
  export default WithdrawalSection;
@@ -1,6 +1,7 @@
1
1
  export const BILLING_STATUSES = { ACTIVE: 'active', READ_ONLY: 'read_only' };
2
2
  export const BILLING_SOURCES = { SUBSCRIPTION: 'subscription', TEAM: 'team', FREE: 'free', NONE: null };
3
3
  export const BILLING_KINDS = { SUBSCRIPTION: 'subscription', TEAM_PACKAGE: 'team_package', TOKEN_PACKAGE: 'token_package' };
4
+ export const BILLING_TOKEN_ORIGINS = ['plan', 'package', 'trial', 'credit'];
4
5
  export const BILLING_ERROR_CODES = ['unknown_plan', 'checkout_unavailable', 'no_customer', 'portal_unavailable', 'no_active_team', 'invalid_user', 'seat_limit'];
5
6
  export const BILLING_OPERATOR_ERROR_CODES = ['authentication_required', 'forbidden', 'invalid_month', 'invalid_page', 'invalid_query', 'reason_required', 'user_not_found'];
6
7
  export const billingApiUrls = (base = '/api/billing/') => {
@@ -1,5 +1,17 @@
1
1
  export const billingTranslations = {
2
2
  'Billing.BALANCE': { de: 'Guthaben {{tokens}} Token', de_informal: 'Guthaben {{tokens}} Token', en: 'Balance {{tokens}} tokens', fr: 'Solde {{tokens}} jetons', sw: 'Salio {{tokens}} tokeni' },
3
+ 'Billing.ORIGIN_HEADER': { de: 'Herkunft', de_informal: 'Herkunft', en: 'Origin', fr: 'Origine', sw: 'Chanzo' },
4
+ 'Billing.VALID_HEADER': { de: 'gültig', de_informal: 'gültig', en: 'validity', fr: 'validité', sw: 'uhalali' },
5
+ 'Billing.ORIGIN_credit': { de: 'Gutschrift', de_informal: 'Gutschrift', en: 'Credit', fr: 'Crédit', sw: 'Salio la ziada' },
6
+ 'Billing.ORIGIN_trial': { de: 'Test-Guthaben', de_informal: 'Test-Guthaben', en: 'Trial balance', fr: 'Solde d’essai', sw: 'Salio la majaribio' },
7
+ 'Billing.ORIGIN_pool': { de: 'Team-Pool', de_informal: 'Team-Pool', en: 'Team pool', fr: 'Pool d’équipe', sw: 'Hazina ya timu' },
8
+ 'Billing.EXPIRES_ON': { de: 'verfällt am {{date}}', de_informal: 'verfällt am {{date}}', en: 'expires on {{date}}', fr: 'expire le {{date}}', sw: 'inaisha tarehe {{date}}' },
9
+ 'Billing.NEVER_EXPIRES': { de: 'verfällt nicht', de_informal: 'verfällt nicht', en: 'does not expire', fr: 'n’expire pas', sw: 'haiishi muda wake' },
10
+ 'Billing.ORIGIN_LINE': { de: '{{name}} · {{amount}} Token', de_informal: '{{name}} · {{amount}} Token', en: '{{name}} · {{amount}} tokens', fr: '{{name}} · {{amount}} jetons', sw: '{{name}} · tokeni {{amount}}' },
11
+ 'Billing.SEAT_PAYER': { de: 'Platz im Team-Paket von {{name}}', de_informal: 'Platz im Team-Paket von {{name}}', en: 'Seat in {{name}}’s team package', fr: 'Place dans le forfait d’équipe de {{name}}', sw: 'Nafasi katika kifurushi cha timu cha {{name}}' },
12
+ 'Billing.PURCHASES': { de: 'Käufe', de_informal: 'Käufe', en: 'Purchases', fr: 'Achats', sw: 'Ununuzi' },
13
+ 'Billing.WITHDRAWN_ON': { de: 'Widerrufen am {{date}}', de_informal: 'Widerrufen am {{date}}', en: 'Withdrawn on {{date}}', fr: 'Révoqué le {{date}}', sw: 'Iliondolewa tarehe {{date}}' },
14
+ 'Billing.WITHDRAWAL_PERIOD_OVER': { de: 'Widerrufsfrist abgelaufen', de_informal: 'Widerrufsfrist abgelaufen', en: 'Withdrawal period expired', fr: 'Délai de rétractation expiré', sw: 'Kipindi cha kujiondoa kimeisha' },
3
15
  'Billing.COST': { de: '{{tokens}} Token', de_informal: '{{tokens}} Token', en: '{{tokens}} tokens', fr: '{{tokens}} jetons', sw: 'Tokeni {{tokens}}' },
4
16
  'Billing.NOT_ENOUGH': { de: 'Guthaben reicht nicht aus', de_informal: 'Guthaben reicht nicht aus', en: 'Insufficient balance', fr: 'Solde insuffisant', sw: 'Salio halitoshi' },
5
17
  'Billing.ENDED_TITLE': { de: 'Abo beendet – Projekte sind schreibgeschützt. Export bleibt möglich.', de_informal: 'Abo beendet – Projekte sind schreibgeschützt. Export bleibt möglich.', en: 'Subscription ended — projects are read-only. You can still export.', fr: 'Abonnement terminé — les projets sont en lecture seule. L’export reste possible.', sw: 'Usajili umeisha — miradi inaweza kusomwa tu. Bado unaweza kuhamisha data.' },
@@ -116,10 +116,9 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
116
116
  return;
117
117
  const isVisible = typeof tab.visible === 'function' ? tab.visible(extensionContext) : true;
118
118
  if (isVisible && !list.some((entry) => entry.value === tab.value)) {
119
- list.push({
120
- value: tab.value,
121
- label: typeof tab.label === 'function' ? tab.label(extensionContext) : tab.label,
122
- });
119
+ // Extra tabs may join my-account, management, or help.
120
+ const group = ['my-account', 'management', 'help'].includes(tab.group) ? tab.group : undefined;
121
+ list.push(Object.assign({ value: tab.value, label: typeof tab.label === 'function' ? tab.label(extensionContext) : tab.label }, (group ? { group } : {})));
123
122
  }
124
123
  });
125
124
  return list;
@@ -142,12 +141,15 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
142
141
  values: new Set(['support']),
143
142
  },
144
143
  ];
145
- const assignedValues = new Set(groupDefinitions.flatMap((group) => [...group.values]));
144
+ const assignedValues = new Set(groupDefinitions.flatMap((group) => [
145
+ ...group.values,
146
+ ...tabs.filter((tab) => tab.group === group.key).map((tab) => tab.value),
147
+ ]));
146
148
  const mappedGroups = groupDefinitions.map((group) => ({
147
149
  key: group.key,
148
150
  label: group.label,
149
151
  items: tabs
150
- .filter((tab) => group.values.has(tab.value))
152
+ .filter((tab) => group.values.has(tab.value) || tab.group === group.key)
151
153
  .map((tab) => ({ key: tab.value, label: tab.label })),
152
154
  }));
153
155
  const extraItems = tabs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.9.0",
3
+ "version": "4.11.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {