Server sync, erroneous doc handling, and @binect/js v0.1.0 integration

- Add server sync to discover documents uploaded elsewhere (fixes missing
  basket documents issue)
- Handle erroneous uploads: preserve binectDocumentId for delete button
- Add "Delete from server" button for erroneous and canceled documents
- Remove archive button for active documents (in_basket, in_production)
- Auto-restore archived documents that have active status
- Refactor to use @binect/js v0.1.0 features:
  - DocumentStatus enum instead of magic numbers
  - isErroneous(), getErrors() helper functions
  - getStatusDescription() for status text
- Add binect-js improvement requirements document

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-16 22:41:43 +01:00
parent f4c0481eda
commit 327943bc18
6 changed files with 739 additions and 69 deletions

View File

@@ -205,7 +205,8 @@ export async function syncFromServer(
binectStatusCode: number,
binectStatusText: string,
price?: number,
recipientAddress?: string
recipientAddress?: string,
errorMessage?: string
): Promise<DocumentProxy> {
const state = await loadQueue();
@@ -219,6 +220,7 @@ export async function syncFromServer(
proxy.binectStatus = mapBinectStatusCode(binectStatusCode);
if (price !== undefined) proxy.price = price;
if (recipientAddress) proxy.recipientAddress = recipientAddress;
if (errorMessage) proxy.errorMessage = errorMessage;
} else {
// Create new proxy from server data
proxy = {
@@ -234,7 +236,8 @@ export async function syncFromServer(
binectStatusCode,
binectStatusText,
price,
recipientAddress
recipientAddress,
errorMessage
};
state.entries.unshift(proxy);
}