platform-types 1.10.850 → 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/auth.d.ts CHANGED
@@ -1668,6 +1668,8 @@ export type CustomerSocialRegisterErrorCode = (typeof CUSTOMER_SOCIAL_REGISTER_E
1668
1668
  * host can refuse with, beside the ordinary `400` validation refusal:
1669
1669
  *
1670
1670
  * - `INVALID_ID_TOKEN` · 401 — the token is expired or malformed; get a fresh one.
1671
+ * - `REAUTH_NOT_RECENT` · 401 — the provider sign-in behind the token
1672
+ * (`auth_time`) is over five minutes old, or unstated: sign in again.
1671
1673
  * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
1672
1674
  * email, or the token carries none.
1673
1675
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a provider other than Google or Apple.
@@ -1675,7 +1677,7 @@ export type CustomerSocialRegisterErrorCode = (typeof CUSTOMER_SOCIAL_REGISTER_E
1675
1677
  * and the body carries no `storeContact.email`, or a relay one.
1676
1678
  * - `EMAIL_IN_USE` · 400 and `CUIT_SHARED` · 409 — exactly as `mode: 'register'`.
1677
1679
  */
1678
- export declare const TENANT_SOCIAL_REGISTER_ERROR_CODES: readonly ["INVALID_ID_TOKEN", "SIGN_IN_IDENTITY_UNVERIFIED", "SIGN_IN_PROVIDER_UNSUPPORTED", "STORE_CONTACT_EMAIL_REQUIRED", "EMAIL_IN_USE", "CUIT_SHARED"];
1680
+ export declare const TENANT_SOCIAL_REGISTER_ERROR_CODES: readonly ["INVALID_ID_TOKEN", "REAUTH_NOT_RECENT", "SIGN_IN_IDENTITY_UNVERIFIED", "SIGN_IN_PROVIDER_UNSUPPORTED", "STORE_CONTACT_EMAIL_REQUIRED", "EMAIL_IN_USE", "CUIT_SHARED"];
1679
1681
  export type TenantSocialRegisterErrorCode = (typeof TENANT_SOCIAL_REGISTER_ERROR_CODES)[number];
1680
1682
  /**
1681
1683
  * `body.error` codes `POST /auth/verify-password` answers for the PROOF itself
package/dist/auth.js CHANGED
@@ -168,6 +168,8 @@ export const CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
168
168
  * host can refuse with, beside the ordinary `400` validation refusal:
169
169
  *
170
170
  * - `INVALID_ID_TOKEN` · 401 — the token is expired or malformed; get a fresh one.
171
+ * - `REAUTH_NOT_RECENT` · 401 — the provider sign-in behind the token
172
+ * (`auth_time`) is over five minutes old, or unstated: sign in again.
171
173
  * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
172
174
  * email, or the token carries none.
173
175
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a provider other than Google or Apple.
@@ -177,6 +179,7 @@ export const CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
177
179
  */
178
180
  export const TENANT_SOCIAL_REGISTER_ERROR_CODES = [
179
181
  'INVALID_ID_TOKEN',
182
+ 'REAUTH_NOT_RECENT',
180
183
  'SIGN_IN_IDENTITY_UNVERIFIED',
181
184
  'SIGN_IN_PROVIDER_UNSUPPORTED',
182
185
  'STORE_CONTACT_EMAIL_REQUIRED',
package/dist/cjs/auth.js CHANGED
@@ -171,6 +171,8 @@ exports.CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
171
171
  * host can refuse with, beside the ordinary `400` validation refusal:
172
172
  *
173
173
  * - `INVALID_ID_TOKEN` · 401 — the token is expired or malformed; get a fresh one.
174
+ * - `REAUTH_NOT_RECENT` · 401 — the provider sign-in behind the token
175
+ * (`auth_time`) is over five minutes old, or unstated: sign in again.
174
176
  * - `SIGN_IN_IDENTITY_UNVERIFIED` · 401 — the provider has not verified the
175
177
  * email, or the token carries none.
176
178
  * - `SIGN_IN_PROVIDER_UNSUPPORTED` · 400 — a provider other than Google or Apple.
@@ -180,6 +182,7 @@ exports.CUSTOMER_SOCIAL_REGISTER_ERROR_CODES = [
180
182
  */
181
183
  exports.TENANT_SOCIAL_REGISTER_ERROR_CODES = [
182
184
  'INVALID_ID_TOKEN',
185
+ 'REAUTH_NOT_RECENT',
183
186
  'SIGN_IN_IDENTITY_UNVERIFIED',
184
187
  'SIGN_IN_PROVIDER_UNSUPPORTED',
185
188
  'STORE_CONTACT_EMAIL_REQUIRED',
@@ -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`, `POST /customers`, the
19
- // storefront profile, or an order's `saveAsDefault`) creates the row and points
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 (staff only, for now: no storefront
45
- * address-book surface consumes it).
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
- * Every DOMAIN refusal on `/customers/addresses`, one bare code each (the
101
- * generic `VALIDATION_FAILED`, `CAPABILITY_REQUIRED` and `INVALID_CURSOR`
102
- * are not listed). None of them writes.
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 safe. ALSO answered
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 {};
@@ -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`, `POST /customers`, the
18
- // storefront profile, or an order's `saveAsDefault`) creates the row and points
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
- /** Persist `deliveryAddress` as the customer's default. Directive only, never stored. */
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), plus the guest's
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.850",
3
+ "version": "1.10.852",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",