From 8be634f783b7b6cd2986cace65d4a8ce94ea281e Mon Sep 17 00:00:00 2001 From: Jos Vooges | STH Date: Tue, 22 Sep 2026 22:37:40 +0200 Subject: [PATCH] Show Viaplay subscription type on each account after add/check. Auto-probe on account add and always render an Abonnement row, with session-cookie fallback when overview is unavailable. --- .../admin-ui/src/app/scripts/ViaplayPanel.tsx | 69 +++++++++----- apps/master-api/src/viaplay/client.ts | 89 +++++++++++++++++-- apps/master-api/src/viaplay/settings.ts | 12 ++- 3 files changed, 139 insertions(+), 31 deletions(-) diff --git a/apps/admin-ui/src/app/scripts/ViaplayPanel.tsx b/apps/admin-ui/src/app/scripts/ViaplayPanel.tsx index 8736897..cfbfa23 100644 --- a/apps/admin-ui/src/app/scripts/ViaplayPanel.tsx +++ b/apps/admin-ui/src/app/scripts/ViaplayPanel.tsx @@ -143,13 +143,22 @@ export function ViaplayPanel({ onChanged }: { onChanged?: (o: ViaplayOverview) = }); const d = await r.json(); if (!r.ok) throw new Error(d.error?.message ?? "Account toevoegen mislukt"); + const emailKey = newEmail.trim().toLowerCase(); applySettings(d); setNewLabel(""); setNewEmail(""); setNewSession(""); setNewAccessToken(""); setNewProfileId(""); - setMsg("Viaplay-account toegevoegd"); + const added = (d.accounts as ViaplayAccount[] | undefined)?.find( + (a) => a.email === emailKey + ); + const sub = added?.subscriptionSummary; + setMsg( + sub + ? `Account toegevoegd · abonnement: ${sub}` + : "Account toegevoegd — abonnement nog niet zichtbaar, druk Check" + ); } catch (e) { setErr(String((e as Error).message ?? e)); } finally { @@ -378,31 +387,43 @@ export function ViaplayPanel({ onChanged }: { onChanged?: (o: ViaplayOverview) = borderBottom: "1px solid var(--border, #333)", }} > -
- {a.label || a.email} - {healthBadge(a)} - - {a.email} - {" · "} - {a.hasSession && a.hasAccessToken ? "tokens ok" : "tokens missen"} - {a.eventCount ? ` · ${a.eventCount} events` : ""} - - {(a.subscriptionSummary || a.partnerName || a.healthError) && ( -
+
+
+ {a.label || a.email} + {healthBadge(a)} + + {a.email} + {a.eventCount ? ` · ${a.eventCount} events` : ""} + +
+
+
+ Abonnement: {a.subscriptionSummary ? ( - - {a.subscriptionSummary} - - ) : a.partnerName ? ( - {a.partnerName} - ) : null} - {a.healthError ? ( - - {a.healthError} - - ) : null} + {a.subscriptionSummary} + ) : ( + nog niet opgehaald — druk Check + )}
- )} + {a.partnerName && a.subscriptionSummary && !a.subscriptionSummary.includes(a.partnerName) ? ( +
+ Partner: {a.partnerName} +
+ ) : null} + {a.healthError ? ( +
+ {a.healthError} +
+ ) : null} +