sinfactura-types 1.10.650 → 1.10.652

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/ai.d.ts CHANGED
@@ -747,6 +747,48 @@ declare global {
747
747
  /** Epoch ms. */
748
748
  updatedAt: number;
749
749
  }
750
+ /** Staff sends a priced quote to the sender of one stored inbound WhatsApp message. No AI spend. */
751
+ interface WhatsAppOrderConfirmationRequest {
752
+ messageId: string;
753
+ presupuestoId: string;
754
+ paymentMethod?: number;
755
+ deliveryMethod?: number;
756
+ }
757
+ type WhatsAppOrderConfirmationStatus = 'sending' | 'awaiting' | 'confirming' | 'confirmed' | 'cancelled' | 'changes_requested' | 'expired' | 'superseded' | 'failed';
758
+ /**
759
+ * Public confirmation returned by POST /whatsapp/order-draft/confirmation and
760
+ * emitted to operator sockets. The private nonce and sender number never reach
761
+ * this shape. An accepted staff-authored quote is converted through the existing
762
+ * atomic order service; an AI parse cannot create an order.
763
+ */
764
+ interface WhatsAppOrderConfirmation {
765
+ messageId: string;
766
+ presupuestoId: string;
767
+ status: WhatsAppOrderConfirmationStatus;
768
+ customerId: string;
769
+ paymentMethod?: number;
770
+ deliveryMethod?: number;
771
+ sentBy: {
772
+ userId: string;
773
+ fullName: string;
774
+ };
775
+ /** Epoch ms; the earlier of the quote expiry and 24 hours after sending. */
776
+ expiresAt: number;
777
+ sentMessageId?: string;
778
+ orderId?: string;
779
+ /** A stable refusal code, never a raw provider message or customer text. */
780
+ error?: string;
781
+ createdAt: number;
782
+ updatedAt: number;
783
+ }
784
+ /**
785
+ * Route refusals in addition to the existing entitlement/impersonation codes.
786
+ * `…_DISABLED` (503) is the `whatsappOrderConfirmationEnabled` platform switch;
787
+ * `…_RECIPIENT_MISMATCH` (409) is a quote whose customer phone is not the
788
+ * source message's sender; `…_SETTLED` (409) carries the final confirmation
789
+ * in `data` (confirmed, cancelled, superseded, or failed after the tap).
790
+ */
791
+ type WhatsAppOrderConfirmationErrorCode = 'VALIDATION_FAILED' | 'ADMIN_REQUIRED' | 'WHATSAPP_MESSAGE_NOT_FOUND' | 'PRESUPUESTO_NOT_FOUND' | 'PRESUPUESTO_NOT_MUTABLE' | 'CUSTOMER_NOT_FOUND' | 'PAYMENT_METHOD_NOT_FOUND' | 'DELIVERY_METHOD_NOT_FOUND' | 'WHATSAPP_WINDOW_CLOSED' | 'WHATSAPP_ORDER_CONFIRMATION_DISABLED' | 'WHATSAPP_ORDER_CONFIRMATION_RECIPIENT_MISMATCH' | 'WHATSAPP_ORDER_CONFIRMATION_PENDING' | 'WHATSAPP_ORDER_CONFIRMATION_SETTLED' | 'PLATFORM_INTEGRATION_DISABLED' | 'WHATSAPP_NOT_CONNECTED' | 'WHATSAPP_RECIPIENT_NOT_ALLOWED' | 'WHATSAPP_SEND_UNCONFIRMED' | 'WHATSAPP_SEND_FAILED' | 'WHATSAPP_TEMPLATE_NOT_APPROVED' | 'WHATSAPP_RECIPIENT_OPTED_OUT' | 'WHATSAPP_RATE_LIMITED' | 'WHATSAPP_ACCOUNT_SUSPENDED' | 'WHATSAPP_TOKEN_REJECTED';
750
792
  /**
751
793
  * The ONE spent-budget refusal every AI spend route answers —
752
794
  * `POST /products/enrich`, `/reports/narrative`, `/marketing/copy`,
@@ -502,10 +502,12 @@ exports.SOCKET_ACTIONS = [
502
502
  'notifications',
503
503
  'support-message',
504
504
  /**
505
- * An automatic WhatsApp order draft settled (`ready` or `failed`). Admin
506
- * sockets of the store only; `data` is a `WhatsAppStoredOrderDraft`.
505
+ * An automatic WhatsApp order draft settled (`ready` or `failed`). The
506
+ * operator sockets of the store only; `data` is a `WhatsAppStoredOrderDraft`.
507
507
  */
