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
+27
View File
@@ -0,0 +1,27 @@
# address-book Specification
## Purpose
TBD - created by archiving change replace-mock-api-wave-7. Update Purpose after archive.
## Requirements
### Requirement: Saved shipping addresses
A customer SHALL be able to list, create, update and delete their own shipping addresses through the API. Every address operation SHALL be scoped to the authenticated customer; operating on another user's address SHALL return 404. Non-customer roles SHALL be rejected with 403.
#### Scenario: manage own addresses
- **WHEN** a customer creates, updates or deletes an address they own
- **THEN** the change persists and appears in their address list
#### Scenario: cross-user access
- **WHEN** a customer requests an address id owned by a different user
- **THEN** the API returns 404 as if the address did not exist
### Requirement: Single default address
Each customer SHALL have at most one default address, enforced by the database. The first saved address SHALL become the default. Setting a new default SHALL unset the previous one atomically. Deleting the default address SHALL promote the most recently created remaining address to default.
#### Scenario: switch default
- **WHEN** a customer marks address B as default while address A was default
- **THEN** B is default and A is not, after one request
#### Scenario: delete the default
- **WHEN** a customer deletes their default address and other addresses remain
- **THEN** the most recently created remaining address becomes the default
+15 -2
View File
@@ -2,9 +2,7 @@
## Purpose
The buyer-facing storefront: shell, home page, discovery, shopping and transaction flows, and the buyer center.
## Requirements
### Requirement: Localized storefront
The mall SHALL render every UI string and all catalog/store/marketing mock content in en or zh from one switcher, defaulting to en. Switching locale SHALL update the desktop shell and current page without a full reload.
@@ -138,3 +136,18 @@ The mall SHALL provide a store directory and store home reading live shops from
#### Scenario: a shop without a profile still renders
- **WHEN** a shop has no profile row
- **THEN** the directory and store home render it without inventing logo, scores or copy
### Requirement: Address book management
The mall buyer center SHALL list, add, edit, delete and set-default the signed-in customer's saved addresses through the selected API adapter, replacing the previous fixed mock list.
#### Scenario: manage addresses in the buyer center
- **WHEN** a signed-in shopper opens `/user/addresses` and adds or edits an address
- **THEN** the change persists through the adapter and survives a full page reload
### Requirement: Checkout address selection
Checkout SHALL offer the customer's saved addresses for selection, defaulting to their default address, and SHALL submit the selected address with the order. When the customer has no saved address, checkout SHALL provide an inline manual address form instead.
#### Scenario: checkout with a saved address
- **WHEN** a signed-in shopper with saved addresses checks out
- **THEN** the default address is preselected and the created order carries the chosen address