@vitrina/api 15.33.0 → 15.34.1

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
@@ -74224,13 +74224,13 @@ interface paths {
74224
74224
  * "at": "2026-10-30T12:00:04.000Z"
74225
74225
  * },
74226
74226
  * "consent": {
74227
- * "version": "mandato-2.2#6.5",
74227
+ * "version": "vitrina-mandato-1.0#6.5",
74228
74228
  * "accepted_at": "2026-10-30T12:00:00.000Z",
74229
74229
  * "current": true
74230
74230
  * },
74231
74231
  * "consent_required": false,
74232
74232
  * "consent_text": {
74233
- * "version": "mandato-2.2#6.5",
74233
+ * "version": "vitrina-mandato-1.0#6.5",
74234
74234
  * "title": "Conectar boletas de honorarios",
74235
74235
  * "points": [
74236
74236
  * "Guardamos la Clave Tributaria de la empresa para leer sus boletas de honorarios desde el SII."
@@ -90018,6 +90018,7 @@ interface paths {
90018
90018
  state: "todo" | "waiting" | "done" | "problem" | "skipped";
90019
90019
  reason: string | null;
90020
90020
  }[];
90021
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90021
90022
  /** @enum {string|null} */
90022
90023
  next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90023
90024
  complete: boolean;
@@ -90404,8 +90405,8 @@ interface paths {
90404
90405
  get?: never;
90405
90406
  put?: never;
90406
90407
  /**
90407
- * A mandato signing link for the representante legal (step 3)
90408
- * @description The link the representante legal opens to sign the mandato. It is returned ONCE; asking again replaces the previous link. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90408
+ * Vitrina's mandato for the representante legal to sign (step 3)
90409
+ * @description Renders Vitrina's mandato (`GET /legal/documents/sii_mandato`, version + SHA-256) for this razón social and opens it in Vitrina's signing service. Returns the representante legal's `signing_url` (also mailed to them unless `send_email: false`). A new request replaces an unsigned one; a signed mandato cannot be replaced. Once signed it is registered at the SII automatically (`sii.mandato.phase`: `connecting` → `connected`). Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90409
90410
  */
90410
90411
  post: {
90411
90412
  parameters: {
@@ -90419,9 +90420,23 @@ interface paths {
90419
90420
  };
90420
90421
  cookie?: never;
90421
90422
  };
90422
- requestBody?: never;
90423
+ requestBody?: {
90424
+ content: {
90425
+ "application/json": {
90426
+ /** @description Who signs. Name and RUT default to the razón social's representante legal; the email is required (here or on file). */
90427
+ signer?: {
90428
+ name?: string;
90429
+ rut?: string;
90430
+ /** Format: email */
90431
+ email?: string;
90432
+ };
90433
+ /** @description Mail the signing link to the signer (default true). */
90434
+ send_email?: boolean;
90435
+ };
90436
+ };
90437
+ };
90423
90438
  responses: {
90424
- /** @description The signing link */
90439
+ /** @description The signing request */
90425
90440
  200: {
90426
90441
  headers: {
90427
90442
  [name: string]: unknown;
@@ -90430,8 +90445,27 @@ interface paths {
90430
90445
  /**
90431
90446
  * @example {
90432
90447
  * "data": {
90433
- * "signing_url": "https://example.invalid/mandato/abc",
90434
- * "status": "pending"
90448
+ * "signing_url": "https://sign.example.invalid/sign/abc",
90449
+ * "status": "pending",
90450
+ * "signature": {
90451
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b09",
90452
+ * "phase": "pending_signature",
90453
+ * "status": "pending_signature",
90454
+ * "terms_version": "vitrina-mandato-1.0",
90455
+ * "terms_sha256": "4398b7f80be1fd551c62325241e39c9e14138a63860f0cb4dcdc5be175f981b4",
90456
+ * "signer": {
90457
+ * "name": "María Pérez Soto",
90458
+ * "rut": "12.345.678-5",
90459
+ * "email": "maria@empresa.cl"
90460
+ * },
90461
+ * "signing_url": "https://sign.example.invalid/sign/abc",
90462
+ * "signed_at": null,
90463
+ * "attested_at": null,
90464
+ * "problem": null,
90465
+ * "document_available": false,
90466
+ * "created_at": "2026-11-02T15:00:00.000Z"
90467
+ * },
90468
+ * "email_sent": true
90435
90469
  * }
90436
90470
  * }
90437
90471
  */
@@ -90439,6 +90473,340 @@ interface paths {
90439
90473
  data: {
90440
90474
  signing_url: string | null;
90441
90475
  status: string | null;
90476
+ signature?: components["schemas"]["FinanzasMandatoSignature"] & Record<string, never>;
90477
+ email_sent?: boolean;
90478
+ };
90479
+ };
90480
+ };
90481
+ };
90482
+ /** @description Validation error */
90483
+ 400: {
90484
+ headers: {
90485
+ [name: string]: unknown;
90486
+ };
90487
+ content: {
90488
+ "application/json": components["schemas"]["Error"];
90489
+ };
90490
+ };
90491
+ /** @description Unauthorized */
90492
+ 401: {
90493
+ headers: {
90494
+ [name: string]: unknown;
90495
+ };
90496
+ content: {
90497
+ "application/json": components["schemas"]["Error"];
90498
+ };
90499
+ };
90500
+ /** @description Forbidden */
90501
+ 403: {
90502
+ headers: {
90503
+ [name: string]: unknown;
90504
+ };
90505
+ content: {
90506
+ "application/json": components["schemas"]["Error"];
90507
+ };
90508
+ };
90509
+ /** @description Not found */
90510
+ 404: {
90511
+ headers: {
90512
+ [name: string]: unknown;
90513
+ };
90514
+ content: {
90515
+ "application/json": components["schemas"]["Error"];
90516
+ };
90517
+ };
90518
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
90519
+ 409: {
90520
+ headers: {
90521
+ [name: string]: unknown;
90522
+ };
90523
+ content: {
90524
+ "application/json": components["schemas"]["Error"];
90525
+ };
90526
+ };
90527
+ /** @description Rate limited */
90528
+ 429: {
90529
+ headers: {
90530
+ [name: string]: unknown;
90531
+ };
90532
+ content: {
90533
+ "application/json": components["schemas"]["Error"];
90534
+ };
90535
+ };
90536
+ };
90537
+ };
90538
+ delete?: never;
90539
+ options?: never;
90540
+ head?: never;
90541
+ patch?: never;
90542
+ trace?: never;
90543
+ };
90544
+ "/finanzas/connect-setup/sii/{id}/mandato/document": {
90545
+ parameters: {
90546
+ query?: never;
90547
+ header?: never;
90548
+ path?: never;
90549
+ cookie?: never;
90550
+ };
90551
+ /**
90552
+ * The signed mandato PDF
90553
+ * @description The signed mandato of this razón social (`file=signed`, default) or the signing service's certificate (`file=certificate`). 404 until it is signed. Requires `finanzas:read`.
90554
+ */
90555
+ get: {
90556
+ parameters: {
90557
+ query?: {
90558
+ file?: "signed" | "certificate";
90559
+ };
90560
+ header?: never;
90561
+ path: {
90562
+ id: string;
90563
+ };
90564
+ cookie?: never;
90565
+ };
90566
+ requestBody?: never;
90567
+ responses: {
90568
+ /** @description The PDF */
90569
+ 200: {
90570
+ headers: {
90571
+ [name: string]: unknown;
90572
+ };
90573
+ content: {
90574
+ "application/pdf": string;
90575
+ };
90576
+ };
90577
+ /** @description Validation error */
90578
+ 400: {
90579
+ headers: {
90580
+ [name: string]: unknown;
90581
+ };
90582
+ content: {
90583
+ "application/json": components["schemas"]["Error"];
90584
+ };
90585
+ };
90586
+ /** @description Unauthorized */
90587
+ 401: {
90588
+ headers: {
90589
+ [name: string]: unknown;
90590
+ };
90591
+ content: {
90592
+ "application/json": components["schemas"]["Error"];
90593
+ };
90594
+ };
90595
+ /** @description Forbidden */
90596
+ 403: {
90597
+ headers: {
90598
+ [name: string]: unknown;
90599
+ };
90600
+ content: {
90601
+ "application/json": components["schemas"]["Error"];
90602
+ };
90603
+ };
90604
+ /** @description Not found */
90605
+ 404: {
90606
+ headers: {
90607
+ [name: string]: unknown;
90608
+ };
90609
+ content: {
90610
+ "application/json": components["schemas"]["Error"];
90611
+ };
90612
+ };
90613
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
90614
+ 409: {
90615
+ headers: {
90616
+ [name: string]: unknown;
90617
+ };
90618
+ content: {
90619
+ "application/json": components["schemas"]["Error"];
90620
+ };
90621
+ };
90622
+ /** @description Rate limited */
90623
+ 429: {
90624
+ headers: {
90625
+ [name: string]: unknown;
90626
+ };
90627
+ content: {
90628
+ "application/json": components["schemas"]["Error"];
90629
+ };
90630
+ };
90631
+ };
90632
+ };
90633
+ put?: never;
90634
+ post?: never;
90635
+ delete?: never;
90636
+ options?: never;
90637
+ head?: never;
90638
+ patch?: never;
90639
+ trace?: never;
90640
+ };
90641
+ "/finanzas/connect-setup/sii/{id}/mandato/revoke": {
90642
+ parameters: {
90643
+ query?: never;
90644
+ header?: never;
90645
+ path?: never;
90646
+ cookie?: never;
90647
+ };
90648
+ get?: never;
90649
+ put?: never;
90650
+ /**
90651
+ * Revoke the mandato (cláusula 7.1)
90652
+ * @description Revokes the signed mandato at the SII and here, with immediate effect: the SII connection stops acting for the empresa until a new mandato is signed. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90653
+ */
90654
+ post: {
90655
+ parameters: {
90656
+ query?: never;
90657
+ header?: {
90658
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
90659
+ "Idempotency-Key"?: string;
90660
+ };
90661
+ path: {
90662
+ id: string;
90663
+ };
90664
+ cookie?: never;
90665
+ };
90666
+ requestBody?: never;
90667
+ responses: {
90668
+ /** @description The setup after the revocation */
90669
+ 200: {
90670
+ headers: {
90671
+ [name: string]: unknown;
90672
+ };
90673
+ content: {
90674
+ /**
90675
+ * @example {
90676
+ * "data": {
90677
+ * "bank": {
90678
+ * "state": "done",
90679
+ * "connected": 1,
90680
+ * "has_movements": true
90681
+ * },
90682
+ * "sii": {
90683
+ * "connection": {
90684
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b01",
90685
+ * "legal_entity_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b02",
90686
+ * "legal_name": "Clínica Ejemplo SpA",
90687
+ * "rut": "76123456-7",
90688
+ * "emission_on": false
90689
+ * },
90690
+ * "steps": [
90691
+ * {
90692
+ * "key": "razon_social",
90693
+ * "state": "done",
90694
+ * "reason": null
90695
+ * },
90696
+ * {
90697
+ * "key": "certificate",
90698
+ * "state": "done",
90699
+ * "reason": null
90700
+ * },
90701
+ * {
90702
+ * "key": "mandato",
90703
+ * "state": "waiting",
90704
+ * "reason": null
90705
+ * },
90706
+ * {
90707
+ * "key": "honorarios",
90708
+ * "state": "todo",
90709
+ * "reason": null
90710
+ * }
90711
+ * ],
90712
+ * "next_step": "honorarios",
90713
+ * "complete": false,
90714
+ * "honorarios": {
90715
+ * "evidence": false,
90716
+ * "declared_none_at": null,
90717
+ * "can_skip": true
90718
+ * },
90719
+ * "sociedades": [
90720
+ * {
90721
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b02",
90722
+ * "legal_name": "Clínica Ejemplo SpA",
90723
+ * "tax_id": "76123456-7",
90724
+ * "connected": true
90725
+ * }
90726
+ * ],
90727
+ * "suggestion": null,
90728
+ * "live": false
90729
+ * },
90730
+ * "onboarding": {
90731
+ * "mode": "guided",
90732
+ * "started_at": "2026-11-02T13:00:00.000Z",
90733
+ * "deferred_at": null
90734
+ * }
90735
+ * }
90736
+ * }
90737
+ */
90738
+ "application/json": {
90739
+ data: {
90740
+ bank: {
90741
+ /** @enum {string} */
90742
+ state: "todo" | "done";
90743
+ connected: number;
90744
+ has_movements: boolean;
90745
+ /** @description Live direct bank links (Fintoc / bank API); Mercado Pago is not counted. */
90746
+ direct: number;
90747
+ /**
90748
+ * @description `direct` = a live bank link reads the bank; `email` = movements arrive as bank notification e-mails (with some delay); `statement` = only imported statements (cartola, Chipax); `none` = nothing yet.
90749
+ * @enum {string}
90750
+ */
90751
+ feed: "direct" | "email" | "statement" | "none";
90752
+ };
90753
+ sii: {
90754
+ connection: {
90755
+ /** Format: uuid */
90756
+ id: string;
90757
+ /** Format: uuid */
90758
+ legal_entity_id: string;
90759
+ legal_name: string | null;
90760
+ rut: string;
90761
+ emission_on: boolean;
90762
+ } | null;
90763
+ steps: {
90764
+ /** @enum {string} */
90765
+ key: "razon_social" | "certificate" | "mandato" | "honorarios";
90766
+ /** @enum {string} */
90767
+ state: "todo" | "waiting" | "done" | "problem" | "skipped";
90768
+ reason: string | null;
90769
+ }[];
90770
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90771
+ /** @enum {string|null} */
90772
+ next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90773
+ complete: boolean;
90774
+ honorarios: {
90775
+ evidence: boolean;
90776
+ declared_none_at: string | null;
90777
+ can_skip: boolean;
90778
+ };
90779
+ sociedades: {
90780
+ /** Format: uuid */
90781
+ id: string;
90782
+ legal_name: string;
90783
+ tax_id: string;
90784
+ connected: boolean;
90785
+ }[];
90786
+ suggestion: {
90787
+ /** @enum {string} */
90788
+ source: "billing" | "sii";
90789
+ rut: string | null;
90790
+ legal_name: string | null;
90791
+ giro: string | null;
90792
+ address_street: string | null;
90793
+ /** @description The house number, split off a billing street that carried it («Av. 21 de Mayo 1126» → street «Av. 21 de Mayo», number «1126»). */
90794
+ address_number: string | null;
90795
+ /** @description The billing comuna, else the one the workspace's branch addresses name after the street; null when none resolves to exactly one. */
90796
+ comuna_code: string | null;
90797
+ comuna_name: string | null;
90798
+ } | null;
90799
+ live: boolean;
90800
+ };
90801
+ onboarding: {
90802
+ /**
90803
+ * @description `guided` = the full-page start, only for a workspace with no Finanzas documents and no bank movements; `checklist` = the «Conecta tus cuentas» card on Resumen; `done` = bank and SII connected.
90804
+ * @enum {string}
90805
+ */
90806
+ mode: "guided" | "checklist" | "done";
90807
+ started_at: string | null;
90808
+ deferred_at: string | null;
90809
+ };
90442
90810
  };
90443
90811
  };
90444
90812
  };
@@ -90644,6 +91012,7 @@ interface paths {
90644
91012
  state: "todo" | "waiting" | "done" | "problem" | "skipped";
90645
91013
  reason: string | null;
90646
91014
  }[];
91015
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90647
91016
  /** @enum {string|null} */
90648
91017
  next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90649
91018
  complete: boolean;
@@ -263656,6 +264025,31 @@ interface components {
263656
264025
  };
263657
264026
  };
263658
264027
  FinanzasAlertList: components["schemas"]["FinanzasAlert"][];
264028
+ FinanzasMandatoSignature: {
264029
+ /** Format: uuid */
264030
+ id: string;
264031
+ /**
264032
+ * @description `pending_signature` = the representante legal has the link; `connecting` = signed, being registered at the SII («Firmado, conectando con el SII…»); `connected` = registered; `failed` = signed but the SII registration keeps failing (retried automatically); `declined` = the signer rejected; `revoked` = revoked in Bancos y SII.
264033
+ * @enum {string}
264034
+ */
264035
+ phase: "none" | "pending_signature" | "connecting" | "connected" | "failed" | "declined" | "revoked";
264036
+ status: string;
264037
+ terms_version: string;
264038
+ terms_sha256: string;
264039
+ signer: {
264040
+ name: string;
264041
+ rut: string;
264042
+ email: string;
264043
+ };
264044
+ /** @description The representante legal's signing link while the signature is pending; null afterwards. */
264045
+ signing_url: string | null;
264046
+ signed_at: string | null;
264047
+ attested_at: string | null;
264048
+ problem: string | null;
264049
+ /** @description The signed PDF can be downloaded (`GET …/sii/{id}/mandato/document`). */
264050
+ document_available: boolean;
264051
+ created_at: string;
264052
+ } | null;
263659
264053
  FinanzasDigestPreview: {
263660
264054
  /** @description Monday of this week (YYYY-MM-DD, workspace time). */
263661
264055
  week_start: string;
package/dist/index.d.ts CHANGED
@@ -74224,13 +74224,13 @@ interface paths {
74224
74224
  * "at": "2026-10-30T12:00:04.000Z"
74225
74225
  * },
74226
74226
  * "consent": {
74227
- * "version": "mandato-2.2#6.5",
74227
+ * "version": "vitrina-mandato-1.0#6.5",
74228
74228
  * "accepted_at": "2026-10-30T12:00:00.000Z",
74229
74229
  * "current": true
74230
74230
  * },
74231
74231
  * "consent_required": false,
74232
74232
  * "consent_text": {
74233
- * "version": "mandato-2.2#6.5",
74233
+ * "version": "vitrina-mandato-1.0#6.5",
74234
74234
  * "title": "Conectar boletas de honorarios",
74235
74235
  * "points": [
74236
74236
  * "Guardamos la Clave Tributaria de la empresa para leer sus boletas de honorarios desde el SII."
@@ -90018,6 +90018,7 @@ interface paths {
90018
90018
  state: "todo" | "waiting" | "done" | "problem" | "skipped";
90019
90019
  reason: string | null;
90020
90020
  }[];
90021
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90021
90022
  /** @enum {string|null} */
90022
90023
  next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90023
90024
  complete: boolean;
@@ -90404,8 +90405,8 @@ interface paths {
90404
90405
  get?: never;
90405
90406
  put?: never;
90406
90407
  /**
90407
- * A mandato signing link for the representante legal (step 3)
90408
- * @description The link the representante legal opens to sign the mandato. It is returned ONCE; asking again replaces the previous link. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90408
+ * Vitrina's mandato for the representante legal to sign (step 3)
90409
+ * @description Renders Vitrina's mandato (`GET /legal/documents/sii_mandato`, version + SHA-256) for this razón social and opens it in Vitrina's signing service. Returns the representante legal's `signing_url` (also mailed to them unless `send_email: false`). A new request replaces an unsigned one; a signed mandato cannot be replaced. Once signed it is registered at the SII automatically (`sii.mandato.phase`: `connecting` → `connected`). Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90409
90410
  */
90410
90411
  post: {
90411
90412
  parameters: {
@@ -90419,9 +90420,23 @@ interface paths {
90419
90420
  };
90420
90421
  cookie?: never;
90421
90422
  };
90422
- requestBody?: never;
90423
+ requestBody?: {
90424
+ content: {
90425
+ "application/json": {
90426
+ /** @description Who signs. Name and RUT default to the razón social's representante legal; the email is required (here or on file). */
90427
+ signer?: {
90428
+ name?: string;
90429
+ rut?: string;
90430
+ /** Format: email */
90431
+ email?: string;
90432
+ };
90433
+ /** @description Mail the signing link to the signer (default true). */
90434
+ send_email?: boolean;
90435
+ };
90436
+ };
90437
+ };
90423
90438
  responses: {
90424
- /** @description The signing link */
90439
+ /** @description The signing request */
90425
90440
  200: {
90426
90441
  headers: {
90427
90442
  [name: string]: unknown;
@@ -90430,8 +90445,27 @@ interface paths {
90430
90445
  /**
90431
90446
  * @example {
90432
90447
  * "data": {
90433
- * "signing_url": "https://example.invalid/mandato/abc",
90434
- * "status": "pending"
90448
+ * "signing_url": "https://sign.example.invalid/sign/abc",
90449
+ * "status": "pending",
90450
+ * "signature": {
90451
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b09",
90452
+ * "phase": "pending_signature",
90453
+ * "status": "pending_signature",
90454
+ * "terms_version": "vitrina-mandato-1.0",
90455
+ * "terms_sha256": "4398b7f80be1fd551c62325241e39c9e14138a63860f0cb4dcdc5be175f981b4",
90456
+ * "signer": {
90457
+ * "name": "María Pérez Soto",
90458
+ * "rut": "12.345.678-5",
90459
+ * "email": "maria@empresa.cl"
90460
+ * },
90461
+ * "signing_url": "https://sign.example.invalid/sign/abc",
90462
+ * "signed_at": null,
90463
+ * "attested_at": null,
90464
+ * "problem": null,
90465
+ * "document_available": false,
90466
+ * "created_at": "2026-11-02T15:00:00.000Z"
90467
+ * },
90468
+ * "email_sent": true
90435
90469
  * }
90436
90470
  * }
90437
90471
  */
@@ -90439,6 +90473,340 @@ interface paths {
90439
90473
  data: {
90440
90474
  signing_url: string | null;
90441
90475
  status: string | null;
90476
+ signature?: components["schemas"]["FinanzasMandatoSignature"] & Record<string, never>;
90477
+ email_sent?: boolean;
90478
+ };
90479
+ };
90480
+ };
90481
+ };
90482
+ /** @description Validation error */
90483
+ 400: {
90484
+ headers: {
90485
+ [name: string]: unknown;
90486
+ };
90487
+ content: {
90488
+ "application/json": components["schemas"]["Error"];
90489
+ };
90490
+ };
90491
+ /** @description Unauthorized */
90492
+ 401: {
90493
+ headers: {
90494
+ [name: string]: unknown;
90495
+ };
90496
+ content: {
90497
+ "application/json": components["schemas"]["Error"];
90498
+ };
90499
+ };
90500
+ /** @description Forbidden */
90501
+ 403: {
90502
+ headers: {
90503
+ [name: string]: unknown;
90504
+ };
90505
+ content: {
90506
+ "application/json": components["schemas"]["Error"];
90507
+ };
90508
+ };
90509
+ /** @description Not found */
90510
+ 404: {
90511
+ headers: {
90512
+ [name: string]: unknown;
90513
+ };
90514
+ content: {
90515
+ "application/json": components["schemas"]["Error"];
90516
+ };
90517
+ };
90518
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
90519
+ 409: {
90520
+ headers: {
90521
+ [name: string]: unknown;
90522
+ };
90523
+ content: {
90524
+ "application/json": components["schemas"]["Error"];
90525
+ };
90526
+ };
90527
+ /** @description Rate limited */
90528
+ 429: {
90529
+ headers: {
90530
+ [name: string]: unknown;
90531
+ };
90532
+ content: {
90533
+ "application/json": components["schemas"]["Error"];
90534
+ };
90535
+ };
90536
+ };
90537
+ };
90538
+ delete?: never;
90539
+ options?: never;
90540
+ head?: never;
90541
+ patch?: never;
90542
+ trace?: never;
90543
+ };
90544
+ "/finanzas/connect-setup/sii/{id}/mandato/document": {
90545
+ parameters: {
90546
+ query?: never;
90547
+ header?: never;
90548
+ path?: never;
90549
+ cookie?: never;
90550
+ };
90551
+ /**
90552
+ * The signed mandato PDF
90553
+ * @description The signed mandato of this razón social (`file=signed`, default) or the signing service's certificate (`file=certificate`). 404 until it is signed. Requires `finanzas:read`.
90554
+ */
90555
+ get: {
90556
+ parameters: {
90557
+ query?: {
90558
+ file?: "signed" | "certificate";
90559
+ };
90560
+ header?: never;
90561
+ path: {
90562
+ id: string;
90563
+ };
90564
+ cookie?: never;
90565
+ };
90566
+ requestBody?: never;
90567
+ responses: {
90568
+ /** @description The PDF */
90569
+ 200: {
90570
+ headers: {
90571
+ [name: string]: unknown;
90572
+ };
90573
+ content: {
90574
+ "application/pdf": string;
90575
+ };
90576
+ };
90577
+ /** @description Validation error */
90578
+ 400: {
90579
+ headers: {
90580
+ [name: string]: unknown;
90581
+ };
90582
+ content: {
90583
+ "application/json": components["schemas"]["Error"];
90584
+ };
90585
+ };
90586
+ /** @description Unauthorized */
90587
+ 401: {
90588
+ headers: {
90589
+ [name: string]: unknown;
90590
+ };
90591
+ content: {
90592
+ "application/json": components["schemas"]["Error"];
90593
+ };
90594
+ };
90595
+ /** @description Forbidden */
90596
+ 403: {
90597
+ headers: {
90598
+ [name: string]: unknown;
90599
+ };
90600
+ content: {
90601
+ "application/json": components["schemas"]["Error"];
90602
+ };
90603
+ };
90604
+ /** @description Not found */
90605
+ 404: {
90606
+ headers: {
90607
+ [name: string]: unknown;
90608
+ };
90609
+ content: {
90610
+ "application/json": components["schemas"]["Error"];
90611
+ };
90612
+ };
90613
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
90614
+ 409: {
90615
+ headers: {
90616
+ [name: string]: unknown;
90617
+ };
90618
+ content: {
90619
+ "application/json": components["schemas"]["Error"];
90620
+ };
90621
+ };
90622
+ /** @description Rate limited */
90623
+ 429: {
90624
+ headers: {
90625
+ [name: string]: unknown;
90626
+ };
90627
+ content: {
90628
+ "application/json": components["schemas"]["Error"];
90629
+ };
90630
+ };
90631
+ };
90632
+ };
90633
+ put?: never;
90634
+ post?: never;
90635
+ delete?: never;
90636
+ options?: never;
90637
+ head?: never;
90638
+ patch?: never;
90639
+ trace?: never;
90640
+ };
90641
+ "/finanzas/connect-setup/sii/{id}/mandato/revoke": {
90642
+ parameters: {
90643
+ query?: never;
90644
+ header?: never;
90645
+ path?: never;
90646
+ cookie?: never;
90647
+ };
90648
+ get?: never;
90649
+ put?: never;
90650
+ /**
90651
+ * Revoke the mandato (cláusula 7.1)
90652
+ * @description Revokes the signed mandato at the SII and here, with immediate effect: the SII connection stops acting for the empresa until a new mandato is signed. Requires the `finanzas` add-on (402 `ENTITLEMENT_NOT_ACTIVE` otherwise). Requires `finanzas_admin:write`.
90653
+ */
90654
+ post: {
90655
+ parameters: {
90656
+ query?: never;
90657
+ header?: {
90658
+ /** @description Replay-safe retries: resending the SAME key with the SAME body returns the original response (`X-Idempotent-Replay: 1`) instead of creating a second copy — safe to send whenever a response might not have arrived. The same key with a DIFFERENT body answers `409 IDEMPOTENCY_KEY_CONFLICT`; use a fresh key per operation. */
90659
+ "Idempotency-Key"?: string;
90660
+ };
90661
+ path: {
90662
+ id: string;
90663
+ };
90664
+ cookie?: never;
90665
+ };
90666
+ requestBody?: never;
90667
+ responses: {
90668
+ /** @description The setup after the revocation */
90669
+ 200: {
90670
+ headers: {
90671
+ [name: string]: unknown;
90672
+ };
90673
+ content: {
90674
+ /**
90675
+ * @example {
90676
+ * "data": {
90677
+ * "bank": {
90678
+ * "state": "done",
90679
+ * "connected": 1,
90680
+ * "has_movements": true
90681
+ * },
90682
+ * "sii": {
90683
+ * "connection": {
90684
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b01",
90685
+ * "legal_entity_id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b02",
90686
+ * "legal_name": "Clínica Ejemplo SpA",
90687
+ * "rut": "76123456-7",
90688
+ * "emission_on": false
90689
+ * },
90690
+ * "steps": [
90691
+ * {
90692
+ * "key": "razon_social",
90693
+ * "state": "done",
90694
+ * "reason": null
90695
+ * },
90696
+ * {
90697
+ * "key": "certificate",
90698
+ * "state": "done",
90699
+ * "reason": null
90700
+ * },
90701
+ * {
90702
+ * "key": "mandato",
90703
+ * "state": "waiting",
90704
+ * "reason": null
90705
+ * },
90706
+ * {
90707
+ * "key": "honorarios",
90708
+ * "state": "todo",
90709
+ * "reason": null
90710
+ * }
90711
+ * ],
90712
+ * "next_step": "honorarios",
90713
+ * "complete": false,
90714
+ * "honorarios": {
90715
+ * "evidence": false,
90716
+ * "declared_none_at": null,
90717
+ * "can_skip": true
90718
+ * },
90719
+ * "sociedades": [
90720
+ * {
90721
+ * "id": "0190a3c2-5d1e-7b6a-9f20-4c1d2e3f5b02",
90722
+ * "legal_name": "Clínica Ejemplo SpA",
90723
+ * "tax_id": "76123456-7",
90724
+ * "connected": true
90725
+ * }
90726
+ * ],
90727
+ * "suggestion": null,
90728
+ * "live": false
90729
+ * },
90730
+ * "onboarding": {
90731
+ * "mode": "guided",
90732
+ * "started_at": "2026-11-02T13:00:00.000Z",
90733
+ * "deferred_at": null
90734
+ * }
90735
+ * }
90736
+ * }
90737
+ */
90738
+ "application/json": {
90739
+ data: {
90740
+ bank: {
90741
+ /** @enum {string} */
90742
+ state: "todo" | "done";
90743
+ connected: number;
90744
+ has_movements: boolean;
90745
+ /** @description Live direct bank links (Fintoc / bank API); Mercado Pago is not counted. */
90746
+ direct: number;
90747
+ /**
90748
+ * @description `direct` = a live bank link reads the bank; `email` = movements arrive as bank notification e-mails (with some delay); `statement` = only imported statements (cartola, Chipax); `none` = nothing yet.
90749
+ * @enum {string}
90750
+ */
90751
+ feed: "direct" | "email" | "statement" | "none";
90752
+ };
90753
+ sii: {
90754
+ connection: {
90755
+ /** Format: uuid */
90756
+ id: string;
90757
+ /** Format: uuid */
90758
+ legal_entity_id: string;
90759
+ legal_name: string | null;
90760
+ rut: string;
90761
+ emission_on: boolean;
90762
+ } | null;
90763
+ steps: {
90764
+ /** @enum {string} */
90765
+ key: "razon_social" | "certificate" | "mandato" | "honorarios";
90766
+ /** @enum {string} */
90767
+ state: "todo" | "waiting" | "done" | "problem" | "skipped";
90768
+ reason: string | null;
90769
+ }[];
90770
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90771
+ /** @enum {string|null} */
90772
+ next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90773
+ complete: boolean;
90774
+ honorarios: {
90775
+ evidence: boolean;
90776
+ declared_none_at: string | null;
90777
+ can_skip: boolean;
90778
+ };
90779
+ sociedades: {
90780
+ /** Format: uuid */
90781
+ id: string;
90782
+ legal_name: string;
90783
+ tax_id: string;
90784
+ connected: boolean;
90785
+ }[];
90786
+ suggestion: {
90787
+ /** @enum {string} */
90788
+ source: "billing" | "sii";
90789
+ rut: string | null;
90790
+ legal_name: string | null;
90791
+ giro: string | null;
90792
+ address_street: string | null;
90793
+ /** @description The house number, split off a billing street that carried it («Av. 21 de Mayo 1126» → street «Av. 21 de Mayo», number «1126»). */
90794
+ address_number: string | null;
90795
+ /** @description The billing comuna, else the one the workspace's branch addresses name after the street; null when none resolves to exactly one. */
90796
+ comuna_code: string | null;
90797
+ comuna_name: string | null;
90798
+ } | null;
90799
+ live: boolean;
90800
+ };
90801
+ onboarding: {
90802
+ /**
90803
+ * @description `guided` = the full-page start, only for a workspace with no Finanzas documents and no bank movements; `checklist` = the «Conecta tus cuentas» card on Resumen; `done` = bank and SII connected.
90804
+ * @enum {string}
90805
+ */
90806
+ mode: "guided" | "checklist" | "done";
90807
+ started_at: string | null;
90808
+ deferred_at: string | null;
90809
+ };
90442
90810
  };
90443
90811
  };
90444
90812
  };
@@ -90644,6 +91012,7 @@ interface paths {
90644
91012
  state: "todo" | "waiting" | "done" | "problem" | "skipped";
90645
91013
  reason: string | null;
90646
91014
  }[];
91015
+ mandato?: components["schemas"]["FinanzasMandatoSignature"];
90647
91016
  /** @enum {string|null} */
90648
91017
  next_step: "razon_social" | "certificate" | "mandato" | "honorarios" | null;
90649
91018
  complete: boolean;
@@ -263656,6 +264025,31 @@ interface components {
263656
264025
  };
263657
264026
  };
263658
264027
  FinanzasAlertList: components["schemas"]["FinanzasAlert"][];
264028
+ FinanzasMandatoSignature: {
264029
+ /** Format: uuid */
264030
+ id: string;
264031
+ /**
264032
+ * @description `pending_signature` = the representante legal has the link; `connecting` = signed, being registered at the SII («Firmado, conectando con el SII…»); `connected` = registered; `failed` = signed but the SII registration keeps failing (retried automatically); `declined` = the signer rejected; `revoked` = revoked in Bancos y SII.
264033
+ * @enum {string}
264034
+ */
264035
+ phase: "none" | "pending_signature" | "connecting" | "connected" | "failed" | "declined" | "revoked";
264036
+ status: string;
264037
+ terms_version: string;
264038
+ terms_sha256: string;
264039
+ signer: {
264040
+ name: string;
264041
+ rut: string;
264042
+ email: string;
264043
+ };
264044
+ /** @description The representante legal's signing link while the signature is pending; null afterwards. */
264045
+ signing_url: string | null;
264046
+ signed_at: string | null;
264047
+ attested_at: string | null;
264048
+ problem: string | null;
264049
+ /** @description The signed PDF can be downloaded (`GET …/sii/{id}/mandato/document`). */
264050
+ document_available: boolean;
264051
+ created_at: string;
264052
+ } | null;
263659
264053
  FinanzasDigestPreview: {
263660
264054
  /** @description Monday of this week (YYYY-MM-DD, workspace time). */
263661
264055
  week_start: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "15.33.0",
3
+ "version": "15.34.1",
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",