@vitrina/api 11.38.0 → 11.40.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.cts CHANGED
@@ -30407,6 +30407,8 @@ interface paths {
30407
30407
  *
30408
30408
  * **`lead_id` names the deal this document CLOSES** (ERP S15-16) — a lead UUID or its folio (`L-89`). Omit it for a walk-in sale with no CRM deal; absent means "no originating deal", never "unknown". The link is then queryable both ways: `GET /sale-notes?lead_id=…` from the deal, and the `lead_id` field on the document itself. A deal has **at most one live closing document** — a second one is a **409** until the first is voided, enforced by a partial unique index rather than by a pre-read, so two concurrent issues cannot both win. The link is set here and never edited: there is no update endpoint, and the correction path is the one ADR 0058 §10 already defines — void (the row, its folio and its link all survive) and issue a replacement.
30409
30409
  *
30410
+ * **Every sale has exactly one Vendedor** (ADR 0114 §3) — the team member who closed it: the `closer` participation, echoed on `salesperson_id`. When the request names nobody, the Vendedor defaults to the assignee of the `lead_id` deal, else the car's Responsable del auto (`vehicle.responsible_user_id`), skipping anyone who is no longer an active member. When neither resolves, the emit is a **400** with `field_errors.salesperson_id` and **no folio consumed**. The default is a proposal: naming someone else always wins.
30411
+ *
30410
30412
  * `approved_by` and `approved_at` are all-or-nothing. Timestamps accept either UTC (`…Z`) or an explicit offset (`…-04:00`, Chile). Unknown body keys are a **400** — `tax` is one character from `tax_clp`, and silently discarding it would record "no IVA was entered" for a caller who entered it. Answers 201.
30411
30413
  *
30412
30414
  * **`funding` IS THE BALANCE GATE (ERP S9-5, BR-418)** — where the money for this sale comes from. Supplying it makes the gate BINDING on this request: `price + Σ statutory add-ons` is weighed against `Σ these payments + retoma + credit` BEFORE anything is written, a short plan is a **400 that states the gap** with **no folio consumed**, and a plan that holds is written into the SAME transaction as the document — so a payment the database refuses rolls `V-n` back rather than burning it on a half-funded sale. **Over-funding is allowed** and comes back labelled as `saldo_a_favor_del_cliente_clp`; it is never an error and is never silently clamped.
@@ -38178,7 +38180,7 @@ interface paths {
38178
38180
  };
38179
38181
  /**
38180
38182
  * Export the deals and their margins (xlsx / csv)
38181
- * @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock, published price, discount (amount and %), total paid (with IVA), IVA, net sale price, retained add-ons, net revenue, purchase cost, gross margin, additional costs, commissions, net margin, pass-through add-ons (neutral) and `Completo`. A figure that is not recorded or not computable is an EMPTY cell, never 0.
38183
+ * @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock, published price, discount (amount and %), total paid (with IVA), IVA, net sale price, retained add-ons, net revenue, purchase cost, gross margin, additional costs, commissions, Utilidad del negocio, pass-through add-ons (neutral) and `Completo`. A figure that is not recorded or not computable is an EMPTY cell, never 0.
38182
38184
  *
38183
38185
  * Pass `period` (`YYYY-MM`, the Margen screen’s month) OR `from`/`to` (`YYYY-MM-DD`, inclusive, on the dealership’s calendar) — one of the two is required (400 otherwise), never both. `format` is `xlsx` (default) or `csv`. **413** over 2000 deals. Requires `dealership_economics:read`.
38184
38186
  */
@@ -38279,7 +38281,7 @@ interface paths {
38279
38281
  cookie?: never;
38280
38282
  };
38281
38283
  /**
38282
- * The deal settlement (liquidación del negocio) of one unit
38284
+ * The Resumen del negocio of one unit
38283
38285
  * @description Everything about one car’s deal on one read: the published price, the discount (amount and %), the sale price, the purchase or consignment basis, the cost lines grouped by category with who absorbs each (`automotora` / `dueno` / `cliente`), the margin (the platform’s one margin definition, embedded whole with `complete` and `gaps`), the commission of each salesperson, the seller, the buyer and the buyer’s origin channel (the sale note’s lead first, then the buyer’s first conversation, then the contact’s recorded origin), how many people asked about the unit, days in stock (entry → approval) and days to sell (first publication → sale).
38284
38286
  *
38285
38287
  * `state` is `sold` (the newest live nota de venta is approved), `pending_approval` (issued, not yet approved) or `preview` (no live nota de venta: the settlement at the published price, with no discount, add-ons or commissions, flagged by a `preview` gap). A figure that is not recorded is `null`, never 0. Requires `dealership_economics:read`.
@@ -38295,7 +38297,7 @@ interface paths {
38295
38297
  };
38296
38298
  requestBody?: never;
38297
38299
  responses: {
38298
- /** @description The deal settlement */
38300
+ /** @description The Resumen del negocio */
38299
38301
  200: {
38300
38302
  headers: {
38301
38303
  [name: string]: unknown;
@@ -38600,8 +38602,8 @@ interface paths {
38600
38602
  cookie?: never;
38601
38603
  };
38602
38604
  /**
38603
- * Print the deal settlement (PDF)
38604
- * @description The liquidación del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk, the costs by category and who absorbs them, and the commissions. With no live template it prints the standard text. A missing fact prints «no registrado»; nothing is refused. A preview carries a «VISTA PREVIA» banner. `X-Template-Version` names the prose used. Requires `dealership_economics:read`.
38605
+ * Print the Resumen del negocio (PDF)
38606
+ * @description The Resumen del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk, the costs by category and who absorbs them, and the commissions. With no live template it prints the standard text. A missing fact prints «no registrado»; nothing is refused. A preview carries a «VISTA PREVIA» banner. `X-Template-Version` names the prose used. Requires `dealership_economics:read`.
38605
38607
  */
38606
38608
  get: {
38607
38609
  parameters: {
@@ -38616,7 +38618,7 @@ interface paths {
38616
38618
  };
38617
38619
  requestBody?: never;
38618
38620
  responses: {
38619
- /** @description The printable deal settlement */
38621
+ /** @description The printable Resumen del negocio, named `resumen-del-negocio-<folio>.pdf` */
38620
38622
  200: {
38621
38623
  headers: {
38622
38624
  [name: string]: unknown;
@@ -38697,8 +38699,8 @@ interface paths {
38697
38699
  cookie?: never;
38698
38700
  };
38699
38701
  /**
38700
- * Export the deal settlement (xlsx / csv)
38701
- * @description The same settlement as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
38702
+ * Export the Resumen del negocio (xlsx / csv)
38703
+ * @description The same Resumen del negocio as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
38702
38704
  */
38703
38705
  get: {
38704
38706
  parameters: {
package/dist/index.d.ts CHANGED
@@ -30407,6 +30407,8 @@ interface paths {
30407
30407
  *
30408
30408
  * **`lead_id` names the deal this document CLOSES** (ERP S15-16) — a lead UUID or its folio (`L-89`). Omit it for a walk-in sale with no CRM deal; absent means "no originating deal", never "unknown". The link is then queryable both ways: `GET /sale-notes?lead_id=…` from the deal, and the `lead_id` field on the document itself. A deal has **at most one live closing document** — a second one is a **409** until the first is voided, enforced by a partial unique index rather than by a pre-read, so two concurrent issues cannot both win. The link is set here and never edited: there is no update endpoint, and the correction path is the one ADR 0058 §10 already defines — void (the row, its folio and its link all survive) and issue a replacement.
30409
30409
  *
30410
+ * **Every sale has exactly one Vendedor** (ADR 0114 §3) — the team member who closed it: the `closer` participation, echoed on `salesperson_id`. When the request names nobody, the Vendedor defaults to the assignee of the `lead_id` deal, else the car's Responsable del auto (`vehicle.responsible_user_id`), skipping anyone who is no longer an active member. When neither resolves, the emit is a **400** with `field_errors.salesperson_id` and **no folio consumed**. The default is a proposal: naming someone else always wins.
30411
+ *
30410
30412
  * `approved_by` and `approved_at` are all-or-nothing. Timestamps accept either UTC (`…Z`) or an explicit offset (`…-04:00`, Chile). Unknown body keys are a **400** — `tax` is one character from `tax_clp`, and silently discarding it would record "no IVA was entered" for a caller who entered it. Answers 201.
30411
30413
  *
30412
30414
  * **`funding` IS THE BALANCE GATE (ERP S9-5, BR-418)** — where the money for this sale comes from. Supplying it makes the gate BINDING on this request: `price + Σ statutory add-ons` is weighed against `Σ these payments + retoma + credit` BEFORE anything is written, a short plan is a **400 that states the gap** with **no folio consumed**, and a plan that holds is written into the SAME transaction as the document — so a payment the database refuses rolls `V-n` back rather than burning it on a half-funded sale. **Over-funding is allowed** and comes back labelled as `saldo_a_favor_del_cliente_clp`; it is never an error and is never silently clamped.
@@ -38178,7 +38180,7 @@ interface paths {
38178
38180
  };
38179
38181
  /**
38180
38182
  * Export the deals and their margins (xlsx / csv)
38181
- * @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock, published price, discount (amount and %), total paid (with IVA), IVA, net sale price, retained add-ons, net revenue, purchase cost, gross margin, additional costs, commissions, net margin, pass-through add-ons (neutral) and `Completo`. A figure that is not recorded or not computable is an EMPTY cell, never 0.
38183
+ * @description One row per live nota de venta in the window, with every settlement column: folio, date, status, patente, vehicle, regime, seller, buyer, buyer origin channel, leads, days in stock, published price, discount (amount and %), total paid (with IVA), IVA, net sale price, retained add-ons, net revenue, purchase cost, gross margin, additional costs, commissions, Utilidad del negocio, pass-through add-ons (neutral) and `Completo`. A figure that is not recorded or not computable is an EMPTY cell, never 0.
38182
38184
  *
38183
38185
  * Pass `period` (`YYYY-MM`, the Margen screen’s month) OR `from`/`to` (`YYYY-MM-DD`, inclusive, on the dealership’s calendar) — one of the two is required (400 otherwise), never both. `format` is `xlsx` (default) or `csv`. **413** over 2000 deals. Requires `dealership_economics:read`.
38184
38186
  */
@@ -38279,7 +38281,7 @@ interface paths {
38279
38281
  cookie?: never;
38280
38282
  };
38281
38283
  /**
38282
- * The deal settlement (liquidación del negocio) of one unit
38284
+ * The Resumen del negocio of one unit
38283
38285
  * @description Everything about one car’s deal on one read: the published price, the discount (amount and %), the sale price, the purchase or consignment basis, the cost lines grouped by category with who absorbs each (`automotora` / `dueno` / `cliente`), the margin (the platform’s one margin definition, embedded whole with `complete` and `gaps`), the commission of each salesperson, the seller, the buyer and the buyer’s origin channel (the sale note’s lead first, then the buyer’s first conversation, then the contact’s recorded origin), how many people asked about the unit, days in stock (entry → approval) and days to sell (first publication → sale).
38284
38286
  *
38285
38287
  * `state` is `sold` (the newest live nota de venta is approved), `pending_approval` (issued, not yet approved) or `preview` (no live nota de venta: the settlement at the published price, with no discount, add-ons or commissions, flagged by a `preview` gap). A figure that is not recorded is `null`, never 0. Requires `dealership_economics:read`.
@@ -38295,7 +38297,7 @@ interface paths {
38295
38297
  };
38296
38298
  requestBody?: never;
38297
38299
  responses: {
38298
- /** @description The deal settlement */
38300
+ /** @description The Resumen del negocio */
38299
38301
  200: {
38300
38302
  headers: {
38301
38303
  [name: string]: unknown;
@@ -38600,8 +38602,8 @@ interface paths {
38600
38602
  cookie?: never;
38601
38603
  };
38602
38604
  /**
38603
- * Print the deal settlement (PDF)
38604
- * @description The liquidación del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk, the costs by category and who absorbs them, and the commissions. With no live template it prints the standard text. A missing fact prints «no registrado»; nothing is refused. A preview carries a «VISTA PREVIA» banner. `X-Template-Version` names the prose used. Requires `dealership_economics:read`.
38605
+ * Print the Resumen del negocio (PDF)
38606
+ * @description The Resumen del negocio as a PDF (`application/pdf`, served `inline`): the workspace’s default `deal_settlement` template — or `template_id` — filled with the deal’s facts, followed by a fixed table of the result walk, the costs by category and who absorbs them, and the commissions. With no live template it prints the standard text. A missing fact prints «no registrado»; nothing is refused. A preview carries a «VISTA PREVIA» banner. `X-Template-Version` names the prose used. Requires `dealership_economics:read`.
38605
38607
  */
38606
38608
  get: {
38607
38609
  parameters: {
@@ -38616,7 +38618,7 @@ interface paths {
38616
38618
  };
38617
38619
  requestBody?: never;
38618
38620
  responses: {
38619
- /** @description The printable deal settlement */
38621
+ /** @description The printable Resumen del negocio, named `resumen-del-negocio-<folio>.pdf` */
38620
38622
  200: {
38621
38623
  headers: {
38622
38624
  [name: string]: unknown;
@@ -38697,8 +38699,8 @@ interface paths {
38697
38699
  cookie?: never;
38698
38700
  };
38699
38701
  /**
38700
- * Export the deal settlement (xlsx / csv)
38701
- * @description The same settlement as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
38702
+ * Export the Resumen del negocio (xlsx / csv)
38703
+ * @description The same Resumen del negocio as a planilla. `xlsx` (default) carries three sheets — **Resumen** (the result walk and the deal’s facts), **Costos** (by category and party) and **Comisiones** (per salesperson); `csv` carries the Resumen. Requires `dealership_economics:read`.
38702
38704
  */
38703
38705
  get: {
38704
38706
  parameters: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "11.38.0",
3
+ "version": "11.40.0",
4
4
  "description": "Typed TypeScript SDK for the Vitrina API pública — generated from the committed openapi.public.json (ADR 0106).",
5
5
  "type": "module",
6
6
  "license": "MIT",