platform-types 1.10.782 → 1.10.784
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/basket.d.ts +56 -0
- package/dist/basket.js +36 -0
- package/dist/cart.d.ts +16 -0
- package/dist/cjs/basket.js +37 -1
- package/dist/store.d.ts +20 -1
- package/dist/wholesaleRequest.d.ts +12 -0
- package/package.json +1 -1
package/dist/basket.d.ts
CHANGED
|
@@ -99,4 +99,60 @@ export type BasketErrorCode = (typeof BASKET_ERROR_CODES)[number];
|
|
|
99
99
|
*/
|
|
100
100
|
export declare const BASKET_RESUME_ERROR_CODES: readonly ["CART_RESUME_UNAVAILABLE", "CART_RESUME_INCOMPLETE"];
|
|
101
101
|
export type BasketResumeErrorCode = (typeof BASKET_RESUME_ERROR_CODES)[number];
|
|
102
|
+
/**
|
|
103
|
+
* The guest cart token's header, BOTH ways. A shopper with no account sends it
|
|
104
|
+
* on `GET`, `POST` and `DELETE /basket/guest`, and every successful guest
|
|
105
|
+
* `POST` answers a fresh one in the same header (exposed to browser JS through
|
|
106
|
+
* `Access-Control-Expose-Headers`). Keep the newest: each write slides the
|
|
107
|
+
* 30-day expiry. The first `POST`, sent without one, creates the cart and is
|
|
108
|
+
* the only way to obtain one. Never put it in a URL or a log.
|
|
109
|
+
*/
|
|
110
|
+
export declare const GUEST_CART_TOKEN_HEADER = "X-Guest-Cart-Token";
|
|
111
|
+
/**
|
|
112
|
+
* The refusals the guest cart routes answer themselves, beside the cart
|
|
113
|
+
* resolver's `BasketErrorCode` refusals they forward unchanged.
|
|
114
|
+
*
|
|
115
|
+
* - GUEST_CART_TOKEN_INVALID (401): every reason the token cannot be honoured —
|
|
116
|
+
* missing, tampered, expired, minted for another store or presented on
|
|
117
|
+
* another store's host or `x-store`, revoked by a sign-in merge, or naming a
|
|
118
|
+
* cart that is gone, belongs to an account, is held by a till, was checked
|
|
119
|
+
* out or was swept as abandoned — with one identical body, so the token is
|
|
120
|
+
* never an oracle. Drop the token and start a new guest cart.
|
|
121
|
+
* - GUEST_CHECKOUT_DISABLED (403): the shop does not sell to guests — it has not
|
|
122
|
+
* switched guest checkout on, admits buyers only after approval, or hides
|
|
123
|
+
* prices from anonymous visitors. Public `GET /store` reports the same verdict
|
|
124
|
+
* as `ecommerce.config.guestCheckoutAvailable`.
|
|
125
|
+
* - GUEST_CHECKOUT_SIGNED_IN (409): the request carried an `Authorization`
|
|
126
|
+
* header. A signed-in buyer is priced and policed as their account, so they
|
|
127
|
+
* use `/basket`; nothing was read or written.
|
|
128
|
+
*
|
|
129
|
+
* A token-holding guest write must send the `version` it read; a stale one is
|
|
130
|
+
* `409 CART_CHANGED_SINCE_CONFIRM` with `data: { currentCartVersion }` (the
|
|
131
|
+
* storefront checkout's code) and writes nothing.
|
|
132
|
+
*/
|
|
133
|
+
export declare const GUEST_CART_ERROR_CODES: readonly ["GUEST_CART_TOKEN_INVALID", "GUEST_CHECKOUT_DISABLED", "GUEST_CHECKOUT_SIGNED_IN"];
|
|
134
|
+
export type GuestCartErrorCode = (typeof GUEST_CART_ERROR_CODES)[number];
|
|
135
|
+
declare global {
|
|
136
|
+
/**
|
|
137
|
+
* A guest cart write's body: exactly the `/basket` named-action envelope.
|
|
138
|
+
* `data` is the cart without buy prices or any server-owned revocation
|
|
139
|
+
* field. The re-issued token travels in the `X-Guest-Cart-Token` response
|
|
140
|
+
* header, never in the body.
|
|
141
|
+
*/
|
|
142
|
+
type GuestCartResponse = CartActionResponse;
|
|
143
|
+
/**
|
|
144
|
+
* `POST /basket { mode: 'merge-guest' }` on the SIGNED-IN route: fold the
|
|
145
|
+
* guest cart the token names into the caller's own cart, re-priced at the
|
|
146
|
+
* account's terms (overflow in `droppedSkus`), and revoke the token in the
|
|
147
|
+
* same write that marks the guest cart `converted`. Answers the `/basket`
|
|
148
|
+
* named-action envelope; a replay of the same token is
|
|
149
|
+
* `401 GUEST_CART_TOKEN_INVALID`. `version` is the caller's OWN cart
|
|
150
|
+
* version, as on every other named action.
|
|
151
|
+
*/
|
|
152
|
+
interface GuestCartMergeRequest {
|
|
153
|
+
mode: 'merge-guest';
|
|
154
|
+
guestCartToken: string;
|
|
155
|
+
version?: number;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
102
158
|
export {};
|
package/dist/basket.js
CHANGED
|
@@ -68,3 +68,39 @@ export const BASKET_ERROR_CODES = [
|
|
|
68
68
|
* clear on retry.
|
|
69
69
|
*/
|
|
70
70
|
export const BASKET_RESUME_ERROR_CODES = ['CART_RESUME_UNAVAILABLE', 'CART_RESUME_INCOMPLETE'];
|
|
71
|
+
/**
|
|
72
|
+
* The guest cart token's header, BOTH ways. A shopper with no account sends it
|
|
73
|
+
* on `GET`, `POST` and `DELETE /basket/guest`, and every successful guest
|
|
74
|
+
* `POST` answers a fresh one in the same header (exposed to browser JS through
|
|
75
|
+
* `Access-Control-Expose-Headers`). Keep the newest: each write slides the
|
|
76
|
+
* 30-day expiry. The first `POST`, sent without one, creates the cart and is
|
|
77
|
+
* the only way to obtain one. Never put it in a URL or a log.
|
|
78
|
+
*/
|
|
79
|
+
export const GUEST_CART_TOKEN_HEADER = 'X-Guest-Cart-Token';
|
|
80
|
+
/**
|
|
81
|
+
* The refusals the guest cart routes answer themselves, beside the cart
|
|
82
|
+
* resolver's `BasketErrorCode` refusals they forward unchanged.
|
|
83
|
+
*
|
|
84
|
+
* - GUEST_CART_TOKEN_INVALID (401): every reason the token cannot be honoured —
|
|
85
|
+
* missing, tampered, expired, minted for another store or presented on
|
|
86
|
+
* another store's host or `x-store`, revoked by a sign-in merge, or naming a
|
|
87
|
+
* cart that is gone, belongs to an account, is held by a till, was checked
|
|
88
|
+
* out or was swept as abandoned — with one identical body, so the token is
|
|
89
|
+
* never an oracle. Drop the token and start a new guest cart.
|
|
90
|
+
* - GUEST_CHECKOUT_DISABLED (403): the shop does not sell to guests — it has not
|
|
91
|
+
* switched guest checkout on, admits buyers only after approval, or hides
|
|
92
|
+
* prices from anonymous visitors. Public `GET /store` reports the same verdict
|
|
93
|
+
* as `ecommerce.config.guestCheckoutAvailable`.
|
|
94
|
+
* - GUEST_CHECKOUT_SIGNED_IN (409): the request carried an `Authorization`
|
|
95
|
+
* header. A signed-in buyer is priced and policed as their account, so they
|
|
96
|
+
* use `/basket`; nothing was read or written.
|
|
97
|
+
*
|
|
98
|
+
* A token-holding guest write must send the `version` it read; a stale one is
|
|
99
|
+
* `409 CART_CHANGED_SINCE_CONFIRM` with `data: { currentCartVersion }` (the
|
|
100
|
+
* storefront checkout's code) and writes nothing.
|
|
101
|
+
*/
|
|
102
|
+
export const GUEST_CART_ERROR_CODES = [
|
|
103
|
+
'GUEST_CART_TOKEN_INVALID',
|
|
104
|
+
'GUEST_CHECKOUT_DISABLED',
|
|
105
|
+
'GUEST_CHECKOUT_SIGNED_IN',
|
|
106
|
+
];
|
package/dist/cart.d.ts
CHANGED
|
@@ -76,6 +76,22 @@ declare global {
|
|
|
76
76
|
* `parkedAt` and to the POS un-park verb, which happens to share the word.
|
|
77
77
|
*/
|
|
78
78
|
resumedAt?: number;
|
|
79
|
+
/**
|
|
80
|
+
* SERVER-OWNED, guest carts only: the revocation generation of the guest
|
|
81
|
+
* cart token. A token carries the generation it was minted at and is refused
|
|
82
|
+
* once this moves; absent reads as 0. The sign-in merge (`POST /basket
|
|
83
|
+
* { mode: 'merge-guest' }`) adds 1 in the same write that marks the cart
|
|
84
|
+
* `converted`. Never sent to a shopper; no client writes it.
|
|
85
|
+
*/
|
|
86
|
+
guestTokenGeneration?: number;
|
|
87
|
+
/**
|
|
88
|
+
* SERVER-OWNED, guest carts only: the random value the write that CREATED
|
|
89
|
+
* the guest cart stamped, carried by every guest cart token minted for it.
|
|
90
|
+
* A token is honoured only on a row bearing its own nonce, so a row deleted
|
|
91
|
+
* and re-created under the same `cartId` never revives an old token. Never
|
|
92
|
+
* sent to a shopper or an operator; no client writes it.
|
|
93
|
+
*/
|
|
94
|
+
guestTokenNonce?: string;
|
|
79
95
|
parkedAt?: number;
|
|
80
96
|
version?: number;
|
|
81
97
|
lines: CartLine[];
|
package/dist/cjs/basket.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASKET_RESUME_ERROR_CODES = exports.BASKET_ERROR_CODES = void 0;
|
|
3
|
+
exports.GUEST_CART_ERROR_CODES = exports.GUEST_CART_TOKEN_HEADER = exports.BASKET_RESUME_ERROR_CODES = exports.BASKET_ERROR_CODES = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Domain refusals from POST /baskets (replacement, named actions and park/resume)
|
|
6
6
|
* and GET /baskets?mode=review. Check GATING_ERROR_CODES separately for middleware
|
|
@@ -71,3 +71,39 @@ exports.BASKET_ERROR_CODES = [
|
|
|
71
71
|
* clear on retry.
|
|
72
72
|
*/
|
|
73
73
|
exports.BASKET_RESUME_ERROR_CODES = ['CART_RESUME_UNAVAILABLE', 'CART_RESUME_INCOMPLETE'];
|
|
74
|
+
/**
|
|
75
|
+
* The guest cart token's header, BOTH ways. A shopper with no account sends it
|
|
76
|
+
* on `GET`, `POST` and `DELETE /basket/guest`, and every successful guest
|
|
77
|
+
* `POST` answers a fresh one in the same header (exposed to browser JS through
|
|
78
|
+
* `Access-Control-Expose-Headers`). Keep the newest: each write slides the
|
|
79
|
+
* 30-day expiry. The first `POST`, sent without one, creates the cart and is
|
|
80
|
+
* the only way to obtain one. Never put it in a URL or a log.
|
|
81
|
+
*/
|
|
82
|
+
exports.GUEST_CART_TOKEN_HEADER = 'X-Guest-Cart-Token';
|
|
83
|
+
/**
|
|
84
|
+
* The refusals the guest cart routes answer themselves, beside the cart
|
|
85
|
+
* resolver's `BasketErrorCode` refusals they forward unchanged.
|
|
86
|
+
*
|
|
87
|
+
* - GUEST_CART_TOKEN_INVALID (401): every reason the token cannot be honoured —
|
|
88
|
+
* missing, tampered, expired, minted for another store or presented on
|
|
89
|
+
* another store's host or `x-store`, revoked by a sign-in merge, or naming a
|
|
90
|
+
* cart that is gone, belongs to an account, is held by a till, was checked
|
|
91
|
+
* out or was swept as abandoned — with one identical body, so the token is
|
|
92
|
+
* never an oracle. Drop the token and start a new guest cart.
|
|
93
|
+
* - GUEST_CHECKOUT_DISABLED (403): the shop does not sell to guests — it has not
|
|
94
|
+
* switched guest checkout on, admits buyers only after approval, or hides
|
|
95
|
+
* prices from anonymous visitors. Public `GET /store` reports the same verdict
|
|
96
|
+
* as `ecommerce.config.guestCheckoutAvailable`.
|
|
97
|
+
* - GUEST_CHECKOUT_SIGNED_IN (409): the request carried an `Authorization`
|
|
98
|
+
* header. A signed-in buyer is priced and policed as their account, so they
|
|
99
|
+
* use `/basket`; nothing was read or written.
|
|
100
|
+
*
|
|
101
|
+
* A token-holding guest write must send the `version` it read; a stale one is
|
|
102
|
+
* `409 CART_CHANGED_SINCE_CONFIRM` with `data: { currentCartVersion }` (the
|
|
103
|
+
* storefront checkout's code) and writes nothing.
|
|
104
|
+
*/
|
|
105
|
+
exports.GUEST_CART_ERROR_CODES = [
|
|
106
|
+
'GUEST_CART_TOKEN_INVALID',
|
|
107
|
+
'GUEST_CHECKOUT_DISABLED',
|
|
108
|
+
'GUEST_CHECKOUT_SIGNED_IN',
|
|
109
|
+
];
|
package/dist/store.d.ts
CHANGED
|
@@ -158,6 +158,25 @@ declare global {
|
|
|
158
158
|
* frame), so the storefront can offer the request.
|
|
159
159
|
*/
|
|
160
160
|
wholesaleRequests?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Whether the shop sells to shoppers without an account (server guest
|
|
163
|
+
* cart, guest checkout). Absent means OFF: a shop opts in. Honoured only
|
|
164
|
+
* while `registrationMode` is not `'approval'` and `showDefaultPriceList`
|
|
165
|
+
* is not `0` — a shop that vets every buyer, or hides prices from
|
|
166
|
+
* anonymous visitors, never sells to a guest whatever this says.
|
|
167
|
+
* Written by `PATCH /store` (ADMIN) and `PUT /platform/stores/{storeId}`
|
|
168
|
+
* (MANAGER). Never sent to shoppers as stored: they get
|
|
169
|
+
* `guestCheckoutAvailable`.
|
|
170
|
+
*/
|
|
171
|
+
guestCheckout?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* SHOPPER-ONLY, never stored: present on web `GET /store` and the
|
|
174
|
+
* customer `stores` frame, `true` when the shop accepts guest carts and
|
|
175
|
+
* guest checkout right now — `guestCheckout` on AND registration open AND
|
|
176
|
+
* prices shown to anonymous visitors. The guest routes refuse
|
|
177
|
+
* `403 GUEST_CHECKOUT_DISABLED` whenever this is `false`.
|
|
178
|
+
*/
|
|
179
|
+
guestCheckoutAvailable?: boolean;
|
|
161
180
|
/**
|
|
162
181
|
* How long a storefront online payment holds the order, in whole
|
|
163
182
|
* minutes: the payment attempt's `expiresAt` and its Checkout Pro
|
|
@@ -1840,7 +1859,7 @@ declare global {
|
|
|
1840
1859
|
* A stored rule the write could not have produced (an unknown audience, an
|
|
1841
1860
|
* undeclared key, a non-positive list) fails CLOSED for shoppers: hidden on
|
|
1842
1861
|
* `GET /store`, refused at checkout, and both catalogs left off the frame.
|
|
1843
|
-
* Operator reads omit
|
|
1862
|
+
* Operator reads omit such a malformed rule (a valid one is kept), and `POST /store` keeps it when an existing row
|
|
1844
1863
|
* is sent back without `availability`; sending a valid rule replaces it.
|
|
1845
1864
|
*/
|
|
1846
1865
|
availability?: StorefrontDesignVisibility;
|
|
@@ -78,6 +78,18 @@ declare global {
|
|
|
78
78
|
/** Unix ms of the decision. Absent while pending. */
|
|
79
79
|
decidedAt?: number;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* The web `GET /user?mode=wholesale-request` envelope. `audienceClass` is the
|
|
83
|
+
* caller's effective class — their resolved list's `audienceClass`, by the rule
|
|
84
|
+
* `GET /store` uses (a deleted list is PUBLICO, retail) — so a buyer already on
|
|
85
|
+
* a wholesale list with no request reads `wholesale`. Absent when the customer
|
|
86
|
+
* row is gone.
|
|
87
|
+
*/
|
|
88
|
+
interface WholesaleRequestReadResponse {
|
|
89
|
+
message: string;
|
|
90
|
+
data: WholesaleRequestStatus | null;
|
|
91
|
+
audienceClass?: 'retail' | 'wholesale';
|
|
92
|
+
}
|
|
81
93
|
/** The operator's view of one request (admin tier only). */
|
|
82
94
|
interface WholesaleRequest extends WholesaleRequestCompany {
|
|
83
95
|
customerId: string;
|