508
508
  'whatsapp-order-draft',
509
+ /** Staff quote confirmation state; operator audience only, data: WhatsAppOrderConfirmation. */
510
+ 'whatsapp-order-confirmation',
509
511
  // Payments & providers.
510
512
  'payment_received',
511
513
  // Operator-only observation invalidation; never a receipt or customer frame.
@@ -581,8 +583,8 @@ exports.SOCKET_ACTIONS = [
581
583
  // ⚠️ A frame for a period whose `periodStatus` is `'OPEN'` carries numbers
582
584
  // ML will still restate; a consumer must not render one as final.
583
585
  'mercadolibre_settlement_period',
584
- // BE → all store users when an avanzado custom domain's provisioning state
585
- // moves (`CustomDomainSocketPayload`). Status only: the row's
586
+ // BE → the store's OPERATOR sockets when an avanzado custom domain's provisioning state
587
+ // moves, or a teardown removes it (`provisioning: null`) (`CustomDomainSocketPayload`). Status only: the row's
586
588
  // `verificationToken` is an ownership credential and is never re-sent here.
587
589
  'customDomain',
588
590
  // BE → all store users on every purchase-order write: create, update, cancel,
package/dist/log.d.ts CHANGED
@@ -166,7 +166,8 @@ declare global {
166
166
  createdAt: number;
167
167
  updatedAt: number;
168
168
  dated: number;
169
- mode?: string;
169
+ /** ERROR rows only; the legacy store LOG writer is retired. */
170
+ mode?: 'error';
170
171
  userId?: string;
171
172
  customerId?: string;
172
173
  fullName?: string;
@@ -132,6 +132,32 @@ export interface TenantWipeOpBody extends PlatformOperatorReason {
132
132
  /** Must equal `storeId`. */
133
133
  confirm: string;
134
134
  }
135
+ /** Additive admission contract; route activation follows coordinated rollout. */
136
+ export interface TenantOperationV2Body extends PlatformOperatorReason {
137
+ mode: 'tenant-operation-v2';
138
+ action: 'delete-tenant' | 'reset-tenant';
139
+ requestId: string;
140
+ storeId: string;
141
+ confirm: string;
142
+ }
143
+ export type TenantOperationState = 'queued' | 'running' | 'uncertain' | 'business-completed' | 'completed' | 'failed';
144
+ export interface TenantOperationClassReport {
145
+ classId: string;
146
+ disposition: 'retained' | 'removed' | 'pending' | 'unresolved';
147
+ reason?: string;
148
+ counts?: Record<string, number>;
149
+ }
150
+ export interface TenantOperationAdmission {
151
+ operationId: string;
152
+ status: TenantOperationState;
153
+ action: 'delete-tenant' | 'reset-tenant';
154
+ targetStoreId: string;
155
+ }
156
+ export interface TenantOperationStatus extends TenantOperationAdmission {
157
+ createdAt: number;
158
+ updatedAt: number;
159
+ classes: TenantOperationClassReport[];
160
+ }
135
161
  /**
136
162
  * `POST /platform/literals` — the MANAGER literals write. The tenant route
137
163
  * (`POST /literals`) takes `scope` and `literals` only.
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", "whatsapp-order-draft", "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", "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"];
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", "whatsapp-order-draft", "whatsapp-order-confirmation", "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", "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"];
30
30
  /** Union of every server→client data-frame action. */
31
31
  export type SocketAction = (typeof SOCKET_ACTIONS)[number];
32
32
  /**
@@ -40,6 +40,12 @@ export interface CustomDomainSocketPayload {
40
40
  storeId: string;
41
41
  /** The NORMALIZED host, as stored on the row. */
42
42
  host: string;
43
+ /**
44
+ * The attempt as it now stands, or `null` when a teardown (a deprovision, a
45
+ * revoke, the grace-expiry sweep) removed it — whatever state it was in.
46
+ * Merge the `null` over a cached row: the attempt is gone, and the host can
47
+ * be provisioned again.
48
+ */
43
49
  provisioning: {
44
50
  state: DomainProvisioningState;
45
51
  /** 1-based; see `DomainProvisioning.step`. */
@@ -55,7 +61,7 @@ export interface CustomDomainSocketPayload {
55
61
  /** Unix MILLISECONDS. Present once `state` reaches `active`. */
56
62
  activatedAt?: number;
57
63
  error?: string;
58
- };
64
+ } | null;
59
65
  /**
60
66
  * See `DomainRecord.deactivatesAt`. Every frame the server sends carries the
61
67
  * key — the number, or `null` when the domain is not in grace — so any frame
package/dist/socket.js CHANGED
@@ -499,10 +499,12 @@ export const SOCKET_ACTIONS = [
499
499
  'notifications',
500
500
  'support-message',
501
501
  /**
502
- * An automatic WhatsApp order draft settled (`ready` or `failed`). Admin
503
- * sockets of the store only; `data` is a `WhatsAppStoredOrderDraft`.
502
+ * An automatic WhatsApp order draft settled (`ready` or `failed`). The
503
+ * operator sockets of the store only; `data` is a `WhatsAppStoredOrderDraft`.
504
504
  */
505
505
  'whatsapp-order-draft',
506
+ /** Staff quote confirmation state; operator audience only, data: WhatsAppOrderConfirmation. */
507
+ 'whatsapp-order-confirmation',
506
508
  // Payments & providers.
507
509
  'payment_received',
508
510
  // Operator-only observation invalidation; never a receipt or customer frame.
@@ -578,8 +580,8 @@ export const SOCKET_ACTIONS = [
578
580
  // ⚠️ A frame for a period whose `periodStatus` is `'OPEN'` carries numbers
579
581
  // ML will still restate; a consumer must not render one as final.
580
582
  'mercadolibre_settlement_period',
581
- // BE → all store users when an avanzado custom domain's provisioning state
582
- // moves (`CustomDomainSocketPayload`). Status only: the row's
583
+ // BE → the store's OPERATOR sockets when an avanzado custom domain's provisioning state
584
+ // moves, or a teardown removes it (`provisioning: null`) (`CustomDomainSocketPayload`). Status only: the row's
583
585
  // `verificationToken` is an ownership credential and is never re-sent here.
584
586
  'customDomain',
585
587
  // BE → all store users on every purchase-order write: create, update, cancel,
package/dist/store.d.ts CHANGED
@@ -1665,6 +1665,7 @@ declare global {
1665
1665
  * that ran out) and the domain keeps serving, and stays the shop's canonical
1666
1666
  * address, until this instant. Then the hourly sweep tears it down: the row
1667
1667
  * stays `VERIFIED`, loses `provisioning`, and this field returns to `null`.
1668
+ * Any other teardown (a deprovision, a revoke) removes it.
1668
1669
  * A domain that never went live gets no grace (the date is the moment of the
1669
1670
  * loss). `null` or absent = not in grace; a re-upgrade clears it.
1670
1671
  */
@@ -1681,9 +1682,14 @@ declare global {
1681
1682
  * `lastCheckedAt` / `startedAt` diagnostics, although this type admits them.
1682
1683
  *
1683
1684
  * Unlike `GET /store/domains`, a PENDING claim whose seven-day window has
1684
- * lapsed but which DynamoDB has not reaped yet is still listed.
1685
+ * lapsed but which DynamoDB has not reaped yet is still listed (it still
1686
+ * blocks every other store from the host until it is reaped), and carries
1687
+ * `claimExpired: true` so staff can tell it from a live claim.
1685
1688
  */
1686
- type PlatformDomainRecord = Omit<DomainRecord, 'verificationToken'>;
1689
+ type PlatformDomainRecord = Omit<DomainRecord, 'verificationToken'> & {
1690
+ /** Present (always `true`) only on a PENDING claim whose seven-day window has lapsed. */
1691
+ claimExpired?: true;
1692
+ };
1687
1693
  /**
1688
1694
  * `GET /platform/stores/{storeId}/domains` (supervisorToken: SUPERVISOR,
1689
1695
  * MANAGER) — one store's custom domains plus its public address, so the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.650",
3
+ "version": "1.10.652",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",