platform-types 1.10.819 → 1.10.821
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/cjs/purchaseWithdrawal.js +27 -4
- package/dist/cjs/return.js +22 -1
- package/dist/cjs/rma.js +9 -1
- package/dist/cjs/store.js +9 -1
- package/dist/guestOrderStatus.d.ts +4 -0
- package/dist/order.d.ts +12 -2
- package/dist/paymentAttempt.d.ts +4 -0
- package/dist/purchaseWithdrawal.d.ts +78 -4
- package/dist/purchaseWithdrawal.js +26 -3
- package/dist/return.d.ts +14 -0
- package/dist/return.js +21 -0
- package/dist/rma.d.ts +68 -0
- package/dist/rma.js +8 -0
- package/dist/store.d.ts +27 -0
- package/dist/store.js +8 -0
- package/package.json +1 -1
|
@@ -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_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,7 +91,22 @@ 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
|
];
|
|
96
|
+
/**
|
|
97
|
+
* Why accepting a withdrawal before fulfilment is refused
|
|
98
|
+
* `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
|
|
99
|
+
* flight on the order, so cancelling it now could leave a voucher on a
|
|
100
|
+
* withdrawn order:
|
|
101
|
+
*
|
|
102
|
+
* - `in-progress` — a factura issuance holds the order's fence right now.
|
|
103
|
+
* Retry once it ends.
|
|
104
|
+
* - `uncertain` — an earlier factura issuance was interrupted and its outcome
|
|
105
|
+
* at ARCA is not confirmed. Retryable only after support reconciles it.
|
|
106
|
+
* - `stranded` — a voucher ARCA authorised could not be recorded on the order.
|
|
107
|
+
* Retryable only after support records it.
|
|
108
|
+
*/
|
|
109
|
+
exports.PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES = ['in-progress', 'uncertain', 'stranded'];
|
|
94
110
|
/** The longest decline or relay `note`, in characters after trimming. */
|
|
95
111
|
exports.PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
|
|
96
112
|
/** The most lines one request may name. */
|
|
@@ -104,11 +120,18 @@ exports.PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
|
|
|
104
120
|
/** How long after a relayed request was received its code is due, in ms. */
|
|
105
121
|
exports.PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
|
|
106
122
|
/**
|
|
107
|
-
* The `intent` a guest's
|
|
108
|
-
*
|
|
109
|
-
* this tuple
|
|
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`.
|
|
110
127
|
*/
|
|
111
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'];
|
|
112
135
|
/**
|
|
113
136
|
* The one refusal of every guest code failure on `POST
|
|
114
137
|
* /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
|
package/dist/cjs/return.js
CHANGED
|
@@ -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;
|
package/dist/order.d.ts
CHANGED
|
@@ -1269,7 +1269,11 @@ declare global {
|
|
|
1269
1269
|
* All four fields are absent on a non-cancelled order.
|
|
1270
1270
|
*/
|
|
1271
1271
|
cancelledAt?: number;
|
|
1272
|
-
/**
|
|
1272
|
+
/**
|
|
1273
|
+
* Who cancelled: the customerId for a self-cancellation, the operator's
|
|
1274
|
+
* userId for an operator cancellation and for a purchase-withdrawal one
|
|
1275
|
+
* (the operator who accepted it), `'system'` for the payment-hold expiry.
|
|
1276
|
+
*/
|
|
1273
1277
|
cancelledBy?: string;
|
|
1274
1278
|
cancellationSource?: OrderCancellationSource;
|
|
1275
1279
|
/**
|
|
@@ -1380,8 +1384,14 @@ declare global {
|
|
|
1380
1384
|
* (`services/orderSystemCancellation.ts`, run by the payment-attempt sweep),
|
|
1381
1385
|
* which cancels an order whose online payment attempt lapsed unpaid; its
|
|
1382
1386
|
* `cancelledBy` is `'system'`, never a user id.
|
|
1387
|
+
*
|
|
1388
|
+
* `purchase-withdrawal` is written only by the purchase-withdrawal door
|
|
1389
|
+
* (`lambdas/orders/_purchaseWithdrawalCancel.ts`): the order cancelled
|
|
1390
|
+
* because an operator accepted the shopper's purchase withdrawal before
|
|
1391
|
+
* fulfilment. Its `cancelledBy` is the accepting operator's userId (the
|
|
1392
|
+
* commit is the operator's act), and it carries no `cancellationReason`.
|
|
1383
1393
|
*/
|
|
1384
|
-
type OrderCancellationSource = 'customer' | 'operator' | 'system';
|
|
1394
|
+
type OrderCancellationSource = 'customer' | 'operator' | 'system' | 'purchase-withdrawal';
|
|
1385
1395
|
/**
|
|
1386
1396
|
* Machine-readable reason an order is locked against a mutation — the
|
|
1387
1397
|
* payload of `409 ORDER_LOCKED` (on the customer cancellation's `409 ORDER_CANCELLATION_LOCKED` it rides in `message` as `reason: <r>` and that body has no `reason` key; the operator cancellation's carries both), and the
|
package/dist/paymentAttempt.d.ts
CHANGED
|
@@ -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,23 @@ 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"];
|
|
70
|
+
/**
|
|
71
|
+
* Why accepting a withdrawal before fulfilment is refused
|
|
72
|
+
* `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
|
|
73
|
+
* flight on the order, so cancelling it now could leave a voucher on a
|
|
74
|
+
* withdrawn order:
|
|
75
|
+
*
|
|
76
|
+
* - `in-progress` — a factura issuance holds the order's fence right now.
|
|
77
|
+
* Retry once it ends.
|
|
78
|
+
* - `uncertain` — an earlier factura issuance was interrupted and its outcome
|
|
79
|
+
* at ARCA is not confirmed. Retryable only after support reconciles it.
|
|
80
|
+
* - `stranded` — a voucher ARCA authorised could not be recorded on the order.
|
|
81
|
+
* Retryable only after support records it.
|
|
82
|
+
*/
|
|
83
|
+
export declare const PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES: readonly ["in-progress", "uncertain", "stranded"];
|
|
69
84
|
/** The longest decline or relay `note`, in characters after trimming. */
|
|
70
85
|
export declare const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
|
|
71
86
|
/** The most lines one request may name. */
|
|
@@ -79,11 +94,18 @@ export declare const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = "W1";
|
|
|
79
94
|
/** How long after a relayed request was received its code is due, in ms. */
|
|
80
95
|
export declare const PURCHASE_WITHDRAWAL_CODE_DUE_MS: number;
|
|
81
96
|
/**
|
|
82
|
-
* The `intent` a guest's
|
|
83
|
-
*
|
|
84
|
-
* this tuple
|
|
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`.
|
|
85
101
|
*/
|
|
86
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"];
|
|
87
109
|
/**
|
|
88
110
|
* The one refusal of every guest code failure on `POST
|
|
89
111
|
* /orders/purchase-withdrawal/guest` (`401`): a wrong, expired, exhausted or
|
|
@@ -100,6 +122,7 @@ declare global {
|
|
|
100
122
|
type PurchaseWithdrawalActionMode = (typeof PURCHASE_WITHDRAWAL_ACTION_MODES)[number];
|
|
101
123
|
type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
|
|
102
124
|
type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
|
|
125
|
+
type PurchaseWithdrawalFiscalInFlightCause = (typeof PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES)[number];
|
|
103
126
|
/** One withdrawn order line, by its index in `Order.items`. */
|
|
104
127
|
interface PurchaseWithdrawalLine {
|
|
105
128
|
orderItemIndex: number;
|
|
@@ -314,6 +337,50 @@ declare global {
|
|
|
314
337
|
/** Unix ms. */
|
|
315
338
|
windowClosesAt: number;
|
|
316
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';
|
|
317
384
|
}
|
|
318
385
|
/** `data` of `409 PURCHASE_WITHDRAWAL_INELIGIBLE`. */
|
|
319
386
|
interface PurchaseWithdrawalIneligibleData {
|
|
@@ -389,6 +456,13 @@ declare global {
|
|
|
389
456
|
decision?: PurchaseWithdrawalDecision;
|
|
390
457
|
declineReason?: PurchaseWithdrawalDeclineReason;
|
|
391
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* `data` of `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT`: why the order's
|
|
461
|
+
* cancellation must wait on its fiscal state. Nothing was written.
|
|
462
|
+
*/
|
|
463
|
+
interface PurchaseWithdrawalFiscalInFlightData {
|
|
464
|
+
cause: PurchaseWithdrawalFiscalInFlightCause;
|
|
465
|
+
}
|
|
392
466
|
/** `data` of `409 PURCHASE_WITHDRAWAL_CHANGED`: the withdrawal as it now stands — review it and resend. */
|
|
393
467
|
interface PurchaseWithdrawalChangedData {
|
|
394
468
|
purchaseWithdrawal: PurchaseWithdrawal;
|
|
@@ -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,7 +88,22 @@ 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
|
];
|
|
93
|
+
/**
|
|
94
|
+
* Why accepting a withdrawal before fulfilment is refused
|
|
95
|
+
* `409 PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT` (`data.cause`) — a factura is in
|
|
96
|
+
* flight on the order, so cancelling it now could leave a voucher on a
|
|
97
|
+
* withdrawn order:
|
|
98
|
+
*
|
|
99
|
+
* - `in-progress` — a factura issuance holds the order's fence right now.
|
|
100
|
+
* Retry once it ends.
|
|
101
|
+
* - `uncertain` — an earlier factura issuance was interrupted and its outcome
|
|
102
|
+
* at ARCA is not confirmed. Retryable only after support reconciles it.
|
|
103
|
+
* - `stranded` — a voucher ARCA authorised could not be recorded on the order.
|
|
104
|
+
* Retryable only after support records it.
|
|
105
|
+
*/
|
|
106
|
+
export const PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES = ['in-progress', 'uncertain', 'stranded'];
|
|
91
107
|
/** The longest decline or relay `note`, in characters after trimming. */
|
|
92
108
|
export const PURCHASE_WITHDRAWAL_NOTE_MAX = 500;
|
|
93
109
|
/** The most lines one request may name. */
|
|
@@ -101,11 +117,18 @@ export const PURCHASE_WITHDRAWAL_CODE_DUE_SOURCE = 'W1';
|
|
|
101
117
|
/** How long after a relayed request was received its code is due, in ms. */
|
|
102
118
|
export const PURCHASE_WITHDRAWAL_CODE_DUE_MS = 24 * 60 * 60 * 1000;
|
|
103
119
|
/**
|
|
104
|
-
* The `intent` a guest's
|
|
105
|
-
*
|
|
106
|
-
* this tuple
|
|
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`.
|
|
107
124
|
*/
|
|
108
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'];
|
|
109
132
|
/**
|
|
110
133
|
* The one refusal of every guest code failure on `POST
|
|
111
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
|
+
* Reserved — no `PATCH /store` validator accepts it yet. Written whole,
|
|
996
|
+
* never cleared with `null`.
|
|
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';
|