platform-types 1.10.817 → 1.10.818

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.
@@ -100,3 +100,17 @@ exports.PURCHASE_WITHDRAWAL_WINDOW_SOURCE = 'W2';
100
100
  exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
101
101
  /** How long after a relayed request was received its code is due, in ms. */
102
102
  exports.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
+ exports.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
+ 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.
@@ -75,6 +75,20 @@ export declare const PURCHASE_WITHDRAWAL_WINDOW_SOURCE = "W2";
75
75
  export declare const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = "W1";
76
76
  /** How long after a relayed request was received its code is due, in ms. */
77
77
  export declare const PURCHASE_WITHDRAWAL_CODE_DUE_MS: number;
78
+ /**
79
+ * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
80
+ * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
81
+ * this tuple with the warranty request.
82
+ */
83
+ export declare const PURCHASE_WITHDRAWAL_GUEST_INTENTS: readonly ["purchase-withdrawal"];
84
+ /**
85
+ * The one refusal of every guest code failure on `POST
86
+ * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
87
+ * already used code, a challenge that does not exist (another store's
88
+ * included), and an order that is no longer a guest order — one body, so the
89
+ * route is never an oracle for which one it was.
90
+ */
91
+ export declare const PURCHASE_WITHDRAWAL_VERIFICATION_FAILED: "PURCHASE_WITHDRAWAL_VERIFICATION_FAILED";
78
92
  declare global {
79
93
  type PurchaseWithdrawalState = (typeof PURCHASE_WITHDRAWAL_STATES)[number];
80
94
  type PurchaseWithdrawalSource = (typeof PURCHASE_WITHDRAWAL_SOURCES)[number];
@@ -82,6 +96,7 @@ declare global {
82
96
  type PurchaseWithdrawalRelayChannel = (typeof PURCHASE_WITHDRAWAL_RELAY_CHANNELS)[number];
83
97
  type PurchaseWithdrawalActionMode = (typeof PURCHASE_WITHDRAWAL_ACTION_MODES)[number];
84
98
  type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
99
+ type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
85
100
  /** One withdrawn order line, by its index in `Order.items`. */
86
101
  interface PurchaseWithdrawalLine {
87
102
  orderItemIndex: number;
@@ -239,6 +254,54 @@ declare global {
239
254
  interface PurchaseWithdrawalSubmitResponse {
240
255
  purchaseWithdrawal: OrderPurchaseWithdrawalView;
241
256
  }
257
+ /**
258
+ * `POST /orders/purchase-withdrawal/guest/start` (Web host, PUBLIC, bound
259
+ * origin). Strict body, ONE of two shapes, each naming the order only:
260
+ *
261
+ * - `{ token }` — the guest order status token (`gs1.…`). It grants nothing
262
+ * by itself: the code still goes to the order's address.
263
+ * - `{ orderId, email }` — the order number and the address the order was
264
+ * placed with.
265
+ *
266
+ * Always the same `202` ({@link PurchaseWithdrawalGuestStartResponse})
267
+ * whether or not anything matches; a match within budget mails a 6-digit
268
+ * code to the address on the order's LIVE guest customer row (never the one
269
+ * typed). Only a malformed body answers otherwise (`400`).
270
+ */
271
+ type PurchaseWithdrawalGuestStartRequest = {
272
+ token: string;
273
+ } | {
274
+ orderId: string;
275
+ email: string;
276
+ };
277
+ /** `data` of the `202` of the guest start: the handle step 2 names. Random, 128 bits, base64url. */
278
+ interface PurchaseWithdrawalGuestStartResponse {
279
+ challengeHandle: string;
280
+ }
281
+ /**
282
+ * `POST /orders/purchase-withdrawal/guest` (Web host, PUBLIC, bound origin).
283
+ * Strict body. `lines` as on {@link PurchaseWithdrawalSubmitRequest}. Every
284
+ * code failure is the one `401 PURCHASE_WITHDRAWAL_VERIFICATION_FAILED`;
285
+ * the fifth wrong code burns the challenge. A correct code is consumed by
286
+ * the request's own transaction, so it creates at most one record.
287
+ */
288
+ interface PurchaseWithdrawalGuestSubmitRequest {
289
+ /** The start's `challengeHandle`. */
290
+ challengeHandle: string;
291
+ /** The 6-digit code mailed to the order's address. */
292
+ code: string;
293
+ intent: PurchaseWithdrawalGuestIntent;
294
+ lines?: PurchaseWithdrawalLine[];
295
+ }
296
+ /**
297
+ * `data` of the `201` of the guest submit: the code on screen, and a guest
298
+ * order status token minted at the order's CURRENT fence generation (no
299
+ * earlier link dies) — the storefront opens `/pedido/{statusToken}` to follow
300
+ * the refund. Absent only when the token could not be minted.
301
+ */
302
+ interface PurchaseWithdrawalGuestSubmitResponse extends PurchaseWithdrawalSubmitResponse {
303
+ statusToken?: string;
304
+ }
242
305
  /** `data` of `409 PURCHASE_WITHDRAWAL_ALREADY_REQUESTED`: the undecided request's code. */
243
306
  interface PurchaseWithdrawalAlreadyRequestedData {
244
307
  withdrawalId: string;
@@ -97,3 +97,17 @@ export const PURCHASE_WITHDRAWAL_WINDOW_SOURCE = 'W2';
97
97
  export const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
98
98
  /** How long after a relayed request was received its code is due, in ms. */
99
99
  export const PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
100
+ /**
101
+ * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
102
+ * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
103
+ * this tuple with the warranty request.
104
+ */
105
+ export const PURCHASE_WITHDRAWAL_GUEST_INTENTS = ['purchase-withdrawal'];
106
+ /**
107
+ * The one refusal of every guest code failure on `POST
108
+ * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
109
+ * already used code, a challenge that does not exist (another store's
110
+ * included), and an order that is no longer a guest order — one body, so the
111
+ * route is never an oracle for which one it was.
112
+ */
113
+ 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.818",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",