feat(mall): address book wave 7 frontend, contract, and archive

Live addresses domain for the mall: shared contract (AddressBookEntry +
five client methods), mock adapter state v3, live domain pick, addresses
page CRUD, checkout saved-address picker with manual fallback, demo seed,
and the archived change plus address-book capability spec.
This commit is contained in:
Chengdong Zhang
2026-09-18 16:00:05 +08:00
parent 5e866d08f4
commit c51e96ae41
17 changed files with 467 additions and 88 deletions
+18
View File
@@ -177,6 +177,24 @@ for (const def of SHOPS) {
await call("POST", "/auth/register", {
body: { email: "customer@vmall.local", password: "customer123", display_name: "Demo Customer" },
});
{
r = await call("POST", "/auth/login", {
body: { email: "customer@vmall.local", password: "customer123" },
});
if (r.status !== 200) fail("customer login", r);
const customerToken = r.data.token;
const existing = (await call("GET", "/addresses", { token: customerToken })).data;
if (Array.isArray(existing) && existing.length === 0) {
const demoAddresses = [
{ recipient: "Demo Customer", phone: "+1 555 0100", country: "US", region: "California", city: "Cupertino", line1: "1 Infinite Loop", postal_code: "95014", is_default: true },
{ recipient: "Demo Customer", phone: "+1 555 0100", country: "US", region: "New York", city: "New York", line1: "88 Fifth Ave", postal_code: "10011" },
];
for (const address of demoAddresses) {
r = await call("POST", "/addresses", { token: customerToken, body: address });
if (r.status !== 200 && r.status !== 201) fail("seed address", r);
}
}
}
// 4. categories (reference data from the migrations)
const cats = (await call("GET", "/categories")).data;