platform-types 1.10.820 → 1.10.822

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.
@@ -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_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_FISCAL_IN_FLIGHT_CAUSES = 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.SHOPPER_REQUEST_INTENTS = 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_FISCAL_IN_FLIGHT_CAUSES = 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.
@@ -82,6 +82,7 @@ exports.PURCHASE_WITHDRAWAL_ACTION_MODES = ['accept', 'decline', 'relay'];
82
82
  * withdrawal that was not declined, in an open return authorisation, or
83
83
  * already returned (`data.orderItemIndex`).
84
84
  * - `nothing-to-withdraw` — every line is already withdrawn or returned.
85
+ * - `not-delivered` — a warranty request on an order not yet delivered.
85
86
  */
86
87
  exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
87
88
  'order-cancelled',
@@ -90,6 +91,7 @@ exports.PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
90
91
  'line-not-on-order',
91
92
  'line-unavailable',
92
93
  'nothing-to-withdraw',
94
+ 'not-delivered',
93
95
  ];
94
96
  /**
95
97
  * Why accepting a withdrawal before fulfilment is refused
@@ -118,11 +120,18 @@ exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
118
120
  /** How long after a relayed request was received its code is due, in ms. */
119
121
  exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
120
122
  /**
121
- * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
122
- * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
123
- * this tuple with the warranty request.
123
+ * The `intent` a guest's withdrawal body names: the purchase withdrawal
124
+ * (*"Me arrepentí"*) only. A warranty request is a separate body variant
125
+ * ({@link SHOPPER_REQUEST_INTENTS}), never a widening of this tuple — the
126
+ * withdrawal handler does not branch on `intent`.
124
127
  */
125
128
  exports.PURCHASE_WITHDRAWAL_GUEST_INTENTS = ['purchase-withdrawal'];
