feat(imports): Access Pass products through the importer's signed-in account (#20)
Release / release (push) Successful in 4s
CI / test (push) Successful in 7m28s
CI / image (apps/api/Dockerfile, t5de-hub-api) (push) Successful in 5s
CI / image (apps/web/Dockerfile, t5de-hub-web) (push) Successful in 16s

Co-authored-by: dhkatz <[email protected]>
This commit was merged in pull request #20.
This commit is contained in:
dhkatz authored and dhkatz committed 2026-11-08 16:10:34 +00:00
1 parent 56d25f7507
commit cc6959082c
12 files changed
+4871 -51

No files matched your search

+52 -1
View File
@@ -406,17 +406,27 @@ export function createApp({
// A whole shop: when the hub last listed its products on IMVU (null: not yet), and how many IMVU listed.
shopListedAt: r.grant.shopListedAt?.toISOString() ?? null,
shopListed: r.grant.shopListed,
shopListedSignedIn: r.grant.shopListedSignedIn,
status: r.grant.status as "pending" | "active" | "declined" | "suspended" | "withdrawn",
statusReason: r.grant.statusReason,
createdAt: r.grant.createdAt.toISOString(),
decidedAt: r.grant.decidedAt?.toISOString() ?? null,
});
/** A product as an importer's IMVU account sees it. */
const seenProduct = t.Object({
id: t.Integer({ minimum: 1 }),
name: t.String({ maxLength: 200 }),
rating: t.Union([t.Literal("general"), t.Literal("adult")]),
creatorId: t.Integer({ minimum: 1 }),
creatorName: t.String({ maxLength: 64 }),
purchasable: t.Boolean(),
});
const jobView = (j: typeof schema.importJob.$inferSelect) => ({
id: j.id,
grant: j.grantId,
imvuProduct: j.imvuProduct,
kind: j.kind as "import" | "recheck",
kind: j.kind as "import" | "recheck" | "list",
status: j.status as "queued" | "claimed" | "done" | "failed",
imvuRevision: j.imvuRevision,
reason: j.reason,
@@ -1943,6 +1953,45 @@ export function createApp({
},
{ body: t.Object({ imvuRevision: t.Integer({ minimum: 1 }) }) },
)
.post(
"/importer/jobs/:id/listing",
async ({ request, params, body }) => {
const c = await imports.importerFor(request.headers.get("authorization"));
if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on.");
return productCall(() => imports.reportListing(c, params.id, body.products));
},
{ body: t.Object({ products: t.Array(seenProduct, { maxItems: 10000 }) }) },
)
.post(
"/importer/jobs/:id/info",
async ({ request, params, body }) => {
const c = await imports.importerFor(request.headers.get("authorization"));
if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on.");
return productCall(() =>
imvuSafe(() =>
imports.reportInfo(c, params.id, {
id: 0,
found: body.found,
name: body.name ?? "",
rating: body.rating ?? "general",
creatorId: body.creatorId ?? 0,
creatorName: body.creatorName ?? "",
purchasable: body.purchasable ?? true,
}),
),
);
},
{
body: t.Object({
found: t.Boolean(),
name: t.Optional(t.String({ maxLength: 200 })),
rating: t.Optional(t.Union([t.Literal("general"), t.Literal("adult")])),
creatorId: t.Optional(t.Integer({ minimum: 1 })),
creatorName: t.Optional(t.String({ maxLength: 64 })),
purchasable: t.Optional(t.Boolean()),
}),
},
)
.post(
"/importer/jobs/:id",
async ({ request, params, body }) => {
@@ -1986,6 +2035,8 @@ export function createApp({
const c = await imports.importerFor(request.headers.get("authorization"));
if (!c) throw new Problem(401, "forbidden", "Not an importer of an approved catalog with imports on.");
const a = await productCall(() => importers.report(c, params.id, body));
// An account signed in with Access Pass: list the catalog's whole shops with it (Access Pass products too).
if (body.state === "ok" && body.accessPass) await imports.queueListings(c.id);
return { account: importerAccountView(a) };
},
{
+151 -24
View File
@@ -7,8 +7,22 @@ import { ImvuUnavailable, NoSuchImvuUser, type ImvuClient, type ImvuUser } from
import type { Signer } from "./keys";
import { BlockedUpload, checkFiles, newProductID, ProductError, type Catalog } from "./products";
const { catalog, catalogChange, fileBlock, hosting, imvuLink, imvuProductInfo, importGrant, importJob, importRequest, library, product, productRevision, user } =
schema;
const {
catalog,
catalogChange,
fileBlock,
hosting,
imvuLink,
imvuProductInfo,
importerAccount,
importGrant,
importJob,
importRequest,
library,
product,
productRevision,
user,
} = schema;
export type Grant = typeof importGrant.$inferSelect;
export type Job = typeof importJob.$inferSelect;
@@ -59,6 +73,23 @@ const imvuNameOf = sql<string | null>`coalesce(${imvuLink.username}, (select u.d
export const unclaimedUsername = (imvuId: number) => `imvu_${imvuId}`;
/** Whether a grant covers an IMVU product (by its IMVU creator): active, the creator's, and in its scope. */
/** A product as an importer's IMVU account sees it (docs/imports.md, "Access Pass products"). */
export type SeenProduct = { id: number; name: string; rating: string; creatorId: number; creatorName: string; purchasable: boolean };
/** Checks what an importer says it saw: null if it isn't a product. */
function checkSeen(p: SeenProduct): SeenProduct | null {
if (!Number.isSafeInteger(p.id) || p.id <= 0 || !Number.isSafeInteger(p.creatorId) || p.creatorId <= 0) return null;
if (p.rating !== "general" && p.rating !== "adult") return null;
return {
id: p.id,
name: String(p.name ?? "").trim().slice(0, 200),
rating: p.rating,
creatorId: p.creatorId,
creatorName: String(p.creatorName ?? "").trim().slice(0, 64),
purchasable: p.purchasable !== false,
};
}
export function covers(g: Grant, imvuProduct: number, creatorId: number): boolean {
if (g.status !== "active" || creatorId !== g.imvuId) return false;
return g.scope === "shop" ? !g.exclude.includes(imvuProduct) : g.products.includes(imvuProduct);
@@ -545,17 +576,24 @@ export class Imports {
listed = []; // the account is gone from IMVU: nothing to list (rechecks withdraw what was imported)
}
const now = new Date();
for (let i = 0; i < listed.length; i += 500) {
const rows = listed.slice(i, i + 500).map((p) => ({
id: p.id,
found: true,
name: p.name,
creatorId: p.creatorId,
creatorName: p.creatorName,
rating: p.adult ? "adult" : "general",
purchasable: p.purchasable,
checkedAt: now,
}));
await this.keepSeen(
listed.map((p) => ({ id: p.id, name: p.name, rating: p.adult ? "adult" : "general", creatorId: p.creatorId, creatorName: p.creatorName, purchasable: p.purchasable })),
now,
);
const [updated] = await this.db
.update(importGrant)
.set({ shopListedAt: now, shopListed: listed.length, shopListedSignedIn: false })
.where(eq(importGrant.id, g.id))
.returning();
const queued = updated?.status === "active" && updated.scope === "shop" ? await this.queueCovered(updated) : 0;
if (updated) await this.queueListing(updated);
return { listed: listed.length, queued };
}
/** Keeps products' info as seen (by the hub's listing, or an importer's account), in batches. */
private async keepSeen(seen: SeenProduct[], now: Date) {
for (let i = 0; i < seen.length; i += 500) {
const rows = seen.slice(i, i + 500).map((p) => ({ ...p, found: true, checkedAt: now }));
await this.db
.insert(imvuProductInfo)
.values(rows)
@@ -572,13 +610,97 @@ export class Imports {
},
});
}
}
/**
* Queues a signed-in listing of a whole-shop grant's shop for its catalog's importer, if one of the importer's IMVU
* accounts signed in with Access Pass: IMVU lists Access Pass products only to them.
*/
async queueListing(g: Grant): Promise<boolean> {
if (g.status !== "active" || g.scope !== "shop") return false;
const [ap] = await this.db
.select({ id: importerAccount.id })
.from(importerAccount)
.where(and(eq(importerAccount.catalogId, g.catalogId), eq(importerAccount.state, "ok"), eq(importerAccount.accessPass, true)))
.limit(1);
if (!ap) return false;
const [j] = await this.db
.insert(importJob)
.values({ id: newProductID(), catalogId: g.catalogId, grantId: g.id, imvuProduct: g.imvuId, kind: "list" })
.onConflictDoNothing()
.returning();
return j !== undefined;
}
/**
* The importer lists a whole shop signed in (a "list" job): the products it saw are kept (only the grant's IMVU
* account's: an importer can't vouch for another creator's), and those not imported yet are queued.
*/
async reportListing(c: Catalog, jobId: string, products: SeenProduct[]): Promise<{ listed: number; queued: number }> {
const job = await this.claimedJob(c, jobId);
if (job.kind !== "list") throw new ProductError(409, "not_list", "That job isn't a shop listing.");
const g = await this.grant(job.grantId);
const seen = new Map<number, SeenProduct>();
for (const p of products) {
const ok = checkSeen(p);
if (ok && ok.creatorId === g.imvuId) seen.set(ok.id, ok);
}
const now = new Date();
await this.keepSeen([...seen.values()], now);
await this.db.update(importJob).set({ status: "done", reason: "", claimedAt: null }).where(eq(importJob.id, job.id));
const [updated] = await this.db
.update(importGrant)
.set({ shopListedAt: now, shopListed: listed.length })
.where(eq(importGrant.id, g.id))
.set({ shopListedAt: now, shopListed: seen.size, shopListedSignedIn: true })
.where(and(eq(importGrant.id, g.id), eq(importGrant.status, "active"), eq(importGrant.scope, "shop")))
.returning();
const queued = updated?.status === "active" && updated.scope === "shop" ? await this.queueCovered(updated) : 0;
return { listed: listed.length, queued };
const queued = updated ? await this.queueCovered(updated) : 0;
return { listed: seen.size, queued };
}
/**
* The importer says what its IMVU account sees of a claimed job's product, which IMVU hides from the hub (Access
* Pass products): kept, so the job can go on. What IMVU shows the hub publicly wins.
*/
async reportInfo(c: Catalog, jobId: string, seen: SeenProduct & { found: boolean }): Promise<{ rating: string | null; covered: boolean }> {
const job = await this.claimedJob(c, jobId);
if (job.kind === "list") throw new ProductError(409, "not_product", "That job is a shop listing.");
const g = await this.grant(job.grantId);
const answer = this.imvu ? await this.imvu.lookup(job.imvuProduct) : "hidden";
let info: ImvuInfo | undefined;
if (typeof answer !== "string") info = await this.info(job.imvuProduct, true);
else if (!seen.found) {
// Gone, as the importer's account sees it too: rechecks withdraw it.
const now = new Date();
await this.db
.insert(imvuProductInfo)
.values({ id: job.imvuProduct, found: false, checkedAt: now })
.onConflictDoUpdate({ target: imvuProductInfo.id, set: { found: false, checkedAt: now } });
} else {
const ok = checkSeen({ ...seen, id: job.imvuProduct });
if (!ok) throw new ProductError(400, "invalid", "That isn't a product's info.");
await this.keepSeen([ok], new Date());
[info] = await this.db.select().from(imvuProductInfo).where(eq(imvuProductInfo.id, job.imvuProduct));
}
return { rating: info?.rating ?? null, covered: !!info && covers(g, job.imvuProduct, info.creatorId) };
}
/** Queues signed-in listings of a catalog's whole-shop grants (once its importer has an Access Pass account). */
async queueListings(catalogId: string): Promise<number> {
const grants = await this.db
.select()
.from(importGrant)
.where(and(eq(importGrant.catalogId, catalogId), eq(importGrant.status, "active"), eq(importGrant.scope, "shop")));
let n = 0;
for (const g of grants) if (await this.queueListing(g)) n++;
return n;
}
/** A job of this catalog's that its importer has claimed. */
private async claimedJob(c: Catalog, jobId: string): Promise<Job> {
const [job] = await this.db.select().from(importJob).where(and(eq(importJob.id, jobId), eq(importJob.catalogId, c.id)));
if (!job) throw new ProductError(404, "not_found", "No such job.");
if (job.status !== "claimed") throw new ProductError(409, "not_claimed", "That job isn't claimed.");
return job;
}
/** Lists the whole-shop grants not listed in a day, never-listed ones first. */
@@ -829,13 +951,17 @@ export class Imports {
.from(imvuProductInfo)
.where(and(inArray(imvuProductInfo.id, jobs.map((j) => j.imvuProduct)), eq(imvuProductInfo.found, true)))
: [];
return jobs.map((j) => ({
id: j.id,
kind: j.kind,
imvuProduct: j.imvuProduct,
lastRevision: last.find((l) => l.imvuProduct === j.imvuProduct)?.imvuRevision ?? 0,
rating: infos.find((i) => i.id === j.imvuProduct)?.rating ?? null,
}));
return jobs.map((j) =>
j.kind === "list"
? { id: j.id, kind: j.kind, imvuProduct: 0, imvuCreator: j.imvuProduct, lastRevision: 0, rating: null }
: {
id: j.id,
kind: j.kind,
imvuProduct: j.imvuProduct,
lastRevision: last.find((l) => l.imvuProduct === j.imvuProduct)?.imvuRevision ?? 0,
rating: infos.find((i) => i.id === j.imvuProduct)?.rating ?? null,
},
);
}
/** A claimed job of this catalog's, whose grant still covers its product. */
@@ -843,6 +969,7 @@ export class Imports {
const [job] = await this.db.select().from(importJob).where(and(eq(importJob.id, jobId), eq(importJob.catalogId, c.id)));
if (!job) throw new ProductError(404, "not_found", "No such job.");
if (job.status !== "claimed") throw new ProductError(409, "not_claimed", "That job isn't claimed.");
if (job.kind === "list") throw new ProductError(409, "not_product", "That job is a shop listing.");
const g = await this.grant(job.grantId);
const info = await this.info(job.imvuProduct);
if (!info || !covers(g, job.imvuProduct, info.creatorId)) throw new ProductError(409, "not_covered", "The grant no longer covers this product.");
+84
View File
@@ -500,3 +500,87 @@ test("whole shops listed on IMVU, and what's available", async () => {
await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/accept`);
expect((await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/list`)).json.error).toBe("not_shop");
});
test("Access Pass products, through the importer's signed-in account", async () => {
const owner = await person("apstall");
const keeper = await person("apkeeper", 903);
const chooser = await person("apchooser", 904);
const reg = await call(owner, "POST", "/api/v1/catalogs", { name: "AP Shelf", url: "https://ap.example.test", contact: "[email protected]", visibility: "public", membership: "open" });
const catalogID = reg.json.catalog.id as string;
const catalogAuth = { Authorization: `Catalog ${catalogID}:${reg.json.key}` };
expect((await call(rootAdmin, "POST", `/api/v1/console/catalogs/${catalogID}/approve`)).status).toBe(200);
const on = await call(owner, "POST", `/api/v1/catalogs/${catalogID}/importer`, { enabled: true });
const importer = { Authorization: `Importer ${catalogID}:${on.json.key}` };
const version = (await call(undefined, "GET", "/api/v1/imports/catalogs")).json.consent.version;
imvuProducts.set(9501, { ...imvuProduct("AP Keeper Coat", 903), creator_name: "apkeeperAv" });
shops.set("apkeeperav", [9501]); // what IMVU lists signed out: the general-rated one
for (const id of [9502, 9503, 9504, 9505]) hiddenProducts.add(id); // Access Pass (or gone): 401 to the hub
// Without an Access Pass account, the hub lists the shop itself; no signed-in listing.
const made = await call(keeper, "POST", "/api/v1/imports/grants", { catalog: catalogID, imvuId: 903, scope: "shop", consentVersion: version });
const grantID = made.json.grant.id as string;
await call(owner, "POST", `/api/v1/imports/grants/${grantID}/accept`);
await imports.listingsDone();
let claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs;
expect(claimed).toEqual([{ id: expect.any(String), kind: "import", imvuProduct: 9501, lastRevision: 0, rating: "general" }]);
await call(undefined, "POST", `/api/v1/importer/jobs/${claimed[0].id}`, { status: "failed", reason: "later" }, importer);
// The importer signs in with an account that has Access Pass: the catalog's whole shops are listed with it.
const [acct] = await db
.insert(schema.importerAccount)
.values({ id: "apacct0001", catalogId: catalogID, imvuId: 777, username: "ImporterAP", position: 0, state: "received" })
.returning();
const signedIn = await call(undefined, "POST", `/api/v1/importer/accounts/${acct!.id}`, { state: "ok", accessPass: true }, importer);
expect(signedIn.json.account).toMatchObject({ state: "ok", accessPass: true });
claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs;
expect(claimed).toEqual([{ id: expect.any(String), kind: "list", imvuProduct: 0, imvuCreator: 903, lastRevision: 0, rating: null }]);
const list = claimed[0].id as string;
expect((await call(undefined, "POST", `/api/v1/importer/jobs/${list}/token`, { imvuRevision: 1 }, importer)).json.error).toBe("not_product");
const seen = (id: number, name: string, rating: string, creatorId = 903) => ({ id, name, rating, creatorId, creatorName: "apkeeperAv", purchasable: true });
const listed = await call(
undefined,
"POST",
`/api/v1/importer/jobs/${list}/listing`,
{ products: [seen(9501, "AP Keeper Coat", "general"), seen(9502, "AP Keeper Robe", "adult"), seen(9503, "Someone Else's", "adult", 999)] },
importer,
);
expect(listed.json).toEqual({ listed: 2, queued: 1 }); // another creator's product isn't taken from it
expect(await imports.info(9502)).toMatchObject({ found: true, name: "AP Keeper Robe", rating: "adult", creatorId: 903 });
expect(await imports.info(9503)).toBeUndefined();
const grant = (await call(owner, "GET", `/api/v1/catalogs/${catalogID}/importer`)).json.grants[0];
expect(grant).toMatchObject({ shopListed: 2, shopListedSignedIn: true });
expect((await call(undefined, "POST", `/api/v1/importer/jobs/${list}/listing`, { products: [] }, importer)).json.error).toBe("not_claimed");
// The Access Pass product imports as adult; the hub's daily recheck keeps it though IMVU hides it from the hub.
claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs;
const robe = claimed.find((j: any) => j.imvuProduct === 9502);
expect(robe).toMatchObject({ kind: "import", rating: "adult" });
const tok = await call(undefined, "POST", `/api/v1/importer/jobs/${robe.id}/token`, { imvuRevision: 2 }, importer);
const r = await call(undefined, "POST", "/api/v1/catalog/revisions", { importToken: tok.json.token, files: [file("index.xml", 9502)], rating: "adult", parent: 0, name: "x" }, catalogAuth);
expect(r.status).toBe(201);
await db.update(schema.importJob).set({ updatedAt: new Date(Date.now() - 2 * 86_400_000) }).where(eq(schema.importJob.imvuProduct, 9502));
const rechecked = await imports.recheck();
expect(rechecked.withdrawn).not.toContain(r.json.product);
// Products chosen by ID that IMVU hides from the hub: the importer says what its account sees, then imports.
const g2 = await call(chooser, "POST", "/api/v1/imports/grants", { catalog: catalogID, imvuId: 904, scope: "products", products: [9504, 9505], consentVersion: version });
await call(owner, "POST", `/api/v1/imports/grants/${g2.json.grant.id}/accept`);
claimed = (await call(undefined, "POST", "/api/v1/importer/jobs/claim", { limit: 10 }, importer)).json.jobs;
const hidden = claimed.filter((j: any) => j.imvuProduct === 9504 || j.imvuProduct === 9505);
expect(hidden.map((j: any) => j.rating)).toEqual([null, null]);
const j4 = hidden.find((j: any) => j.imvuProduct === 9504);
const j5 = hidden.find((j: any) => j.imvuProduct === 9505);
expect((await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/token`, { imvuRevision: 1 }, importer)).json.error).toBe("not_covered");
const info = await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/info`, { found: true, name: "Chosen Veil", rating: "adult", creatorId: 904, creatorName: "chooserAv", purchasable: true }, importer);
expect(info.json).toEqual({ rating: "adult", covered: true });
expect((await call(undefined, "POST", `/api/v1/importer/jobs/${j4.id}/token`, { imvuRevision: 1 }, importer)).status).toBe(200);
// Another creator's, as the account sees it: not covered.
const other = await call(undefined, "POST", `/api/v1/importer/jobs/${j5.id}/info`, { found: true, name: "Not Theirs", rating: "general", creatorId: 999, creatorName: "x", purchasable: true }, importer);
expect(other.json).toEqual({ rating: "general", covered: false });
// What IMVU shows the hub publicly wins over the importer's word.
hiddenProducts.delete(9505);
imvuProducts.set(9505, { ...imvuProduct("Public Now", 904), creator_name: "chooserAv" });
const pub = await call(undefined, "POST", `/api/v1/importer/jobs/${j5.id}/info`, { found: false }, importer);
expect(pub.json).toEqual({ rating: "general", covered: true });
expect(await imports.info(9505)).toMatchObject({ name: "Public Now", creatorId: 904 });
});
@@ -157,7 +157,7 @@ export function ImporterAccountForm({
<p className="truncate font-medium">{found.username}</p>
<p className="text-xs text-muted-foreground">IMVU ID {found.imvuId}</p>
<div className="flex flex-wrap gap-1">
{found.accessPass ? <Tag tone="adult">Access Pass</Tag> : <Tag>No Access Pass</Tag>}
{found.accessPass ? <Tag tone="adult">Access Pass</Tag> : <Tag>Access Pass not shown</Tag>}
{found.ageVerified ? <Tag tone="adult">Age verified</Tag> : <Tag>Not age verified</Tag>}
</div>
</div>
@@ -165,8 +165,8 @@ export function ImporterAccountForm({
)}
{found && !found.accessPass && (
<p className="text-sm text-amber-700 dark:text-amber-400">
Without Access Pass, the importer can&apos;t see AP products, so it can&apos;t import them with this
account.
IMVU shows Access Pass publicly only if the member chooses to; the importer checks when it signs in.
Without Access Pass, it can&apos;t import Access Pass products with this account.
</p>
)}
<p className="text-xs text-muted-foreground">
@@ -45,6 +45,7 @@ const accountState = {
needs_password: { tone: "danger", label: "needs its password" },
} as const;
const imvuPage = (id: number) => `https://www.imvu.com/shop/product.php?products_id=${id}`;
const imvuShop = (creator: number) => `https://www.imvu.com/shop/web_search.php?manufacturers_id=${creator}`;
export default async function CatalogImports({
params,
@@ -178,7 +179,11 @@ export default async function CatalogImports({
<span className="font-medium">{a.username}</span>
<span className="text-muted-foreground">(IMVU {a.imvuId})</span>
<Tag tone={st.tone}>{st.label}</Tag>
{a.accessPass ? <Tag tone="adult">Access Pass</Tag> : <Tag>No Access Pass</Tag>}
{a.accessPass ? (
<Tag tone="adult">Access Pass</Tag>
) : (
<Tag>{a.state === "ok" ? "No Access Pass" : "Access Pass not checked"}</Tag>
)}
{a.stateMessage && <span className="text-xs text-muted-foreground">{a.stateMessage}</span>}
</div>
{can.run && (
@@ -372,17 +377,28 @@ export default async function CatalogImports({
{data.jobs.map((j) => (
<TableRow key={j.id}>
<TableCell>
<a
href={imvuPage(j.imvuProduct)}
target="_blank"
rel="noreferrer"
className="underline-offset-4 hover:underline"
>
{j.name || j.imvuProduct}
</a>
{j.kind === "list" ? (
<a
href={imvuShop(j.imvuProduct)}
target="_blank"
rel="noreferrer"
className="underline-offset-4 hover:underline"
>
IMVU shop {j.imvuProduct}
</a>
) : (
<a
href={imvuPage(j.imvuProduct)}
target="_blank"
rel="noreferrer"
className="underline-offset-4 hover:underline"
>
{j.name || j.imvuProduct}
</a>
)}
</TableCell>
<TableCell className="text-muted-foreground">
{j.kind}
{j.kind === "list" ? "listing, signed in" : j.kind}
{j.imvuRevision ? ` · revision ${j.imvuRevision}` : ""}
</TableCell>
<TableCell className="whitespace-normal">
+10 -4
View File
@@ -4,16 +4,22 @@ import { DateTime } from "@/components/time";
export function ShopListing({
grant: g,
}: {
grant: { scope: string; status: string; shopListedAt: string | null; shopListed: number };
grant: {
scope: string;
status: string;
shopListedAt: string | null;
shopListed: number;
shopListedSignedIn: boolean;
};
}) {
if (g.scope !== "shop" || g.status !== "active") return null;
if (!g.shopListedAt) return <> Not checked on IMVU yet.</>;
return (
<>
{" "}
On IMVU: {g.shopListed} general-rated product{g.shopListed === 1 ? "" : "s"} (checked{" "}
<DateTime iso={g.shopListedAt} />
).
On IMVU: {g.shopListed} {g.shopListedSignedIn ? "" : "general-rated "}product{g.shopListed === 1 ? "" : "s"}{" "}
(checked <DateTime iso={g.shopListedAt} />
{g.shopListedSignedIn ? " by the importer, with Access Pass" : ""}).
</>
);
}