diff --git a/frontend/src/productsApi.dialect.test.ts b/frontend/src/productsApi.dialect.test.ts new file mode 100644 index 0000000..dd53acc --- /dev/null +++ b/frontend/src/productsApi.dialect.test.ts @@ -0,0 +1,10 @@ +import { describe, expect, it } from "vitest"; +import { dialectLabel } from "./productsApi"; + +describe("dialectLabel", () => { + it("labels canonical", () => expect(dialectLabel("canonical")).toBe("Canonical format")); + it("labels shopify as mapped (PUC-6)", () => + expect(dialectLabel("shopify")).toBe("Shopify product CSV — mapped")); + it("passes through an unknown dialect verbatim", () => + expect(dialectLabel("weird")).toBe("weird")); +}); diff --git a/frontend/src/productsApi.ts b/frontend/src/productsApi.ts index 03ca4c8..94c2dbd 100644 --- a/frontend/src/productsApi.ts +++ b/frontend/src/productsApi.ts @@ -50,7 +50,9 @@ export type Result = { ok: true; value: T } | { ok: false; error: ApiError; s // One label rule for CSV dialects, shared by Products history / preview / run detail. export function dialectLabel(d: string): string { - return d === "canonical" ? "Canonical format" : d; + if (d === "canonical") return "Canonical format"; + if (d === "shopify") return "Shopify product CSV — mapped"; + return d; } export type ExportStatus = "all" | "active" | "draft" | "archived"; diff --git a/frontend/src/screens/products/ImportUpload.tsx b/frontend/src/screens/products/ImportUpload.tsx index 934ccdc..9e18fe5 100644 --- a/frontend/src/screens/products/ImportUpload.tsx +++ b/frontend/src/screens/products/ImportUpload.tsx @@ -50,9 +50,13 @@ export default function ImportUpload() { CSV, up to 5,000 rows

- Works with the canonical format.{" "} + Works with the canonical format or a Shopify product CSV.{" "} Download sample CSV + {" "} + ·{" "} + + Column reference

diff --git a/frontend/src/screens/products/ProductsPage.tsx b/frontend/src/screens/products/ProductsPage.tsx index 7aff087..29f3180 100644 --- a/frontend/src/screens/products/ProductsPage.tsx +++ b/frontend/src/screens/products/ProductsPage.tsx @@ -113,6 +113,10 @@ export default function ProductsPage() {

Download sample CSV + {" "} + ·{" "} + + Column reference