feat: whole shops listed on IMVU, and GET /imports/available
Pull request / title (pull_request) Successful in 1s
CI / test (pull_request) Successful in 1m22s
CI / image (apps/api/Dockerfile, t5de-hub-api) (pull_request) Skipped
CI / image (apps/web/Dockerfile, t5de-hub-web) (pull_request) Skipped

Whole-shop grants now import the shop's products, not only those people asked for. The hub lists the shop on
IMVU's public API (general-rated products) when the grant is accepted, daily after, and on "List the shop again".
Each listing keeps the products' info and queues what isn't imported yet, less exclusions. IMVU's small pages
overlap and miss products, so the hub asks for pages of 1000 and drops repeats.

GET /imports/available tells the proxy what T5DE has of IMVU products and shops, from what the hub knows only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-11-07 15:16:33 -08:00
1 parent 8f6dacba10
commit b4eed85bd6
15 files changed
+4954 -20

No files matched your search

@@ -10,7 +10,15 @@ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@
import { api, unwrap, type ImportGrant } from "@/lib/api";
import { ConsoleNav, requireConsole } from "../../../console-nav";
import { shortFingerprint } from "@/lib/importer";
import { changeImporterAccount, decideGrant, retryJob, setImporter, setImporterSettings } from "../../actions";
import {
changeImporterAccount,
decideGrant,
listShop,
retryJob,
setImporter,
setImporterSettings,
} from "../../actions";
import { ShopListing } from "@/components/shop-listing";
import { ImporterAccountForm } from "./importer-account-form";
export const metadata: Metadata = { title: "Imports" };
@@ -325,7 +333,7 @@ export default async function CatalogImports({
</CardHeader>
<CardContent className="divide-y">
{others.map((g) => (
<GrantRow key={g.id} id={id} grant={g} accept={can.accept} withdraw={can.withdraw} />
<GrantRow key={g.id} id={id} grant={g} accept={can.accept} withdraw={can.withdraw} run={can.run} />
))}
</CardContent>
</Card>
@@ -415,11 +423,13 @@ function GrantRow({
grant: g,
accept,
withdraw,
run = false,
}: {
id: string;
grant: ImportGrant;
accept: boolean;
withdraw: boolean;
run?: boolean;
}) {
const open = g.status === "pending" || g.status === "active" || g.status === "suspended";
return (
@@ -440,8 +450,16 @@ function GrantRow({
? `The whole shop${g.exclude.length ? `, less ${g.exclude.length} left out` : ""}.`
: `${g.products.length} chosen product${g.products.length === 1 ? "" : "s"}: ${g.products.slice(0, 10).join(", ")}${g.products.length > 10 ? "…" : ""}.`}{" "}
{g.listed ? "Listed." : "Unlisted."}
<ShopListing grant={g} />
</p>
{g.statusReason && <p className="text-sm text-muted-foreground">{g.statusReason}</p>}
{run && g.status === "active" && g.scope === "shop" && (
<ActionForm action={listShop} fields={{ id, grant: g.id }}>
<SubmitButton size="sm" variant="outline" pendingLabel="Listing…">
{g.shopListedAt ? "List the shop again" : "List the shop now"}
</SubmitButton>
</ActionForm>
)}
{open && (accept || withdraw) && (
<ActionForm action={decideGrant} fields={{ id, grant: g.id }}>
<div className="flex max-w-2xl flex-wrap gap-2">
+13 -1
View File
@@ -156,7 +156,19 @@ export async function decideGrant(_: ActionState, form: FormData): Promise<Actio
.grants({ id: grant })({ decision })
.post(reason ? { reason } : {}),
);
return decision === "accept" ? `Accepted. ${r.queued} queued for the importer.` : "Declined.";
if (decision !== "accept") return "Declined.";
return r.grant.scope === "shop"
? `Accepted. ${r.queued} queued for the importer; the shop's other products follow once it's listed on IMVU.`
: `Accepted. ${r.queued} queued for the importer.`;
});
}
/** Lists a whole-shop grant's products on IMVU again (new ones are queued). */
export async function listShop(_: ActionState, form: FormData): Promise<ActionState> {
return onCatalog(form, async (id) => {
revalidatePath(`/console/catalogs/${id}/imports`);
const r = unwrap(await api.imports.grants({ id: field(form, "grant") }).list.post());
return `${r.listed} product${r.listed === 1 ? "" : "s"} on IMVU; ${r.queued} new queued.`;
});
}