platform-types 1.10.859 → 1.10.861

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.
@@ -79,8 +79,8 @@ declare global {
79
79
  /**
80
80
  * Whether a `mode: 'order'` start may name this debit: it is the OLDEST open
81
81
  * debit of its order, counting the ones not listed here (an order's credit
82
- * settles that one first). `false` on an orderless debit, and on a newer
83
- * debit of an order whose older one cannot be paid online.
82
+ * settles that one first). `false` on an orderless debit, and on any newer
83
+ * debit of its order — listed or not, the older one is paid first.
84
84
  */
85
85
  orderPayable: boolean;
86
86
  }
@@ -183,6 +183,9 @@ export declare const BALANCE_ATTEMPT_MAX_DEBITS = 50;
183
183
  * `order` — an orderless debit, or not the oldest open debit of its order.
184
184
  * - `BALANCE_NOTHING_OWED` · 409 — the selection owes nothing.
185
185
  * - `BALANCE_ATTEMPT_NOT_FOUND` · 404 — no such attempt of the caller's.
186
+ * - `BALANCE_ATTEMPT_CONFLICT` · 409 — a start of another selection by the same
187
+ * customer, at the same moment, took this attempt number; nothing was started
188
+ * for this request — retry.
186
189
  */
187
- export declare const BALANCE_PAYMENT_ERROR_CODES: readonly ["BALANCE_PAYMENT_DISABLED", "BALANCE_CURRENCY_UNSUPPORTED", "BALANCE_SELECTION_STALE", "BALANCE_SELECTION_NOT_PREFIX", "BALANCE_NOTHING_OWED", "BALANCE_ATTEMPT_NOT_FOUND"];
190
+ export declare const BALANCE_PAYMENT_ERROR_CODES: readonly ["BALANCE_PAYMENT_DISABLED", "BALANCE_CURRENCY_UNSUPPORTED", "BALANCE_SELECTION_STALE", "BALANCE_SELECTION_NOT_PREFIX", "BALANCE_NOTHING_OWED", "BALANCE_ATTEMPT_NOT_FOUND", "BALANCE_ATTEMPT_CONFLICT"];
188
191
  export {};
@@ -61,6 +61,9 @@ export const BALANCE_ATTEMPT_MAX_DEBITS = 50;
61
61
  * `order` — an orderless debit, or not the oldest open debit of its order.
62
62
  * - `BALANCE_NOTHING_OWED` · 409 — the selection owes nothing.
63
63
  * - `BALANCE_ATTEMPT_NOT_FOUND` · 404 — no such attempt of the caller's.
64
+ * - `BALANCE_ATTEMPT_CONFLICT` · 409 — a start of another selection by the same
65
+ * customer, at the same moment, took this attempt number; nothing was started
66
+ * for this request — retry.
64
67
  */
