platform-types 1.10.817 → 1.10.819

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.
@@ -7,8 +7,13 @@
7
7
  * The token (`gs1.…`) is a bearer credential over exactly ONE order, read-only:
8
8
  * it authorises no cart write, payment, cancellation, withdrawal or export. It
9
9
  * carries no expiry; the read is refused once the order was delivered (or
10
- * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago, and every
11
- * earlier link dies when a recovery or an operator revokes it.
10
+ * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago — unless a
11
+ * purchase withdrawal on it is not final or a refund on it is not closed — and
12
+ * every earlier link dies when a recovery or an operator revokes it.
13
+ *
14
+ * The guest purchase-withdrawal start (`POST /orders/purchase-withdrawal/guest/start`)
15
+ * accepts the token only to NAME the order: the withdrawal itself needs the
16
+ * code mailed to the order's address, so the token still authorises none.
12
17
  */
13
18
  Object.defineProperty(exports, "__esModule", { value: true });
14
19
  exports.GUEST_ORDER_STATUS_LINK_TEMPLATE = exports.GUEST_ORDER_STATUS_ERROR_CODES = void 0;
@@ -20,7 +20,7 @@
20
20
  * `status`, `revisedAt` replaces `updatedAt`, and there is no `dated`.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_DAYS = exports.PURCHASE_WITHDRAWAL_LINES_MAX = exports.PURCHASE_WITHDRAWAL_NOTE_MAX = exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = exports.PURCHASE_WITHDRAWAL_ACTION_MODES = exports.PURCHASE_WITHDRAWAL_RELAY_CHANNELS = exports.PURCHASE_WITHDRAWAL_DECLINE_REASONS = exports.PURCHASE_WITHDRAWAL_SOURCES = exports.PURCHASE_WITHDRAWAL_LIST_FILTERS = exports.PURCHASE_WITHDRAWAL_STATES = void 0;
23
+ exports.PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = exports.PURCHASE_WITHDRAWAL_GUEST_INTENTS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = exports.PURCHASE_WITHDRAWAL_WINDOW_DAYS = exports.PURCHASE_WITHDRAWAL_LINES_MAX = exports.PURCHASE_WITHDRAWAL_NOTE_MAX = exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = exports.PURCHASE_WITHDRAWAL_ACTION_MODES = exports.PURCHASE_WITHDRAWAL_RELAY_CHANNELS = exports.PURCHASE_WITHDRAWAL_DECLINE_REASONS = exports.PURCHASE_WITHDRAWAL_SOURCES = exports.PURCHASE_WITHDRAWAL_LIST_FILTERS = exports.PURCHASE_WITHDRAWAL_STATES = void 0;
24
24
  /**
25
25
  * - `requested` — submitted, the code minted, the order's dispatch locked
26
26
  * (`purchase-withdrawal-pending`) until an operator decides.
@@ -29,9 +29,12 @@ exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = exports.PURCHASE_WITHDRAWAL_CODE_DUE_S
29
29
  * - `accepted` — an operator accepted it. The order's cancellation (before
30
30
  * fulfilment) or its return authorisation (after it) follows from here.
31
31
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
32
- * - `refund-pending` — money is owed back (an open refund obligation).
32
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
33
+ * to `completed` with the closure of its last open obligation, never while
34
+ * another one is open.
33
35
  * - `completed` — nothing is owed any more. Not final while money can still
34
- * arrive: a late capture moves it back to `refund-pending`.
36
+ * arrive: a late capture (a new payment approval the order's payment
37
+ * attempt refused to settle) moves it back to `refund-pending`.
35
38
  */
36
39
  exports.PURCHASE_WITHDRAWAL_STATES = [
37
40
  'requested',
@@ -100,3 +103,17 @@ exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = 'W2';
100
103
  exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
101
104
  /** How long after a relayed request was received its code is due, in ms. */
102
105
  exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
106
+ /**
107
+ * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
108
+ * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
109
+ * this tuple with the warranty request.
110
+ */
111
+ exports.PURCHASE_WITHDRAWAL_GUEST_INTENTS = ['purchase-withdrawal'];
112
+ /**
113
+ * The one refusal of every guest code failure on `POST
114
+ * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
115
+ * already used code, a challenge that does not exist (another store's
116
+ * included), and an order that is no longer a guest order — one body, so the
117
+ * route is never an oracle for which one it was.
118
+ */
119
+ exports.PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = 'PURCHASE_WITHDRAWAL_VERIFICATION_FAILED';
@@ -551,7 +551,8 @@ exports.SOCKET_ACTIONS = [
551
551
  *
552
552
  * ⚠️ To the order's OWN customer only (`wsPostCustomer`), never a store-wide
553
553
  * customer broadcast. The operator frame for the same write is
554
- * `purchaseWithdrawalChanged`.
554
+ * `purchaseWithdrawalChanged`; the order's own `orders` frame (the post-commit
555
+ * row, carrying or no longer carrying the dispatch lock) follows both.
555
556
  */
556
557
  'orderPurchaseWithdrawal',
557
558
  /**
@@ -6,8 +6,13 @@
6
6
  * The token (`gs1.…`) is a bearer credential over exactly ONE order, read-only:
7
7
  * it authorises no cart write, payment, cancellation, withdrawal or export. It
8
8
  * carries no expiry; the read is refused once the order was delivered (or
9
- * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago, and every
10
- * earlier link dies when a recovery or an operator revokes it.
9
+ * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago — unless a
10
+ * purchase withdrawal on it is not final or a refund on it is not closed — and
11
+ * every earlier link dies when a recovery or an operator revokes it.
12
+ *
13
+ * The guest purchase-withdrawal start (`POST /orders/purchase-withdrawal/guest/start`)
14
+ * accepts the token only to NAME the order: the withdrawal itself needs the
15
+ * code mailed to the order's address, so the token still authorises none.
11
16
  */
12
17
  /**
13
18
  * The refusals the guest status routes answer themselves.
@@ -93,6 +98,14 @@ declare global {
93
98
  onlinePayment?: true;
94
99
  /** The latest online payment attempt, when the order has one. */
95
100
  paymentAttempt?: OrderPaymentAttemptView;
101
+ /**
102
+ * The order's purchase withdrawals, newest first, with their refunds —
103
+ * the same `OrderPurchaseWithdrawalView`s `StorefrontOrderView` carries.
104
+ * Absent when the order has none.
105
+ */
106
+ purchaseWithdrawals?: OrderPurchaseWithdrawalView[];
107
+ /** Whether the withdrawal window is open now — as on `StorefrontOrderView`. Always present. */
108
+ purchaseWithdrawalEligibility: OrderPurchaseWithdrawalEligibility;
96
109
  contact: {
97
110
  /** The stored address, masked (e.g. `j***@d***.com`). */
98
111
  emailMasked: string;
@@ -6,8 +6,13 @@
6
6
  * The token (`gs1.…`) is a bearer credential over exactly ONE order, read-only:
7
7
  * it authorises no cart write, payment, cancellation, withdrawal or export. It
8
8
  * carries no expiry; the read is refused once the order was delivered (or
9
- * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago, and every
10
- * earlier link dies when a recovery or an operator revokes it.
9
+ * cancelled) more than `guestStatusLinkDaysAfterDelivery` days ago — unless a
10
+ * purchase withdrawal on it is not final or a refund on it is not closed — and
11
+ * every earlier link dies when a recovery or an operator revokes it.
12
+ *
13
+ * The guest purchase-withdrawal start (`POST /orders/purchase-withdrawal/guest/start`)
14
+ * accepts the token only to NAME the order: the withdrawal itself needs the
15
+ * code mailed to the order's address, so the token still authorises none.
11
16
  */
12
17
  /**
13
18
  * The refusals the guest status routes answer themselves.
@@ -26,9 +26,12 @@
26
26
  * - `accepted` — an operator accepted it. The order's cancellation (before
27
27
  * fulfilment) or its return authorisation (after it) follows from here.
28
28
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
29
- * - `refund-pending` — money is owed back (an open refund obligation).
29
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
30
+ * to `completed` with the closure of its last open obligation, never while
31
+ * another one is open.
30
32
  * - `completed` — nothing is owed any more. Not final while money can still
31
- * arrive: a late capture moves it back to `refund-pending`.
33
+ * arrive: a late capture (a new payment approval the order's payment
34
+ * attempt refused to settle) moves it back to `refund-pending`.
32
35
  */
33
36
  export declare const PURCHASE_WITHDRAWAL_STATES: readonly ["requested", "declined", "accepted", "awaiting-goods", "refund-pending", "completed"];
34
37
  /**
@@ -75,6 +78,20 @@ export declare const PURCHASE_WITHDRAWAL_WINDOW_SOURCE = "W2";
75
78
  export declare const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = "W1";
76
79
  /** How long after a relayed request was received its code is due, in ms. */
77
80
  export declare const PURCHASE_WITHDRAWAL_CODE_DUE_MS: number;
81
+ /**
82
+ * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
83
+ * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
84
+ * this tuple with the warranty request.
85
+ */
86
+ export declare const PURCHASE_WITHDRAWAL_GUEST_INTENTS: readonly ["purchase-withdrawal"];
87
+ /**
88
+ * The one refusal of every guest code failure on `POST
89
+ * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
90
+ * already used code, a challenge that does not exist (another store's
91
+ * included), and an order that is no longer a guest order — one body, so the
92
+ * route is never an oracle for which one it was.
93
+ */
94
+ export declare const PURCHASE_WITHDRAWAL_VERIFICATION_FAILED: "PURCHASE_WITHDRAWAL_VERIFICATION_FAILED";
78
95
  declare global {
79
96
  type PurchaseWithdrawalState = (typeof PURCHASE_WITHDRAWAL_STATES)[number];
80
97
  type PurchaseWithdrawalSource = (typeof PURCHASE_WITHDRAWAL_SOURCES)[number];
@@ -82,6 +99,7 @@ declare global {
82
99
  type PurchaseWithdrawalRelayChannel = (typeof PURCHASE_WITHDRAWAL_RELAY_CHANNELS)[number];
83
100
  type PurchaseWithdrawalActionMode = (typeof PURCHASE_WITHDRAWAL_ACTION_MODES)[number];
84
101
  type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
102
+ type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
85
103
  /** One withdrawn order line, by its index in `Order.items`. */
86
104
  interface PurchaseWithdrawalLine {
87
105
  orderItemIndex: number;
@@ -239,6 +257,54 @@ declare global {
239
257
  interface PurchaseWithdrawalSubmitResponse {
240
258
  purchaseWithdrawal: OrderPurchaseWithdrawalView;
241
259
  }
260
+ /**
261
+ * `POST /orders/purchase-withdrawal/guest/start` (Web host, PUBLIC, bound
262
+ * origin). Strict body, ONE of two shapes, each naming the order only:
263
+ *
264
+ * - `{ token }` — the guest order status token (`gs1.…`). It grants nothing
265
+ * by itself: the code still goes to the order's address.
266
+ * - `{ orderId, email }` — the order number and the address the order was
267
+ * placed with.
268
+ *
269
+ * Always the same `202` ({@link PurchaseWithdrawalGuestStartResponse})
270
+ * whether or not anything matches; a match within budget mails a 6-digit
271
+ * code to the address on the order's LIVE guest customer row (never the one
272
+ * typed). Only a malformed body answers otherwise (`400`).
273
+ */
274
+ type PurchaseWithdrawalGuestStartRequest = {
275
+ token: string;
276
+ } | {
277
+ orderId: string;
278
+ email: string;
279
+ };
280
+ /** `data` of the `202` of the guest start: the handle step 2 names. Random, 128 bits, base64url. */
281
+ interface PurchaseWithdrawalGuestStartResponse {
282
+ challengeHandle: string;
283
+ }
284
+ /**
285
+ * `POST /orders/purchase-withdrawal/guest` (Web host, PUBLIC, bound origin).
286
+ * Strict body. `lines` as on {@link PurchaseWithdrawalSubmitRequest}. Every
287
+ * code failure is the one `401 PURCHASE_WITHDRAWAL_VERIFICATION_FAILED`;
288
+ * the fifth wrong code burns the challenge. A correct code is consumed by
289
+ * the request's own transaction, so it creates at most one record.
290
+ */
291
+ interface PurchaseWithdrawalGuestSubmitRequest {
292
+ /** The start's `challengeHandle`. */
293
+ challengeHandle: string;
294
+ /** The 6-digit code mailed to the order's address. */
295
+ code: string;
296
+ intent: PurchaseWithdrawalGuestIntent;
297
+ lines?: PurchaseWithdrawalLine[];
298
+ }
299
+ /**
300
+ * `data` of the `201` of the guest submit: the code on screen, and a guest
301
+ * order status token minted at the order's CURRENT fence generation (no
302
+ * earlier link dies) — the storefront opens `/pedido/{statusToken}` to follow
303
+ * the refund. Absent only when the token could not be minted.
304
+ */
305
+ interface PurchaseWithdrawalGuestSubmitResponse extends PurchaseWithdrawalSubmitResponse {
306
+ statusToken?: string;
307
+ }
242
308
  /** `data` of `409 PURCHASE_WITHDRAWAL_ALREADY_REQUESTED`: the undecided request's code. */
243
309
  interface PurchaseWithdrawalAlreadyRequestedData {
244
310
  withdrawalId: string;
@@ -26,9 +26,12 @@
26
26
  * - `accepted` — an operator accepted it. The order's cancellation (before
27
27
  * fulfilment) or its return authorisation (after it) follows from here.
28
28
  * - `awaiting-goods` — after fulfilment, the goods are on their way back.
29
- * - `refund-pending` — money is owed back (an open refund obligation).
29
+ * - `refund-pending` — money is owed back (an open refund obligation). Moves
30
+ * to `completed` with the closure of its last open obligation, never while
31
+ * another one is open.
30
32
  * - `completed` — nothing is owed any more. Not final while money can still
31
- * arrive: a late capture moves it back to `refund-pending`.
33
+ * arrive: a late capture (a new payment approval the order's payment
34
+ * attempt refused to settle) moves it back to `refund-pending`.
32
35
  */
33
36
  export const PURCHASE_WITHDRAWAL_STATES = [
34
37
  'requested',
@@ -97,3 +100,17 @@ export const PURCHASE_WITHDRAWAL_WINDOW_SOURCE = 'W2';
97
100
  export const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
98
101
  /** How long after a relayed request was received its code is due, in ms. */
99
102
  export const PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
103
+ /**
104
+ * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
105
+ * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
106
+ * this tuple with the warranty request.
107
+ */
108
+ export const PURCHASE_WITHDRAWAL_GUEST_INTENTS = ['purchase-withdrawal'];
109
+ /**
110
+ * The one refusal of every guest code failure on `POST
111
+ * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
112
+ * already used code, a challenge that does not exist (another store's
113
+ * included), and an order that is no longer a guest order — one body, so the
114
+ * route is never an oracle for which one it was.
115
+ */
116
+ export const PURCHASE_WITHDRAWAL_VERIFICATION_FAILED = 'PURCHASE_WITHDRAWAL_VERIFICATION_FAILED';
package/dist/socket.js CHANGED
@@ -548,7 +548,8 @@ export const SOCKET_ACTIONS = [
548
548
  *
549
549
  * ⚠️ To the order's OWN customer only (`wsPostCustomer`), never a store-wide
550
550
  * customer broadcast. The operator frame for the same write is
551
- * `purchaseWithdrawalChanged`.
551
+ * `purchaseWithdrawalChanged`; the order's own `orders` frame (the post-commit
552
+ * row, carrying or no longer carrying the dispatch lock) follows both.
552
553
  */
553
554
  'orderPurchaseWithdrawal',
554
555
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.817",
3
+ "version": "1.10.819",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",