From 5ba3619d9a24d897054137e85625e288b4181a4d Mon Sep 17 00:00:00 2001 From: mihir Date: Mon, 16 Nov 2026 20:16:06 +0530 Subject: [PATCH] feat: manage private B2B artwork versions and approvals --- docs/PHASES.md | 4 +- nginx.conf | 2 +- src/App.tsx | 12 ++ src/components/WorkspaceShell.tsx | 1 + src/lib/api.ts | 47 +++++-- src/lib/artwork.ts | 67 ++++++++++ src/lib/platform.tsx | 6 + src/pages/ArtworkPage.tsx | 207 +++++++++++++++++++++++++++++ src/pages/BusinessAccountsPage.tsx | 3 + test/api.test.ts | 45 +++++++ test/artwork.test.ts | 57 ++++++++ test/artwork.ui.test.tsx | 182 +++++++++++++++++++++++++ 12 files changed, 622 insertions(+), 11 deletions(-) create mode 100644 src/lib/artwork.ts create mode 100644 src/pages/ArtworkPage.tsx create mode 100644 test/artwork.test.ts create mode 100644 test/artwork.ui.test.tsx diff --git a/docs/PHASES.md b/docs/PHASES.md index 03413a6..0f001e4 100644 --- a/docs/PHASES.md +++ b/docs/PHASES.md @@ -58,4 +58,6 @@ Customer and administration screens are implemented, with recovery, pricing, sto - Credit policy UAT should verify that unverified accounts and self-review are rejected, a second active policy in the same currency cannot be approved, and suspension permits a replacement. - B2B samples support requests for published variants, independent approval or rejection, and manual dispatch records with staff and reference history. - Sample UAT should verify ineligible accounts and variants, self-review, dispatch only after approval, and replay with the original payload and key. -- Artwork, partner orders and payments, custom requests and reporting remain open. +- B2B artwork supports private PDF, PNG, and JPEG version uploads, independent review, and permission-based downloads. +- Artwork UAT should use separate uploader, reviewer, and reader accounts. Exercise the 2 MiB upload limit through ingress, approval and rejection, download permissions, and preservation of prior approved versions. +- Partner orders and payments, custom requests and reporting remain open. diff --git a/nginx.conf b/nginx.conf index 61bad26..be4c4d1 100644 --- a/nginx.conf +++ b/nginx.conf @@ -20,7 +20,7 @@ server { proxy_hide_header Access-Control-Allow-Origin; proxy_hide_header Access-Control-Allow-Credentials; - location ~ "^/api/v1/supplier-documents/[0-9a-fA-F-]{36}/versions$" { + location ~ "^/api/v1/(?:supplier-documents|b2b/artworks)/[0-9a-fA-F-]{36}/versions$" { client_max_body_size 3m; proxy_pass https://manicandles-backend.midastix.com; } diff --git a/src/App.tsx b/src/App.tsx index c125874..835d059 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -34,6 +34,7 @@ const PriceListsPage = lazy(() => import("@/pages/PriceListsPage")); const QuotesPage = lazy(() => import("@/pages/QuotesPage")); const CreditPoliciesPage = lazy(() => import("@/pages/CreditPoliciesPage")); const SamplesPage = lazy(() => import("@/pages/SamplesPage")); +const ArtworkPage = lazy(() => import("@/pages/ArtworkPage")); const MaterialCostRatesPage = lazy(() => import("@/pages/MaterialCostRatesPage")); const ProcurementPage = lazy(() => import("@/pages/ProcurementPage")); const BomPage = lazy(() => import("@/pages/BomPage")); @@ -117,6 +118,17 @@ function Router() { {(params) => } + {() => } + {() => } + + {(params) => } + + + {(params) => } + + + {(params) => } + {() => } {(params) => } diff --git a/src/components/WorkspaceShell.tsx b/src/components/WorkspaceShell.tsx index 0e8d703..75a8615 100644 --- a/src/components/WorkspaceShell.tsx +++ b/src/components/WorkspaceShell.tsx @@ -75,6 +75,7 @@ export function WorkspaceNavigation() { { label: "B2B quotations", path: "/admin/b2b-quotes", permission: "b2b.quote.read" }, { label: "B2B credit policies", path: "/admin/b2b-credit-policies", permission: "b2b.credit.read" }, { label: "B2B samples", path: "/admin/b2b-samples", permission: "b2b.sample.read" }, + { label: "B2B artwork", path: "/admin/b2b-artwork", permission: "b2b.artwork.read" }, ]; return (