platform-types 1.10.851 → 1.10.852
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/customerAddress.js +7 -3
- package/dist/customerAddress.d.ts +59 -10
- package/dist/customerAddress.js +7 -3
- package/dist/order.d.ts +29 -3
- package/package.json +1 -1
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
//
|
|
16
16
|
// Every existing reader of those fields keeps working unchanged. Forward-only:
|
|
17
17
|
// a customer written before the address book has no address rows; the first
|
|
18
|
-
// edit of their address (through `/customers/addresses`,
|
|
19
|
-
// storefront profile, or an order's `saveAsDefault`)
|
|
20
|
-
// the default at it. Nothing sweeps.
|
|
18
|
+
// edit of their address (through `/customers/addresses`, the web `/addresses`,
|
|
19
|
+
// `POST /customers`, the storefront profile, or an order's `saveAsDefault`)
|
|
20
|
+
// creates the row and points the default at it. Nothing sweeps.
|
|
21
|
+
//
|
|
22
|
+
// Two surfaces: staff `/customers/addresses` (both kinds, uncapped) and the
|
|
23
|
+
// shopper's own web `/addresses` (the `delivery` kind only, at most
|
|
24
|
+
// `SHOPPER_DELIVERY_ADDRESS_CAP` = 20, plus an order's `saveAddress`).
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -30,7 +30,8 @@ declare global {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* `GET /customers/addresses?customerId=` — one page, ascending by
|
|
33
|
-
* `addressId` (oldest first).
|
|
33
|
+
* `addressId` (oldest first). Also web `GET /addresses`, where it holds the
|
|
34
|
+
* caller's own `delivery` addresses only.
|
|
34
35
|
*/
|
|
35
36
|
interface CustomerAddressPage {
|
|
36
37
|
items: CustomerAddress[];
|
|
@@ -41,8 +42,10 @@ declare global {
|
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* `data` of the `customerAddress` socket frame. OPERATOR audience only — the
|
|
44
|
-
* customer's own socket is NOT addressed
|
|
45
|
-
*
|
|
45
|
+
* customer's own socket is NOT addressed, also when the customer made the
|
|
46
|
+
* change through web `/addresses` (the storefront reads its own write from
|
|
47
|
+
* the REST answer). A shopper's write sends exactly the frame a staff write
|
|
48
|
+
* does.
|
|
46
49
|
*
|
|
47
50
|
* `address` is the whole row on the admin tier for `created` / `updated`.
|
|
48
51
|
* It is absent on a `deleted` change, and on the rare `updated` frame of a
|
|
@@ -97,9 +100,48 @@ declare global {
|
|
|
97
100
|
updatedAt: number;
|
|
98
101
|
}
|
|
99
102
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
+
* Web `POST /addresses` body — the shopper's own new `delivery` address.
|
|
104
|
+
* There is no `kind` (a sent one is ignored: the shopper surface books
|
|
105
|
+
* `delivery` only) and no `customerId` (the session names the customer).
|
|
106
|
+
* `address` is required; every text field is trimmed and at most 200
|
|
107
|
+
* characters.
|
|
108
|
+
*/
|
|
109
|
+
interface ShopperAddressCreateRequest {
|
|
110
|
+
label?: string;
|
|
111
|
+
fullName?: string;
|
|
112
|
+
phone?: string;
|
|
113
|
+
address: string;
|
|
114
|
+
city?: string;
|
|
115
|
+
province?: string;
|
|
116
|
+
postalCode?: string;
|
|
117
|
+
/** Make it the delivery default — `Customer.deliveryAddress` follows in the same write. */
|
|
118
|
+
makeDefault?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Web `PUT /addresses` body: the address to edit plus ONLY the fields that
|
|
122
|
+
* changed (the storefront sends a dirty-field diff), and/or `makeDefault:
|
|
123
|
+
* true`. At least one of the two. A billing `addressId`, or another
|
|
124
|
+
* customer's, is `404 CUSTOMER_ADDRESS_NOT_FOUND`.
|
|
125
|
+
*/
|
|
126
|
+
interface ShopperAddressUpdateRequest extends Partial<Omit<ShopperAddressCreateRequest, 'makeDefault'>> {
|
|
127
|
+
addressId: string;
|
|
128
|
+
/** A default is replaced, never cleared, so only `true` is accepted. */
|
|
129
|
+
makeDefault?: true;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Web `POST` / `PUT /addresses` → `{ data, defaultAddressId }`: the address
|
|
133
|
+
* as written, and the delivery default AFTER the write — a create that
|
|
134
|
+
* adopted the customer's legacy `deliveryAddress` leaves THAT one the
|
|
135
|
+
* default. Absent when the customer has no delivery default.
|
|
136
|
+
*/
|
|
137
|
+
interface ShopperAddressWriteResult {
|
|
138
|
+
data: CustomerAddress;
|
|
139
|
+
defaultAddressId?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Every DOMAIN refusal on `/customers/addresses` and the web `/addresses`,
|
|
143
|
+
* one bare code each (the generic `VALIDATION_FAILED`, `CAPABILITY_REQUIRED`
|
|
144
|
+
* and `INVALID_CURSOR` are not listed). None of them writes.
|
|
103
145
|
*
|
|
104
146
|
* - `CUSTOMER_ADDRESS_CUSTOMER_NOT_FOUND` (404) — not a customer of the
|
|
105
147
|
* caller's store; covers «no such id», so the route is no cross-tenant
|
|
@@ -108,13 +150,20 @@ declare global {
|
|
|
108
150
|
* art. 16; enforced atomically with the write.
|
|
109
151
|
* - `CUSTOMER_ADDRESS_CUSTOMER_MERGED` (409) — folded into another customer
|
|
110
152
|
* (`mergedInto`); write on the survivor.
|
|
111
|
-
* - `CUSTOMER_ADDRESS_NOT_FOUND` (404) — no such address for that customer
|
|
153
|
+
* - `CUSTOMER_ADDRESS_NOT_FOUND` (404) — no such address for that customer;
|
|
154
|
+
* on the web `/addresses`, also a `billing` address.
|
|
112
155
|
* - `CUSTOMER_ADDRESS_IS_DEFAULT` (409) — the address is its kind's default;
|
|
113
156
|
* make another address the default first. The default is what
|
|
114
157
|
* `Customer.address` / `deliveryAddress` mirror, so it is never deleted
|
|
115
|
-
* out from under them.
|
|
158
|
+
* out from under them. One exception, web `/addresses` only: the
|
|
159
|
+
* shopper's ONLY delivery address may be deleted, which unmarks the
|
|
160
|
+
* default and removes `Customer.deliveryAddress` in the same write.
|
|
161
|
+
* - `CUSTOMER_ADDRESS_LIMIT_REACHED` (409) — web `/addresses` only: the
|
|
162
|
+
* shopper already holds 20 delivery addresses (a book too large to count
|
|
163
|
+
* counts as full). Delete one first. Staff routes are uncapped.
|
|
116
164
|
* - `CUSTOMER_ADDRESS_WRITE_CONTENDED` (503) — the customer's default or the
|
|
117
|
-
* address changed under every bounded retry; retry is
|
|
165
|
+
* address changed under every bounded retry, on either surface; retry is
|
|
166
|
+
* safe. ALSO answered
|
|
118
167
|
* by `POST /customers` and the storefront `POST /user` when an edit of
|
|
119
168
|
* the address loses to a rival that moved the default or its copy — those
|
|
120
169
|
* refuse on the FIRST failure, with no retry of their own. The storefront
|
|
@@ -126,6 +175,6 @@ declare global {
|
|
|
126
175
|
* `409 CUSTOMER_ANONYMIZED` (see `Customer.anonymizedAt`) and `409
|
|
127
176
|
* CUSTOMER_MERGE_IN_PROGRESS` (merged or mid-merge after their read).
|
|
128
177
|
*/
|
|
129
|
-
type CustomerAddressErrorCode = 'CUSTOMER_ADDRESS_CUSTOMER_NOT_FOUND' | 'CUSTOMER_ADDRESS_CUSTOMER_ANONYMIZED' | 'CUSTOMER_ADDRESS_CUSTOMER_MERGED' | 'CUSTOMER_ADDRESS_NOT_FOUND' | 'CUSTOMER_ADDRESS_IS_DEFAULT' | 'CUSTOMER_ADDRESS_WRITE_CONTENDED';
|
|
178
|
+
type CustomerAddressErrorCode = 'CUSTOMER_ADDRESS_CUSTOMER_NOT_FOUND' | 'CUSTOMER_ADDRESS_CUSTOMER_ANONYMIZED' | 'CUSTOMER_ADDRESS_CUSTOMER_MERGED' | 'CUSTOMER_ADDRESS_NOT_FOUND' | 'CUSTOMER_ADDRESS_IS_DEFAULT' | 'CUSTOMER_ADDRESS_LIMIT_REACHED' | 'CUSTOMER_ADDRESS_WRITE_CONTENDED';
|
|
130
179
|
}
|
|
131
180
|
export {};
|
package/dist/customerAddress.js
CHANGED
|
@@ -14,7 +14,11 @@
|
|
|
14
14
|
//
|
|
15
15
|
// Every existing reader of those fields keeps working unchanged. Forward-only:
|
|
16
16
|
// a customer written before the address book has no address rows; the first
|
|
17
|
-
// edit of their address (through `/customers/addresses`,
|
|
18
|
-
// storefront profile, or an order's `saveAsDefault`)
|
|
19
|
-
// the default at it. Nothing sweeps.
|
|
17
|
+
// edit of their address (through `/customers/addresses`, the web `/addresses`,
|
|
18
|
+
// `POST /customers`, the storefront profile, or an order's `saveAsDefault`)
|
|
19
|
+
// creates the row and points the default at it. Nothing sweeps.
|
|
20
|
+
//
|
|
21
|
+
// Two surfaces: staff `/customers/addresses` (both kinds, uncapped) and the
|
|
22
|
+
// shopper's own web `/addresses` (the `delivery` kind only, at most
|
|
23
|
+
// `SHOPPER_DELIVERY_ADDRESS_CAP` = 20, plus an order's `saveAddress`).
|
|
20
24
|
export {};
|
package/dist/order.d.ts
CHANGED
|
@@ -2524,8 +2524,33 @@ declare global {
|
|
|
2524
2524
|
province?: string;
|
|
2525
2525
|
postalCode?: string;
|
|
2526
2526
|
};
|
|
2527
|
-
/**
|
|
2527
|
+
/**
|
|
2528
|
+
* Persist `deliveryAddress` as the customer's default, OVERWRITING the
|
|
2529
|
+
* current delivery default's text in place (creating one only when there
|
|
2530
|
+
* is none). Directive only, never stored.
|
|
2531
|
+
*
|
|
2532
|
+
* DEPRECATED — use {@link saveAddress}, which appends a new address to
|
|
2533
|
+
* the customer's book instead of overwriting the default. `saveAsDefault`
|
|
2534
|
+
* keeps working, and retires one release after `saveAddress` is live.
|
|
2535
|
+
* `saveAsDefault: true` together with `saveAddress` is `400
|
|
2536
|
+
* VALIDATION_FAILED`; `false` asks for nothing and is accepted beside it.
|
|
2537
|
+
*/
|
|
2528
2538
|
saveAsDefault?: boolean;
|
|
2539
|
+
/**
|
|
2540
|
+
* Save `deliveryAddress` as a NEW delivery address in the customer's
|
|
2541
|
+
* book (web `/addresses`), AFTER the order commits — best effort: it
|
|
2542
|
+
* never refuses or fails the order. `makeDefault: true` also makes it the
|
|
2543
|
+
* delivery default (and `Customer.deliveryAddress`); otherwise the
|
|
2544
|
+
* current default, text included, is left as it was. Ignored without
|
|
2545
|
+
* `deliveryAddress`, or when that address carries no `address` line or a
|
|
2546
|
+
* field over 200 characters; skipped (and logged) when the customer
|
|
2547
|
+
* already holds 20 delivery addresses. Directive only, never stored.
|
|
2548
|
+
* Sending it together with `saveAsDefault: true` is `400
|
|
2549
|
+
* VALIDATION_FAILED`; an unknown inner key is stripped.
|
|
2550
|
+
*/
|
|
2551
|
+
saveAddress?: {
|
|
2552
|
+
makeDefault?: boolean;
|
|
2553
|
+
};
|
|
2529
2554
|
/**
|
|
2530
2555
|
* The `cartId` of the cart the shopper confirmed (`CART` + 6-10 digits).
|
|
2531
2556
|
* Omit it ONLY when that cart had none (a legacy cart). ⚠️ Compared
|
|
@@ -2560,11 +2585,12 @@ declare global {
|
|
|
2560
2585
|
/**
|
|
2561
2586
|
* Web `POST /orders/guest` body: a guest places an order from the server
|
|
2562
2587
|
* guest cart its `X-Guest-Cart-Token` names. `StorefrontOrderCreateRequest`
|
|
2563
|
-
* without `saveAsDefault` (a guest has no defaults
|
|
2588
|
+
* without `saveAsDefault` / `saveAddress` (a guest has no defaults and no
|
|
2589
|
+
* address book), plus the guest's
|
|
2564
2590
|
* `contact`, and with the cart pin REQUIRED: the guest cart always has an
|
|
2565
2591
|
* id and a version.
|
|
2566
2592
|
*/
|
|
2567
|
-
interface StorefrontGuestOrderCreateRequest extends Omit<StorefrontOrderCreateRequest, 'saveAsDefault' | 'expectedCartId' | 'expectedCartVersion'> {
|
|
2593
|
+
interface StorefrontGuestOrderCreateRequest extends Omit<StorefrontOrderCreateRequest, 'saveAsDefault' | 'saveAddress' | 'expectedCartId' | 'expectedCartVersion'> {
|
|
2568
2594
|
contact: GuestContact;
|
|
2569
2595
|
expectedCartId: string;
|
|
2570
2596
|
expectedCartVersion: number;
|