@micha.bigler/ui-core-micha 4.8.0 → 4.9.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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.9.0 - UCM-BILL-5
4
+
5
+ Informal German for the whole billing surface: every `Billing.*` key now has a `de_informal` value (the "du" form where
6
+ the text addresses the person, identical to `de` otherwise), selected through the kit's existing German variant
7
+ mechanism. In German the seat is a "Platz" everywhere ("Sitzplatz" is gone: `Billing.SEATS_ADD` "Platz vergeben",
8
+ `Billing.TEAM_SEATS` "Plaetze im Team-Paket", `Billing.ERROR_SEAT_LIMIT` "Alle Plaetze sind belegt.", the seat counts).
9
+ New optional prop `seatCandidates` on `SubscriptionSection`: an array of `{ id, name, email? }` from the app. With it the
10
+ seat assignment is a select "Teammitglied waehlen" plus the button "Platz vergeben" (people who already hold a seat are
11
+ not offered; the chosen id goes to the existing `api.addSeat({ userId })`), and a team without a free seat shows only
12
+ "Alle Plaetze sind belegt." Without the prop the free text field stays exactly as before. New key `Billing.SEAT_PICK`.
13
+
14
+ ## 4.8.1 - UCM-RCPT-2
15
+
16
+ `ReceiptReviewDialog` matches its prototype again. Each recognised field is one row with the columns label, value and action and a divider between rows (the label above the value on phones); the "uncertain" chip is a soft warning tint beside the action (under the value on phones); the sheet on phones is as high as its content up to the available height, with full-width actions stacked as "Alle uebernehmen", "Nur leere Felder", "Schliessen"; the wide dialog is 640 px wide with a 640 px maximum height; the currency is shown with the amount (a receipt that has a currency but no amount keeps a currency row) and applying the amount hands over amount and currency; the date has a four-digit year in the active language (the picker follows). The review no longer prints line items of the form through string conversion: both the recognised and the current items are lists, blank rows count as empty. "Only empty fields" never overwrites a filled currency. Props and the `onApply` contract are unchanged.
17
+
3
18
  ## 4.8.0 - UCM-BILL-2
4
19
 