65
68
  export const BALANCE_PAYMENT_ERROR_CODES = [
66
69
  'BALANCE_PAYMENT_DISABLED',
@@ -69,4 +72,5 @@ export const BALANCE_PAYMENT_ERROR_CODES = [
69
72
  'BALANCE_SELECTION_NOT_PREFIX',
70
73
  'BALANCE_NOTHING_OWED',
71
74
  'BALANCE_ATTEMPT_NOT_FOUND',
75
+ 'BALANCE_ATTEMPT_CONFLICT',
72
76
  ];
@@ -64,6 +64,9 @@ exports.BALANCE_ATTEMPT_MAX_DEBITS = 50;
64
64
  * `order` — an orderless debit, or not the oldest open debit of its order.
65
65
  * - `BALANCE_NOTHING_OWED` · 409 — the selection owes nothing.
66
66
  * - `BALANCE_ATTEMPT_NOT_FOUND` · 404 — no such attempt of the caller's.
67
+ * - `BALANCE_ATTEMPT_CONFLICT` · 409 — a start of another selection by the same
68
+ * customer, at the same moment, took this attempt number; nothing was started
69
+ * for this request — retry.
67
70
  */
68
71
  exports.BALANCE_PAYMENT_ERROR_CODES = [
69
72
  'BALANCE_PAYMENT_DISABLED',
@@ -72,4 +75,5 @@ exports.BALANCE_PAYMENT_ERROR_CODES = [
72
75
  'BALANCE_SELECTION_NOT_PREFIX',
73
76
  'BALANCE_NOTHING_OWED',
74
77
  'BALANCE_ATTEMPT_NOT_FOUND',
78
+ 'BALANCE_ATTEMPT_CONFLICT',
75
79
  ];
@@ -584,6 +584,21 @@ exports.SOCKET_ACTIONS = [
584
584
  'purchaseWithdrawalChanged',
585
585
  'stripe',
586
586
  'subscription',
587
+ /**
588
+ * A message pack's credits landed on the store's bought balance, or a
589
+ * reversed pack took them back. `data` is the store's fresh
590
+ * `MessageBalanceView` (`messaging.ts`), exactly what
591
+ * `GET /message-credits?mode=balance` answers — replace the cached balance.
592
+ * AT MOST once per committed move, never on a provider redelivery: a send
593
+ * lost after the commit is not repeated, so it is a refresh hint, never the
594
+ * only way the balance reaches the client.
595
+ *
596
+ * ⚠️ OPERATOR sockets of the store only, and ADMIN tier only (`wsPostStore`
597
+ * with `audience: 'operator'` and `lowTierData: null` — the tier
598
+ * `GET /message-credits` admits). Never a customer socket. Silent while
599
+ * `tenantMessagingEnabled` is off.
600
+ */
601
+ 'messageCredits',
587
602
  // Fiscal.
588
603
  'caea',
589
604
  // Print agent audience (`wsPostPrinter`).
@@ -92,8 +92,10 @@ exports.TERMINAL_ENROLMENT_ERROR_CODES = [
92
92
  * did not match.
93
93
  * - `PASSWORD_NOT_SET` · 409 — `POST /terminal/activation` and `POST
94
94
  * /terminal/pin`: the employee (a founder registered with Google or Apple) has
95
- * no password. The body carries `providers`, the recorded sign-in providers, as
96
- * `POST /auth/verify-password` does. Nothing is counted against the account.
95
+ * no password. On `/terminal/pin` the body carries `providers`, the recorded
96
+ * sign-in providers, as `POST /auth/verify-password` does; `/terminal/activation`
97
+ * answers it after the lock and captcha gates, with no `providers`. Nothing is
98
+ * counted against the account.
97
99
  * - `IDEMPOTENCY_KEY_REUSE` · 422 / `IDEMPOTENCY_IN_PROGRESS` · 409 /
98
100
  * `INVALID_IDEMPOTENCY_KEY` · 400 — the `Idempotency-Key` header's own
99
101
  * refusals on `POST /terminal/operators`. A MISSING header is
@@ -251,6 +251,42 @@ declare global {
251
251
  currency: MessagePackCurrency;
252
252
  displayOrder: number;
253
253
  }
254
+ /**
255
+ * One message pack the store paid for, as `GET /message-credits?mode=purchases`
256
+ * lists it — one MercadoPago payment, newest first by `paidAt`.
257
+ */
258
+ interface StoreMessagePackPurchase {
259
+ /** The MercadoPago payment id. */
260
+ paymentId: string;
261
+ packId: string;
262
+ /** The pack's CURRENT catalogue name (an inactive pack included); `null` once its row is gone. */
263
+ packName: string | null;
264
+ /** The credits the purchase added — frozen at checkout, never a later reprice. */
265
+ credits: number;
266
+ /** What was paid, in centavos; `null` when the provider reported no amount. */
267
+ amountCents: number | null;
268
+ /** As the provider reported it, lowercase (`ars`); `null` when it reported none. */
269
+ currency: string | null;
270
+ /** When MercadoPago reports it paid, else when the approval landed here. */
271
+ paidAt: number;
272
+ /**
273
+ * The payment refunded or charged back — its credits were taken back.
274
+ * When both happened, the EARLIER one.
275
+ */
276
+ reversal: null | {
277
+ cause: 'refunded' | 'charged_back';
278
+ at: number;
279
+ };
280
+ /** The platform's comprobante for the purchase. Always `null` for now. */
281
+ factura: PlatformFiscalDoc;
282
+ /** The platform's credit note for its reversal. Always `null` for now. */
283
+ creditNote: PlatformFiscalDoc;
284
+ }
285
+ /** One page of the store's pack purchases, newest first. `cursor` present only when more may follow. */
286
+ interface MessagePackPurchasePage {
287
+ items: StoreMessagePackPurchase[];
288
+ cursor?: string;
289
+ }
254
290
  /** `POST /platform/billing/message-packs` (managerToken). */
255
291
  interface MessagePackCreateRequest {
256
292
  name: string;
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", "balancePaymentAttempt", "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"];
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", "balancePaymentAttempt", "orderDelivery", "paymentAttemptChanged", "orderPurchaseWithdrawal", "orderReturnRequest", "purchaseWithdrawalChanged", "stripe", "subscription", "messageCredits", "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
@@ -581,6 +581,21 @@ export const SOCKET_ACTIONS = [
581
581
  'purchaseWithdrawalChanged',
582
582
  'stripe',
583
583
  'subscription',
584
+ /**
585
+ * A message pack's credits landed on the store's bought balance, or a
586
+ * reversed pack took them back. `data` is the store's fresh
587
+ * `MessageBalanceView` (`messaging.ts`), exactly what
588
+ * `GET /message-credits?mode=balance` answers — replace the cached balance.
589
+ * AT MOST once per committed move, never on a provider redelivery: a send
590
+ * lost after the commit is not repeated, so it is a refresh hint, never the
591
+ * only way the balance reaches the client.
592
+ *
593
+ * ⚠️ OPERATOR sockets of the store only, and ADMIN tier only (`wsPostStore`
594
+ * with `audience: 'operator'` and `lowTierData: null` — the tier
595
+ * `GET /message-credits` admits). Never a customer socket. Silent while
596
+ * `tenantMessagingEnabled` is off.
597
+ */
598
+ 'messageCredits',
584
599
  // Fiscal.
585
600
  'caea',
586
601
  // Print agent audience (`wsPostPrinter`).
@@ -724,6 +724,21 @@ declare global {
724
724
  refundedAt?: number;
725
725
  chargedBackAt?: number;
726
726
  }
727
+ /**
728
+ * The platform's own fiscal document for a charge it made a tenant (a
729
+ * subscription payment, a message pack) or for its reversal — never an
730
+ * `Invoice` the tenant issues. Always `null` for now: no platform
731
+ * self-billing writes it yet. `issuedAt` is Unix ms.
732
+ */
733
+ type PlatformFiscalDoc = null | {
734
+ status: 'pending';
735
+ } | {
736
+ status: 'issued';
737
+ letter: 'A' | 'B';
738
+ number: string;
739
+ cae: string;
740
+ issuedAt: number;
741
+ };
727
742
  /**
728
743
  * One charge SINFACTURA made against a tenant, normalized out of whichever
729
744
  * billing provider holds the money. Backs the per-tenant payment history and
@@ -589,8 +589,10 @@ export type TerminalEnrolmentErrorCode = (typeof TERMINAL_ENROLMENT_ERROR_CODES)
589
589
  * did not match.
590
590
  * - `PASSWORD_NOT_SET` · 409 — `POST /terminal/activation` and `POST
591
591
  * /terminal/pin`: the employee (a founder registered with Google or Apple) has
592
- * no password. The body carries `providers`, the recorded sign-in providers, as
593
- * `POST /auth/verify-password` does. Nothing is counted against the account.
592
+ * no password. On `/terminal/pin` the body carries `providers`, the recorded
593
+ * sign-in providers, as `POST /auth/verify-password` does; `/terminal/activation`
594
+ * answers it after the lock and captcha gates, with no `providers`. Nothing is
595
+ * counted against the account.
594
596
  * - `IDEMPOTENCY_KEY_REUSE` · 422 / `IDEMPOTENCY_IN_PROGRESS` · 409 /
595
597
  * `INVALID_IDEMPOTENCY_KEY` · 400 — the `Idempotency-Key` header's own
596
598
  * refusals on `POST /terminal/operators`. A MISSING header is
package/dist/terminal.js CHANGED
@@ -89,8 +89,10 @@ export const TERMINAL_ENROLMENT_ERROR_CODES = [
89
89
  * did not match.
90
90
  * - `PASSWORD_NOT_SET` · 409 — `POST /terminal/activation` and `POST
91
91
  * /terminal/pin`: the employee (a founder registered with Google or Apple) has
92
- * no password. The body carries `providers`, the recorded sign-in providers, as
93
- * `POST /auth/verify-password` does. Nothing is counted against the account.
92
+ * no password. On `/terminal/pin` the body carries `providers`, the recorded
93
+ * sign-in providers, as `POST /auth/verify-password` does; `/terminal/activation`
94
+ * answers it after the lock and captcha gates, with no `providers`. Nothing is
95
+ * counted against the account.
94
96
  * - `IDEMPOTENCY_KEY_REUSE` · 422 / `IDEMPOTENCY_IN_PROGRESS` · 409 /
95
97
  * `INVALID_IDEMPOTENCY_KEY` · 400 — the `Idempotency-Key` header's own
96
98
  * refusals on `POST /terminal/operators`. A MISSING header is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "platform-types",
3
- "version": "1.10.859",
3
+ "version": "1.10.861",
4
4
  "description": "Shared wire and entity contracts for the platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",