@vitrina/api 15.15.0 → 15.17.0

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/index.d.ts CHANGED
@@ -22035,7 +22035,7 @@ interface paths {
22035
22035
  put?: never;
22036
22036
  /**
22037
22037
  * Submit a website buyer inquiry (dealer-website write API)
22038
- * @description Creates a CRM lead with `website` origin, attaching the inquired Vehículo when `vehicle_id` is given. A proyecto form (Módulo Proyectos) sends `project_id` and/or `unit_model_id` (a tipología names its proyecto): the lead lands on the proyecto, is routed to its ejecutivos, and `message` becomes optional. `attribution` carries the visitor's `first_touch` and `last_touch` (utm_*, gclid, fbclid, anonymous_id); both are kept on the lead. Requires the write-only `leads:intake` scope (never `leads:write`). Returns a minimized `{ status }` ack — `received` on create, `duplicate` on dedup — and echoes no internal ids. Rate-limited like every authenticated endpoint; a hidden `hp_website` honeypot field silently drops spam.
22038
+ * @description Creates a CRM lead with `website` origin, attaching the inquired Vehículo when `vehicle_id` is given. A proyecto form (Módulo Proyectos) sends `project_id` and/or `unit_model_id` (a tipología names its proyecto): the lead lands on the proyecto, is routed to its ejecutivos, and `message` becomes optional. `attribution` carries the visitor's `first_touch` and `last_touch` (utm_*, gclid, fbclid, anonymous_id); both are kept on the lead. `value_amount` is the lead's value; `quote_amount` is a figure the site quoted that is not the deal (a trade-in quote): it only fills the first-touch template's amount and the inbox card when `value_amount` is absent, and is never stored as the lead's value. Requires the write-only `leads:intake` scope (never `leads:write`). Returns a minimized `{ status }` ack — `received` on create, `duplicate` on dedup — and echoes no internal ids. Rate-limited like every authenticated endpoint; a hidden `hp_website` honeypot field silently drops spam.
22039
22039
  */
22040
22040
  post: {
22041
22041
  parameters: {
@@ -22101,6 +22101,7 @@ interface paths {
22101
22101
  stage_id?: string;
22102
22102
  value_amount?: number;
22103
22103
  value_currency?: string;
22104
+ quote_amount?: number;
22104
22105
  item_label?: string;
22105
22106
  source_ref?: string;
22106
22107
  fields?: {
@@ -88356,6 +88357,180 @@ interface paths {
88356
88357
  };
88357
88358
  trace?: never;
88358
88359
  };
88360
+ "/finanzas/produccion": {
88361
+ parameters: {
88362
+ query?: never;
88363
+ header?: never;
88364
+ path?: never;
88365
+ cookie?: never;
88366
+ };
88367
+ /**
88368
+ * Producción, cobrado y boleteado (clinics)
88369
+ * @description The clinic’s bridge per month and for the range: **producción** (treatments performed), **cobrado** (patient payments received) and **boleteado** (boletas DTE 39/41 issued, at totals, minus notas de crédito on boletas), with **por cobrar** (produced, not paid) and **anticipos** (paid, not produced) per patient, so that producción − por cobrar + anticipos = cobrado; the range column nets per patient. Clinic money authority: a clinic mirrored from Dentalink/Medilink reads producción and cobrado only from the mirror (`source: clinic_mirror`), otherwise from Vitrina’s registers; bank movements are never income. Boletas are checked against payments both ways (`payments_without_boleta`, `boletas_without_payment`): first the link the clinic system holds, then a boleta to the payment’s own patient, then a monthly summary boleta (to the generic receiver 66.666.666-6 or to nobody, named by no payment) covers its month’s remaining payments (`monthly_boletas`). `ingresos_resultado_clp` is the Resultado’s income for the same months, to read next to it. A caller without the patient roster sees «Paciente A. P.» and no RUT. Other verticals answer `is_clinic: false` with empty figures. Requires the `finanzas` add-on — without it every Finanzas operation answers `402 ENTITLEMENT_NOT_ACTIVE` (`details.required = ["finanzas"]`). Requires `finanzas_reports:read`.
88370
+ */
88371
+ get: {
88372
+ parameters: {
88373
+ query?: {
88374
+ from?: string;
88375
+ to?: string;
88376
+ limit?: number;
88377
+ };
88378
+ header?: never;
88379
+ path?: never;
88380
+ cookie?: never;
88381
+ };
88382
+ requestBody?: never;
88383
+ responses: {
88384
+ /** @description The bridge */
88385
+ 200: {
88386
+ headers: {
88387
+ [name: string]: unknown;
88388
+ };
88389
+ content: {
88390
+ /**
88391
+ * @example {
88392
+ * "data": {
88393
+ * "from": "2026-10",
88394
+ * "to": "2026-10",
88395
+ * "current_month": "2026-11",
88396
+ * "currency": "CLP",
88397
+ * "is_clinic": true,
88398
+ * "source": "clinic_mirror",
88399
+ * "boletas_source": "finanzas",
88400
+ * "months": [
88401
+ * {
88402
+ * "month": "2026-10",
88403
+ * "label": "octubre 2026",
88404
+ * "proforma": false,
88405
+ * "produccion_clp": 61340000,
88406
+ * "cobrado_clp": 58204222,
88407
+ * "boleteado_clp": 57726146,
88408
+ * "por_cobrar_clp": 4955778,
88409
+ * "anticipos_clp": 1820000,
88410
+ * "cobrado_sin_boleta_clp": 478076,
88411
+ * "boletas_sin_pago_clp": 0,
88412
+ * "ingresos_resultado_clp": 57726146
88413
+ * }
88414
+ * ],
88415
+ * "total": {
88416
+ * "produccion_clp": 61340000,
88417
+ * "cobrado_clp": 58204222,
88418
+ * "boleteado_clp": 57726146,
88419
+ * "por_cobrar_clp": 4955778,
88420
+ * "anticipos_clp": 1820000,
88421
+ * "cobrado_sin_boleta_clp": 478076,
88422
+ * "boletas_sin_pago_clp": 0,
88423
+ * "ingresos_resultado_clp": 57726146
88424
+ * },
88425
+ * "payments_without_boleta": {
88426
+ * "count": 3,
88427
+ * "total_clp": 478076,
88428
+ * "items": [
88429
+ * {
88430
+ * "payment_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f7101",
88431
+ * "source": "clinic_mirror",
88432
+ * "day": "2026-10-31",
88433
+ * "amount_clp": 250000,
88434
+ * "without_boleta_clp": 250000,
88435
+ * "reason": "sin_boleta",
88436
+ * "folios": [],
88437
+ * "patient": {
88438
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f7301",
88439
+ * "name": "Paciente A. P.",
88440
+ * "rut": null
88441
+ * }
88442
+ * }
88443
+ * ]
88444
+ * },
88445
+ * "boletas_without_payment": {
88446
+ * "count": 0,
88447
+ * "total_clp": 0,
88448
+ * "items": []
88449
+ * },
88450
+ * "monthly_boletas": [
88451
+ * {
88452
+ * "document_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f7201",
88453
+ * "dte_type": 41,
88454
+ * "folio": "1204",
88455
+ * "day": "2026-10-31",
88456
+ * "month": "2026-10",
88457
+ * "total_clp": 57726146,
88458
+ * "covered_clp": 57726146,
88459
+ * "payments": 412
88460
+ * }
88461
+ * ]
88462
+ * }
88463
+ * }
88464
+ */
88465
+ "application/json": {
88466
+ data: components["schemas"]["FinanzasPuente"];
88467
+ };
88468
+ };
88469
+ };
88470
+ /** @description Validation error */
88471
+ 400: {
88472
+ headers: {
88473
+ [name: string]: unknown;
88474
+ };
88475
+ content: {
88476
+ "application/json": components["schemas"]["Error"];
88477
+ };
88478
+ };
88479
+ /** @description Unauthorized */
88480
+ 401: {
88481
+ headers: {
88482
+ [name: string]: unknown;
88483
+ };
88484
+ content: {
88485
+ "application/json": components["schemas"]["Error"];
88486
+ };
88487
+ };
88488
+ /** @description Forbidden */
88489
+ 403: {
88490
+ headers: {
88491
+ [name: string]: unknown;
88492
+ };
88493
+ content: {
88494
+ "application/json": components["schemas"]["Error"];
88495
+ };
88496
+ };
88497
+ /** @description Not found */
88498
+ 404: {
88499
+ headers: {
88500
+ [name: string]: unknown;
88501
+ };
88502
+ content: {
88503
+ "application/json": components["schemas"]["Error"];
88504
+ };
88505
+ };
88506
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
88507
+ 409: {
88508
+ headers: {
88509
+ [name: string]: unknown;
88510
+ };
88511
+ content: {
88512
+ "application/json": components["schemas"]["Error"];
88513
+ };
88514
+ };
88515
+ /** @description Rate limited */
88516
+ 429: {
88517
+ headers: {
88518
+ [name: string]: unknown;
88519
+ };
88520
+ content: {
88521
+ "application/json": components["schemas"]["Error"];
88522
+ };
88523
+ };
88524
+ };
88525
+ };
88526
+ put?: never;
88527
+ post?: never;
88528
+ delete?: never;
88529
+ options?: never;
88530
+ head?: never;
88531
+ patch?: never;
88532
+ trace?: never;
88533
+ };
88359
88534
  "/clinic/evidence-cards": {
88360
88535
  parameters: {
88361
88536
  query?: never;
@@ -138959,6 +139134,8 @@ interface paths {
138959
139134
  *
138960
139135
  * Each row also carries `campaign_origin` — the newest campaign send stored in the thread (`null` when none): its campaign, when it left, whether the send created the thread, and whether it is still the newest message (`awaiting_reply`). `fromCampaign=true` lists every such thread, closed ones included.
138961
139136
  *
139137
+ * Each row also carries `waiting_since` — when its customer started waiting on a human, `null` when nobody waits (the «Esperando respuesta» rule; see the `waiting` parameter). `waiting=true` lists only waiting conversations, team-wide; `sort=wait` orders urgent first, then the longest wait.
139138
+ *
138962
139139
  * Rows here do NOT carry `ad_origin_nudge` — that field is single-conversation-read only, to avoid a per-row integration lookup on every page of the inbox.
138963
139140
  *
138964
139141
  * `fields=summary` answers the SAME page with only the identifying and funnel scalars per row — `id`, `display_id`, `channel`, `source`, `status`, `handler`, `assignee_user_id`, `contact_id`, `ticket_id`, `awaiting_human_since`, `first_ai_message_at`, `last_message_date`, `created_at`, `ad_origin` — plus `contact_name`, `ticket_status` and `current_stage_id` off the embeds, and `assignee_name` / `unread` when the list computed them (an api_key has no read markers, so no `unread`). No `contact`, `ticket`, `lastMessage`, `tags`, `marketplaceWindow` or `last_call`. `meta` and `counts` are unchanged. A 20-row page is ~147k characters at `full` (the default, byte-identical to omitting the parameter) and a fraction of that at `summary`; page with `summary` to choose, then `GET /conversations/{id}` for one thread whole.
@@ -138990,7 +139167,10 @@ interface paths {
138990
139167
  aiReplied?: boolean | null;
138991
139168
  fromAd?: boolean | null;
138992
139169
  fromCampaign?: boolean | null;
138993
- sort?: "created_at" | "updated_at" | "last_message_date";
139170
+ /** @description true: only conversations where a customer is waiting on a human («Esperando respuesta»), team-wide. Waiting = open or pending, not filtered, on a channel you can reply in, and either an AI handoff nobody on the team has answered yet (a reply from ANY teammate clears it, including WhatsApp Business / Instagram app replies; a silent «Visita acordada» notice needs no answer) or a human-handled thread whose last message is the customer’s; waits older than 7 days are left out. Each row carries `waiting_since`. Pair with `sort=wait` for the queue order. */
139171
+ waiting?: boolean | null;
139172
+ /** @description `wait`: urgent (`handoff_urgent`) first, then by `waiting_since` — `order=desc` (default) is the longest wait first, `asc` the newest; conversations that are not waiting go last. */
139173
+ sort?: "created_at" | "updated_at" | "last_message_date" | "wait";
138994
139174
  order?: "asc" | "desc";
138995
139175
  include?: "counts";
138996
139176
  /** @description `full` (default): the inbox row with its `contact`, `ticket`, `lastMessage`, `tags`, `marketplaceWindow`, `ad_origin` and `last_call`, exactly as without the parameter. `summary`: only the identifying and funnel scalars — `id`, `display_id`, `channel`, `source`, `status`, `handler`, `assignee_user_id`, `contact_id`, `ticket_id`, `awaiting_human_since`, `first_ai_message_at`, `last_message_date`, `created_at`, `ad_origin`, plus `contact_name`, `ticket_status`, `current_stage_id` off the embeds and `assignee_name` / `unread` when the list computed them. Pagination, `meta` and `counts` are unchanged. Use `summary` to page the inbox cheaply, then `GET /conversations/{id}` for one thread in full. */
@@ -139129,7 +139309,8 @@ interface paths {
139129
139309
  * }
139130
139310
  * ],
139131
139311
  * "last_call": null,
139132
- * "handoff_urgent": false
139312
+ * "handoff_urgent": false,
139313
+ * "waiting_since": null
139133
139314
  * },
139134
139315
  * {
139135
139316
  * "id": "bbbbbbbb-0000-4000-8000-000000000002",
@@ -139266,7 +139447,8 @@ interface paths {
139266
139447
  * },
139267
139448
  * "tags": [],
139268
139449
  * "last_call": null,
139269
- * "handoff_urgent": false
139450
+ * "handoff_urgent": false,
139451
+ * "waiting_since": null
139270
139452
  * }
139271
139453
  * ],
139272
139454
  * "meta": {
@@ -139555,9 +139737,11 @@ interface paths {
139555
139737
  cookie?: never;
139556
139738
  };
139557
139739
  /**
139558
- * Inbox badge counts (my open / unread / mentions / unassigned)
139740
+ * Inbox badge counts (my open / unread / mentions / unassigned / waiting)
139559
139741
  * @description The four badge counts on their own, scoped to the calling principal: `myOpen` and `myUnread` are the conversations assigned to the member behind the credential, `myMentions` the ones that @-mention them, `unassigned` the whole workspace’s unowned queue. An API key has no member behind it, so its three "my" counts read 0 and only `unassigned` is meaningful — use a personal token to get a person’s badges.
139560
139742
  *
139743
+ * «Esperando respuesta» (the waiting queue): `waiting` is how many conversations have a customer waiting on a human, team-wide (the list `GET /conversations?waiting=true` returns exactly these); `waitingUrgent` how many of them are flagged urgent; `waitingMine` how many are assigned to the caller (0 for an API key); `waitingOldestSince` when the longest wait started (ISO, `null` when nobody waits) — render it as «el más antiguo 2 h».
139744
+ *
139561
139745
  * `GET /conversations?include=counts` returns the same payload beside a page of conversations; this route exists for the caller that wants the badges without one.
139562
139746
  */
139563
139747
  get: {
@@ -139581,7 +139765,11 @@ interface paths {
139581
139765
  * "myOpen": 3,
139582
139766
  * "myUnread": 1,
139583
139767
  * "unassigned": 2,
139584
- * "myMentions": 0
139768
+ * "myMentions": 0,
139769
+ * "waiting": 3,
139770
+ * "waitingUrgent": 1,
139771
+ * "waitingMine": 1,
139772
+ * "waitingOldestSince": "2026-10-31T13:05:00.000Z"
139585
139773
  * }
139586
139774
  * }
139587
139775
  */
@@ -139820,6 +140008,7 @@ interface paths {
139820
140008
  * ],
139821
140009
  * "last_call": null,
139822
140010
  * "handoff_urgent": false,
140011
+ * "waiting_since": null,
139823
140012
  * "ad_origin_nudge": null,
139824
140013
  * "handoff_resolved_suggested": false,
139825
140014
  * "message": [
@@ -229644,7 +229833,7 @@ interface paths {
229644
229833
  get: {
229645
229834
  parameters: {
229646
229835
  query?: {
229647
- status?: ("draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded")[];
229836
+ status?: ("draft" | "pending_payment" | "paid" | "preparing" | "ready_for_pickup" | "shipped" | "delivered" | "cancelled" | "refunded")[];
229648
229837
  source?: ("native" | "shopify" | "woocommerce")[];
229649
229838
  contact_id?: string;
229650
229839
  conversation_id?: string;
@@ -229691,6 +229880,7 @@ interface paths {
229691
229880
  * "item_count": 2,
229692
229881
  * "stock_decremented_at": null,
229693
229882
  * "paid_at": null,
229883
+ * "ready_for_pickup_at": null,
229694
229884
  * "shipped_at": null,
229695
229885
  * "delivered_at": null,
229696
229886
  * "cancelled_at": null,
@@ -229950,6 +230140,7 @@ interface paths {
229950
230140
  * "item_count": 2,
229951
230141
  * "stock_decremented_at": null,
229952
230142
  * "paid_at": null,
230143
+ * "ready_for_pickup_at": null,
229953
230144
  * "shipped_at": null,
229954
230145
  * "delivered_at": null,
229955
230146
  * "cancelled_at": null,
@@ -230091,7 +230282,7 @@ interface paths {
230091
230282
  };
230092
230283
  /**
230093
230284
  * Get an order
230094
- * @description One order with its lines, by uuid or display id (`O-42`). `status` is the order’s lifecycle; whether money arrived is the ledger’s (`GET /obligations?group_id=…`). Requires `orders:read`.
230285
+ * @description One order with its lines and the buyer emails it sent (`buyer_emails`: kind, status, sent_at), by uuid or display id (`O-42`). `status` is the order’s lifecycle; whether money arrived is the ledger’s (`GET /obligations?group_id=…`). Requires `orders:read`.
230095
230286
  */
230096
230287
  get: {
230097
230288
  parameters: {
@@ -230118,7 +230309,7 @@ interface paths {
230118
230309
  * "display_id": "O-42",
230119
230310
  * "source": "native",
230120
230311
  * "external_id": null,
230121
- * "status": "pending_payment",
230312
+ * "status": "paid",
230122
230313
  * "contact_id": "0199e3b0-0000-7000-8000-0000000000c1",
230123
230314
  * "conversation_id": "0199e3b0-0000-7000-8000-0000000000c2",
230124
230315
  * "lead_id": "0199e3b0-0000-7000-8000-0000000000c3",
@@ -230136,6 +230327,7 @@ interface paths {
230136
230327
  * "item_count": 2,
230137
230328
  * "stock_decremented_at": null,
230138
230329
  * "paid_at": null,
230330
+ * "ready_for_pickup_at": null,
230139
230331
  * "shipped_at": null,
230140
230332
  * "delivered_at": null,
230141
230333
  * "cancelled_at": null,
@@ -230197,12 +230389,24 @@ interface paths {
230197
230389
  * "line_total_clp": 20000,
230198
230390
  * "obligation_id": "0199e3b0-0000-7000-8000-0000000000a2"
230199
230391
  * }
230392
+ * ],
230393
+ * "buyer_emails": [
230394
+ * {
230395
+ * "kind": "order_confirmed",
230396
+ * "status": "delivered",
230397
+ * "to": "comprador@example.com",
230398
+ * "sent_at": "2026-10-31T14:02:11.000Z",
230399
+ * "delivered_at": "2026-10-31T14:02:13.000Z",
230400
+ * "failed_at": null,
230401
+ * "attempts": 1,
230402
+ * "created_at": "2026-10-31T14:02:10.000Z"
230403
+ * }
230200
230404
  * ]
230201
230405
  * }
230202
230406
  * }
230203
230407
  */
230204
230408
  "application/json": {
230205
- data: components["schemas"]["CommerceOrder"];
230409
+ data: components["schemas"]["CommerceOrderDetail"];
230206
230410
  };
230207
230411
  };
230208
230412
  };
@@ -230329,6 +230533,7 @@ interface paths {
230329
230533
  * "item_count": 2,
230330
230534
  * "stock_decremented_at": null,
230331
230535
  * "paid_at": null,
230536
+ * "ready_for_pickup_at": null,
230332
230537
  * "shipped_at": null,
230333
230538
  * "delivered_at": null,
230334
230539
  * "cancelled_at": null,
@@ -230596,7 +230801,7 @@ interface paths {
230596
230801
  put?: never;
230597
230802
  /**
230598
230803
  * Move a paid order along fulfilment
230599
- * @description `paid → preparing → shipped → delivered`; a step may be skipped (paid → shipped). An unpaid order answers 409 `invalid_transition`. The lead follows on an `ecommerce_orders` board (Despachado, Postventa). Fires `order.status_changed`. Requires `orders:write`.
230804
+ * @description Courier: `paid → preparing → shipped → delivered`. Pickup: `paid → preparing → ready_for_pickup → delivered` («Listo para retiro»). A step may be skipped (paid → shipped, paid → delivered). An unpaid order answers 409 `invalid_transition`; `ready_for_pickup` on a courier order 409 `not_a_pickup_order`; `shipped` on a pickup order 409 `pickup_order_not_shipped`. A storefront buyer is emailed once per step (ready_for_pickup, shipped, delivered; the confirmation goes out when it is paid), and a failed email never fails the move. The lead follows on an `ecommerce_orders` board (Despachado, Postventa). Fires `order.status_changed`. Requires `orders:write`.
230600
230805
  */
230601
230806
  post: {
230602
230807
  parameters: {
@@ -230619,10 +230824,10 @@ interface paths {
230619
230824
  */
230620
230825
  "application/json": {
230621
230826
  /**
230622
- * @description The next fulfilment step. A paid order may skip steps (paid → shipped).
230827
+ * @description The next fulfilment step. A paid order may skip steps (paid → shipped). `ready_for_pickup` («Listo para retiro») only for `delivery.method = pickup` (else 409 `not_a_pickup_order`); a pickup order is never `shipped` (409 `pickup_order_not_shipped`). Each of paid, ready_for_pickup, shipped and delivered emails a storefront buyer once.
230623
230828
  * @enum {string}
230624
230829
  */
230625
- status: "preparing" | "shipped" | "delivered";
230830
+ status: "preparing" | "ready_for_pickup" | "shipped" | "delivered";
230626
230831
  };
230627
230832
  };
230628
230833
  };
@@ -230659,6 +230864,7 @@ interface paths {
230659
230864
  * "item_count": 2,
230660
230865
  * "stock_decremented_at": null,
230661
230866
  * "paid_at": null,
230867
+ * "ready_for_pickup_at": null,
230662
230868
  * "shipped_at": null,
230663
230869
  * "delivered_at": null,
230664
230870
  * "cancelled_at": null,
@@ -230862,6 +231068,7 @@ interface paths {
230862
231068
  * "item_count": 2,
230863
231069
  * "stock_decremented_at": null,
230864
231070
  * "paid_at": null,
231071
+ * "ready_for_pickup_at": null,
230865
231072
  * "shipped_at": null,
230866
231073
  * "delivered_at": null,
230867
231074
  * "cancelled_at": "2026-10-15T12:30:00.000Z",
@@ -231069,6 +231276,7 @@ interface paths {
231069
231276
  * "item_count": 2,
231070
231277
  * "stock_decremented_at": null,
231071
231278
  * "paid_at": "2026-10-15T12:05:00.000Z",
231279
+ * "ready_for_pickup_at": null,
231072
231280
  * "shipped_at": null,
231073
231281
  * "delivered_at": null,
231074
231282
  * "cancelled_at": null,
@@ -258762,6 +258970,109 @@ interface components {
258762
258970
  updated_by: string | null;
258763
258971
  updated_at: string | null;
258764
258972
  };
258973
+ FinanzasPuente: {
258974
+ from: string;
258975
+ to: string;
258976
+ current_month: string;
258977
+ /** @enum {string} */
258978
+ currency: "CLP";
258979
+ is_clinic: boolean;
258980
+ /**
258981
+ * @description Where producción and cobrado come from: the clinic system mirror (Dentalink/Medilink) or Vitrina’s own registers. Never both.
258982
+ * @enum {string|null}
258983
+ */
258984
+ source: "clinic_mirror" | "vitrina" | null;
258985
+ /** @enum {string} */
258986
+ boletas_source: "finanzas" | "clinic_register" | "none";
258987
+ months: {
258988
+ month: string;
258989
+ label: string;
258990
+ proforma: boolean;
258991
+ /** @description Treatments performed (the clinic system’s value). */
258992
+ produccion_clp: number;
258993
+ /** @description Patient payments received. */
258994
+ cobrado_clp: number;
258995
+ /** @description Boletas issued (DTE 39/41, at totals), minus notas de crédito on boletas. */
258996
+ boleteado_clp: number;
258997
+ /** @description Produced and not paid in the period, per patient. */
258998
+ por_cobrar_clp: number;
258999
+ /** @description Paid and not produced in the period, per patient. */
259000
+ anticipos_clp: number;
259001
+ cobrado_sin_boleta_clp: number;
259002
+ boletas_sin_pago_clp: number;
259003
+ /** @description The Resultado’s «Ingresos» (issued documents, net) for the same months. */
259004
+ ingresos_resultado_clp: number;
259005
+ }[];
259006
+ /** @description The range, netted per patient. */
259007
+ total: {
259008
+ /** @description Treatments performed (the clinic system’s value). */
259009
+ produccion_clp: number;
259010
+ /** @description Patient payments received. */
259011
+ cobrado_clp: number;
259012
+ /** @description Boletas issued (DTE 39/41, at totals), minus notas de crédito on boletas. */
259013
+ boleteado_clp: number;
259014
+ /** @description Produced and not paid in the period, per patient. */
259015
+ por_cobrar_clp: number;
259016
+ /** @description Paid and not produced in the period, per patient. */
259017
+ anticipos_clp: number;
259018
+ cobrado_sin_boleta_clp: number;
259019
+ boletas_sin_pago_clp: number;
259020
+ /** @description The Resultado’s «Ingresos» (issued documents, net) for the same months. */
259021
+ ingresos_resultado_clp: number;
259022
+ };
259023
+ payments_without_boleta: {
259024
+ count: number;
259025
+ total_clp: number;
259026
+ items: {
259027
+ /** Format: uuid */
259028
+ payment_id: string;
259029
+ /** @enum {string} */
259030
+ source: "clinic_mirror" | "vitrina";
259031
+ day: string;
259032
+ amount_clp: number;
259033
+ without_boleta_clp: number;
259034
+ /** @enum {string} */
259035
+ reason: "sin_boleta" | "boleta_no_encontrada";
259036
+ folios: string[];
259037
+ patient: {
259038
+ /** Format: uuid */
259039
+ id: string;
259040
+ /** @description Full name; «Paciente A. P.» for a caller without the patient roster. */
259041
+ name: string;
259042
+ rut: string | null;
259043
+ } | null;
259044
+ }[];
259045
+ };
259046
+ boletas_without_payment: {
259047
+ count: number;
259048
+ total_clp: number;
259049
+ items: {
259050
+ document_id: string;
259051
+ dte_type: number | null;
259052
+ folio: string | null;
259053
+ day: string;
259054
+ total_clp: number;
259055
+ without_payment_clp: number;
259056
+ receiver: {
259057
+ name: string | null;
259058
+ rut: string | null;
259059
+ /** Format: uuid */
259060
+ patient_id: string | null;
259061
+ };
259062
+ monthly_summary: boolean;
259063
+ }[];
259064
+ };
259065
+ monthly_boletas: {
259066
+ document_id: string;
259067
+ dte_type: number | null;
259068
+ folio: string | null;
259069
+ day: string;
259070
+ month: string;
259071
+ total_clp: number;
259072
+ covered_clp: number;
259073
+ payments: number;
259074
+ }[];
259075
+ };
258765
259076
  ClinicImportedBalanceBudget: {
258766
259077
  /** Format: uuid */
258767
259078
  budget_id: string;
@@ -267652,7 +267963,7 @@ interface components {
267652
267963
  order_id: string;
267653
267964
  display_id: string;
267654
267965
  /** @enum {string} */
267655
- status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded";
267966
+ status: "draft" | "pending_payment" | "paid" | "preparing" | "ready_for_pickup" | "shipped" | "delivered" | "cancelled" | "refunded";
267656
267967
  total_clp: number;
267657
267968
  currency: string;
267658
267969
  lines: {
@@ -267742,7 +268053,120 @@ interface components {
267742
268053
  /** @description A store order: the store's modification time as of the last applied store event. */
267743
268054
  external_updated_at: string | null;
267744
268055
  /** @enum {string} */
267745
- status: "draft" | "pending_payment" | "paid" | "preparing" | "shipped" | "delivered" | "cancelled" | "refunded";
268056
+ status: "draft" | "pending_payment" | "paid" | "preparing" | "ready_for_pickup" | "shipped" | "delivered" | "cancelled" | "refunded";
268057
+ /** Format: uuid */
268058
+ contact_id: string | null;
268059
+ /** Format: uuid */
268060
+ conversation_id: string | null;
268061
+ /** Format: uuid */
268062
+ lead_id: string | null;
268063
+ /** Format: uuid */
268064
+ obligation_group_id: string | null;
268065
+ currency: string;
268066
+ delivery: {
268067
+ [key: string]: unknown;
268068
+ };
268069
+ notes: string | null;
268070
+ /** @description What the order charges for delivery (a courier quote frozen at checkout, `delivery.method = shipping`). Included in `total_clp`. */
268071
+ shipping_clp: number;
268072
+ /** @description Σ of the lines + `shipping_clp`. */
268073
+ total_clp: number;
268074
+ item_count: number;
268075
+ stock_decremented_at: string | null;
268076
+ paid_at: string | null;
268077
+ /** @description A pickup order: when the store marked it ready («Listo para retiro»), first time. */
268078
+ ready_for_pickup_at: string | null;
268079
+ shipped_at: string | null;
268080
+ delivered_at: string | null;
268081
+ cancelled_at: string | null;
268082
+ cancelled_reason: string | null;
268083
+ /** @description When a paid order was refunded in full (`status: refunded`). */
268084
+ refunded_at: string | null;
268085
+ refund_reason: string | null;
268086
+ /** @description The payment provider refund id (Mercado Pago refund id, or the Webpay refund authorization code), when returned. */
268087
+ refund_reference: string | null;
268088
+ /** @description A storefront checkout’s buyer as declared at purchase (`POST /orders/checkout`). `{}` for orders created by staff or the agent: the contact is the buyer. */
268089
+ buyer: {
268090
+ name?: string | null;
268091
+ rut?: string | null;
268092
+ phone?: string | null;
268093
+ email?: string | null;
268094
+ };
268095
+ /** @description A storefront checkout’s ad touch (utm_*, fbclid, gclid, anonymous_id, fbp, fbc). `{}` otherwise. */
268096
+ attribution: {
268097
+ [key: string]: string;
268098
+ };
268099
+ /** @description A storefront checkout’s browser InitiateCheckout `eventID` (the server InitiateCheckout and Purchase reuse it). Null otherwise. */
268100
+ client_event_id: string | null;
268101
+ /** @description A storefront checkout’s return pages. Null = the Vitrina receipt page. */
268102
+ return_urls: {
268103
+ success: string;
268104
+ failure: string;
268105
+ pending: string;
268106
+ } | null;
268107
+ /** Format: uuid */
268108
+ created_by: string | null;
268109
+ created_at: string;
268110
+ updated_at: string;
268111
+ lines: {
268112
+ /** Format: uuid */
268113
+ id: string;
268114
+ position: number;
268115
+ /** Format: uuid */
268116
+ product_id: string | null;
268117
+ /** Format: uuid */
268118
+ variant_id: string | null;
268119
+ title: string;
268120
+ variant_title: string | null;
268121
+ /** @description The variant’s option values frozen at creation (`[{name: "Color", value: "Negro"}]`). Empty for a simple product and for lines created before 2026-10-29. */
268122
+ variant_options: {
268123
+ name: string;
268124
+ value: string;
268125
+ }[];
268126
+ sku: string | null;
268127
+ unit_price_clp: number;
268128
+ quantity: number;
268129
+ line_total_clp: number;
268130
+ /** Format: uuid */
268131
+ obligation_id: string | null;
268132
+ }[];
268133
+ };
268134
+ OrderBuyerEmail: {
268135
+ /**
268136
+ * @description Which step: order_confirmed (paid), ready_for_pickup, shipped, delivered.
268137
+ * @enum {string}
268138
+ */
268139
+ kind: "order_confirmed" | "ready_for_pickup" | "shipped" | "delivered";
268140
+ /**
268141
+ * @description `pending` while sending; `sent` accepted by the mail provider; `delivered` the buyer’s server took it; `failed` not sent (retried while attempts remain); `bounced` / `complained` reported back by the provider.
268142
+ * @enum {string}
268143
+ */
268144
+ status: "pending" | "sent" | "delivered" | "failed" | "bounced" | "complained";
268145
+ /** @description The buyer address it went to. */
268146
+ to: string;
268147
+ sent_at: string | null;
268148
+ delivered_at: string | null;
268149
+ failed_at: string | null;
268150
+ attempts: number;
268151
+ created_at: string;
268152
+ };
268153
+ CommerceOrderDetail: {
268154
+ /** Format: uuid */
268155
+ id: string;
268156
+ /** Format: uuid */
268157
+ tenant_id: string;
268158
+ display_id: string;
268159
+ /** @enum {string} */
268160
+ source: "native" | "shopify" | "woocommerce";
268161
+ external_id: string | null;
268162
+ /** @description A store order: the number the store shows (it can differ from `external_id`). Null for a native order. */
268163
+ external_number: string | null;
268164
+ /** @description A store order: the store's own payment page, where the buyer pays with the store's gateways. Null for a native order. */
268165
+ store_payment_url: string | null;
268166
+ /** @description A store order: the store's modification time as of the last applied store event. */
268167
+ external_updated_at: string | null;
268168
+ /** @enum {string} */
268169
+ status: "draft" | "pending_payment" | "paid" | "preparing" | "ready_for_pickup" | "shipped" | "delivered" | "cancelled" | "refunded";
267746
268170
  /** Format: uuid */
267747
268171
  contact_id: string | null;
267748
268172
  /** Format: uuid */
@@ -267763,6 +268187,8 @@ interface components {
267763
268187
  item_count: number;
267764
268188
  stock_decremented_at: string | null;
267765
268189
  paid_at: string | null;
268190
+ /** @description A pickup order: when the store marked it ready («Listo para retiro»), first time. */
268191
+ ready_for_pickup_at: string | null;
267766
268192
  shipped_at: string | null;
267767
268193
  delivered_at: string | null;
267768
268194
  cancelled_at: string | null;
@@ -267817,6 +268243,8 @@ interface components {
267817
268243
  /** Format: uuid */
267818
268244
  obligation_id: string | null;
267819
268245
  }[];
268246
+ /** @description The emails this order’s storefront buyer got, oldest first (#6270): at most one per kind. `[]` for orders without a buyer email (staff/agent orders hear in their conversation). Only on `GET /orders/{id}`. */
268247
+ buyer_emails: components["schemas"]["OrderBuyerEmail"][];
267820
268248
  };
267821
268249
  OrderRefundResult: {
267822
268250
  order: components["schemas"]["CommerceOrder"];