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
+15
View File
@@ -1,5 +1,6 @@
import type {
Address,
AddressBookEntry,
AuthTokens,
Brand,
BrandInput,
@@ -77,6 +78,10 @@ export interface ShipmentItemBody {
qty: number;
}
export interface AddressInput extends Address {
is_default?: boolean;
}
export interface CurrencyUpsertBody {
code: string;
name: LocalizedText;
@@ -175,6 +180,11 @@ export interface ApiClient {
/** Public store directory: active shops with whatever profile they have. */
listShops(): Promise<ShopProfile[]>;
getShop(slug: string): Promise<ShopProfile>;
listMyAddresses(): Promise<AddressBookEntry[]>;
createAddress(address: AddressInput): Promise<AddressBookEntry>;
updateAddress(id: string, address: AddressInput): Promise<AddressBookEntry>;
deleteAddress(id: string): Promise<AddressBookEntry[]>;
setDefaultAddress(id: string): Promise<AddressBookEntry>;
shop: {
getMyShop(): Promise<Shop>;
listMyProducts(q?: ShopProductQuery): Promise<Paged<Product>>;
@@ -250,6 +260,11 @@ export function createApi(opts: ApiClientOptions): ApiClient {
getHomeContent: () => r("GET", "/content/home"),
listShops: () => r("GET", "/shops"),
getShop: (slug) => r("GET", `/shops/${slug}`),
listMyAddresses: () => r("GET", "/addresses"),
createAddress: (address) => r("POST", "/addresses", address),
updateAddress: (id, address) => r("PUT", `/addresses/${id}`, address),
deleteAddress: (id) => r("DELETE", `/addresses/${id}`),
setDefaultAddress: (id) => r("POST", `/addresses/${id}/default`),
shop: {
getMyShop: () => r("GET", "/shop/profile"),
listMyProducts: (q = {}) => r("GET", "/shop/products", undefined, { ...q }),
+7
View File
@@ -176,6 +176,13 @@ export interface Address {
postal_code: string;
}
export interface AddressBookEntry extends Address {
id: string;
user_id: string;
is_default: boolean;
created_at: string;
}
export type ShipmentStatus = "pending" | "shipped" | "delivered";
export interface Shipment {