129
+ /**
130
+ * The two intents of the shopper request form: *"Me arrepentí"* and *"El
131
+ * producto tiene un problema"*. Change of mind is not an intent — the server
132
+ * routes a late withdrawal-shaped request to it.
133
+ */
134
+ exports.SHOPPER_REQUEST_INTENTS = ['purchase-withdrawal', 'warranty'];
126
135
  /**
127
136
  * The one refusal of every guest code failure on `POST
128
137
  * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RETURN_LINE_DISPOSITIONS = void 0;
3
+ exports.RETURN_REASON_FLOWS = exports.RETURN_FLOWS = exports.RETURN_LINE_DISPOSITIONS = void 0;
4
4
  /**
5
5
  * Every state a returned line's physical disposition can be in, as a runtime
6
6
  * value so the api's Zod enum, the app's picker and the union below derive
@@ -12,3 +12,24 @@ exports.RETURN_LINE_DISPOSITIONS = [
12
12
  'confirmed_sellable',
13
13
  'confirmed_damaged',
14
14
  ];
15
+ /**
16
+ * The legal track a return follows: the statutory purchase withdrawal, a
17
+ * store's voluntary change-of-mind policy, the legal warranty, or an
18
+ * administrative correction. Server-derived, never chosen by the shopper.
19
+ */
20
+ exports.RETURN_FLOWS = ['purchase-withdrawal', 'change-of-mind', 'warranty', 'administrative'];
21
+ /**
22
+ * The flow each {@link ReturnReason} belongs to. `purchase-withdrawal` is never
23
+ * a reason's flow: only the withdrawal record itself opens that track.
24
+ */
25
+ exports.RETURN_REASON_FLOWS = {
26
+ defective: 'warranty',
27
+ wrong_item: 'warranty',
28
+ damaged_shipping: 'warranty',
29
+ not_as_described: 'warranty',
30
+ customer_changed_mind: 'change-of-mind',
31
+ duplicate_order: 'administrative',
32
+ price_adjustment: 'administrative',
33
+ billing_error: 'administrative',
34
+ other: 'administrative',
35
+ };
package/dist/cjs/rma.js CHANGED
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.canTransitionRma = exports.RMA_STATUSES = exports.RMA_TRANSITIONS = void 0;
3
+ exports.canTransitionRma = exports.RMA_STATUSES = exports.RMA_TRANSITIONS = exports.SHOPPER_RETURN_REQUEST_DESCRIPTION_MAX = exports.WARRANTY_WINDOW_SOURCE = exports.WARRANTY_MONTHS = exports.RMA_SOURCES = void 0;
4
+ /** Who opened an RMA: an operator, the shopper's own request, or a purchase withdrawal. */
5
+ exports.RMA_SOURCES = ['operator', 'shopper', 'purchase-withdrawal'];
6
+ /** Calendar months of the legal warranty window after delivery. */
7
+ exports.WARRANTY_MONTHS = 6;
8
+ /** The matrix row {@link Rma.warrantyEndsAt} is computed from. */
9
+ exports.WARRANTY_WINDOW_SOURCE = 'W3';
10
+ /** The longest shopper return-request description, in characters after trimming. */
11
+ exports.SHOPPER_RETURN_REQUEST_DESCRIPTION_MAX = 500;
4
12
  /**
5
13
  * Runtime value, not just a type — the handler validates against it and the FE
6
14
  * renders from it, so there is exactly one source of truth.
package/dist/cjs/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STORE_PATCH_ERROR_CODES = exports.STORE_MODULE_ERROR_CODES = exports.isStoreModuleOn = exports.isStoreModuleKey = exports.STORE_MODULE_KEYS = exports.STOREFRONT_METHOD_KINDS = exports.STORE_ONBOARDING_REVIEW_AREAS = exports.CUSTOM_DOMAIN_ROW_LIMIT = exports.CUSTOM_DOMAIN_SLOT_LIMIT = void 0;
3
+ exports.CHANGE_OF_MIND_WINDOW_SOURCE = exports.CHANGE_OF_MIND_RETURN_DAYS_MAX = exports.CHANGE_OF_MIND_REFUND_AS = exports.CHANGE_OF_MIND_RETURN_SHIPPING_PAYERS = exports.STORE_PATCH_ERROR_CODES = exports.STORE_MODULE_ERROR_CODES = exports.isStoreModuleOn = exports.isStoreModuleKey = exports.STORE_MODULE_KEYS = exports.STOREFRONT_METHOD_KINDS = exports.STORE_ONBOARDING_REVIEW_AREAS = exports.CUSTOM_DOMAIN_ROW_LIMIT = exports.CUSTOM_DOMAIN_SLOT_LIMIT = void 0;
4
4
  /**
5
5
  * How many custom-domain rows a store may hold that count: one active domain
6
6
  * and one spare, so a replacement can be verified and provisioned before the
@@ -200,3 +200,11 @@ exports.STORE_PATCH_ERROR_CODES = [
200
200
  'FORBIDDEN',
201
201
  'STORE_NOT_FOUND',
202
202
  ];
203
+ /** Who pays the return shipping under a store's change-of-mind policy. */
204
+ exports.CHANGE_OF_MIND_RETURN_SHIPPING_PAYERS = ['merchant', 'shopper'];
205
+ /** How a change-of-mind return is paid back: a refund, or store credit. */
206
+ exports.CHANGE_OF_MIND_REFUND_AS = ['refund', 'store-credit'];
207
+ /** The longest change-of-mind window a store may set, in calendar days after delivery. */
208
+ exports.CHANGE_OF_MIND_RETURN_DAYS_MAX = 365;
209
+ /** The source of a change-of-mind deadline: the store's own setting, not a statutory row. */
210
+ exports.CHANGE_OF_MIND_WINDOW_SOURCE = 'store:changeOfMindReturns';
@@ -106,6 +106,10 @@ declare global {
106
106
  purchaseWithdrawals?: OrderPurchaseWithdrawalView[];
107
107
  /** Whether the withdrawal window is open now — as on `StorefrontOrderView`. Always present. */
108
108
  purchaseWithdrawalEligibility: OrderPurchaseWithdrawalEligibility;
109
+ /** Shopper-sourced return requests, newest first. Reserved — not attached yet. */
110
+ returnRequests?: OrderReturnRequestView[];
111
+ /** Reserved — not attached yet. */
112
+ returnRequestEligibility?: OrderReturnRequestEligibility;
109
113
  contact: {
110
114
  /** The stored address, masked (e.g. `j***@d***.com`). */
111
115
  emailMasked: string;
@@ -136,6 +136,10 @@ declare global {
136
136
  delivery?: OrderDeliveryView;
137
137
  purchaseWithdrawals?: OrderPurchaseWithdrawalView[];
138
138
  purchaseWithdrawalEligibility?: OrderPurchaseWithdrawalEligibility;
139
+ /** Shopper-sourced return requests, newest first. Reserved — not attached yet. */
140
+ returnRequests?: OrderReturnRequestView[];
141
+ /** Reserved — not attached yet. */
142
+ returnRequestEligibility?: OrderReturnRequestEligibility;
139
143
  };
140
144
  /**
141
145
  * `data` of an `orderPaymentAttempt` socket frame, sent to the order's own
@@ -64,8 +64,9 @@ export declare const PURCHASE_WITHDRAWAL_ACTION_MODES: readonly ["accept", "decl
64
64
  * withdrawal that was not declined, in an open return authorisation, or
65
65
  * already returned (`data.orderItemIndex`).
66
66
  * - `nothing-to-withdraw` — every line is already withdrawn or returned.
67
+ * - `not-delivered` — a warranty request on an order not yet delivered.
67
68
  */
68
- export declare const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS: readonly ["order-cancelled", "no-customer", "partial-before-fulfilment", "line-not-on-order", "line-unavailable", "nothing-to-withdraw"];
69
+ export declare const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS: readonly ["order-cancelled", "no-customer", "partial-before-fulfilment", "line-not-on-order", "line-unavailable", "nothing-to-withdraw", "not-delivered"];
69
70
  /**
70
71
  * Why accepting a withdrawal before fulfilment is refused
71
72
  * `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
@@ -93,11 +94,18 @@ export declare const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = "W1";
93
94
  /** How long after a relayed request was received its code is due, in ms. */
94
95
  export declare const PURCHASE_WITHDRAWAL_CODE_DUE_MS: number;
95
96
  /**
96
- * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
97
- * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
98
- * this tuple with the warranty request.
97
+ * The `intent` a guest's withdrawal body names: the purchase withdrawal
98
+ * (*"Me arrepentí"*) only. A warranty request is a separate body variant
99
+ * ({@link SHOPPER_REQUEST_INTENTS}), never a widening of this tuple — the
100
+ * withdrawal handler does not branch on `intent`.
99
101
  */
100
102
  export declare const PURCHASE_WITHDRAWAL_GUEST_INTENTS: readonly ["purchase-withdrawal"];
103
+ /**
104
+ * The two intents of the shopper request form: *"Me arrepentí"* and *"El
105
+ * producto tiene un problema"*. Change of mind is not an intent — the server
106
+ * routes a late withdrawal-shaped request to it.
107
+ */
108
+ export declare const SHOPPER_REQUEST_INTENTS: readonly ["purchase-withdrawal", "warranty"];
101
109
  /**
102
110
  * The one refusal of every guest code failure on `POST
103
111
  * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
@@ -329,6 +337,50 @@ declare global {
329
337
  /** Unix ms. */
330
338
  windowClosesAt: number;
331
339
  source: 'W2';
340
+ /** Unix ms. Present only when the store's change-of-mind policy is on but its window has passed too. */
341
+ changeOfMindEndsAt?: number;
342
+ }
343
+ type ShopperRequestIntent = (typeof SHOPPER_REQUEST_INTENTS)[number];
344
+ /**
345
+ * The warranty variant of `POST /orders/purchase-withdrawal`. Reserved — the
346
+ * live strict body refuses it `400` until the warranty request ships.
347
+ */
348
+ interface ShopperWarrantySubmitRequest {
349
+ intent: 'warranty';
350
+ /** `ORD` + 6–10 digits. */
351
+ orderId: string;
352
+ lines?: PurchaseWithdrawalLine[];
353
+ /**
354
+ * 1–`SHOPPER_RETURN_REQUEST_DESCRIPTION_MAX` characters after trimming.
355
+ * Never stored for an erased customer; never in an audit row.
356
+ */
357
+ description: string;
358
+ }
359
+ type ShopperOrderRequest = PurchaseWithdrawalSubmitRequest | ShopperWarrantySubmitRequest;
360
+ /** The warranty variant of the guest submit. Reserved, as {@link ShopperWarrantySubmitRequest}. */
361
+ interface ShopperWarrantyGuestSubmitRequest {
362
+ challengeHandle: string;
363
+ code: string;
364
+ intent: 'warranty';
365
+ lines?: PurchaseWithdrawalLine[];
366
+ description: string;
367
+ }
368
+ type ShopperOrderGuestRequest = PurchaseWithdrawalGuestSubmitRequest | ShopperWarrantyGuestSubmitRequest;
369
+ /** `data` of the `201` when the request opened a return request rather than a withdrawal. */
370
+ interface ShopperReturnRequestSubmitResponse {
371
+ returnRequest: OrderReturnRequestView;
372
+ }
373
+ interface ShopperReturnRequestGuestSubmitResponse extends ShopperReturnRequestSubmitResponse {
374
+ statusToken?: string;
375
+ }
376
+ /** Tell apart by key: `purchaseWithdrawal` or `returnRequest`. */
377
+ type ShopperOrderRequestResponse = PurchaseWithdrawalSubmitResponse | ShopperReturnRequestSubmitResponse;
378
+ type ShopperOrderGuestRequestResponse = PurchaseWithdrawalGuestSubmitResponse | ShopperReturnRequestGuestSubmitResponse;
379
+ /** `data` of `409 WARRANTY_WINDOW_CLOSED`. */
380
+ interface WarrantyWindowClosedData {
381
+ /** Unix ms. */
382
+ warrantyEndsAt: number;
383
+ source: 'W3';
332
384
  }
333
385
  /** `data` of `409 PURCHASE_WITHDRAWAL_INELIGIBLE`. */
334
386
  interface PurchaseWithdrawalIneligibleData {
@@ -79,6 +79,7 @@ export const PURCHASE_WITHDRAWAL_ACTION_MODES = ['accept', 'decline', 'relay'];
79
79
  * withdrawal that was not declined, in an open return authorisation, or
80
80
  * already returned (`data.orderItemIndex`).
81
81
  * - `nothing-to-withdraw` — every line is already withdrawn or returned.
82
+ * - `not-delivered` — a warranty request on an order not yet delivered.
82
83
  */
83
84
  export const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
84
85
  'order-cancelled',
@@ -87,6 +88,7 @@ export const PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS = [
87
88
  'line-not-on-order',
88
89
  'line-unavailable',
89
90
  'nothing-to-withdraw',
91
+ 'not-delivered',
90
92
  ];
91
93
  /**
92
94
  * Why accepting a withdrawal before fulfilment is refused
@@ -115,11 +117,18 @@ export const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
115
117
  /** How long after a relayed request was received its code is due, in ms. */
116
118
  export const PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
117
119
  /**
118
- * The `intent` a guest's `POST /orders/purchase-withdrawal/guest` names. Only
119
- * the purchase withdrawal (*"Me arrepentí"*) today; the warranty intent joins
120
- * this tuple with the warranty request.
120
+ * The `intent` a guest's withdrawal body names: the purchase withdrawal
121
+ * (*"Me arrepentí"*) only. A warranty request is a separate body variant
122
+ * ({@link SHOPPER_REQUEST_INTENTS}), never a widening of this tuple — the
123
+ * withdrawal handler does not branch on `intent`.
121
124
  */
122
125
  export const PURCHASE_WITHDRAWAL_GUEST_INTENTS = ['purchase-withdrawal'];
126
+ /**
127
+ * The two intents of the shopper request form: *"Me arrepentí"* and *"El
128
+ * producto tiene un problema"*. Change of mind is not an intent — the server
129
+ * routes a late withdrawal-shaped request to it.
130
+ */
131
+ export const SHOPPER_REQUEST_INTENTS = ['purchase-withdrawal', 'warranty'];
123
132
  /**
124
133
  * The one refusal of every guest code failure on `POST
125
134
  * /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
package/dist/return.d.ts CHANGED
@@ -4,7 +4,21 @@
4
4
  * from ONE list. See {@link ReturnLineDisposition} for the machine.
5
5
  */
6
6
  export declare const RETURN_LINE_DISPOSITIONS: readonly ["pending_inspection", "suspicious", "confirmed_sellable", "confirmed_damaged"];
7
+ /**
8
+ * The legal track a return follows: the statutory purchase withdrawal, a
9
+ * store's voluntary change-of-mind policy, the legal warranty, or an
10
+ * administrative correction. Server-derived, never chosen by the shopper.
11
+ */
12
+ export declare const RETURN_FLOWS: readonly ["purchase-withdrawal", "change-of-mind", "warranty", "administrative"];
13
+ /**
14
+ * The flow each {@link ReturnReason} belongs to. `purchase-withdrawal` is never
15
+ * a reason's flow: only the withdrawal record itself opens that track.
16
+ */
17
+ export declare const RETURN_REASON_FLOWS: {
18
+ readonly [R in ReturnReason]: Exclude<ReturnFlow, 'purchase-withdrawal'>;
19
+ };
7
20
  declare global {
21
+ type ReturnFlow = (typeof RETURN_FLOWS)[number];
8
22
  /** Where a customer return's value is paid. Omission on a request or legacy row means account. */
9
23
  type ReturnRefundMethod = 'account' | 'cash';
10
24
  /** Return planning refusals: invalid selected lines, too many return summaries, or more than 100 transaction items. */
package/dist/return.js CHANGED
@@ -9,3 +9,24 @@ export const RETURN_LINE_DISPOSITIONS = [
9
9
  'confirmed_sellable',
10
10
  'confirmed_damaged',
11
11
  ];
12
+ /**
13
+ * The legal track a return follows: the statutory purchase withdrawal, a
14
+ * store's voluntary change-of-mind policy, the legal warranty, or an
15
+ * administrative correction. Server-derived, never chosen by the shopper.
16
+ */
17
+ export const RETURN_FLOWS = ['purchase-withdrawal', 'change-of-mind', 'warranty', 'administrative'];
18
+ /**
19
+ * The flow each {@link ReturnReason} belongs to. `purchase-withdrawal` is never
20
+ * a reason's flow: only the withdrawal record itself opens that track.
21
+ */
22
+ export const RETURN_REASON_FLOWS = {
23
+ defective: 'warranty',
24
+ wrong_item: 'warranty',
25
+ damaged_shipping: 'warranty',
26
+ not_as_described: 'warranty',
27
+ customer_changed_mind: 'change-of-mind',
28
+ duplicate_order: 'administrative',
29
+ price_adjustment: 'administrative',
30
+ billing_error: 'administrative',
31
+ other: 'administrative',
32
+ };
package/dist/rma.d.ts CHANGED
@@ -125,6 +125,14 @@ declare global {
125
125
  * field's meaning does not change.
126
126
  */
127
127
  expiresAt?: number;
128
+ /** Who opened the request. Absent means `operator`. No writer sets another value yet. */
129
+ source?: RmaSource;
130
+ /** Server-derived legal track. Absent on an operator request. */
131
+ flow?: ReturnFlow;
132
+ /** End of the legal warranty window (W3). Set only on a `warranty` request. */
133
+ warrantyEndsAt?: StatutoryInstant;
134
+ /** The store's change-of-mind terms as they stood when requested. Set only on a `change-of-mind` request. */
135
+ changeOfMind?: RmaChangeOfMindTerms;
128
136
  /** Lowercase, rebuilt on every write. A row missing it is invisible to search. */
129
137
  search?: string;
130
138
  createdAt: number;
@@ -197,7 +205,67 @@ declare global {
197
205
  returnId: string;
198
206
  }
199
207
  type RmaPostInput = RmaCreateInput | RmaAuthorizeInput | RmaRejectInput | RmaReceiveInput | RmaTrackingInput | RmaSettleInput;
208
+ type RmaSource = (typeof RMA_SOURCES)[number];
209
+ /** The flows a shopper's own return request can land in. */
210
+ type ShopperReturnRequestFlow = Extract<ReturnFlow, 'warranty' | 'change-of-mind'>;
211
+ /** The change-of-mind terms snapshotted onto a request, so a later policy edit does not rewrite them. */
212
+ interface RmaChangeOfMindTerms {
213
+ endsAt: StatutoryInstant;
214
+ returnShippingPaidBy: ChangeOfMindReturnShippingPayer;
215
+ refundAs: ChangeOfMindRefundAs;
216
+ }
217
+ interface OrderReturnRequestItemView {
218
+ orderItemIndex: number;
219
+ requestedQuantity: number;
220
+ /** Present once authorised; `0` = that line was refused. */
221
+ approvedQuantity?: number;
222
+ }
223
+ /**
224
+ * A shopper-sourced return request as the shopper sees it, by ALLOW-LIST:
225
+ * never the operator's reasons or actors, carrier, tracking, nor the
226
+ * shopper's own description. Reserved — no read serves it yet.
227
+ */
228
+ interface OrderReturnRequestView {
229
+ rmaId: string;
230
+ flow: ShopperReturnRequestFlow;
231
+ status: RmaStatus;
232
+ requestedAt: number;
233
+ items: OrderReturnRequestItemView[];
234
+ /** Unix ms. */
235
+ warrantyEndsAt?: number;
236
+ changeOfMind?: {
237
+ /** Unix ms. */
238
+ endsAt: number;
239
+ returnShippingPaidBy: ChangeOfMindReturnShippingPayer;
240
+ refundAs: ChangeOfMindRefundAs;
241
+ };
242
+ refunds?: OrderPurchaseWithdrawalRefundView[];
243
+ }
244
+ /** Whether the shopper can open a return request on the order now. Reserved — no read serves it yet. */
245
+ interface OrderReturnRequestEligibility {
246
+ warranty: {
247
+ open: boolean;
248
+ /** Unix ms. */
249
+ warrantyEndsAt?: number;
250
+ };
251
+ /** Present only while the store's policy is on and the order was delivered. */
252
+ changeOfMind?: {
253
+ open: boolean;
254
+ /** Unix ms. */
255
+ endsAt: number;
256
+ returnShippingPaidBy: ChangeOfMindReturnShippingPayer;
257
+ refundAs: ChangeOfMindRefundAs;
258
+ };
259
+ }
200
260
  }
261
+ /** Who opened an RMA: an operator, the shopper's own request, or a purchase withdrawal. */
262
+ export declare const RMA_SOURCES: readonly ["operator", "shopper", "purchase-withdrawal"];
263
+ /** Calendar months of the legal warranty window after delivery. */
264
+ export declare const WARRANTY_MONTHS = 6;
265
+ /** The matrix row {@link Rma.warrantyEndsAt} is computed from. */
266
+ export declare const WARRANTY_WINDOW_SOURCE = "W3";
267
+ /** The longest shopper return-request description, in characters after trimming. */
268
+ export declare const SHOPPER_RETURN_REQUEST_DESCRIPTION_MAX = 500;
201
269
  /**
202
270
  * Runtime value, not just a type — the handler validates against it and the FE
203
271
  * renders from it, so there is exactly one source of truth.
package/dist/rma.js CHANGED
@@ -1,3 +1,11 @@
1
+ /** Who opened an RMA: an operator, the shopper's own request, or a purchase withdrawal. */
2
+ export const RMA_SOURCES = ['operator', 'shopper', 'purchase-withdrawal'];
3
+ /** Calendar months of the legal warranty window after delivery. */
4
+ export const WARRANTY_MONTHS = 6;
5
+ /** The matrix row {@link Rma.warrantyEndsAt} is computed from. */
6
+ export const WARRANTY_WINDOW_SOURCE = 'W3';
7
+ /** The longest shopper return-request description, in characters after trimming. */
8
+ export const SHOPPER_RETURN_REQUEST_DESCRIPTION_MAX = 500;
1
9
  /**
2
10
  * Runtime value, not just a type — the handler validates against it and the FE
3
11
  * renders from it, so there is exactly one source of truth.
package/dist/store.d.ts CHANGED
@@ -989,6 +989,13 @@ declare global {
989
989
  * storefront.
990
990
  */
991
991
  publicContact?: boolean;
992
+ /**
993
+ * The store's voluntary change-of-mind return policy, beyond the
994
+ * statutory withdrawal window. Absent, or `enabled: false`, means off.
995
+ * Written whole through `PATCH /store` (ADMIN/SUPERVISOR/MANAGER); a
996
+ * plain USER is refused, and `null` never clears it.
997
+ */
998
+ changeOfMindReturns?: ChangeOfMindReturnsConfig;
992
999
  /**
993
1000
  * Per-category × per-channel notification/feedback defaults; absent ⇒
994
1001
  * FE falls back to all-on. FE-read only — `PATCH /store` validates shape only.
@@ -2648,3 +2655,23 @@ export type StoreModuleRefusalBody = {
2648
2655
  */
2649
2656
  export declare const STORE_PATCH_ERROR_CODES: readonly ["STORE_CONFIG_FORBIDDEN", "STORE_ECOMMERCE_FORBIDDEN", "STORE_FISCAL_FIELD_FORBIDDEN", "STORE_JURISDICTION_FORBIDDEN", "AFIP_RELACION_FLAG_FORBIDDEN", "FX_TABLE_FORBIDDEN", "FX_AUTO_UPDATE_FORBIDDEN", "FIELD_NOT_WRITABLE_HERE", "AFIP_POINT_OF_SALE_NOT_CLEARABLE", "CURRENCY_CATALOG_ID_UNKNOWN", "ARS_RATE_MUST_BE_ONE", "CURRENCY_RATE_ABOVE_CEILING", "FX_CATALOG_ID_UNKNOWN", "FX_SOURCE_ID_UNKNOWN", "DISPLAY_CURRENCY_NOT_INVOICEABLE", "PRODUCT_CURRENCY_NOT_INVOICEABLE", "PRICE_LIST_NOT_FOUND", "DELIVERY_FEE_INVALID", "WHOLESALE_LIST_REQUIRED", "NET_PLUS_IVA_REQUIRES_RI", "DATA_FISCAL_URL_INVALID", "STORE_PUBLIC_HOST_MISSING", "FORBIDDEN", "STORE_NOT_FOUND"];
2650
2657
  export type StorePatchErrorCode = (typeof STORE_PATCH_ERROR_CODES)[number];
2658
+ /** Who pays the return shipping under a store's change-of-mind policy. */
2659
+ export declare const CHANGE_OF_MIND_RETURN_SHIPPING_PAYERS: readonly ["merchant", "shopper"];
2660
+ /** How a change-of-mind return is paid back: a refund, or store credit. */
2661
+ export declare const CHANGE_OF_MIND_REFUND_AS: readonly ["refund", "store-credit"];
2662
+ /** The longest change-of-mind window a store may set, in calendar days after delivery. */
2663
+ export declare const CHANGE_OF_MIND_RETURN_DAYS_MAX = 365;
2664
+ /** The source of a change-of-mind deadline: the store's own setting, not a statutory row. */
2665
+ export declare const CHANGE_OF_MIND_WINDOW_SOURCE = "store:changeOfMindReturns";
2666
+ declare global {
2667
+ type ChangeOfMindReturnShippingPayer = (typeof CHANGE_OF_MIND_RETURN_SHIPPING_PAYERS)[number];
2668
+ type ChangeOfMindRefundAs = (typeof CHANGE_OF_MIND_REFUND_AS)[number];
2669
+ /** `Store.config.changeOfMindReturns`. Absent, or `enabled: false`, means off. */
2670
+ interface ChangeOfMindReturnsConfig {
2671
+ enabled: boolean;
2672
+ /** Whole calendar days after delivery, 1–{@link CHANGE_OF_MIND_RETURN_DAYS_MAX}. */
2673
+ days: number;
2674
+ returnShippingPaidBy: ChangeOfMindReturnShippingPayer;
2675
+ refundAs: ChangeOfMindRefundAs;
2676
+ }
2677
+ }
package/dist/store.js CHANGED
@@ -195,3 +195,11 @@ export const STORE_PATCH_ERROR_CODES = [
195
195
  'FORBIDDEN',
196
196
  'STORE_NOT_FOUND',
197
197
  ];
198
+ /** Who pays the return shipping under a store's change-of-mind policy. */
199
+ export const CHANGE_OF_MIND_RETURN_SHIPPING_PAYERS = ['merchant', 'shopper'];
200
+ /** How a change-of-mind return is paid back: a refund, or store credit. */
201
+ export const CHANGE_OF_MIND_REFUND_AS = ['refund', 'store-credit'];
202
+ /** The longest change-of-mind window a store may set, in calendar days after delivery. */
203
+ export const CHANGE_OF_MIND_RETURN_DAYS_MAX = 365;
204
+ /** The source of a change-of-mind deadline: the store's own setting, not a statutory row. */
205
+ export const CHANGE_OF_MIND_WINDOW_SOURCE = 'store:changeOfMindReturns';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.820",
3
+ "version": "1.10.822",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",