platform-types 1.10.838 → 1.10.840
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/serviceOrder.js +8 -1
- package/dist/cjs/socket.js +2 -0
- package/dist/print.d.ts +26 -4
- package/dist/purchaseWithdrawal.d.ts +29 -0
- package/dist/return.d.ts +8 -0
- package/dist/serviceOrder.d.ts +28 -1
- package/dist/serviceOrder.js +7 -0
- package/dist/socket.d.ts +1 -1
- package/dist/socket.js +2 -0
- package/dist/store.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/serviceOrder.js
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* A cancelled order can still have the device on the shelf.
|
|
35
35
|
*/
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.SERVICE_ORDER_ERROR_CODES = exports.MAX_SERVICE_PICTURES = exports.SERVICE_CUSTODIES = exports.SERVICE_CUSTODY_TRANSITIONS = exports.SERVICE_TERMINAL_STATUSES = exports.SERVICE_STATUSES = exports.SERVICE_TRANSITIONS = void 0;
|
|
37
|
+
exports.SERVICE_ORDER_ERROR_CODES = exports.MAX_SERVICE_PICTURES = exports.SERVICE_CUSTODIES = exports.SERVICE_CUSTODY_TRANSITIONS = exports.SERVICE_TERMINAL_STATUSES = exports.SERVICE_STATUSES = exports.SERVICE_ORDER_DOCUMENTS = exports.SERVICE_TRANSITIONS = void 0;
|
|
38
38
|
/**
|
|
39
39
|
* The legal moves on a service order. Exhaustive over `ServiceStatus` by
|
|
40
40
|
* construction — adding a status to the union without a row here is a typecheck
|
|
@@ -85,6 +85,8 @@ exports.SERVICE_TRANSITIONS = {
|
|
|
85
85
|
* of an exhaustive `Record` cannot omit one. Same reasoning, and the same
|
|
86
86
|
* assertion to a non-empty tuple, as `ORDER_FULFILMENT_STATUSES`.
|
|
87
87
|
*/
|
|
88
|
+
/** Every {@link ServiceOrderDocument}, in the order the app offers them. */
|
|
89
|
+
exports.SERVICE_ORDER_DOCUMENTS = ['recepcion', 'presupuesto', 'entrega', 'devolucion'];
|
|
88
90
|
exports.SERVICE_STATUSES = Object.keys(exports.SERVICE_TRANSITIONS);
|
|
89
91
|
/**
|
|
90
92
|
* The statuses a service order can end in. Nothing transitions out of these.
|
|
@@ -264,6 +266,9 @@ exports.MAX_SERVICE_PICTURES = 20;
|
|
|
264
266
|
* cart keeps its coupon. Remove the coupon from the cart (or decline the
|
|
265
267
|
* basket) and retry.
|
|
266
268
|
* - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
|
|
269
|
+
* - `PRINT_JOB_DOCUMENT_NOT_FOUND` · 404 — `GET ?mode=job-document`: the job is
|
|
270
|
+
* unknown to the caller's store, is not a service-order job, was cancelled, is
|
|
271
|
+
* still held, or ended without being sent. One answer for all five.
|
|
267
272
|
*
|
|
268
273
|
* ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
|
|
269
274
|
* role no mode admits); cross-cutting gating refusals are NOT repeated —
|
|
@@ -284,6 +289,8 @@ exports.SERVICE_ORDER_ERROR_CODES = [
|
|
|
284
289
|
'REWORK_INDEX_UNAVAILABLE',
|
|
285
290
|
'STORE_NOT_FOUND',
|
|
286
291
|
'SERVICE_ORDER_NOT_FOUND',
|
|
292
|
+
// The print agent's `GET ?mode=job-document` — no fetchable service-order job by that id
|
|
293
|
+
'PRINT_JOB_DOCUMENT_NOT_FOUND',
|
|
287
294
|
// Intake and edit
|
|
288
295
|
'CUSTOMER_NOT_FOUND',
|
|
289
296
|
'PARENT_SERVICE_ORDER_NOT_FOUND',
|
package/dist/cjs/socket.js
CHANGED
|
@@ -585,6 +585,8 @@ exports.SOCKET_ACTIONS = [
|
|
|
585
585
|
'print-invoice',
|
|
586
586
|
'print-product',
|
|
587
587
|
'print-tag',
|
|
588
|
+
// A service-order document, id-only (`PrintServiceOrderFrameData`).
|
|
589
|
+
'print-service-order',
|
|
588
590
|
'print_job_failed',
|
|
589
591
|
// BE → agent: re-send your COMPLETE printer set (carries only `storeId`).
|
|
590
592
|
// Needed because `register_printers` only fires on connect/local-change, so
|
package/dist/print.d.ts
CHANGED
|
@@ -440,8 +440,26 @@ declare global {
|
|
|
440
440
|
*/
|
|
441
441
|
printers: PrintPrinterReport[];
|
|
442
442
|
}
|
|
443
|
-
/**
|
|
444
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Print use cases that can be routed independently. `service-order` is every
|
|
445
|
+
* service-order document (the intake receipt, the quote, the delivery and
|
|
446
|
+
* hand-back records) — PDF documents, routed apart from `receipt`, which is the
|
|
447
|
+
* ESC/POS ticket rule.
|
|
448
|
+
*/
|
|
449
|
+
type PrintUseCase = 'order' | 'invoice' | 'label' | 'tag' | 'receipt' | 'report' | 'service-order';
|
|
450
|
+
/**
|
|
451
|
+
* `data` of the server → agent `print-service-order` frame. Id-only, always:
|
|
452
|
+
* the agent fetches the PDF with `GET /services?mode=job-document&jobId=…`,
|
|
453
|
+
* which renders the document THIS job names and nothing else. The ids are
|
|
454
|
+
* for display; the fetch reads them off the job, never off the request.
|
|
455
|
+
*/
|
|
456
|
+
interface PrintServiceOrderFrameData {
|
|
457
|
+
jobId: string;
|
|
458
|
+
storeId: string;
|
|
459
|
+
serviceOrderId: string;
|
|
460
|
+
document: ServiceOrderDocument;
|
|
461
|
+
options?: PrintOptions;
|
|
462
|
+
}
|
|
445
463
|
/**
|
|
446
464
|
* One row of `PRINT_RULE#${storeId}` — at most one rule per
|
|
447
465
|
* (`storeId`, `useCase`, `agentId`).
|
|
@@ -551,6 +569,10 @@ declare global {
|
|
|
551
569
|
printerId?: string;
|
|
552
570
|
orderId?: string;
|
|
553
571
|
invoiceId?: string;
|
|
572
|
+
/** The service order a `service-order` job prints — dispatch-stamped, never written by an ack. */
|
|
573
|
+
serviceOrderId?: string;
|
|
574
|
+
/** Which document of {@link serviceOrderId} the job prints. */
|
|
575
|
+
serviceOrderDocument?: ServiceOrderDocument;
|
|
554
576
|
detail?: string;
|
|
555
577
|
/**
|
|
556
578
|
* Machine-readable failure classification, when one is recognised. BE-side
|
|
@@ -564,11 +586,11 @@ declare global {
|
|
|
564
586
|
* An automatic job (`Store.config.autoPrint`) adds three BE-side codes on
|
|
565
587
|
* `error`: `PRINT_QUEUE_EXPIRED` — it was held for want of a connected
|
|
566
588
|
* agent and its `heldUntil` passed — `AUTO_PRINT_SOURCE_GONE` — the
|
|
567
|
-
* order or
|
|
589
|
+
* order, invoice or service order it was printing no longer exists when it was replayed —
|
|
568
590
|
* and `AUTO_PRINT_NO_LONGER_ELIGIBLE` — at replay it no longer passed the
|
|
569
591
|
* checks it was minted under (the store's switch for its event is off, the
|
|
570
592
|
* order was cancelled or its ready / delivered mark cleared, the factura is
|
|
571
|
-
* a credit note), so it was never sent.
|
|
593
|
+
* a credit note, the service order was cancelled or disabled), so it was never sent.
|
|
572
594
|
* A HELD job is `queued` with `NO_PRINTER_CONNECTED` and `heldUntil`.
|
|
573
595
|
*/
|
|
574
596
|
errorCode?: string;
|
|
@@ -151,6 +151,20 @@ declare global {
|
|
|
151
151
|
type PurchaseWithdrawalIneligibleReason = (typeof PURCHASE_WITHDRAWAL_INELIGIBLE_REASONS)[number];
|
|
152
152
|
type PurchaseWithdrawalGuestIntent = (typeof PURCHASE_WITHDRAWAL_GUEST_INTENTS)[number];
|
|
153
153
|
type PurchaseWithdrawalFiscalInFlightCause = (typeof PURCHASE_WITHDRAWAL_FISCAL_IN_FLIGHT_CAUSES)[number];
|
|
154
|
+
/** A withdrawal credit note's failure cause: a return's, plus one only a withdrawal stores. */
|
|
155
|
+
type PurchaseWithdrawalCreditNoteErrorCode = ReturnCreditNoteErrorCode | 'RETURN_LEDGER_BASIS_UNAVAILABLE';
|
|
156
|
+
/** Why a withdrawal's credit note is `not_requested`: FAC already credited, no FAC yet, FAC rejected. */
|
|
157
|
+
type PurchaseWithdrawalCreditNoteSkip = 'fac-credited' | 'no-fac-counsel-pending' | 'fac-rejected';
|
|
158
|
+
/**
|
|
159
|
+
* The `return-credit-note` retry's refusal codes for a withdrawal's note: a return's, plus
|
|
160
|
+
* `PURCHASE_WITHDRAWAL_NOT_FOUND` (404) — no withdrawal row under that `orderId` and `withdrawalId`.
|
|
161
|
+
* Two of a return's codes cover more for a withdrawal:
|
|
162
|
+
* - `NC_OUTCOME_UNCONFIRMED` (503) also answers the handled waits — the factura the note credits, or an
|
|
163
|
+
* earlier credit note of it, is still `pending_cae`. Nothing was issued; the `message` names which one.
|
|
164
|
+
* - `NC_NOT_REQUESTED` (409) also answers a `rejected` note stored without its allocation and order-index
|
|
165
|
+
* subset: what to credit could not be determined, so the note is issued by hand, never retried.
|
|
166
|
+
*/
|
|
167
|
+
type PurchaseWithdrawalCreditNoteRetryErrorCode = ReturnCreditNoteRetryErrorCode | 'PURCHASE_WITHDRAWAL_NOT_FOUND';
|
|
154
168
|
/** One withdrawn order line, by its index in `Order.items`. */
|
|
155
169
|
interface PurchaseWithdrawalLine {
|
|
156
170
|
orderItemIndex: number;
|
|
@@ -247,6 +261,16 @@ declare global {
|
|
|
247
261
|
declineReason?: PurchaseWithdrawalDeclineReason;
|
|
248
262
|
/** The operator's own words on a decline. Removed by a customer erasure; never in an audit row. */
|
|
249
263
|
declineNote?: string;
|
|
264
|
+
/** The credit note of the order's cancellation; absent when none was planned. Never moves `revision`. */
|
|
265
|
+
ncStatus?: ReturnCreditNoteStatus;
|
|
266
|
+
/** The credit note's ARCA voucher NUMBER (`String(invoice.invoiceNumber)`), once `authorized` — not an INVOICE id. */
|
|
267
|
+
creditNoteId?: string;
|
|
268
|
+
/** Machine-readable cause when `ncStatus` is `rejected`. */
|
|
269
|
+
ncErrorCode?: PurchaseWithdrawalCreditNoteErrorCode;
|
|
270
|
+
/** Unix ms — when the credit note last went into `pending`. */
|
|
271
|
+
ncPendingSince?: number;
|
|
272
|
+
/** Why `ncStatus` is `not_requested`. */
|
|
273
|
+
creditNoteSkip?: PurchaseWithdrawalCreditNoteSkip;
|
|
250
274
|
/** Bumped by every move, for a compare-and-set. */
|
|
251
275
|
revision: number;
|
|
252
276
|
/** Unix ms. */
|
|
@@ -254,6 +278,11 @@ declare global {
|
|
|
254
278
|
/** Unix ms of the last move. */
|
|
255
279
|
revisedAt: number;
|
|
256
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* What the `return-credit-note` retry answers for a withdrawal's note: its credit-note fields and the ids that
|
|
283
|
+
* name it, nothing else — the retry is open to a `creditNote` holder who may not read customers.
|
|
284
|
+
*/
|
|
285
|
+
type PurchaseWithdrawalCreditNoteView = Pick<PurchaseWithdrawal, 'withdrawalId' | 'orderId' | 'ncStatus' | 'creditNoteId' | 'ncErrorCode' | 'ncPendingSince' | 'creditNoteSkip'>;
|
|
257
286
|
/**
|
|
258
287
|
* The undecided request an order carries, stamped on the ORDER row while
|
|
259
288
|
* the request is `requested` and removed in the decision's transaction. Its
|
package/dist/return.d.ts
CHANGED
|
@@ -1011,6 +1011,14 @@ declare global {
|
|
|
1011
1011
|
mode: 'return-credit-note';
|
|
1012
1012
|
returnId: string;
|
|
1013
1013
|
}
|
|
1014
|
+
/** The same retry for the credit note of a purchase withdrawal's cancellation. */
|
|
1015
|
+
interface RetryPurchaseWithdrawalCreditNoteRequest {
|
|
1016
|
+
mode: 'return-credit-note';
|
|
1017
|
+
orderId: string;
|
|
1018
|
+
withdrawalId: string;
|
|
1019
|
+
}
|
|
1020
|
+
/** The `return-credit-note` body: a return's, or a purchase withdrawal's — never both. */
|
|
1021
|
+
type RetryCreditNoteRequest = RetryReturnCreditNoteRequest | RetryPurchaseWithdrawalCreditNoteRequest;
|
|
1014
1022
|
/**
|
|
1015
1023
|
* `POST /orders` with `mode: 'return-disposition'` — re-grade ONE line of a
|
|
1016
1024
|
* committed return. ADMIN/MANAGER only, and the `Idempotency-Key` header is
|
package/dist/serviceOrder.d.ts
CHANGED
|
@@ -1108,8 +1108,30 @@ declare global {
|
|
|
1108
1108
|
by: string;
|
|
1109
1109
|
at: number;
|
|
1110
1110
|
};
|
|
1111
|
+
/**
|
|
1112
|
+
* `true` once any document of this order was dispatched to the print
|
|
1113
|
+
* agents. Like `Order.orderPrinted` it means QUEUED, not printed — it is
|
|
1114
|
+
* set before any agent has seen the job.
|
|
1115
|
+
*/
|
|
1116
|
+
serviceOrderPrinted?: boolean;
|
|
1117
|
+
/** The most recent print job's id, last-write-wins across all four documents. */
|
|
1118
|
+
printJobId?: string;
|
|
1119
|
+
/** Which document {@link printJobId} prints. */
|
|
1120
|
+
printJobDocument?: ServiceOrderDocument;
|
|
1121
|
+
/**
|
|
1122
|
+
* ms epoch at which the agent confirmed {@link printJobId} printed. Absent =
|
|
1123
|
+
* not confirmed. Removed by every new dispatch, so it always describes the
|
|
1124
|
+
* CURRENT `printJobId`.
|
|
1125
|
+
*/
|
|
1126
|
+
printedAt?: number;
|
|
1111
1127
|
disabled: boolean;
|
|
1112
1128
|
}
|
|
1129
|
+
/**
|
|
1130
|
+
* One printable service-order document — the `document` of
|
|
1131
|
+
* `GET /services?mode=pdf` and of `POST /services {mode:'print'}`.
|
|
1132
|
+
* `recepcion` is the intake receipt (comprobante de ingreso).
|
|
1133
|
+
*/
|
|
1134
|
+
type ServiceOrderDocument = (typeof SERVICE_ORDER_DOCUMENTS)[number];
|
|
1113
1135
|
/**
|
|
1114
1136
|
* The running-timer sentinel — one row per technician, for exactly as long as
|
|
1115
1137
|
* their timer runs. PK `SERVICETIMER#{storeId}`, SK `{technicianId}`.
|
|
@@ -1313,6 +1335,8 @@ export declare const SERVICE_TRANSITIONS: Readonly<Record<ServiceStatus, readonl
|
|
|
1313
1335
|
* of an exhaustive `Record` cannot omit one. Same reasoning, and the same
|
|
1314
1336
|
* assertion to a non-empty tuple, as `ORDER_FULFILMENT_STATUSES`.
|
|
1315
1337
|
*/
|
|
1338
|
+
/** Every {@link ServiceOrderDocument}, in the order the app offers them. */
|
|
1339
|
+
export declare const SERVICE_ORDER_DOCUMENTS: readonly ["recepcion", "presupuesto", "entrega", "devolucion"];
|
|
1316
1340
|
export declare const SERVICE_STATUSES: [ServiceStatus, ...ServiceStatus[]];
|
|
1317
1341
|
/**
|
|
1318
1342
|
* The statuses a service order can end in. Nothing transitions out of these.
|
|
@@ -1481,12 +1505,15 @@ export declare const MAX_SERVICE_PICTURES = 20;
|
|
|
1481
1505
|
* cart keeps its coupon. Remove the coupon from the cart (or decline the
|
|
1482
1506
|
* basket) and retry.
|
|
1483
1507
|
* - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
|
|
1508
|
+
* - `PRINT_JOB_DOCUMENT_NOT_FOUND` · 404 — `GET ?mode=job-document`: the job is
|
|
1509
|
+
* unknown to the caller's store, is not a service-order job, was cancelled, is
|
|
1510
|
+
* still held, or ended without being sent. One answer for all five.
|
|
1484
1511
|
*
|
|
1485
1512
|
* ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
|
|
1486
1513
|
* role no mode admits); cross-cutting gating refusals are NOT repeated —
|
|
1487
1514
|
* check `GATING_ERROR_CODES` in addition. The deposit's opt-in idempotency
|
|
1488
1515
|
* refusals are included here.
|
|
1489
1516
|
*/
|
|
1490
|
-
export declare const SERVICE_ORDER_ERROR_CODES: readonly ["UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "APPOINTMENT_NOT_FOUND", "APPOINTMENT_NOT_LINKABLE", "APPOINTMENT_NOT_OPEN", "APPOINTMENT_CUSTOMER_MISMATCH", "APPOINTMENT_VERSION_CONFLICT", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENCY_LOCK_CONTENTION", "SERVICE_DEPOSIT_CURRENCY_MISMATCH", "SERVICE_DEPOSIT_INVALID", "INVALID_AMOUNT", "DEFAULT_DRAWER_UNAVAILABLE", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "CATEGORY_NOT_FOUND", "CATEGORY_DISABLED", "CATEGORY_DISABLE_IN_PROGRESS", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "SERVICE_DELIVERY_BASKET_CURRENCY_MISMATCH", "PRODUCT_NOT_AVAILABLE", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_LINE_PRICE_TOO_LARGE", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED", "CART_PROMOTION_UNAVAILABLE", "COUPON_NOT_FOUND", "COUPON_NOT_ACTIVE", "COUPON_EXPIRED", "COUPON_EXHAUSTED", "COUPON_EXHAUSTED_AT_CHECKOUT", "COUPON_MIN_SUBTOTAL", "COUPON_REQUIRES_CUSTOMER", "COUPON_BUDGET_EXHAUSTED", "COUPON_CURRENCY_MISMATCH"];
|
|
1517
|
+
export declare const SERVICE_ORDER_ERROR_CODES: readonly ["UNIT_QUANTITY_NOT_WHOLE", "UNIT_REVISION_STALE", "ROLE_FORBIDDEN", "PARENT_FILTER_CONFLICT", "VALIDATION_FAILED", "INVALID_CURSOR", "INVALID_FROM_DATE", "INVALID_TO_DATE", "INVALID_DATE_RANGE", "REWORK_INDEX_UNAVAILABLE", "STORE_NOT_FOUND", "SERVICE_ORDER_NOT_FOUND", "PRINT_JOB_DOCUMENT_NOT_FOUND", "CUSTOMER_NOT_FOUND", "PARENT_SERVICE_ORDER_NOT_FOUND", "SERVICE_TEMPLATE_NOT_FOUND", "SERVICE_TYPE_REQUIRED", "INVALID_IMAGE_REFERENCE", "MISSING_STORE_CONTEXT", "WARRANTY_BELOW_LEGAL_MINIMUM", "TECHNICIAN_NOT_FOUND", "TECHNICIAN_NOT_ELIGIBLE", "CUSTODY_ILLEGAL_TRANSITION", "SERVICE_ORDER_BILLABLE_FROZEN", "SERVICE_ORDER_EDIT_CHANGED", "SERVICE_ORDER_DISABLED_STATE_UNCHANGED", "APPOINTMENT_NOT_FOUND", "APPOINTMENT_NOT_LINKABLE", "APPOINTMENT_NOT_OPEN", "APPOINTMENT_CUSTOMER_MISMATCH", "APPOINTMENT_VERSION_CONFLICT", "SERVICE_ORDER_TERMINAL", "SERVICE_ORDER_DISABLED", "SERVICE_ORDER_ILLEGAL_TRANSITION", "SERVICE_ORDER_STATUS_CHANGED", "SERVICE_ORDER_OUTCOME_REQUIRED", "SERVICE_ORDER_OUTCOME_NOT_ALLOWED", "SERVICE_ORDER_CUSTODY_NOT_RECEIVED", "SERVICE_ORDER_BILLABLE_NOT_AT_THIS_TRANSITION", "PAYMENT_METHODS_NOT_CONFIGURED", "PAYMENT_METHOD_NOT_FOUND", "SERVICE_ORDER_DEPOSIT_CHANGED", "INVALID_IDEMPOTENCY_KEY", "IDEMPOTENCY_KEY_REUSE", "IDEMPOTENCY_IN_PROGRESS", "IDEMPOTENCY_KEY_FAILED", "IDEMPOTENCY_LOCK_CONTENTION", "SERVICE_DEPOSIT_CURRENCY_MISMATCH", "SERVICE_DEPOSIT_INVALID", "INVALID_AMOUNT", "DEFAULT_DRAWER_UNAVAILABLE", "CURRENCY_MISMATCH", "SHIFT_NOT_OPEN", "SERVICE_BILLING_PRODUCTS_UNAVAILABLE", "CATEGORY_NOT_FOUND", "CATEGORY_DISABLED", "CATEGORY_DISABLE_IN_PROGRESS", "SERVICE_BILLING_PRODUCT_IN_BASKET", "SERVICE_DELIVERY_BASKET_DECISION_REQUIRED", "SERVICE_DELIVERY_BASKET_CURRENCY_MISMATCH", "PRODUCT_NOT_AVAILABLE", "PRODUCT_SALE_LIMIT_EXCEEDED", "PRODUCT_SALE_LIMIT_INVALID", "FX_CONVERSION_UNAVAILABLE", "TRANSACT_ITEMS_LIMIT_EXCEEDED", "SERVICE_LINE_PRICE_TOO_LARGE", "SERVICE_PARTS_RESTORE_EXCEEDS_CONSUMED", "SERVICE_PARTS_RESTORE_EXCEEDS_AMOUNT", "SERVICE_PARTS_STOCK_INSUFFICIENT", "SERVICE_PARTS_PRODUCT_NOT_FOUND", "SERVICE_PARTS_LEDGER_FULL", "SERVICE_PARTS_TOO_MANY", "SERVICE_ORDER_PARTS_CHANGED", "SERVICE_QUOTE_NOT_FOUND", "SERVICE_QUOTE_NOT_OFFERABLE", "SERVICE_QUOTE_HOLDS_TOO_MANY", "SERVICE_QUOTE_SUPERSEDED", "SERVICE_QUOTE_ALREADY_RESOLVED", "SERVICE_QUOTE_LAPSED", "SERVICE_QUOTE_CHANNEL_RESERVED", "SERVICE_QUOTE_CHANNEL_NOT_APPLICABLE", "SERVICE_QUOTE_REASON_NOT_APPLICABLE", "SERVICE_ORDER_QUOTE_CHANGED", "SERVICE_ORDER_NOT_READY", "SERVICE_RENOTIFY_IMPERSONATED", "SERVICE_RENOTIFY_TOO_SOON", "SERVICE_RENOTIFY_CONFLICT", "SERVICE_RENOTIFY_NOT_RECORDED", "SERVICE_RENOTIFY_LEDGER_UNREADABLE", "SERVICE_RENOTIFY_NOT_DISPATCHED", "SERVICE_TIMER_ALREADY_RUNNING", "SERVICE_TIMER_NOT_RUNNING", "SERVICE_TIMER_STOP_CONFLICT", "TECHNICIAN_NOT_CLOCKED_IN", "SERVICE_ORDER_GONE", "SERVICE_WORKLOG_NOT_FOUND", "SERVICE_WORKLOG_NOT_REVERSIBLE", "SERVICE_WORKLOG_ALREADY_REVERSED", "SERVICE_ORDER_WORKLOG_CHANGED", "CART_PROMOTION_UNAVAILABLE", "COUPON_NOT_FOUND", "COUPON_NOT_ACTIVE", "COUPON_EXPIRED", "COUPON_EXHAUSTED", "COUPON_EXHAUSTED_AT_CHECKOUT", "COUPON_MIN_SUBTOTAL", "COUPON_REQUIRES_CUSTOMER", "COUPON_BUDGET_EXHAUSTED", "COUPON_CURRENCY_MISMATCH"];
|
|
1491
1518
|
export type ServiceOrderErrorCode = (typeof SERVICE_ORDER_ERROR_CODES)[number];
|
|
1492
1519
|
export {};
|
package/dist/serviceOrder.js
CHANGED
|
@@ -82,6 +82,8 @@ export const SERVICE_TRANSITIONS = {
|
|
|
82
82
|
* of an exhaustive `Record` cannot omit one. Same reasoning, and the same
|
|
83
83
|
* assertion to a non-empty tuple, as `ORDER_FULFILMENT_STATUSES`.
|
|
84
84
|
*/
|
|
85
|
+
/** Every {@link ServiceOrderDocument}, in the order the app offers them. */
|
|
86
|
+
export const SERVICE_ORDER_DOCUMENTS = ['recepcion', 'presupuesto', 'entrega', 'devolucion'];
|
|
85
87
|
export const SERVICE_STATUSES = Object.keys(SERVICE_TRANSITIONS);
|
|
86
88
|
/**
|
|
87
89
|
* The statuses a service order can end in. Nothing transitions out of these.
|
|
@@ -261,6 +263,9 @@ export const MAX_SERVICE_PICTURES = 20;
|
|
|
261
263
|
* cart keeps its coupon. Remove the coupon from the cart (or decline the
|
|
262
264
|
* basket) and retry.
|
|
263
265
|
* - `VALIDATION_FAILED` · 400 — the body or query failed its schema.
|
|
266
|
+
* - `PRINT_JOB_DOCUMENT_NOT_FOUND` · 404 — `GET ?mode=job-document`: the job is
|
|
267
|
+
* unknown to the caller's store, is not a service-order job, was cancelled, is
|
|
268
|
+
* still held, or ended without being sent. One answer for all five.
|
|
264
269
|
*
|
|
265
270
|
* ⚠️ `ROLE_FORBIDDEN` here is the router's own role check (a print agent, or a
|
|
266
271
|
* role no mode admits); cross-cutting gating refusals are NOT repeated —
|
|
@@ -281,6 +286,8 @@ export const SERVICE_ORDER_ERROR_CODES = [
|
|
|
281
286
|
'REWORK_INDEX_UNAVAILABLE',
|
|
282
287
|
'STORE_NOT_FOUND',
|
|
283
288
|
'SERVICE_ORDER_NOT_FOUND',
|
|
289
|
+
// The print agent's `GET ?mode=job-document` — no fetchable service-order job by that id
|
|
290
|
+
'PRINT_JOB_DOCUMENT_NOT_FOUND',
|
|
284
291
|
// Intake and edit
|
|
285
292
|
'CUSTOMER_NOT_FOUND',
|
|
286
293
|
'PARENT_SERVICE_ORDER_NOT_FOUND',
|
package/dist/socket.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* A client must ignore actions it does not own rather than assume it
|
|
27
27
|
* receives all of them.
|
|
28
28
|
*/
|
|
29
|
-
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "appointmentWaitlist", "attendance", "attributes", "automation-rules", "baskets", "cart", "brands", "cash", "catalogOperation", "categories", "campaigns", "customers", "customerNote", "customerAddress", "customerContact", "deliveries", "globals", "inventory", "invoices", "literals", "loyalty", "orders", "presupuestos", "products", "promotions", "segments", "returns", "rma", "templates", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "warehouses", "zones", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "payment_received", "mp_payment_status_changed", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "orderPaymentAttempt", "orderDelivery", "paymentAttemptChanged", "orderPurchaseWithdrawal", "orderReturnRequest", "purchaseWithdrawalChanged", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders", "cycleCounts", "stockTransfers", "workItems", "wholesaleRequests"];
|
|
29
|
+
export declare const SOCKET_ACTIONS: readonly ["account", "appointments", "appointmentWaitlist", "attendance", "attributes", "automation-rules", "baskets", "cart", "brands", "cash", "catalogOperation", "categories", "campaigns", "customers", "customerNote", "customerAddress", "customerContact", "deliveries", "globals", "inventory", "invoices", "literals", "loyalty", "orders", "presupuestos", "products", "promotions", "segments", "returns", "rma", "templates", "services", "service-templates", "shifts", "stores", "suppliers", "supplier-invoice", "support", "surveys", "users", "warehouses", "zones", "favorites", "webhooks", "account-delete", "baskets-delete", "cart-delete", "log-delete", "notifications", "support-message", "payment_received", "mp_payment_status_changed", "payment_linked", "payment_unlinked", "mercadopago", "mercadopago_dynamic_qr_created", "mercadopago_static_qr_created", "mp_hook_log_appended", "mp_ipn_log_appended", "orderPaymentAttempt", "orderDelivery", "paymentAttemptChanged", "orderPurchaseWithdrawal", "orderReturnRequest", "purchaseWithdrawalChanged", "stripe", "subscription", "caea", "print", "print-order", "print-invoice", "print-product", "print-tag", "print-service-order", "print_job_failed", "request_printers", "printers_changed", "agent_status_changed", "print_rules_changed", "printers_active", "agent_command", "maintenance", "currency_auto_updated", "drain_progress", "integration_event_appended", "userActivityRecorded", "mercadolibre_settlement_period", "customDomain", "purchaseOrders", "cycleCounts", "stockTransfers", "workItems", "wholesaleRequests"];
|
|
30
30
|
/** Union of every server→client data-frame action. */
|
|
31
31
|
export type SocketAction = (typeof SOCKET_ACTIONS)[number];
|
|
32
32
|
/**
|
package/dist/socket.js
CHANGED
|
@@ -582,6 +582,8 @@ export const SOCKET_ACTIONS = [
|
|
|
582
582
|
'print-invoice',
|
|
583
583
|
'print-product',
|
|
584
584
|
'print-tag',
|
|
585
|
+
// A service-order document, id-only (`PrintServiceOrderFrameData`).
|
|
586
|
+
'print-service-order',
|
|
585
587
|
'print_job_failed',
|
|
586
588
|
// BE → agent: re-send your COMPLETE printer set (carries only `storeId`).
|
|
587
589
|
// Needed because `register_printers` only fires on connect/local-change, so
|
package/dist/store.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ declare global {
|
|
|
108
108
|
orderReady?: boolean;
|
|
109
109
|
/** The shipping tag, when an order with a delivery address is marked delivered. */
|
|
110
110
|
deliveryTag?: boolean;
|
|
111
|
+
/** The intake receipt (comprobante de ingreso), when a service order is created. */
|
|
112
|
+
serviceOrderCreated?: boolean;
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
115
|
* One store-wide module a store can switch off for every user — the
|