Clarify watermark features across packages

This commit is contained in:
Codex Agent
2026-01-20 13:10:49 +01:00
parent 620dfa415a
commit 1ce0fad720
13 changed files with 157 additions and 29 deletions

View File

@@ -80,6 +80,18 @@ const FEATURE_LABELS: Record<string, { key: string; fallback: string }> = {
key: 'mobileDashboard.packageSummary.feature.watermark_allowed',
fallback: 'Watermarks',
},
watermark_base: {
key: 'mobileDashboard.packageSummary.feature.watermark_base',
fallback: 'Fotospiel watermark',
},
no_watermark: {
key: 'mobileDashboard.packageSummary.feature.no_watermark',
fallback: 'Remove Fotospiel watermark',
},
watermark_custom: {
key: 'mobileDashboard.packageSummary.feature.watermark_custom',
fallback: 'Custom watermark',
},
};
const LIMIT_LABELS: Array<{ key: string; labelKey: string; fallback: string }> = [
@@ -241,13 +253,38 @@ export function collectPackageFeatures(pkg: TenantPackageSummary): string[] {
features.add('branding_allowed');
}
if (pkg.package_type !== 'reseller' && pkg.watermark_allowed) {
features.add('watermark_allowed');
const watermarkFeature = resolveTenantWatermarkFeatureKey(pkg);
if (watermarkFeature) {
['watermark_allowed', 'watermark', 'no_watermark', 'watermark_base', 'watermark_custom'].forEach((key) =>
features.delete(key)
);
features.add(watermarkFeature);
}
return Array.from(features);
}
export function resolveTenantWatermarkFeatureKey(pkg: TenantPackageSummary): string | null {
if (pkg.package_type === 'reseller') {
return null;
}
if (pkg.watermark_allowed === false) {
return 'watermark_base';
}
const features = Array.isArray(pkg.features) ? pkg.features : [];
if (features.includes('no_watermark')) {
return 'no_watermark';
}
if (pkg.watermark_allowed === true) {
return 'watermark_custom';
}
return null;
}
export function formatEventUsage(used: number | null, limit: number | null, t: Translate): string | null {
if (limit === null || used === null) {
return null;