5
20
  Operator surfaces for billing and a fuller "Abo" section, against the `django-core-micha` operator endpoints
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
- import { Alert, Button, CircularProgress, Stack, TextField, Typography } from '@mui/material';
3
+ import { Alert, Button, CircularProgress, MenuItem, Stack, TextField, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { defaultBillingApi } from './api';
6
6
  import { DEFAULT_PAYMENT_HOSTS, isTrustedPaymentUrl } from './safeUrl';
@@ -11,12 +11,16 @@ import { TokenBalanceBadge } from './TokenBalanceBadge';
11
11
  import { AccessEndedBanner } from './AccessEndedBanner';
12
12
  import { WithdrawalSection } from './WithdrawalSection';
13
13
  export const SUBSCRIPTION_SECTION_ALERT_SX = { width: '100%' };
14
+ export const SUBSCRIPTION_SECTION_SEAT_SELECT_SX = { flex: '1 1 auto', minWidth: 0 };
15
+ // The seat button keeps its width and its single line next to a shrinking select (375 px).
16
+ export const SUBSCRIPTION_SECTION_SEAT_ADD_SX = { flexShrink: 0, whiteSpace: 'nowrap' };
14
17
  function isStatus(error, status) { var _a; return ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === status; }
15
18
  function activeUntil(access, t, language) {
16
19
  const date = formatDate(access === null || access === void 0 ? void 0 : access.ends_at, language);
17
20
  return date ? t('Billing.ACTIVE_UNTIL', { date }) : null;
18
21
  }
19
- export function SubscriptionSection({ api = defaultBillingApi, redirect = (url) => window.location.assign(url), allowedHosts = DEFAULT_PAYMENT_HOSTS, onRenew, describePlan, withdrawal = true, sx }) {
22
+ export function SubscriptionSection({ api = defaultBillingApi, redirect = (url) => window.location.assign(url), allowedHosts = DEFAULT_PAYMENT_HOSTS, onRenew, describePlan, withdrawal = true, seatCandidates, sx }) {
23
+ var _a, _b, _c;
20
24
  const { t, i18n } = useTranslation();
21
25
  const { state, me, reload } = useBilling(api);
22
26
  const [withdrawnPurchases, setWithdrawnPurchases] = useState({});
@@ -86,13 +90,28 @@ export function SubscriptionSection({ api = defaultBillingApi, redirect = (url)
86
90
  const dateLine = activeUntil(access, t, i18n.language);
87
91
  const packagePlans = (Array.isArray(me.plans) ? me.plans : []).filter((plan) => (plan === null || plan === void 0 ? void 0 : plan.kind) === 'token_package');
88
92
  const sourceLine = access.source === 'subscription' ? t('Billing.SOURCE_SUBSCRIPTION') : access.source === 'team' ? t('Billing.SOURCE_TEAM') : access.source === 'free' ? t('Billing.SOURCE_FREE') : null;
93
+ // With a candidate list the app has a team concept, so a full team shows only the message; without one the free text path stays as it always was (the server answers 409 for a full team).
94
+ const hasSeatLimit = Array.isArray(seatCandidates) && Number.isInteger((_a = me.team) === null || _a === void 0 ? void 0 : _a.seats_used) && Number.isInteger((_b = me.team) === null || _b === void 0 ? void 0 : _b.seats_total) && me.team.seats_used >= me.team.seats_total;
95
+ const occupiedIds = new Set([
96
+ ...(Array.isArray(seats) ? seats.map((seat) => seat === null || seat === void 0 ? void 0 : seat.user_id) : []),
97
+ ...(Array.isArray((_c = me.team) === null || _c === void 0 ? void 0 : _c.seat_holders) ? me.team.seat_holders.map((holder) => holder === null || holder === void 0 ? void 0 : holder.user_id) : []),
98
+ ].filter((id) => id != null).map(String));
99
+ const eligibleSeatCandidates = Array.isArray(seatCandidates)
100
+ ? seatCandidates.filter((candidate) => (candidate === null || candidate === void 0 ? void 0 : candidate.id) != null && !occupiedIds.has(String(candidate.id)))
101
+ : [];
102
+ const selectedSeatCandidate = eligibleSeatCandidates.find((candidate) => String(candidate.id) === seatInput);
89
103
  if (!sourceLine && access.status === 'active')
90
104
  return _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: t('Billing.ERROR_LOAD') });
91
105
  return _jsxs(Stack, { sx: sx, spacing: 2, children: [access.status === 'read_only' ? _jsxs(_Fragment, { children: [_jsx(AccessEndedBanner, { endedAt: access.ends_at, onRenew: onRenew || (() => {
92
106
  var _a, _b, _c, _d;
93
107
  (_b = (_a = renewalPickerRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { behavior: 'smooth', block: 'start' });
94
108
  (_d = (_c = renewalPickerRef.current) === null || _c === void 0 ? void 0 : _c.querySelector('input[type="radio"]')) === null || _d === void 0 ? void 0 : _d.focus();
95
- }) }), _jsx("div", { ref: renewalPickerRef, children: _jsx(PlanPicker, { plans: me.plans || [], api: api, redirect: redirect, allowedHosts: allowedHosts, describePlan: describePlan }) })] }) : _jsxs(_Fragment, { children: [_jsx(Typography, { variant: "h5", children: t('Billing.HEADING') }), _jsx(Typography, { children: sourceLine }), access.source !== 'free' && dateLine && _jsx(Typography, { children: dateLine }), me.subscription && typeof me.subscription === 'object' && typeof me.subscription.plan_key === 'string' && typeof me.subscription.renews === 'boolean' && formatDate(me.subscription.current_period_end, i18n.language) && _jsxs(Stack, { spacing: 0.5, children: [_jsx(Typography, { children: t('Billing.OP_PLAN', { plan: me.subscription.plan_name || me.subscription.plan_key }) }), formatDate(me.subscription.current_period_end, i18n.language) && _jsx(Typography, { children: formatDate(me.subscription.current_period_start, i18n.language) ? `${formatDate(me.subscription.current_period_start, i18n.language)} – ${formatDate(me.subscription.current_period_end, i18n.language)}` : t('Billing.OP_UNTIL', { date: formatDate(me.subscription.current_period_end, i18n.language) }) }), typeof me.subscription.renews === 'boolean' && _jsx(Typography, { children: t(me.subscription.renews ? 'Billing.OP_RENEWS' : 'Billing.OP_ENDS') })] }), access.source === 'subscription' && _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Button, { disabled: busy, onClick: () => safeRedirect(() => api.openPortal(), 'Billing.ERROR_PORTAL'), children: t('Billing.MANAGE') }), _jsx(Typography, { children: t('Billing.MANAGE_DETAILS') })] }), access.source === 'team' && seatError && !seats && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: t('Billing.ERROR_LOAD') }), me.team && Number.isInteger(me.team.seats_used) && Number.isInteger(me.team.seats_total) && _jsxs(Stack, { spacing: 0.5, children: [_jsx(Typography, { children: t('Billing.OP_SEATS_USED', { n: formatTokens(me.team.seats_used, i18n.language), m: formatTokens(me.team.seats_total, i18n.language) }) }), (Array.isArray(me.team.seat_holders) ? me.team.seat_holders : []).map((holder) => _jsxs(Stack, { children: [_jsx(Typography, { children: holder.name || holder.email }), holder.name && _jsx(Typography, { color: "text.secondary", children: holder.email })] }, holder.user_id))] }), access.source === 'team' && seats && _jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { children: t('Billing.TEAM_SEATS') }), seats.map((seat) => _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [(() => { var _a; const holder = (((_a = me.team) === null || _a === void 0 ? void 0 : _a.seat_holders) || []).find((entry) => String(entry.user_id) === String(seat.user_id)); return _jsxs(Stack, { children: [_jsx(Typography, { children: (holder === null || holder === void 0 ? void 0 : holder.name) || (holder === null || holder === void 0 ? void 0 : holder.email) || String(seat.user_id) }), (holder === null || holder === void 0 ? void 0 : holder.name) && _jsx(Typography, { color: "text.secondary", children: holder.email })] }); })(), _jsx(Button, { disabled: busy, onClick: () => updateSeat(() => api.removeSeat({ userId: seat.user_id })), children: t('Billing.SEAT_REMOVE') })] }, seat.user_id)), _jsxs(Stack, { direction: "row", spacing: 1, children: [_jsx(TextField, { size: "small", label: t('Billing.SEAT_USER'), value: seatInput, onChange: (event) => setSeatInput(event.target.value) }), _jsx(Button, { disabled: busy || !seatInput.trim(), onClick: () => updateSeat(() => seatInput.includes('@') ? api.addSeat({ email: seatInput.trim() }) : api.addSeat({ userId: seatInput.trim() })), 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) => {
109
+ }) }), _jsx("div", { ref: renewalPickerRef, children: _jsx(PlanPicker, { plans: me.plans || [], api: api, redirect: redirect, allowedHosts: allowedHosts, describePlan: describePlan }) })] }) : _jsxs(_Fragment, { children: [_jsx(Typography, { variant: "h5", children: t('Billing.HEADING') }), _jsx(Typography, { children: sourceLine }), access.source !== 'free' && dateLine && _jsx(Typography, { children: dateLine }), me.subscription && typeof me.subscription === 'object' && typeof me.subscription.plan_key === 'string' && typeof me.subscription.renews === 'boolean' && formatDate(me.subscription.current_period_end, i18n.language) && _jsxs(Stack, { spacing: 0.5, children: [_jsx(Typography, { children: t('Billing.OP_PLAN', { plan: me.subscription.plan_name || me.subscription.plan_key }) }), formatDate(me.subscription.current_period_end, i18n.language) && _jsx(Typography, { children: formatDate(me.subscription.current_period_start, i18n.language) ? `${formatDate(me.subscription.current_period_start, i18n.language)} – ${formatDate(me.subscription.current_period_end, i18n.language)}` : t('Billing.OP_UNTIL', { date: formatDate(me.subscription.current_period_end, i18n.language) }) }), typeof me.subscription.renews === 'boolean' && _jsx(Typography, { children: t(me.subscription.renews ? 'Billing.OP_RENEWS' : 'Billing.OP_ENDS') })] }), access.source === 'subscription' && _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [_jsx(Button, { disabled: busy, onClick: () => safeRedirect(() => api.openPortal(), 'Billing.ERROR_PORTAL'), children: t('Billing.MANAGE') }), _jsx(Typography, { children: t('Billing.MANAGE_DETAILS') })] }), access.source === 'team' && seatError && !seats && _jsx(Alert, { severity: "error", sx: SUBSCRIPTION_SECTION_ALERT_SX, children: t('Billing.ERROR_LOAD') }), me.team && Number.isInteger(me.team.seats_used) && Number.isInteger(me.team.seats_total) && _jsxs(Stack, { spacing: 0.5, children: [_jsx(Typography, { children: t('Billing.OP_SEATS_USED', { n: formatTokens(me.team.seats_used, i18n.language), m: formatTokens(me.team.seats_total, i18n.language) }) }), (Array.isArray(me.team.seat_holders) ? me.team.seat_holders : []).map((holder) => _jsxs(Stack, { children: [_jsx(Typography, { children: holder.name || holder.email }), holder.name && _jsx(Typography, { color: "text.secondary", children: holder.email })] }, holder.user_id))] }), access.source === 'team' && seats && _jsxs(Stack, { spacing: 1, children: [_jsx(Typography, { children: t('Billing.TEAM_SEATS') }), seats.map((seat) => _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [(() => { var _a; const holder = (((_a = me.team) === null || _a === void 0 ? void 0 : _a.seat_holders) || []).find((entry) => String(entry.user_id) === String(seat.user_id)); return _jsxs(Stack, { children: [_jsx(Typography, { children: (holder === null || holder === void 0 ? void 0 : holder.name) || (holder === null || holder === void 0 ? void 0 : holder.email) || String(seat.user_id) }), (holder === null || holder === void 0 ? void 0 : holder.name) && _jsx(Typography, { color: "text.secondary", children: holder.email })] }); })(), _jsx(Button, { disabled: busy, onClick: () => updateSeat(() => api.removeSeat({ userId: seat.user_id })), children: t('Billing.SEAT_REMOVE') })] }, seat.user_id)), hasSeatLimit ? _jsx(Typography, { color: "text.secondary", children: t('Billing.ERROR_SEAT_LIMIT') }) : _jsxs(Stack, { direction: "row", spacing: 1, children: [Array.isArray(seatCandidates) ? _jsxs(TextField, { select: true, SelectProps: { displayEmpty: true, SelectDisplayProps: { 'aria-label': t('Billing.SEAT_PICK'), 'aria-labelledby': undefined } }, size: "small", value: seatInput, onChange: (event) => setSeatInput(event.target.value), sx: SUBSCRIPTION_SECTION_SEAT_SELECT_SX, children: [_jsx(MenuItem, { value: "", children: t('Billing.SEAT_PICK') }), eligibleSeatCandidates.map((candidate) => _jsx(MenuItem, { value: String(candidate.id), children: _jsxs(Stack, { children: [_jsx(Typography, { children: candidate.name }), candidate.email && _jsx(Typography, { variant: "body2", color: "text.secondary", children: candidate.email })] }) }, String(candidate.id)))] }) : _jsx(TextField, { size: "small", label: t('Billing.SEAT_USER'), value: seatInput, onChange: (event) => setSeatInput(event.target.value) }), _jsx(Button, { sx: SUBSCRIPTION_SECTION_SEAT_ADD_SX, disabled: busy || (Array.isArray(seatCandidates) ? !selectedSeatCandidate : !seatInput.trim()), onClick: () => updateSeat(() => {
110
+ if (Array.isArray(seatCandidates)) {
111
+ return selectedSeatCandidate ? api.addSeat({ userId: selectedSeatCandidate.id }) : undefined;
112
+ }
113
+ 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) => {
96
115
  if (!['plan', 'package'].includes(grant === null || grant === void 0 ? void 0 : grant.source) || !Number.isInteger(grant.amount) || !Number.isInteger(grant.remaining))
97
116
  return null;
98
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}`);
@@ -1,45 +1,46 @@
1
1
  export const billingTranslations = {
2
- 'Billing.BALANCE': { de: 'Guthaben {{tokens}} Token', en: 'Balance {{tokens}} tokens', fr: 'Solde {{tokens}} jetons', sw: 'Salio {{tokens}} tokeni' },
3
- 'Billing.COST': { de: '{{tokens}} Token', en: '{{tokens}} tokens', fr: '{{tokens}} jetons', sw: 'Tokeni {{tokens}}' },
4
- 'Billing.NOT_ENOUGH': { de: 'Guthaben reicht nicht aus', en: 'Insufficient balance', fr: 'Solde insuffisant', sw: 'Salio halitoshi' },
5
- 'Billing.ENDED_TITLE': { de: '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.' },
6
- 'Billing.ENDED_ON': { de: 'Beendet am {{date}}', en: 'Ended on {{date}}', fr: 'Terminé le {{date}}', sw: 'Uliisha tarehe {{date}}' },
7
- 'Billing.DELETION_ON': { de: 'Löschung am {{date}}', en: 'Deletion on {{date}}', fr: 'Suppression le {{date}}', sw: 'Kufutwa tarehe {{date}}' },
8
- 'Billing.RENEW': { de: 'Abo erneuern', en: 'Renew subscription', fr: 'Renouveler l’abonnement', sw: 'Fanya upya usajili' },
9
- 'Billing.MONTHLY': { de: 'Monatlich', en: 'Monthly', fr: 'Mensuel', sw: 'Kila mwezi' },
10
- 'Billing.YEARLY': { de: 'Jährlich', en: 'Yearly', fr: 'Annuel', sw: 'Kila mwaka' },
11
- 'Billing.PER_MONTH': { de: '/ Monat', en: '/ month', fr: '/ mois', sw: '/ mwezi' },
12
- 'Billing.PER_YEAR': { de: '/ Jahr', en: '/ year', fr: '/ an', sw: '/ mwaka' },
13
- 'Billing.TOKENS_INCLUDED': { de: '{{tokens}} Token inklusive', en: '{{tokens}} tokens included', fr: '{{tokens}} jetons inclus', sw: 'Tokeni {{tokens}} zimejumuishwa' },
14
- 'Billing.CONTINUE_TO_PAYMENT': { de: 'Weiter zur Bezahlung', en: 'Continue to payment', fr: 'Continuer vers le paiement', sw: 'Endelea kulipa' },
15
- 'Billing.ERROR_CHECKOUT': { de: 'Die Bezahlung konnte nicht gestartet werden. Bitte versuchen Sie es erneut.', en: 'Checkout could not be started. Please try again.', fr: 'Le paiement n’a pas pu démarrer. Veuillez réessayer.', sw: 'Malipo hayakuweza kuanzishwa. Tafadhali jaribu tena.' },
16
- 'Billing.ERROR_LOAD': { de: 'Abodaten konnten nicht geladen werden.', en: 'Subscription details could not be loaded.', fr: 'Impossible de charger les informations de l’abonnement.', sw: 'Maelezo ya usajili hayakuweza kupakiwa.' },
17
- 'Billing.RETRY': { de: 'Erneut versuchen', en: 'Try again', fr: 'Réessayer', sw: 'Jaribu tena' },
18
- 'Billing.SOURCE_SUBSCRIPTION': { de: 'Persönliches Abo', en: 'Personal subscription', fr: 'Abonnement personnel', sw: 'Usajili binafsi' },
19
- 'Billing.SOURCE_TEAM': { de: 'Platz in einem Team-Paket', en: 'Seat in a team package', fr: 'Place dans un forfait d’équipe', sw: 'Nafasi katika kifurushi cha timu' },
20
- 'Billing.SOURCE_FREE': { de: 'Ohne Abo freigeschaltet', en: 'Access enabled without a subscription', fr: 'Accès activé sans abonnement', sw: 'Ufikiaji umewezeshwa bila usajili' },
21
- 'Billing.ACTIVE_UNTIL': { de: 'Aktiv bis {{date}}', en: 'Active until {{date}}', fr: 'Actif jusqu’au {{date}}', sw: 'Inatumika hadi {{date}}' },
22
- 'Billing.MANAGE': { de: 'Abo verwalten', en: 'Manage subscription', fr: 'Gérer l’abonnement', sw: 'Dhibiti usajili' },
23
- 'Billing.MANAGE_DETAILS': { de: 'Kündigung, Zahlungsmethode und Belege', en: 'Cancellation, payment method, and receipts', fr: 'Résiliation, moyen de paiement et reçus', sw: 'Kughairi, njia ya malipo na risiti' },
24
- 'Billing.ERROR_PORTAL': { de: 'Das Abo-Portal ist derzeit nicht verfügbar.', en: 'The subscription portal is unavailable right now.', fr: 'Le portail d’abonnement est indisponible pour le moment.', sw: 'Tovuti ya usajili haipatikani kwa sasa.' },
25
- 'Billing.BALANCE_LABEL': { de: 'Token-Guthaben', en: 'Token balance', fr: 'Solde de jetons', sw: 'Salio la tokeni' },
26
- 'Billing.BUY_PACKAGE': { de: 'Token-Paket kaufen', en: 'Buy a token package', fr: 'Acheter un forfait de jetons', sw: 'Nunua kifurushi cha tokeni' },
27
- 'Billing.PACKAGE_BUY': { de: 'Paket kaufen', en: 'Buy package', fr: 'Acheter le forfait', sw: 'Nunua kifurushi' },
28
- 'Billing.SEATS_one': { de: '{{count}} Sitzplatz', en: '{{count}} seat', fr: '{{count}} place', sw: 'Nafasi {{count}}' },
29
- 'Billing.SEATS_other': { de: '{{count}} Sitzplätze', en: '{{count}} seats', fr: '{{count}} places', sw: 'Nafasi {{count}}' },
30
- 'Billing.TERM_MONTHS_one': { de: '{{count}} Monat', en: '{{count}} month', fr: '{{count}} mois', sw: 'Mwezi {{count}}' },
31
- 'Billing.TERM_MONTHS_other': { de: '{{count}} Monate', en: '{{count}} months', fr: '{{count}} mois', sw: 'Miezi {{count}}' },
32
- 'Billing.SEATS_ADD': { de: 'Sitzplatz hinzufügen', en: 'Add seat', fr: 'Ajouter une place', sw: 'Ongeza nafasi' },
33
- 'Billing.SEAT_USER': { de: 'E-Mail-Adresse oder Benutzer-ID', en: 'Email address or user ID', fr: 'Adresse e-mail ou identifiant utilisateur', sw: 'Barua pepe au kitambulisho cha mtumiaji' },
34
- 'Billing.SEAT_REMOVE': { de: 'Entfernen', en: 'Remove', fr: 'Retirer', sw: 'Ondoa' },
35
- 'Billing.ERROR_SEAT_LIMIT': { de: 'Alle Sitzplätze sind belegt.', en: 'All seats are occupied.', fr: 'Toutes les places sont occupées.', sw: 'Nafasi zote zimejazwa.' },
36
- 'Billing.ERROR_SEAT_USER': { de: 'Diese Person kann nicht hinzugefügt werden.', en: 'This person could not be added.', fr: 'Cette personne ne peut pas être ajoutée.', sw: 'Mtu huyu hakuweza kuongezwa.' },
37
- 'Billing.PLAN_INTERVAL': { de: 'Abrechnungszeitraum', en: 'Billing interval', fr: 'Période de facturation', sw: 'Kipindi cha malipo' },
38
- 'Billing.LOADING': { de: 'Abodaten werden geladen …', en: 'Loading subscription details …', fr: 'Chargement de l’abonnement …', sw: 'Inapakia maelezo ya usajili …' },
39
- 'Billing.HEADING': { de: 'Abo', en: 'Subscription', fr: 'Abonnement', sw: 'Usajili' },
40
- 'Billing.TEAM_SEATS': { de: 'Sitzplätze im Team-Paket', en: 'Seats in the team package', fr: 'Places dans le forfait d’équipe', sw: 'Nafasi katika kifurushi cha timu' },
41
- 'Billing.PACKAGE_TOKENS': { de: '{{tokens}} Token', en: '{{tokens}} tokens', fr: '{{tokens}} jetons', sw: 'Tokeni {{tokens}}' },
42
- 'Billing.PLANS': { de: 'Pläne', en: 'Plans', fr: 'Offres', sw: 'Mipango' },
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.COST': { de: '{{tokens}} Token', de_informal: '{{tokens}} Token', en: '{{tokens}} tokens', fr: '{{tokens}} jetons', sw: 'Tokeni {{tokens}}' },
4
+ 'Billing.NOT_ENOUGH': { de: 'Guthaben reicht nicht aus', de_informal: 'Guthaben reicht nicht aus', en: 'Insufficient balance', fr: 'Solde insuffisant', sw: 'Salio halitoshi' },
5
+ '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.' },
6
+ 'Billing.ENDED_ON': { de: 'Beendet am {{date}}', de_informal: 'Beendet am {{date}}', en: 'Ended on {{date}}', fr: 'Terminé le {{date}}', sw: 'Uliisha tarehe {{date}}' },
7
+ 'Billing.DELETION_ON': { de: 'Löschung am {{date}}', de_informal: 'Löschung am {{date}}', en: 'Deletion on {{date}}', fr: 'Suppression le {{date}}', sw: 'Kufutwa tarehe {{date}}' },
8
+ 'Billing.RENEW': { de: 'Abo erneuern', de_informal: 'Abo erneuern', en: 'Renew subscription', fr: 'Renouveler l’abonnement', sw: 'Fanya upya usajili' },
9
+ 'Billing.MONTHLY': { de: 'Monatlich', de_informal: 'Monatlich', en: 'Monthly', fr: 'Mensuel', sw: 'Kila mwezi' },
10
+ 'Billing.YEARLY': { de: 'Jährlich', de_informal: 'Jährlich', en: 'Yearly', fr: 'Annuel', sw: 'Kila mwaka' },
11
+ 'Billing.PER_MONTH': { de: '/ Monat', de_informal: '/ Monat', en: '/ month', fr: '/ mois', sw: '/ mwezi' },
12
+ 'Billing.PER_YEAR': { de: '/ Jahr', de_informal: '/ Jahr', en: '/ year', fr: '/ an', sw: '/ mwaka' },
13
+ 'Billing.TOKENS_INCLUDED': { de: '{{tokens}} Token inklusive', de_informal: '{{tokens}} Token inklusive', en: '{{tokens}} tokens included', fr: '{{tokens}} jetons inclus', sw: 'Tokeni {{tokens}} zimejumuishwa' },
14
+ 'Billing.CONTINUE_TO_PAYMENT': { de: 'Weiter zur Bezahlung', de_informal: 'Weiter zur Bezahlung', en: 'Continue to payment', fr: 'Continuer vers le paiement', sw: 'Endelea kulipa' },
15
+ 'Billing.ERROR_CHECKOUT': { de: 'Die Bezahlung konnte nicht gestartet werden. Bitte versuchen Sie es erneut.', de_informal: 'Die Bezahlung konnte nicht gestartet werden. Bitte versuche es erneut.', en: 'Checkout could not be started. Please try again.', fr: 'Le paiement n’a pas pu démarrer. Veuillez réessayer.', sw: 'Malipo hayakuweza kuanzishwa. Tafadhali jaribu tena.' },
16
+ 'Billing.ERROR_LOAD': { de: 'Abodaten konnten nicht geladen werden.', de_informal: 'Abodaten konnten nicht geladen werden.', en: 'Subscription details could not be loaded.', fr: 'Impossible de charger les informations de l’abonnement.', sw: 'Maelezo ya usajili hayakuweza kupakiwa.' },
17
+ 'Billing.RETRY': { de: 'Erneut versuchen', de_informal: 'Erneut versuchen', en: 'Try again', fr: 'Réessayer', sw: 'Jaribu tena' },
18
+ 'Billing.SOURCE_SUBSCRIPTION': { de: 'Persönliches Abo', de_informal: 'Persönliches Abo', en: 'Personal subscription', fr: 'Abonnement personnel', sw: 'Usajili binafsi' },
19
+ 'Billing.SOURCE_TEAM': { de: 'Platz in einem Team-Paket', de_informal: 'Platz in einem Team-Paket', en: 'Seat in a team package', fr: 'Place dans un forfait d’équipe', sw: 'Nafasi katika kifurushi cha timu' },
20
+ 'Billing.SOURCE_FREE': { de: 'Ohne Abo freigeschaltet', de_informal: 'Ohne Abo freigeschaltet', en: 'Access enabled without a subscription', fr: 'Accès activé sans abonnement', sw: 'Ufikiaji umewezeshwa bila usajili' },
21
+ 'Billing.ACTIVE_UNTIL': { de: 'Aktiv bis {{date}}', de_informal: 'Aktiv bis {{date}}', en: 'Active until {{date}}', fr: 'Actif jusqu’au {{date}}', sw: 'Inatumika hadi {{date}}' },
22
+ 'Billing.MANAGE': { de: 'Abo verwalten', de_informal: 'Abo verwalten', en: 'Manage subscription', fr: 'Gérer l’abonnement', sw: 'Dhibiti usajili' },
23
+ 'Billing.MANAGE_DETAILS': { de: 'Kündigung, Zahlungsmethode und Belege', de_informal: 'Kündigung, Zahlungsmethode und Belege', en: 'Cancellation, payment method, and receipts', fr: 'Résiliation, moyen de paiement et reçus', sw: 'Kughairi, njia ya malipo na risiti' },
24
+ 'Billing.ERROR_PORTAL': { de: 'Das Abo-Portal ist derzeit nicht verfügbar.', de_informal: 'Das Abo-Portal ist derzeit nicht verfügbar.', en: 'The subscription portal is unavailable right now.', fr: 'Le portail d’abonnement est indisponible pour le moment.', sw: 'Tovuti ya usajili haipatikani kwa sasa.' },
25
+ 'Billing.BALANCE_LABEL': { de: 'Token-Guthaben', de_informal: 'Token-Guthaben', en: 'Token balance', fr: 'Solde de jetons', sw: 'Salio la tokeni' },
26
+ 'Billing.BUY_PACKAGE': { de: 'Token-Paket kaufen', de_informal: 'Token-Paket kaufen', en: 'Buy a token package', fr: 'Acheter un forfait de jetons', sw: 'Nunua kifurushi cha tokeni' },
27
+ 'Billing.PACKAGE_BUY': { de: 'Paket kaufen', de_informal: 'Paket kaufen', en: 'Buy package', fr: 'Acheter le forfait', sw: 'Nunua kifurushi' },
28
+ 'Billing.SEATS_one': { de: '{{count}} Platz', de_informal: '{{count}} Platz', en: '{{count}} seat', fr: '{{count}} place', sw: 'Nafasi {{count}}' },
29
+ 'Billing.SEATS_other': { de: '{{count}} Plätze', de_informal: '{{count}} Plätze', en: '{{count}} seats', fr: '{{count}} places', sw: 'Nafasi {{count}}' },
30
+ 'Billing.TERM_MONTHS_one': { de: '{{count}} Monat', de_informal: '{{count}} Monat', en: '{{count}} month', fr: '{{count}} mois', sw: 'Mwezi {{count}}' },
31
+ 'Billing.TERM_MONTHS_other': { de: '{{count}} Monate', de_informal: '{{count}} Monate', en: '{{count}} months', fr: '{{count}} mois', sw: 'Miezi {{count}}' },
32
+ 'Billing.SEATS_ADD': { de: 'Platz vergeben', de_informal: 'Platz vergeben', en: 'Add seat', fr: 'Ajouter une place', sw: 'Ongeza nafasi' },
33
+ 'Billing.SEAT_USER': { de: 'E-Mail-Adresse oder Benutzer-ID', de_informal: 'E-Mail-Adresse oder Benutzer-ID', en: 'Email address or user ID', fr: 'Adresse e-mail ou identifiant utilisateur', sw: 'Barua pepe au kitambulisho cha mtumiaji' },
34
+ 'Billing.SEAT_PICK': { de: 'Teammitglied wählen', de_informal: 'Teammitglied wählen', en: 'Choose a team member', fr: 'Choisir un membre de l’équipe', sw: 'Chagua mwanatimu' },
35
+ 'Billing.SEAT_REMOVE': { de: 'Entfernen', de_informal: 'Entfernen', en: 'Remove', fr: 'Retirer', sw: 'Ondoa' },
36
+ 'Billing.ERROR_SEAT_LIMIT': { de: 'Alle Plätze sind belegt.', de_informal: 'Alle Plätze sind belegt.', en: 'All seats are occupied.', fr: 'Toutes les places sont occupées.', sw: 'Nafasi zote zimejazwa.' },
37
+ 'Billing.ERROR_SEAT_USER': { de: 'Diese Person kann nicht hinzugefügt werden.', de_informal: 'Diese Person kann nicht hinzugefügt werden.', en: 'This person could not be added.', fr: 'Cette personne ne peut pas être ajoutée.', sw: 'Mtu huyu hakuweza kuongezwa.' },
38
+ 'Billing.PLAN_INTERVAL': { de: 'Abrechnungszeitraum', de_informal: 'Abrechnungszeitraum', en: 'Billing interval', fr: 'Période de facturation', sw: 'Kipindi cha malipo' },
39
+ 'Billing.LOADING': { de: 'Abodaten werden geladen …', de_informal: 'Abodaten werden geladen …', en: 'Loading subscription details …', fr: 'Chargement de l’abonnement …', sw: 'Inapakia maelezo ya usajili …' },
40
+ 'Billing.HEADING': { de: 'Abo', de_informal: 'Abo', en: 'Subscription', fr: 'Abonnement', sw: 'Usajili' },
41
+ 'Billing.TEAM_SEATS': { de: 'Plätze im Team-Paket', de_informal: 'Plätze im Team-Paket', en: 'Seats in the team package', fr: 'Places dans le forfait d’équipe', sw: 'Nafasi katika kifurushi cha timu' },
42
+ 'Billing.PACKAGE_TOKENS': { de: '{{tokens}} Token', de_informal: '{{tokens}} Token', en: '{{tokens}} tokens', fr: '{{tokens}} jetons', sw: 'Tokeni {{tokens}}' },
43
+ 'Billing.PLANS': { de: 'Pläne', de_informal: 'Pläne', en: 'Plans', fr: 'Offres', sw: 'Mipango' },
43
44
  'Billing.WITHDRAWAL_BUTTON': { de: 'Vertrag hier widerrufen', de_informal: 'Vertrag hier widerrufen', en: 'Withdraw this contract', fr: 'Révoquer ce contrat ici', sw: 'Ondoa mkataba huu hapa' },
44
45
  'Billing.WITHDRAWAL_UNTIL': { de: 'bis {{date}}', de_informal: 'bis {{date}}', en: 'until {{date}}', fr: 'jusqu’au {{date}}', sw: 'hadi {{date}}' },
45
46
  'Billing.WITHDRAWAL_TITLE': { de: 'Vertrag widerrufen?', de_informal: 'Vertrag widerrufen?', en: 'Withdraw this contract?', fr: 'Révoquer ce contrat ?', sw: 'Uondoe mkataba huu?' },
@@ -61,43 +62,43 @@ export const billingTranslations = {
61
62
  'Billing.WITHDRAWAL_TOKEN_SHARE': { de: 'Tokenanteil: {{amount}}', de_informal: 'Tokenanteil: {{amount}}', en: 'Token share: {{amount}}', fr: 'Part des jetons : {{amount}}', sw: 'Sehemu ya tokeni: {{amount}}' },
62
63
  'Billing.WITHDRAWAL_USED': { de: 'Genutzt: {{amount}}', de_informal: 'Genutzt: {{amount}}', en: 'Used: {{amount}}', fr: 'Utilisé : {{amount}}', sw: 'Imetumika: {{amount}}' },
63
64
  'Billing.WITHDRAWAL_CLOSE': { de: 'Schließen', de_informal: 'Schließen', en: 'Close', fr: 'Fermer', sw: 'Funga' },
64
- 'Billing.OP_OVERVIEW_TITLE': { de: 'Übersicht Abos', en: 'Subscription overview', fr: 'Aperçu des abonnements', sw: 'Muhtasari wa usajili' },
65
- 'Billing.OP_ACTIVE_ACCOUNTS': { de: 'Aktive Konten', en: 'Active accounts', fr: 'Comptes actifs', sw: 'Akaunti zinazotumika' },
66
- 'Billing.OP_PLAN': { de: 'Abo {{plan}}', en: 'Subscription {{plan}}', fr: 'Abonnement {{plan}}', sw: 'Usajili {{plan}}' },
67
- 'Billing.OP_TEAM_SEAT': { de: 'Team-Platz', en: 'Team seat', fr: 'Place d’équipe', sw: 'Nafasi ya timu' },
68
- 'Billing.OP_FREE_ACCESS': { de: 'Ohne Abo freigeschaltet', en: 'Access enabled without a subscription', fr: 'Accès activé sans abonnement', sw: 'Ufikiaji umewezeshwa bila usajili' },
69
- 'Billing.OP_READ_ONLY': { de: 'Schreibgeschützt', en: 'Read-only', fr: 'Lecture seule', sw: 'Kusoma pekee' },
70
- 'Billing.OP_NEW_SUBSCRIPTIONS': { de: 'Neue Abos', en: 'New subscriptions', fr: 'Nouveaux abonnements', sw: 'Usajili mpya' },
71
- 'Billing.OP_ENDED_SUBSCRIPTIONS': { de: 'Beendete Abos', en: 'Ended subscriptions', fr: 'Abonnements terminés', sw: 'Usajili uliomalizika' },
72
- 'Billing.OP_PACKAGES_SOLD': { de: 'Verkaufte Pakete', en: 'Packages sold', fr: 'Forfaits vendus', sw: 'Vifurushi vilivyouzwa' },
73
- 'Billing.OP_TOKENS_GRANTED': { de: 'Token gewährt', en: 'Tokens granted', fr: 'Jetons accordés', sw: 'Tokeni zilizotolewa' },
74
- 'Billing.OP_TOKENS_USED': { de: 'Token verbraucht', en: 'Tokens used', fr: 'Jetons utilisés', sw: 'Tokeni zilizotumika' },
75
- 'Billing.OP_TOKENS_EXPIRED': { de: 'Token verfallen', en: 'Tokens expired', fr: 'Jetons expirés', sw: 'Tokeni zilizoisha muda' },
76
- 'Billing.OP_AI_COST': { de: 'KI-Kosten', en: 'AI costs', fr: 'Coûts de l’IA', sw: 'Gharama za AI' },
77
- 'Billing.OP_COST_PER_TOKEN': { de: 'Kosten pro Token', en: 'Cost per token', fr: 'Coût par jeton', sw: 'Gharama kwa tokeni' },
78
- 'Billing.OP_ACCESS': { de: 'Zugang', en: 'Access', fr: 'Accès', sw: 'Ufikiaji' },
79
- 'Billing.OP_REASON': { de: 'Grund', en: 'Reason', fr: 'Motif', sw: 'Sababu' },
80
- 'Billing.OP_REVOKE_TITLE': { de: 'Freischaltung aufheben?', en: 'Revoke access?', fr: 'Retirer l’accès ?', sw: 'Uondoe ruhusa ya ufikiaji?' },
81
- 'Billing.OP_REVOKE_BODY': { de: 'Die Daten bleiben erhalten; ohne anderen Zugang sind sie danach schreibgeschützt.', en: 'The data will remain; without another access source, it will become read-only.', fr: 'Les données sont conservées ; sans autre accès, elles seront ensuite en lecture seule.', sw: 'Data zitabaki; bila chanzo kingine cha ufikiaji, zitasomeka pekee.' },
82
- 'Billing.OP_UNTIL': { de: 'bis {{date}}', en: 'until {{date}}', fr: 'jusqu’au {{date}}', sw: 'hadi {{date}}' },
83
- 'Billing.OP_RENEWS': { de: 'verlängert sich', en: 'renews', fr: 'se renouvelle', sw: 'inasasishwa' },
84
- 'Billing.OP_ENDS': { de: 'endet', en: 'ends', fr: 'se termine', sw: 'inaisha' },
85
- 'Billing.OP_GRANT_PLAN': { de: 'Kontingent', en: 'Allowance', fr: 'Allocation', sw: 'Kiwango kilichotengwa' },
86
- 'Billing.OP_GRANT_PACKAGE': { de: 'Paket', en: 'Package', fr: 'Forfait', sw: 'Kifurushi' },
87
- 'Billing.OP_REMAINING': { de: 'verbleibend', en: 'remaining', fr: 'restants', sw: 'zilizobaki' },
88
- 'Billing.OP_VALID_UNTIL': { de: 'gültig bis {{date}}', en: 'valid until {{date}}', fr: 'valable jusqu’au {{date}}', sw: 'halali hadi {{date}}' },
89
- 'Billing.OP_SEATS_USED': { de: '{{n}} von {{m}} Plätzen belegt', en: '{{n}} of {{m}} seats occupied', fr: '{{n}} places occupées sur {{m}}', sw: 'Nafasi {{n}} kati ya {{m}} zimejazwa' },
90
- 'Billing.OP_MONTH': { de: 'Monat', en: 'Month', fr: 'Mois', sw: 'Mwezi' },
91
- 'Billing.OP_PROVIDER': { de: 'Anbieter', en: 'Provider', fr: 'Fournisseur', sw: 'Mtoa huduma' },
92
- 'Billing.OP_MODEL': { de: 'Modell', en: 'Model', fr: 'Modèle', sw: 'Muundo' },
93
- 'Billing.OP_CALLS': { de: 'Aufrufe', en: 'Calls', fr: 'Appels', sw: 'Miito' },
94
- 'Billing.OP_COST_USD': { de: 'Kosten (USD)', en: 'Cost (USD)', fr: 'Coût (USD)', sw: 'Gharama (USD)' },
95
- 'Billing.OP_CANCEL': { de: 'Abbrechen', en: 'Cancel', fr: 'Annuler', sw: 'Ghairi' },
96
- 'Billing.OP_GRANT': { de: 'Freischalten', en: 'Grant access', fr: 'Autoriser l’accès', sw: 'Ruhusu ufikiaji' },
97
- 'Billing.OP_REVOKE': { de: 'Aufheben', en: 'Revoke', fr: 'Retirer', sw: 'Ondoa' },
98
- 'Billing.OP_SEAT_UNTIL': { de: 'Team-Platz bis {{date}}', en: 'Team seat until {{date}}', fr: 'Place d’équipe jusqu’au {{date}}', sw: 'Nafasi ya timu hadi {{date}}' },
99
- 'Billing.OP_LOAD_ERROR': { de: 'Die Übersicht konnte nicht geladen werden.', en: 'The overview could not be loaded.', fr: 'Impossible de charger l’aperçu.', sw: 'Muhtasari haukuweza kupakiwa.' },
100
- 'Billing.OP_SAVE_ERROR': { de: 'Die Änderung konnte nicht gespeichert werden.', en: 'The change could not be saved.', fr: 'Impossible d’enregistrer la modification.', sw: 'Mabadiliko hayakuweza kuhifadhiwa.' },
101
- 'Billing.OP_FORBIDDEN': { de: 'Dafür fehlt die Berechtigung.', en: 'You do not have permission for this action.', fr: 'Vous n’avez pas l’autorisation pour cette action.', sw: 'Huna ruhusa ya kufanya kitendo hiki.' },
102
- 'Billing.OP_NO_AI_COST': { de: 'In diesem Monat gab es keine KI-Aufrufe.', en: 'There were no AI calls this month.', fr: 'Aucun appel à l’IA ce mois-ci.', sw: 'Hakukuwa na miito ya AI mwezi huu.' },
65
+ 'Billing.OP_OVERVIEW_TITLE': { de: 'Übersicht Abos', de_informal: 'Übersicht Abos', en: 'Subscription overview', fr: 'Aperçu des abonnements', sw: 'Muhtasari wa usajili' },
66
+ 'Billing.OP_ACTIVE_ACCOUNTS': { de: 'Aktive Konten', de_informal: 'Aktive Konten', en: 'Active accounts', fr: 'Comptes actifs', sw: 'Akaunti zinazotumika' },
67
+ 'Billing.OP_PLAN': { de: 'Abo {{plan}}', de_informal: 'Abo {{plan}}', en: 'Subscription {{plan}}', fr: 'Abonnement {{plan}}', sw: 'Usajili {{plan}}' },
68
+ 'Billing.OP_TEAM_SEAT': { de: 'Team-Platz', de_informal: 'Team-Platz', en: 'Team seat', fr: 'Place d’équipe', sw: 'Nafasi ya timu' },
69
+ 'Billing.OP_FREE_ACCESS': { de: 'Ohne Abo freigeschaltet', de_informal: 'Ohne Abo freigeschaltet', en: 'Access enabled without a subscription', fr: 'Accès activé sans abonnement', sw: 'Ufikiaji umewezeshwa bila usajili' },
70
+ 'Billing.OP_READ_ONLY': { de: 'Schreibgeschützt', de_informal: 'Schreibgeschützt', en: 'Read-only', fr: 'Lecture seule', sw: 'Kusoma pekee' },
71
+ 'Billing.OP_NEW_SUBSCRIPTIONS': { de: 'Neue Abos', de_informal: 'Neue Abos', en: 'New subscriptions', fr: 'Nouveaux abonnements', sw: 'Usajili mpya' },
72
+ 'Billing.OP_ENDED_SUBSCRIPTIONS': { de: 'Beendete Abos', de_informal: 'Beendete Abos', en: 'Ended subscriptions', fr: 'Abonnements terminés', sw: 'Usajili uliomalizika' },
73
+ 'Billing.OP_PACKAGES_SOLD': { de: 'Verkaufte Pakete', de_informal: 'Verkaufte Pakete', en: 'Packages sold', fr: 'Forfaits vendus', sw: 'Vifurushi vilivyouzwa' },
74
+ 'Billing.OP_TOKENS_GRANTED': { de: 'Token gewährt', de_informal: 'Token gewährt', en: 'Tokens granted', fr: 'Jetons accordés', sw: 'Tokeni zilizotolewa' },
75
+ 'Billing.OP_TOKENS_USED': { de: 'Token verbraucht', de_informal: 'Token verbraucht', en: 'Tokens used', fr: 'Jetons utilisés', sw: 'Tokeni zilizotumika' },
76
+ 'Billing.OP_TOKENS_EXPIRED': { de: 'Token verfallen', de_informal: 'Token verfallen', en: 'Tokens expired', fr: 'Jetons expirés', sw: 'Tokeni zilizoisha muda' },
77
+ 'Billing.OP_AI_COST': { de: 'KI-Kosten', de_informal: 'KI-Kosten', en: 'AI costs', fr: 'Coûts de l’IA', sw: 'Gharama za AI' },
78
+ 'Billing.OP_COST_PER_TOKEN': { de: 'Kosten pro Token', de_informal: 'Kosten pro Token', en: 'Cost per token', fr: 'Coût par jeton', sw: 'Gharama kwa tokeni' },
79
+ 'Billing.OP_ACCESS': { de: 'Zugang', de_informal: 'Zugang', en: 'Access', fr: 'Accès', sw: 'Ufikiaji' },
80
+ 'Billing.OP_REASON': { de: 'Grund', de_informal: 'Grund', en: 'Reason', fr: 'Motif', sw: 'Sababu' },
81
+ 'Billing.OP_REVOKE_TITLE': { de: 'Freischaltung aufheben?', de_informal: 'Freischaltung aufheben?', en: 'Revoke access?', fr: 'Retirer l’accès ?', sw: 'Uondoe ruhusa ya ufikiaji?' },
82
+ 'Billing.OP_REVOKE_BODY': { de: 'Die Daten bleiben erhalten; ohne anderen Zugang sind sie danach schreibgeschützt.', de_informal: 'Die Daten bleiben erhalten; ohne anderen Zugang sind sie danach schreibgeschützt.', en: 'The data will remain; without another access source, it will become read-only.', fr: 'Les données sont conservées ; sans autre accès, elles seront ensuite en lecture seule.', sw: 'Data zitabaki; bila chanzo kingine cha ufikiaji, zitasomeka pekee.' },
83
+ 'Billing.OP_UNTIL': { de: 'bis {{date}}', de_informal: 'bis {{date}}', en: 'until {{date}}', fr: 'jusqu’au {{date}}', sw: 'hadi {{date}}' },
84
+ 'Billing.OP_RENEWS': { de: 'verlängert sich', de_informal: 'verlängert sich', en: 'renews', fr: 'se renouvelle', sw: 'inasasishwa' },
85
+ 'Billing.OP_ENDS': { de: 'endet', de_informal: 'endet', en: 'ends', fr: 'se termine', sw: 'inaisha' },
86
+ 'Billing.OP_GRANT_PLAN': { de: 'Kontingent', de_informal: 'Kontingent', en: 'Allowance', fr: 'Allocation', sw: 'Kiwango kilichotengwa' },
87
+ 'Billing.OP_GRANT_PACKAGE': { de: 'Paket', de_informal: 'Paket', en: 'Package', fr: 'Forfait', sw: 'Kifurushi' },
88
+ 'Billing.OP_REMAINING': { de: 'verbleibend', de_informal: 'verbleibend', en: 'remaining', fr: 'restants', sw: 'zilizobaki' },
89
+ 'Billing.OP_VALID_UNTIL': { de: 'gültig bis {{date}}', de_informal: 'gültig bis {{date}}', en: 'valid until {{date}}', fr: 'valable jusqu’au {{date}}', sw: 'halali hadi {{date}}' },
90
+ 'Billing.OP_SEATS_USED': { de: '{{n}} von {{m}} Plätzen belegt', de_informal: '{{n}} von {{m}} Plätzen belegt', en: '{{n}} of {{m}} seats occupied', fr: '{{n}} places occupées sur {{m}}', sw: 'Nafasi {{n}} kati ya {{m}} zimejazwa' },
91
+ 'Billing.OP_MONTH': { de: 'Monat', de_informal: 'Monat', en: 'Month', fr: 'Mois', sw: 'Mwezi' },
92
+ 'Billing.OP_PROVIDER': { de: 'Anbieter', de_informal: 'Anbieter', en: 'Provider', fr: 'Fournisseur', sw: 'Mtoa huduma' },
93
+ 'Billing.OP_MODEL': { de: 'Modell', de_informal: 'Modell', en: 'Model', fr: 'Modèle', sw: 'Muundo' },
94
+ 'Billing.OP_CALLS': { de: 'Aufrufe', de_informal: 'Aufrufe', en: 'Calls', fr: 'Appels', sw: 'Miito' },
95
+ 'Billing.OP_COST_USD': { de: 'Kosten (USD)', de_informal: 'Kosten (USD)', en: 'Cost (USD)', fr: 'Coût (USD)', sw: 'Gharama (USD)' },
96
+ 'Billing.OP_CANCEL': { de: 'Abbrechen', de_informal: 'Abbrechen', en: 'Cancel', fr: 'Annuler', sw: 'Ghairi' },
97
+ 'Billing.OP_GRANT': { de: 'Freischalten', de_informal: 'Freischalten', en: 'Grant access', fr: 'Autoriser l’accès', sw: 'Ruhusu ufikiaji' },
98
+ 'Billing.OP_REVOKE': { de: 'Aufheben', de_informal: 'Aufheben', en: 'Revoke', fr: 'Retirer', sw: 'Ondoa' },
99
+ 'Billing.OP_SEAT_UNTIL': { de: 'Team-Platz bis {{date}}', de_informal: 'Team-Platz bis {{date}}', en: 'Team seat until {{date}}', fr: 'Place d’équipe jusqu’au {{date}}', sw: 'Nafasi ya timu hadi {{date}}' },
100
+ 'Billing.OP_LOAD_ERROR': { de: 'Die Übersicht konnte nicht geladen werden.', de_informal: 'Die Übersicht konnte nicht geladen werden.', en: 'The overview could not be loaded.', fr: 'Impossible de charger l’aperçu.', sw: 'Muhtasari haukuweza kupakiwa.' },
101
+ 'Billing.OP_SAVE_ERROR': { de: 'Die Änderung konnte nicht gespeichert werden.', de_informal: 'Die Änderung konnte nicht gespeichert werden.', en: 'The change could not be saved.', fr: 'Impossible d’enregistrer la modification.', sw: 'Mabadiliko hayakuweza kuhifadhiwa.' },
102
+ 'Billing.OP_FORBIDDEN': { de: 'Dafür fehlt die Berechtigung.', de_informal: 'Dafür fehlt die Berechtigung.', en: 'You do not have permission for this action.', fr: 'Vous n’avez pas l’autorisation pour cette action.', sw: 'Huna ruhusa ya kufanya kitendo hiki.' },
103
+ 'Billing.OP_NO_AI_COST': { de: 'In diesem Monat gab es keine KI-Aufrufe.', de_informal: 'In diesem Monat gab es keine KI-Aufrufe.', en: 'There were no AI calls this month.', fr: 'Aucun appel à l’IA ce mois-ci.', sw: 'Hakukuwa na miito ya AI mwezi huu.' },
103
104
  };
@@ -1,39 +1,164 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
+ import { alpha } from '@mui/material/styles';
3
4
  import { Box, Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Drawer, Stack, Typography, useMediaQuery } from '@mui/material';
4
5
  import { useTheme } from '@mui/material/styles';
5
6
  import { useTranslation } from 'react-i18next';
6
- import { formatReceiptAmount, formatReceiptDate, isEmptyValue, receiptValueEqual } from './format';
7
- export const RECEIPT_REVIEW_ACTIONS_SX = { gap: 1, flexWrap: 'wrap', flexDirection: { xs: 'column', sm: 'row' }, '& > :nth-of-type(1)': { order: { xs: 3, sm: 0 } }, '& > :nth-of-type(2)': { order: { xs: 2, sm: 0 } }, '& > :nth-of-type(3)': { order: { xs: 1, sm: 0 } } };
8
- export const RECEIPT_REVIEW_ROW_SX = { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) auto', columnGap: 1, alignItems: 'start' };
9
- export const RECEIPT_REVIEW_SHEET_PAPER_SX = { height: '92%' };
10
- export const RECEIPT_REVIEW_ACTION_BUTTON_SX = { flex: '1 1 auto' };
7
+ import { formatReceiptAmount, formatReceiptDate, isEmptyValue, normaliseItems, receiptValueEqual } from './format';
8
+ // The gap spaces the buttons; MUI's own left margin between DialogActions children would shift the stacked buttons.
9
+ export const RECEIPT_REVIEW_ACTIONS_SX = { gap: 1, flexWrap: { xs: 'nowrap', sm: 'wrap' }, flexDirection: { xs: 'column', sm: 'row' }, alignItems: { xs: 'stretch', sm: 'center' }, '& > :not(style):not(:first-of-type)': { marginLeft: 0 } };
10
+ export const RECEIPT_REVIEW_ROW_SX = {
11
+ display: 'grid',
12
+ gridTemplateColumns: { xs: 'minmax(0, 1fr) auto', sm: '120px minmax(0, 1fr) auto' },
13
+ columnGap: 1.25,
14
+ alignItems: 'center',
15
+ py: 1.125,
16
+ borderBottom: '1px solid',
17
+ borderColor: 'divider',
18
+ '&:last-of-type': { borderBottom: 0 },
19
+ '& > :first-child': { gridColumn: { xs: '1 / -1', sm: 'auto' } },
20
+ };
21
+ // The prototype's dialog is 640 px wide; on narrower windows it keeps the usual margin.
22
+ export const RECEIPT_REVIEW_DIALOG_PAPER_SX = { width: 640, maxWidth: 'calc(100% - 64px)', maxHeight: 'min(640px, calc(100% - 64px))' };
23
+ export const RECEIPT_REVIEW_SHEET_PAPER_SX = (theme) => ({
24
+ height: 'auto',
25
+ maxHeight: 'calc(100% - 56px)',
26
+ display: 'flex',
27
+ flexDirection: 'column',
28
+ borderTopLeftRadius: theme.shape.borderRadius * 2,
29
+ borderTopRightRadius: theme.shape.borderRadius * 2,
30
+ });
31
+ export const RECEIPT_REVIEW_ACTION_BUTTON_SX = { flex: { xs: '1 1 100%', sm: '0 0 auto' }, width: { xs: '100%', sm: 'auto' } };
32
+ export const RECEIPT_REVIEW_CHIP_SX = {
33
+ alignSelf: 'flex-start',
34
+ fontWeight: 700,
35
+ backgroundColor: (theme) => alpha(theme.palette.warning.main, 0.12),
36
+ color: 'warning.dark',
37
+ };
38
+ export const RECEIPT_REVIEW_ROW_ACTION_SX = { justifySelf: 'end', alignSelf: 'center' };
39
+ const normaliseScalar = (value) => (typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '');
40
+ const isItemsEmpty = (value) => normaliseItems(value).length === 0;
41
+ const isRowEmpty = (row, values) => row.key === 'items'
42
+ ? isItemsEmpty(values.items)
43
+ : row.key === 'total'
44
+ ? isEmptyValue(values.total)
45
+ : isEmptyValue(values[row.key]);
46
+ function rowApplyValues(row, receipt, values) {
47
+ if (row.key === 'total') {
48
+ const result = { total: row.value };
49
+ if (receipt === null || receipt === void 0 ? void 0 : receipt.currency)
50
+ result.currency = receipt.currency;
51
+ return result;
52
+ }
53
+ return { [row.key]: row.value };
54
+ }
55
+ function emptyApplyRows(rows, receipt, values) {
56
+ const result = {};
57
+ rows.forEach((row) => {
58
+ if (!isRowEmpty(row, values))
59
+ return;
60
+ const handed = rowApplyValues(row, receipt, values);
61
+ // "Only empty fields" never overwrites a filled currency that sits next to an empty amount.
62
+ if (row.key === 'total' && !isEmptyValue(values.currency))
63
+ delete handed.currency;
64
+ Object.assign(result, handed);
65
+ });
66
+ const hasTotalRow = rows.some((row) => row.key === 'total');
67
+ if (hasTotalRow && !isEmptyValue(values.total) && isEmptyValue(values.currency) && (receipt === null || receipt === void 0 ? void 0 : receipt.currency)) {
68
+ result.currency = receipt.currency;
69
+ }
70
+ return result;
71
+ }
72
+ function rowEqual(row, receipt, values) {
73
+ if (row.key === 'items')
74
+ return !isItemsEmpty(values.items) && receiptValueEqual('items', values.items, row.value);
75
+ if (row.key === 'total') {
76
+ const amountMatches = !isEmptyValue(values.total) && receiptValueEqual('total', values.total, row.value);
77
+ if (!amountMatches)
78
+ return false;
79
+ if (!(receipt === null || receipt === void 0 ? void 0 : receipt.currency))
80
+ return true;
81
+ return typeof values.currency === 'string'
82
+ && values.currency.trim().toLowerCase() === receipt.currency.trim().toLowerCase();
83
+ }
84
+ return !isEmptyValue(values[row.key]) && receiptValueEqual(row.key, values[row.key], row.value);
85
+ }
86
+ function ItemLines({ items, struckThrough = false }) {
87
+ const rows = normaliseItems(items);
88
+ if (!rows.length)
89
+ return null;
90
+ return (_jsx(Box, { component: "ul", sx: { display: 'grid', gap: 0.25, m: 0, p: 0, listStyle: 'none', textDecoration: struckThrough ? 'line-through' : 'none' }, children: rows.map((item, index) => (_jsxs(Box, { component: "li", sx: { display: 'flex', justifyContent: 'space-between', gap: 1 }, children: [_jsx(Typography, { component: "span", variant: "body2", sx: { color: struckThrough ? 'text.disabled' : 'text.secondary' }, children: item.description }), item.amount && _jsx(Typography, { component: "span", variant: "body2", sx: { flexShrink: 0, color: struckThrough ? 'text.disabled' : 'text.secondary', fontVariantNumeric: 'tabular-nums' }, children: item.amount })] }, `${item.description}-${item.amount}-${index}`))) }));
91
+ }
11
92
  export function ReceiptReviewDialog({ open, receipt, values = {}, fieldLabels = {}, extraFields = [], accountLabel = (id) => id, onApply, onClose }) {
12
93
  var _a;
13
94
  const { t, i18n } = useTranslation();
14
95
  const theme = useTheme();
15
96
  const mobile = useMediaQuery(theme.breakpoints.down('sm'));
16
97
  const rows = [];
17
- const add = (key, value, recognized = value !== '' && value != null, format = (v) => String(v)) => { if (recognized)
18
- rows.push({ key, value, text: format(value), confidence: receipt === null || receipt === void 0 ? void 0 : receipt.confidence }); };
98
+ const add = (key, value, recognized = value !== '' && value != null, format = (v) => normaliseScalar(v)) => {
99
+ if (recognized) {
100
+ const formatted = format(value);
101
+ rows.push({ key, value, text: formatted !== null && formatted !== void 0 ? formatted : '', confidence: receipt === null || receipt === void 0 ? void 0 : receipt.confidence });
102
+ }
103
+ };
19
104
  add('merchant', receipt === null || receipt === void 0 ? void 0 : receipt.merchant);
20
- add('date', receipt === null || receipt === void 0 ? void 0 : receipt.date, Boolean(receipt === null || receipt === void 0 ? void 0 : receipt.date), (v) => formatReceiptDate(v, i18n.language));
21
- add('total', receipt === null || receipt === void 0 ? void 0 : receipt.total, Boolean(receipt === null || receipt === void 0 ? void 0 : receipt.total), (v) => formatReceiptAmount(v, receipt === null || receipt === void 0 ? void 0 : receipt.currency, i18n.language));
22
- add('currency', receipt === null || receipt === void 0 ? void 0 : receipt.currency);
23
- if ((receipt === null || receipt === void 0 ? void 0 : receipt.payment_method) && receipt.payment_method !== 'unknown')
24
- add('payment_method', receipt.payment_method, true, (v) => t(`Receipts.PAYMENT_${v}`));
25
- const account = (_a = receipt === null || receipt === void 0 ? void 0 : receipt.account_suggestions) === null || _a === void 0 ? void 0 : _a.find((s) => s === null || s === void 0 ? void 0 : s.account_id);
105
+ add('date', receipt === null || receipt === void 0 ? void 0 : receipt.date, Boolean(receipt === null || receipt === void 0 ? void 0 : receipt.date), (value) => formatReceiptDate(value, i18n.language));
106
+ add('total', receipt === null || receipt === void 0 ? void 0 : receipt.total, Boolean(receipt === null || receipt === void 0 ? void 0 : receipt.total), (value) => formatReceiptAmount(value, receipt === null || receipt === void 0 ? void 0 : receipt.currency, i18n.language));
107
+ // A receipt with a currency but no amount keeps its own currency row, so the currency can still be shown and applied.
108
+ if ((receipt === null || receipt === void 0 ? void 0 : receipt.currency) && !(receipt === null || receipt === void 0 ? void 0 : receipt.total))
109
+ add('currency', receipt.currency);
110
+ if ((receipt === null || receipt === void 0 ? void 0 : receipt.payment_method) && receipt.payment_method !== 'unknown') {
111
+ add('payment_method', receipt.payment_method, true, (value) => t(`Receipts.PAYMENT_${value}`));
112
+ }
113
+ const account = (_a = receipt === null || receipt === void 0 ? void 0 : receipt.account_suggestions) === null || _a === void 0 ? void 0 : _a.find((suggestion) => suggestion === null || suggestion === void 0 ? void 0 : suggestion.account_id);
26
114
  if (account)
27
115
  rows.push({ key: 'account', value: account.account_id, text: accountLabel(account.account_id), confidence: account.confidence === 'low' ? 'low' : receipt === null || receipt === void 0 ? void 0 : receipt.confidence });
28
- if (Array.isArray(receipt === null || receipt === void 0 ? void 0 : receipt.items) && receipt.items.length)
29
- rows.push({ key: 'items', value: receipt.items, text: receipt.items.map((item) => `${item.description || ''}${item.amount ? ` · ${item.amount}` : ''}`).join('\n'), confidence: receipt === null || receipt === void 0 ? void 0 : receipt.confidence });
30
- (extraFields || []).forEach(({ key, format }) => { if (!['merchant', 'date', 'total', 'currency', 'payment_method', 'account', 'items'].includes(key) && (receipt === null || receipt === void 0 ? void 0 : receipt[key]) != null && receipt[key] !== '')
31
- add(key, receipt[key], true, format || ((v) => typeof v === 'string' ? v : JSON.stringify(v))); });
116
+ if (normaliseItems(receipt === null || receipt === void 0 ? void 0 : receipt.items).length) {
117
+ rows.push({ key: 'items', value: receipt.items, text: '', confidence: receipt === null || receipt === void 0 ? void 0 : receipt.confidence });
118
+ }
119
+ (extraFields || []).forEach(({ key, format }) => {
120
+ if (['merchant', 'date', 'total', 'currency', 'payment_method', 'account', 'items'].includes(key))
121
+ return;
122
+ const value = receipt === null || receipt === void 0 ? void 0 : receipt[key];
123
+ if (value == null || value === '')
124
+ return;
125
+ add(key, value, true, format || ((item) => (typeof item === 'string' || typeof item === 'number' ? String(item).trim() : JSON.stringify(item))));
126
+ });
32
127
  const label = (key) => { var _a; return fieldLabels[key] || ((_a = extraFields.find((field) => field.key === key)) === null || _a === void 0 ? void 0 : _a.label) || t(`Receipts.FIELD_${key}`); };
33
- const apply = (list, mode, close) => { if (!list.length)
34
- return; onApply === null || onApply === void 0 ? void 0 : onApply(Object.fromEntries(list.map((r) => [r.key, r.value])), { mode }); if (close)
35
- onClose === null || onClose === void 0 ? void 0 : onClose(); };
36
- const content = _jsxs(_Fragment, { children: [_jsx(DialogTitle, { id: "receipt-review-title", children: t('Receipts.REVIEW_TITLE') }), _jsx(DialogContent, { children: _jsx(Stack, { spacing: 2, children: rows.map((row) => { const current = values[row.key]; const equal = !isEmptyValue(current) && receiptValueEqual(row.key, current, row.value); return _jsxs(Box, { sx: RECEIPT_REVIEW_ROW_SX, children: [_jsxs(Box, { sx: { minWidth: 0 }, children: [_jsx(Typography, { variant: "subtitle2", children: label(row.key) }), _jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", flexWrap: "wrap", children: [row.key === 'items' ? _jsx(Box, { component: "ul", sx: { m: 0, pl: 2 }, children: row.value.map((item, index) => _jsx("li", { children: _jsx(Typography, { component: "span", children: `${item.description || ''}${item.amount ? ` · ${item.amount}` : ''}` }) }, index)) }) : _jsx(Typography, { children: row.text }), row.confidence === 'low' && _jsx(Chip, { size: "small", color: "warning", label: t('Receipts.UNCERTAIN') }), equal ? _jsx(Typography, { variant: "caption", children: t('Receipts.SAME_AS_FORM') }) : !isEmptyValue(current) && _jsx(Typography, { variant: "body2", sx: { textDecoration: 'line-through' }, children: String(current) })] })] }), !equal && _jsx(Button, { size: "small", onClick: () => apply([row], 'field', false), children: t('Receipts.APPLY') })] }, row.key); }) }) }), _jsxs(DialogActions, { sx: RECEIPT_REVIEW_ACTIONS_SX, children: [_jsx(Button, { sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, onClick: onClose, children: t('Receipts.CLOSE') }), _jsx(Button, { variant: "outlined", sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, disabled: !rows.some((r) => isEmptyValue(values[r.key])), onClick: () => apply(rows.filter((r) => isEmptyValue(values[r.key])), 'empty', true), children: t('Receipts.ONLY_EMPTY') }), _jsx(Button, { variant: "contained", sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, disabled: !rows.length, onClick: () => apply(rows, 'all', true), children: t('Receipts.APPLY_ALL') })] })] });
37
- return mobile ? _jsx(Drawer, { anchor: "bottom", open: open, onClose: onClose, PaperProps: { sx: RECEIPT_REVIEW_SHEET_PAPER_SX, role: 'dialog', 'aria-labelledby': 'receipt-review-title' }, children: content }) : _jsx(Dialog, { open: open, onClose: onClose, maxWidth: "sm", fullWidth: true, "aria-labelledby": "receipt-review-title", children: content });
128
+ const apply = (list, mode, close) => {
129
+ if (!list.length)
130
+ return;
131
+ const payload = mode === 'empty'
132
+ ? emptyApplyRows(list, receipt, values)
133
+ : Object.assign({}, ...list.map((row) => rowApplyValues(row, receipt, values)));
134
+ if (Object.keys(payload).length)
135
+ onApply === null || onApply === void 0 ? void 0 : onApply(payload, { mode });
136
+ if (close)
137
+ onClose === null || onClose === void 0 ? void 0 : onClose();
138
+ };
139
+ const rowElements = rows.map((row, index) => {
140
+ const equal = rowEqual(row, receipt, values);
141
+ const currentItems = row.key === 'items' ? normaliseItems(values.items) : [];
142
+ const displayCurrent = row.key === 'items'
143
+ ? currentItems.length > 0
144
+ : typeof values[row.key] === 'string' || typeof values[row.key] === 'number';
145
+ const uncertain = row.confidence === 'low';
146
+ const showCurrent = !equal && !isRowEmpty(row, values) && displayCurrent;
147
+ return (_jsxs(Box, { "data-receipt-review-row": row.key, sx: RECEIPT_REVIEW_ROW_SX, children: [_jsx(Typography, { variant: "caption", color: "text.secondary", children: label(row.key) }), _jsxs(Stack, { spacing: 0.25, sx: { minWidth: 0 }, children: [row.key === 'items'
148
+ ? _jsx(ItemLines, { items: row.value })
149
+ : _jsx(Typography, { sx: { fontWeight: 600, fontVariantNumeric: row.key === 'total' ? 'tabular-nums' : undefined }, children: row.text }), equal && _jsx(Typography, { variant: "caption", color: "text.disabled", children: t('Receipts.SAME_AS_FORM') }), showCurrent && (row.key === 'items'
150
+ ? _jsx(ItemLines, { items: values.items, struckThrough: true })
151
+ : _jsx(Typography, { variant: "body2", color: "text.disabled", sx: { textDecoration: 'line-through' }, children: row.key === 'total' && values.currency ? formatReceiptAmount(normaliseScalar(values.total), values.currency, i18n.language) : normaliseScalar(values[row.key]) })), mobile && uncertain && _jsx(Chip, { size: "small", sx: RECEIPT_REVIEW_CHIP_SX, label: t('Receipts.UNCERTAIN') })] }), (!equal || (!mobile && uncertain)) && (_jsxs(Stack, { direction: "row", spacing: 0.75, alignItems: "center", sx: RECEIPT_REVIEW_ROW_ACTION_SX, children: [!mobile && uncertain && _jsx(Chip, { size: "small", sx: RECEIPT_REVIEW_CHIP_SX, label: t('Receipts.UNCERTAIN') }), !equal && (_jsx(Button, { size: "small", onClick: () => onApply === null || onApply === void 0 ? void 0 : onApply(rowApplyValues(row, receipt, values), { mode: 'field' }), children: t('Receipts.APPLY') }))] }))] }, row.key));
152
+ });
153
+ const closeButton = _jsx(Button, { fullWidth: mobile, sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, onClick: onClose, children: t('Receipts.CLOSE') }, "close");
154
+ const hasEmptyValue = rows.some((row) => isRowEmpty(row, values));
155
+ const hasEmptyCurrency = rows.some((row) => row.key === 'total') && !isEmptyValue(values.total) && isEmptyValue(values.currency) && (receipt === null || receipt === void 0 ? void 0 : receipt.currency);
156
+ const emptyButton = _jsx(Button, { fullWidth: mobile, variant: "outlined", sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, disabled: !hasEmptyValue && !hasEmptyCurrency, onClick: () => apply(rows, 'empty', true), children: t('Receipts.ONLY_EMPTY') }, "empty");
157
+ const allButton = _jsx(Button, { fullWidth: mobile, variant: "contained", sx: RECEIPT_REVIEW_ACTION_BUTTON_SX, disabled: !rows.length, onClick: () => apply(rows, 'all', true), children: t('Receipts.APPLY_ALL') }, "all");
158
+ const actions = mobile ? [allButton, emptyButton, closeButton] : [closeButton, emptyButton, allButton];
159
+ const content = _jsxs(_Fragment, { children: [_jsx(DialogTitle, { id: "receipt-review-title", children: t('Receipts.REVIEW_TITLE') }), _jsx(DialogContent, { sx: { overflowY: mobile ? 'auto' : undefined, flex: mobile ? '1 1 auto' : undefined }, children: _jsx(Box, { children: rowElements }) }), _jsx(DialogActions, { sx: RECEIPT_REVIEW_ACTIONS_SX, children: actions })] });
160
+ return mobile
161
+ ? _jsx(Drawer, { anchor: "bottom", open: open, onClose: onClose, PaperProps: { sx: RECEIPT_REVIEW_SHEET_PAPER_SX, role: 'dialog', 'aria-labelledby': 'receipt-review-title' }, children: content })
162
+ : _jsx(Dialog, { open: open, onClose: onClose, maxWidth: false, PaperProps: { sx: RECEIPT_REVIEW_DIALOG_PAPER_SX }, "aria-labelledby": "receipt-review-title", children: content });
38
163
  }
39
164
  export default ReceiptReviewDialog;
@@ -30,12 +30,29 @@ export function formatReceiptDate(iso, language) {
30
30
  const date = new Date(`${iso}T00:00:00Z`);
31
31
  if (!Number.isFinite(date.getTime()) || date.toISOString().slice(0, 10) !== iso)
32
32
  return iso;
33
- return new Intl.DateTimeFormat(intlLocale(language), { dateStyle: 'short', timeZone: 'UTC' }).format(date);
33
+ return new Intl.DateTimeFormat(intlLocale(language), { day: '2-digit', month: '2-digit', year: 'numeric', timeZone: 'UTC' }).format(date);
34
34
  }
35
35
  export function isEmptyValue(value) { return value === '' || value === null || value === undefined || (Array.isArray(value) && value.length === 0); }
36
+ export function normaliseItems(value) {
37
+ if (!Array.isArray(value))
38
+ return [];
39
+ return value.map((item) => {
40
+ if (typeof item === 'string')
41
+ return { description: item.trim(), amount: '' };
42
+ if (item === null || typeof item !== 'object' || Array.isArray(item))
43
+ return { description: '', amount: '' };
44
+ return { description: normaliseItemPart(item.description), amount: normaliseItemPart(item.amount) };
45
+ }).filter((item) => item.description || item.amount);
46
+ }
47
+ function normaliseItemPart(value) {
48
+ return typeof value === 'string' || typeof value === 'number' ? String(value).trim() : '';
49
+ }
36
50
  export function receiptValueEqual(key, a, b) {
37
- if (key === 'items')
38
- return Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((item, i) => ['description', 'amount'].every((k) => { var _a; var _b, _c; return String((_b = item === null || item === void 0 ? void 0 : item[k]) !== null && _b !== void 0 ? _b : '').trim().toLowerCase() === String((_c = (_a = b[i]) === null || _a === void 0 ? void 0 : _a[k]) !== null && _c !== void 0 ? _c : '').trim().toLowerCase(); }));
51
+ if (key === 'items') {
52
+ const first = normaliseItems(a);
53
+ const second = normaliseItems(b);
54
+ return first.length === second.length && first.every((item, index) => ['description', 'amount'].every((keyPart) => item[keyPart].toLowerCase() === second[index][keyPart].toLowerCase()));
55
+ }
39
56
  if (key === 'total' && a !== '' && b !== '' && Number.isFinite(Number(a)) && Number.isFinite(Number(b)))
40
57
  return Number(a) === Number(b);
41
58
  return String(a !== null && a !== void 0 ? a : '').trim().toLowerCase() === String(b !== null && b !== void 0 ? b : '').trim().toLowerCase();
@@ -36,7 +36,7 @@ import { createKitSxEntry } from './kitSxEntry';
36
36
  import { ACCESS_ENDED_BANNER_ALERT_SX } from '../billing/AccessEndedBanner';
37
37
  import { TOKEN_BALANCE_BADGE_SX } from '../billing/TokenBalanceBadge';
38
38
  import { PLAN_PICKER_ALERT_SX, PLAN_PICKER_CARD_SX, PLAN_PICKER_LABEL_SX, PLAN_PICKER_SELECTED_CARD_SX } from '../billing/PlanPicker';
39
- import { SUBSCRIPTION_SECTION_ALERT_SX } from '../billing/SubscriptionSection';
39
+ import { SUBSCRIPTION_SECTION_ALERT_SX, SUBSCRIPTION_SECTION_SEAT_ADD_SX, SUBSCRIPTION_SECTION_SEAT_SELECT_SX } from '../billing/SubscriptionSection';
40
40
  import { WITHDRAWAL_DIALOG_ALERT_SX } from '../billing/WithdrawalDialog';
41
41
  import { WITHDRAWAL_SECTION_ALERT_SX } from '../billing/WithdrawalSection';
42
42
  import { FREE_ACCESS_SWITCH_ALERT_SX } from '../billing/FreeAccessSwitch';
@@ -44,7 +44,7 @@ import { OPERATOR_OVERVIEW_ALERT_SX } from '../billing/OperatorOverview';
44
44
  import { RECEIPT_CONSENT_ALERT_SX, RECEIPT_CONSENT_CONTROL_SX } from '../receipts/ReceiptConsentSwitch';
45
45
  import { RECEIPT_CAPTURE_ACTION_SX, RECEIPT_CAPTURE_ALERT_SX, RECEIPT_CAPTURE_CARD_SX, RECEIPT_CAPTURE_PROGRESS_SX } from '../receipts/ReceiptCaptureCard';
46
46
  import { RECEIPT_PICKER_ACTION_SX, RECEIPT_PICKER_CARD_SX } from '../receipts/ReceiptPicker';
47
- import { RECEIPT_REVIEW_ACTIONS_SX, RECEIPT_REVIEW_ACTION_BUTTON_SX, RECEIPT_REVIEW_SHEET_PAPER_SX } from '../receipts/ReceiptReviewDialog';
47
+ import { RECEIPT_REVIEW_ACTIONS_SX, RECEIPT_REVIEW_ACTION_BUTTON_SX, RECEIPT_REVIEW_CHIP_SX, RECEIPT_REVIEW_DIALOG_PAPER_SX, RECEIPT_REVIEW_SHEET_PAPER_SX } from '../receipts/ReceiptReviewDialog';
48
48
  const SX_EXPORTS = {
49
49
  ACCESS_CODE_ACTION_SX,
50
50
  ACCESS_ENDED_BANNER_ALERT_SX,
@@ -122,6 +122,8 @@ const SX_EXPORTS = {
122
122
  PLAN_PICKER_LABEL_SX,
123
123
  PLAN_PICKER_SELECTED_CARD_SX,
124
124
  SUBSCRIPTION_SECTION_ALERT_SX,
125
+ SUBSCRIPTION_SECTION_SEAT_SELECT_SX,
126
+ SUBSCRIPTION_SECTION_SEAT_ADD_SX,
125
127
  WITHDRAWAL_DIALOG_ALERT_SX,
126
128
  WITHDRAWAL_SECTION_ALERT_SX,
127
129
  RECEIPT_CONSENT_ALERT_SX,
@@ -134,6 +136,8 @@ const SX_EXPORTS = {
134
136
  RECEIPT_PICKER_CARD_SX,
135
137
  RECEIPT_REVIEW_ACTIONS_SX,
136
138
  RECEIPT_REVIEW_ACTION_BUTTON_SX,
139
+ RECEIPT_REVIEW_CHIP_SX,
140
+ RECEIPT_REVIEW_DIALOG_PAPER_SX,
137
141
  RECEIPT_REVIEW_SHEET_PAPER_SX,
138
142
  USER_INVITE_ACTION_SX,
139
143
  USER_INVITE_ALERT_SX,
@@ -240,6 +244,8 @@ export const KIT_COMPONENT_SX_REGISTRY = [
240
244
  entry('PlanPicker.label', 'MuiFormControlLabel', PLAN_PICKER_LABEL_SX),
241
245
  entry('PlanPicker.alert', 'MuiAlert', PLAN_PICKER_ALERT_SX),
242
246
  entry('SubscriptionSection.alert', 'MuiAlert', SUBSCRIPTION_SECTION_ALERT_SX),
247
+ entry('SubscriptionSection.seatSelect', 'MuiTextField', SUBSCRIPTION_SECTION_SEAT_SELECT_SX),
248
+ entry('SubscriptionSection.seatAdd', 'MuiButton', SUBSCRIPTION_SECTION_SEAT_ADD_SX),
243
249
  entry('FreeAccessSwitch.alert', 'MuiAlert', FREE_ACCESS_SWITCH_ALERT_SX),
244
250
  entry('OperatorOverview.alert', 'MuiAlert', OPERATOR_OVERVIEW_ALERT_SX),
245
251
  entry('WithdrawalDialog.alert', 'MuiAlert', WITHDRAWAL_DIALOG_ALERT_SX),
@@ -253,6 +259,8 @@ export const KIT_COMPONENT_SX_REGISTRY = [
253
259
  entry('ReceiptPicker.card', 'MuiCard', RECEIPT_PICKER_CARD_SX),
254
260
  entry('ReceiptPicker.actions', 'MuiDialogActions', RECEIPT_PICKER_ACTION_SX),
255
261
  entry('ReceiptReviewDialog.actions', 'MuiDialogActions', RECEIPT_REVIEW_ACTIONS_SX),
262
+ entry('ReceiptReviewDialog.dialogPaper', 'MuiPaper', RECEIPT_REVIEW_DIALOG_PAPER_SX),
256
263
  entry('ReceiptReviewDialog.sheetPaper', 'MuiPaper', RECEIPT_REVIEW_SHEET_PAPER_SX),
257
264
  entry('ReceiptReviewDialog.action', 'MuiButton', RECEIPT_REVIEW_ACTION_BUTTON_SX),
265
+ entry('ReceiptReviewDialog.uncertainChip', 'MuiChip', RECEIPT_REVIEW_CHIP_SX),
258
266
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {