merge: ui/batch-diff

This commit is contained in:
Tyler
2026-06-20 17:30:30 -06:00
12 changed files with 2556 additions and 0 deletions
+26
View File
@@ -23,6 +23,7 @@
import type {
Ack,
BatchDiff,
ClaimDetail,
ClaimOutput,
ClaimPayment,
@@ -508,6 +509,30 @@ async function getRemittance<T = unknown>(id: string): Promise<T> {
return (await res.json()) as T;
}
/**
* Fetch the side-by-side diff between two batches.
*
* Drives ``GET /api/batch-diff?a=<batch_id>&b=<batch_id>``. Both ids
* are required; the endpoint returns 400 when either is missing and
* 404 when the id is unknown — both surface here as ``ApiError`` so
* the page can branch on ``.status`` like every other diff / fetch
* surface in the app.
*/
async function getBatchDiff(a: string, b: string): Promise<BatchDiff> {
if (!isConfigured) throw notConfiguredError();
const res = await fetch(
joinUrl(
`/api/batch-diff?${qs({ a, b })}`,
),
{ headers: { Accept: "application/json" } },
);
if (!res.ok) {
const detail = await readErrorBody(res);
throw new ApiError(res.status, detail || res.statusText);
}
return (await res.json()) as BatchDiff;
}
async function listProviders<T = unknown>(
params: ListProvidersParams = {}
): Promise<PaginatedResponse<T>> {
@@ -672,6 +697,7 @@ export const api = {
parse999,
listBatches,
getBatch,
getBatchDiff,
listClaims,
getClaimDetail,
listRemittances,