@vitrina/api 14.44.1 → 14.45.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
@@ -27016,6 +27016,251 @@ interface paths {
27016
27016
  patch?: never;
27017
27017
  trace?: never;
27018
27018
  };
27019
+ "/leads/{id}/first-touch": {
27020
+ parameters: {
27021
+ query?: never;
27022
+ header?: never;
27023
+ path?: never;
27024
+ cookie?: never;
27025
+ };
27026
+ /**
27027
+ * One lead's first-touch outcome
27028
+ * @description Whether the proactive first message for this lead went out, and if not, why: `status` (`none` = never attempted, `pending`, `sent`, `skipped`, `error`), the `skip_reason` (`invalid_phone` carries the number the portal delivered in `skip_evidence.raw_phone`), the classified `error_class`/`error_code` of a failed send (`undeliverable` = WhatsApp could not reach the number), the conversation it opened, and the contact's current phone with `phone_dialable`. `retryable` says whether `POST /leads/{id}/first-touch/retry` would be accepted; `retry_blocked_reason` names why not (`already_sent`, `in_progress`, `do_not_contact`, `source_disabled`, `no_contact`).
27029
+ */
27030
+ get: {
27031
+ parameters: {
27032
+ query?: never;
27033
+ header?: never;
27034
+ path: {
27035
+ id: string;
27036
+ };
27037
+ cookie?: never;
27038
+ };
27039
+ requestBody?: never;
27040
+ responses: {
27041
+ /** @description Lead first-touch state */
27042
+ 200: {
27043
+ headers: {
27044
+ [name: string]: unknown;
27045
+ };
27046
+ content: {
27047
+ /**
27048
+ * @example {
27049
+ * "data": {
27050
+ * "status": "skipped",
27051
+ * "skip_reason": "invalid_phone",
27052
+ * "skip_evidence": {
27053
+ * "raw_phone": "+90773361"
27054
+ * },
27055
+ * "error_class": null,
27056
+ * "error_code": null,
27057
+ * "conversation_id": null,
27058
+ * "source": "chileautos",
27059
+ * "contact_id": "01a14658-50d7-764b-89dd-601c87c24fd7",
27060
+ * "phone": "+90773361",
27061
+ * "phone_dialable": false,
27062
+ * "retryable": true,
27063
+ * "retry_blocked_reason": null
27064
+ * }
27065
+ * }
27066
+ */
27067
+ "application/json": {
27068
+ data?: unknown;
27069
+ meta?: {
27070
+ [key: string]: unknown;
27071
+ };
27072
+ };
27073
+ };
27074
+ };
27075
+ /** @description Validation error */
27076
+ 400: {
27077
+ headers: {
27078
+ [name: string]: unknown;
27079
+ };
27080
+ content: {
27081
+ "application/json": components["schemas"]["Error"];
27082
+ };
27083
+ };
27084
+ /** @description Unauthorized */
27085
+ 401: {
27086
+ headers: {
27087
+ [name: string]: unknown;
27088
+ };
27089
+ content: {
27090
+ "application/json": components["schemas"]["Error"];
27091
+ };
27092
+ };
27093
+ /** @description Forbidden */
27094
+ 403: {
27095
+ headers: {
27096
+ [name: string]: unknown;
27097
+ };
27098
+ content: {
27099
+ "application/json": components["schemas"]["Error"];
27100
+ };
27101
+ };
27102
+ /** @description Not found */
27103
+ 404: {
27104
+ headers: {
27105
+ [name: string]: unknown;
27106
+ };
27107
+ content: {
27108
+ "application/json": components["schemas"]["Error"];
27109
+ };
27110
+ };
27111
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
27112
+ 409: {
27113
+ headers: {
27114
+ [name: string]: unknown;
27115
+ };
27116
+ content: {
27117
+ "application/json": components["schemas"]["Error"];
27118
+ };
27119
+ };
27120
+ /** @description Rate limited */
27121
+ 429: {
27122
+ headers: {
27123
+ [name: string]: unknown;
27124
+ };
27125
+ content: {
27126
+ "application/json": components["schemas"]["Error"];
27127
+ };
27128
+ };
27129
+ };
27130
+ };
27131
+ put?: never;
27132
+ post?: never;
27133
+ delete?: never;
27134
+ options?: never;
27135
+ head?: never;
27136
+ patch?: never;
27137
+ trace?: never;
27138
+ };
27139
+ "/leads/{id}/first-touch/retry": {
27140
+ parameters: {
27141
+ query?: never;
27142
+ header?: never;
27143
+ path?: never;
27144
+ cookie?: never;
27145
+ };
27146
+ get?: never;
27147
+ put?: never;
27148
+ /**
27149
+ * Send the first message again, after fixing the buyer phone
27150
+ * @description Re-runs the proactive first touch for a lead whose first attempt was skipped or failed — typically because the portal delivered a phone WhatsApp cannot reach. Pass `phone` to correct the contact first (it must pass the dial gate: E.164 or a 9-digit Chilean number, else 400 `invalid_phone`). Uses the configured template and account of the lead's source, reopens the buyer's original inquiry as the context card, and answers with the rail's outcome: `sent` with the new `conversation_id`, or `sent: false` with the `reason` (`burst_skip`, `no_template`, `daily_cap`, …). 409 with the blocking reason when the first touch already went out, is in flight, the person asked not to be contacted, or the source is off.
27151
+ */
27152
+ post: {
27153
+ parameters: {
27154
+ query?: never;
27155
+ header?: {
27156
+ /** @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. */
27157
+ "Idempotency-Key"?: string;
27158
+ };
27159
+ path: {
27160
+ id: string;
27161
+ };
27162
+ cookie?: never;
27163
+ };
27164
+ requestBody?: {
27165
+ content: {
27166
+ /**
27167
+ * @example {
27168
+ * "phone": "+56990773361"
27169
+ * }
27170
+ */
27171
+ "application/json": {
27172
+ /** @description Corrected buyer phone, applied to the contact before the retry. E.164 (`+56990773361`) or a 9-digit Chilean national number. */
27173
+ phone?: string;
27174
+ };
27175
+ };
27176
+ };
27177
+ responses: {
27178
+ /** @description First-touch retry outcome */
27179
+ 200: {
27180
+ headers: {
27181
+ [name: string]: unknown;
27182
+ };
27183
+ content: {
27184
+ /**
27185
+ * @example {
27186
+ * "data": {
27187
+ * "sent": true,
27188
+ * "reason": null,
27189
+ * "conversation_id": "c0c0c0c0-0000-4000-8000-000000000459",
27190
+ * "phone": "+56990773361"
27191
+ * }
27192
+ * }
27193
+ */
27194
+ "application/json": {
27195
+ data?: unknown;
27196
+ meta?: {
27197
+ [key: string]: unknown;
27198
+ };
27199
+ };
27200
+ };
27201
+ };
27202
+ /** @description Validation error */
27203
+ 400: {
27204
+ headers: {
27205
+ [name: string]: unknown;
27206
+ };
27207
+ content: {
27208
+ "application/json": components["schemas"]["Error"];
27209
+ };
27210
+ };
27211
+ /** @description Unauthorized */
27212
+ 401: {
27213
+ headers: {
27214
+ [name: string]: unknown;
27215
+ };
27216
+ content: {
27217
+ "application/json": components["schemas"]["Error"];
27218
+ };
27219
+ };
27220
+ /** @description Forbidden */
27221
+ 403: {
27222
+ headers: {
27223
+ [name: string]: unknown;
27224
+ };
27225
+ content: {
27226
+ "application/json": components["schemas"]["Error"];
27227
+ };
27228
+ };
27229
+ /** @description Not found */
27230
+ 404: {
27231
+ headers: {
27232
+ [name: string]: unknown;
27233
+ };
27234
+ content: {
27235
+ "application/json": components["schemas"]["Error"];
27236
+ };
27237
+ };
27238
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
27239
+ 409: {
27240
+ headers: {
27241
+ [name: string]: unknown;
27242
+ };
27243
+ content: {
27244
+ "application/json": components["schemas"]["Error"];
27245
+ };
27246
+ };
27247
+ /** @description Rate limited */
27248
+ 429: {
27249
+ headers: {
27250
+ [name: string]: unknown;
27251
+ };
27252
+ content: {
27253
+ "application/json": components["schemas"]["Error"];
27254
+ };
27255
+ };
27256
+ };
27257
+ };
27258
+ delete?: never;
27259
+ options?: never;
27260
+ head?: never;
27261
+ patch?: never;
27262
+ trace?: never;
27263
+ };
27019
27264
  "/leads/{id}/interests": {
27020
27265
  parameters: {
27021
27266
  query?: never;
@@ -184101,7 +184346,7 @@ interface paths {
184101
184346
  };
184102
184347
  /**
184103
184348
  * List the clinic's services
184104
- * @description The clinic's price list. `search` (min 2 chars) matches nombre, código or categoría accent-insensitively. `active` is OPTIONAL and omitting it returns every row. `precio` is the vendor LIST price before previsión/convenio — it is deliberately never shown to the AI agent. `is_entry` filters entry prestaciones, tri-state: `true` = entry (evaluación / diagnóstico), `false` = CONFIRMED treatment rows only, `unclassified` = nobody has said yet (`is_entry IS NULL`); omitted = every row. `arancel` (repeatable or comma-separated) keeps only rows priced in those vendor aranceles (`'0'` = «Arancel base»); each row carries `arancel_external_id` + `arancel_name`.
184349
+ * @description The clinic's price list. `search` (min 2 chars) matches nombre, código or categoría accent-insensitively. `active` is OPTIONAL and omitting it returns every row. `precio` is the vendor LIST price before previsión/convenio — it is deliberately never shown to the AI agent. `is_entry` filters entry prestaciones, tri-state: `true` = entry (evaluación / diagnóstico), `false` = CONFIRMED treatment rows only, `unclassified` = nobody has said yet (`is_entry IS NULL`); omitted = every row. `arancel` (repeatable or comma-separated) keeps only rows priced in those vendor aranceles (`'0'` = «Arancel base»); each row carries `arancel_external_id` + `arancel_name`. `categoria` keeps one exact category. `agent_bookable` (`yes` | `no`) filters on the EFFECTIVE agent-bookable value: each row carries the explicit `agent_bookable` (null = undecided) and `agent_bookable_effective` (`agent_bookable ?? settings.clinic_attendance.agent_bookable_default`, unset default = true).
184105
184350
  *
184106
184351
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184107
184352
  */
@@ -184113,6 +184358,8 @@ interface paths {
184113
184358
  review_state?: "pending" | "stale" | "draft" | "reviewed";
184114
184359
  is_entry?: "true" | "false" | "unclassified";
184115
184360
  arancel?: string[] | null;
184361
+ categoria?: string;
184362
+ agent_bookable?: "yes" | "no";
184116
184363
  sort?: "nombre" | "codigo" | "categoria" | "tipo" | "precio" | "synced_at";
184117
184364
  dir?: "asc" | "desc";
184118
184365
  page?: number;
@@ -184297,6 +184544,7 @@ interface paths {
184297
184544
  is_telehealth?: boolean;
184298
184545
  online_bookable?: boolean;
184299
184546
  is_entry?: boolean | null;
184547
+ agent_bookable?: boolean | null;
184300
184548
  lab_bearing?: boolean;
184301
184549
  /** Format: uuid */
184302
184550
  requires_consent_template_id?: string | null;
@@ -184526,6 +184774,239 @@ interface paths {
184526
184774
  patch?: never;
184527
184775
  trace?: never;
184528
184776
  };
184777
+ "/clinic/services/agent-bookable-count": {
184778
+ parameters: {
184779
+ query?: never;
184780
+ header?: never;
184781
+ path?: never;
184782
+ cookie?: never;
184783
+ };
184784
+ /**
184785
+ * How many active prestaciones the AI agent may book
184786
+ * @description `{ bookable, reception_only, total }` over ACTIVE services, by the EFFECTIVE agent-bookable value (`agent_bookable`, or the tenant default `settings.clinic_attendance.agent_bookable_default` when the row is undecided). `arancel` (repeatable or comma-separated) counts only rows priced in those vendor aranceles.
184787
+ *
184788
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184789
+ */
184790
+ get: {
184791
+ parameters: {
184792
+ query?: {
184793
+ arancel?: string[] | null;
184794
+ };
184795
+ header?: never;
184796
+ path?: never;
184797
+ cookie?: never;
184798
+ };
184799
+ requestBody?: never;
184800
+ responses: {
184801
+ /** @description Agent-bookable split */
184802
+ 200: {
184803
+ headers: {
184804
+ [name: string]: unknown;
184805
+ };
184806
+ content: {
184807
+ /**
184808
+ * @example {
184809
+ * "data": {
184810
+ * "bookable": 12,
184811
+ * "reception_only": 383,
184812
+ * "total": 395
184813
+ * }
184814
+ * }
184815
+ */
184816
+ "application/json": {
184817
+ data: components["schemas"]["ClinicServiceAgentBookableCount"];
184818
+ };
184819
+ };
184820
+ };
184821
+ /** @description Validation error */
184822
+ 400: {
184823
+ headers: {
184824
+ [name: string]: unknown;
184825
+ };
184826
+ content: {
184827
+ "application/json": components["schemas"]["Error"];
184828
+ };
184829
+ };
184830
+ /** @description Unauthorized */
184831
+ 401: {
184832
+ headers: {
184833
+ [name: string]: unknown;
184834
+ };
184835
+ content: {
184836
+ "application/json": components["schemas"]["Error"];
184837
+ };
184838
+ };
184839
+ /** @description Forbidden */
184840
+ 403: {
184841
+ headers: {
184842
+ [name: string]: unknown;
184843
+ };
184844
+ content: {
184845
+ "application/json": components["schemas"]["Error"];
184846
+ };
184847
+ };
184848
+ /** @description Not found */
184849
+ 404: {
184850
+ headers: {
184851
+ [name: string]: unknown;
184852
+ };
184853
+ content: {
184854
+ "application/json": components["schemas"]["Error"];
184855
+ };
184856
+ };
184857
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
184858
+ 409: {
184859
+ headers: {
184860
+ [name: string]: unknown;
184861
+ };
184862
+ content: {
184863
+ "application/json": components["schemas"]["Error"];
184864
+ };
184865
+ };
184866
+ /** @description Rate limited */
184867
+ 429: {
184868
+ headers: {
184869
+ [name: string]: unknown;
184870
+ };
184871
+ content: {
184872
+ "application/json": components["schemas"]["Error"];
184873
+ };
184874
+ };
184875
+ };
184876
+ };
184877
+ put?: never;
184878
+ post?: never;
184879
+ delete?: never;
184880
+ options?: never;
184881
+ head?: never;
184882
+ patch?: never;
184883
+ trace?: never;
184884
+ };
184885
+ "/clinic/services/agent-bookable": {
184886
+ parameters: {
184887
+ query?: never;
184888
+ header?: never;
184889
+ path?: never;
184890
+ cookie?: never;
184891
+ };
184892
+ get?: never;
184893
+ put?: never;
184894
+ /**
184895
+ * Set which prestaciones the AI agent may book, in bulk
184896
+ * @description Sets `agent_bookable` to `value` — `true` (the agent may offer and book it), `false` (reception-only: the agent knows it exists, tells the patient reception schedules it and never books it) or `null` (back to the tenant default) — on up to 500 `ids`, OR on every row matching `all_matching` (the same filters, in the same string form, as the `GET /clinic/services` query). Exactly one of the two. Works on ANY source — the flag is Vitrina-owned and never reaches the vendor. `updated` is how many rows matched; ids of another tenant match nothing.
184897
+ *
184898
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184899
+ */
184900
+ post: {
184901
+ parameters: {
184902
+ query?: never;
184903
+ header?: {
184904
+ /** @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. */
184905
+ "Idempotency-Key"?: string;
184906
+ };
184907
+ path?: never;
184908
+ cookie?: never;
184909
+ };
184910
+ requestBody?: {
184911
+ content: {
184912
+ /**
184913
+ * @example {
184914
+ * "value": false,
184915
+ * "all_matching": {
184916
+ * "search": "control",
184917
+ * "active": "true",
184918
+ * "arancel": "0"
184919
+ * }
184920
+ * }
184921
+ */
184922
+ "application/json": {
184923
+ value: boolean | null;
184924
+ ids?: string[];
184925
+ all_matching?: components["schemas"]["ClinicServiceMatchFilter"];
184926
+ };
184927
+ };
184928
+ };
184929
+ responses: {
184930
+ /** @description Rows updated */
184931
+ 200: {
184932
+ headers: {
184933
+ [name: string]: unknown;
184934
+ };
184935
+ content: {
184936
+ /**
184937
+ * @example {
184938
+ * "data": {
184939
+ * "updated": 37
184940
+ * }
184941
+ * }
184942
+ */
184943
+ "application/json": {
184944
+ data: components["schemas"]["ClinicServiceEntryFlagsResult"];
184945
+ };
184946
+ };
184947
+ };
184948
+ /** @description Validation error */
184949
+ 400: {
184950
+ headers: {
184951
+ [name: string]: unknown;
184952
+ };
184953
+ content: {
184954
+ "application/json": components["schemas"]["Error"];
184955
+ };
184956
+ };
184957
+ /** @description Unauthorized */
184958
+ 401: {
184959
+ headers: {
184960
+ [name: string]: unknown;
184961
+ };
184962
+ content: {
184963
+ "application/json": components["schemas"]["Error"];
184964
+ };
184965
+ };
184966
+ /** @description Forbidden */
184967
+ 403: {
184968
+ headers: {
184969
+ [name: string]: unknown;
184970
+ };
184971
+ content: {
184972
+ "application/json": components["schemas"]["Error"];
184973
+ };
184974
+ };
184975
+ /** @description Not found */
184976
+ 404: {
184977
+ headers: {
184978
+ [name: string]: unknown;
184979
+ };
184980
+ content: {
184981
+ "application/json": components["schemas"]["Error"];
184982
+ };
184983
+ };
184984
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
184985
+ 409: {
184986
+ headers: {
184987
+ [name: string]: unknown;
184988
+ };
184989
+ content: {
184990
+ "application/json": components["schemas"]["Error"];
184991
+ };
184992
+ };
184993
+ /** @description Rate limited */
184994
+ 429: {
184995
+ headers: {
184996
+ [name: string]: unknown;
184997
+ };
184998
+ content: {
184999
+ "application/json": components["schemas"]["Error"];
185000
+ };
185001
+ };
185002
+ };
185003
+ };
185004
+ delete?: never;
185005
+ options?: never;
185006
+ head?: never;
185007
+ patch?: never;
185008
+ trace?: never;
185009
+ };
184529
185010
  "/clinic/services/{id}": {
184530
185011
  parameters: {
184531
185012
  query?: never;
@@ -184651,6 +185132,7 @@ interface paths {
184651
185132
  is_telehealth?: boolean;
184652
185133
  online_bookable?: boolean;
184653
185134
  is_entry?: boolean | null;
185135
+ agent_bookable?: boolean | null;
184654
185136
  lab_bearing?: boolean;
184655
185137
  /** Format: uuid */
184656
185138
  requires_consent_template_id?: string | null;
@@ -186873,6 +187355,8 @@ interface components {
186873
187355
  is_telehealth: boolean;
186874
187356
  online_bookable: boolean;
186875
187357
  is_entry: boolean | null;
187358
+ agent_bookable: boolean | null;
187359
+ agent_bookable_effective: boolean;
186876
187360
  lab_bearing: boolean;
186877
187361
  requires_consent_template_id: string | null;
186878
187362
  eligibility_min_age_years: number | null;
@@ -194266,6 +194750,27 @@ interface components {
194266
194750
  /** @description The Flow JSON, as a string. */
194267
194751
  flow_json: string;
194268
194752
  };
194753
+ ClinicServiceEntryFlagsResult: {
194754
+ updated: number;
194755
+ };
194756
+ ClinicServiceAgentBookableCount: {
194757
+ bookable: number;
194758
+ reception_only: number;
194759
+ total: number;
194760
+ };
194761
+ ClinicServiceMatchFilter: {
194762
+ search?: string;
194763
+ /** @enum {string} */
194764
+ active?: "true" | "false";
194765
+ /** @enum {string} */
194766
+ review_state?: "pending" | "stale" | "draft" | "reviewed";
194767
+ /** @enum {string} */
194768
+ is_entry?: "true" | "false" | "unclassified";
194769
+ arancel?: string[] | null;
194770
+ categoria?: string;
194771
+ /** @enum {string} */
194772
+ agent_bookable?: "yes" | "no";
194773
+ };
194269
194774
  };
194270
194775
  responses: never;
194271
194776
  parameters: never;
package/dist/index.d.ts CHANGED
@@ -27016,6 +27016,251 @@ interface paths {
27016
27016
  patch?: never;
27017
27017
  trace?: never;
27018
27018
  };
27019
+ "/leads/{id}/first-touch": {
27020
+ parameters: {
27021
+ query?: never;
27022
+ header?: never;
27023
+ path?: never;
27024
+ cookie?: never;
27025
+ };
27026
+ /**
27027
+ * One lead's first-touch outcome
27028
+ * @description Whether the proactive first message for this lead went out, and if not, why: `status` (`none` = never attempted, `pending`, `sent`, `skipped`, `error`), the `skip_reason` (`invalid_phone` carries the number the portal delivered in `skip_evidence.raw_phone`), the classified `error_class`/`error_code` of a failed send (`undeliverable` = WhatsApp could not reach the number), the conversation it opened, and the contact's current phone with `phone_dialable`. `retryable` says whether `POST /leads/{id}/first-touch/retry` would be accepted; `retry_blocked_reason` names why not (`already_sent`, `in_progress`, `do_not_contact`, `source_disabled`, `no_contact`).
27029
+ */
27030
+ get: {
27031
+ parameters: {
27032
+ query?: never;
27033
+ header?: never;
27034
+ path: {
27035
+ id: string;
27036
+ };
27037
+ cookie?: never;
27038
+ };
27039
+ requestBody?: never;
27040
+ responses: {
27041
+ /** @description Lead first-touch state */
27042
+ 200: {
27043
+ headers: {
27044
+ [name: string]: unknown;
27045
+ };
27046
+ content: {
27047
+ /**
27048
+ * @example {
27049
+ * "data": {
27050
+ * "status": "skipped",
27051
+ * "skip_reason": "invalid_phone",
27052
+ * "skip_evidence": {
27053
+ * "raw_phone": "+90773361"
27054
+ * },
27055
+ * "error_class": null,
27056
+ * "error_code": null,
27057
+ * "conversation_id": null,
27058
+ * "source": "chileautos",
27059
+ * "contact_id": "01a14658-50d7-764b-89dd-601c87c24fd7",
27060
+ * "phone": "+90773361",
27061
+ * "phone_dialable": false,
27062
+ * "retryable": true,
27063
+ * "retry_blocked_reason": null
27064
+ * }
27065
+ * }
27066
+ */
27067
+ "application/json": {
27068
+ data?: unknown;
27069
+ meta?: {
27070
+ [key: string]: unknown;
27071
+ };
27072
+ };
27073
+ };
27074
+ };
27075
+ /** @description Validation error */
27076
+ 400: {
27077
+ headers: {
27078
+ [name: string]: unknown;
27079
+ };
27080
+ content: {
27081
+ "application/json": components["schemas"]["Error"];
27082
+ };
27083
+ };
27084
+ /** @description Unauthorized */
27085
+ 401: {
27086
+ headers: {
27087
+ [name: string]: unknown;
27088
+ };
27089
+ content: {
27090
+ "application/json": components["schemas"]["Error"];
27091
+ };
27092
+ };
27093
+ /** @description Forbidden */
27094
+ 403: {
27095
+ headers: {
27096
+ [name: string]: unknown;
27097
+ };
27098
+ content: {
27099
+ "application/json": components["schemas"]["Error"];
27100
+ };
27101
+ };
27102
+ /** @description Not found */
27103
+ 404: {
27104
+ headers: {
27105
+ [name: string]: unknown;
27106
+ };
27107
+ content: {
27108
+ "application/json": components["schemas"]["Error"];
27109
+ };
27110
+ };
27111
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
27112
+ 409: {
27113
+ headers: {
27114
+ [name: string]: unknown;
27115
+ };
27116
+ content: {
27117
+ "application/json": components["schemas"]["Error"];
27118
+ };
27119
+ };
27120
+ /** @description Rate limited */
27121
+ 429: {
27122
+ headers: {
27123
+ [name: string]: unknown;
27124
+ };
27125
+ content: {
27126
+ "application/json": components["schemas"]["Error"];
27127
+ };
27128
+ };
27129
+ };
27130
+ };
27131
+ put?: never;
27132
+ post?: never;
27133
+ delete?: never;
27134
+ options?: never;
27135
+ head?: never;
27136
+ patch?: never;
27137
+ trace?: never;
27138
+ };
27139
+ "/leads/{id}/first-touch/retry": {
27140
+ parameters: {
27141
+ query?: never;
27142
+ header?: never;
27143
+ path?: never;
27144
+ cookie?: never;
27145
+ };
27146
+ get?: never;
27147
+ put?: never;
27148
+ /**
27149
+ * Send the first message again, after fixing the buyer phone
27150
+ * @description Re-runs the proactive first touch for a lead whose first attempt was skipped or failed — typically because the portal delivered a phone WhatsApp cannot reach. Pass `phone` to correct the contact first (it must pass the dial gate: E.164 or a 9-digit Chilean number, else 400 `invalid_phone`). Uses the configured template and account of the lead's source, reopens the buyer's original inquiry as the context card, and answers with the rail's outcome: `sent` with the new `conversation_id`, or `sent: false` with the `reason` (`burst_skip`, `no_template`, `daily_cap`, …). 409 with the blocking reason when the first touch already went out, is in flight, the person asked not to be contacted, or the source is off.
27151
+ */
27152
+ post: {
27153
+ parameters: {
27154
+ query?: never;
27155
+ header?: {
27156
+ /** @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. */
27157
+ "Idempotency-Key"?: string;
27158
+ };
27159
+ path: {
27160
+ id: string;
27161
+ };
27162
+ cookie?: never;
27163
+ };
27164
+ requestBody?: {
27165
+ content: {
27166
+ /**
27167
+ * @example {
27168
+ * "phone": "+56990773361"
27169
+ * }
27170
+ */
27171
+ "application/json": {
27172
+ /** @description Corrected buyer phone, applied to the contact before the retry. E.164 (`+56990773361`) or a 9-digit Chilean national number. */
27173
+ phone?: string;
27174
+ };
27175
+ };
27176
+ };
27177
+ responses: {
27178
+ /** @description First-touch retry outcome */
27179
+ 200: {
27180
+ headers: {
27181
+ [name: string]: unknown;
27182
+ };
27183
+ content: {
27184
+ /**
27185
+ * @example {
27186
+ * "data": {
27187
+ * "sent": true,
27188
+ * "reason": null,
27189
+ * "conversation_id": "c0c0c0c0-0000-4000-8000-000000000459",
27190
+ * "phone": "+56990773361"
27191
+ * }
27192
+ * }
27193
+ */
27194
+ "application/json": {
27195
+ data?: unknown;
27196
+ meta?: {
27197
+ [key: string]: unknown;
27198
+ };
27199
+ };
27200
+ };
27201
+ };
27202
+ /** @description Validation error */
27203
+ 400: {
27204
+ headers: {
27205
+ [name: string]: unknown;
27206
+ };
27207
+ content: {
27208
+ "application/json": components["schemas"]["Error"];
27209
+ };
27210
+ };
27211
+ /** @description Unauthorized */
27212
+ 401: {
27213
+ headers: {
27214
+ [name: string]: unknown;
27215
+ };
27216
+ content: {
27217
+ "application/json": components["schemas"]["Error"];
27218
+ };
27219
+ };
27220
+ /** @description Forbidden */
27221
+ 403: {
27222
+ headers: {
27223
+ [name: string]: unknown;
27224
+ };
27225
+ content: {
27226
+ "application/json": components["schemas"]["Error"];
27227
+ };
27228
+ };
27229
+ /** @description Not found */
27230
+ 404: {
27231
+ headers: {
27232
+ [name: string]: unknown;
27233
+ };
27234
+ content: {
27235
+ "application/json": components["schemas"]["Error"];
27236
+ };
27237
+ };
27238
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
27239
+ 409: {
27240
+ headers: {
27241
+ [name: string]: unknown;
27242
+ };
27243
+ content: {
27244
+ "application/json": components["schemas"]["Error"];
27245
+ };
27246
+ };
27247
+ /** @description Rate limited */
27248
+ 429: {
27249
+ headers: {
27250
+ [name: string]: unknown;
27251
+ };
27252
+ content: {
27253
+ "application/json": components["schemas"]["Error"];
27254
+ };
27255
+ };
27256
+ };
27257
+ };
27258
+ delete?: never;
27259
+ options?: never;
27260
+ head?: never;
27261
+ patch?: never;
27262
+ trace?: never;
27263
+ };
27019
27264
  "/leads/{id}/interests": {
27020
27265
  parameters: {
27021
27266
  query?: never;
@@ -184101,7 +184346,7 @@ interface paths {
184101
184346
  };
184102
184347
  /**
184103
184348
  * List the clinic's services
184104
- * @description The clinic's price list. `search` (min 2 chars) matches nombre, código or categoría accent-insensitively. `active` is OPTIONAL and omitting it returns every row. `precio` is the vendor LIST price before previsión/convenio — it is deliberately never shown to the AI agent. `is_entry` filters entry prestaciones, tri-state: `true` = entry (evaluación / diagnóstico), `false` = CONFIRMED treatment rows only, `unclassified` = nobody has said yet (`is_entry IS NULL`); omitted = every row. `arancel` (repeatable or comma-separated) keeps only rows priced in those vendor aranceles (`'0'` = «Arancel base»); each row carries `arancel_external_id` + `arancel_name`.
184349
+ * @description The clinic's price list. `search` (min 2 chars) matches nombre, código or categoría accent-insensitively. `active` is OPTIONAL and omitting it returns every row. `precio` is the vendor LIST price before previsión/convenio — it is deliberately never shown to the AI agent. `is_entry` filters entry prestaciones, tri-state: `true` = entry (evaluación / diagnóstico), `false` = CONFIRMED treatment rows only, `unclassified` = nobody has said yet (`is_entry IS NULL`); omitted = every row. `arancel` (repeatable or comma-separated) keeps only rows priced in those vendor aranceles (`'0'` = «Arancel base»); each row carries `arancel_external_id` + `arancel_name`. `categoria` keeps one exact category. `agent_bookable` (`yes` | `no`) filters on the EFFECTIVE agent-bookable value: each row carries the explicit `agent_bookable` (null = undecided) and `agent_bookable_effective` (`agent_bookable ?? settings.clinic_attendance.agent_bookable_default`, unset default = true).
184105
184350
  *
184106
184351
  * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184107
184352
  */
@@ -184113,6 +184358,8 @@ interface paths {
184113
184358
  review_state?: "pending" | "stale" | "draft" | "reviewed";
184114
184359
  is_entry?: "true" | "false" | "unclassified";
184115
184360
  arancel?: string[] | null;
184361
+ categoria?: string;
184362
+ agent_bookable?: "yes" | "no";
184116
184363
  sort?: "nombre" | "codigo" | "categoria" | "tipo" | "precio" | "synced_at";
184117
184364
  dir?: "asc" | "desc";
184118
184365
  page?: number;
@@ -184297,6 +184544,7 @@ interface paths {
184297
184544
  is_telehealth?: boolean;
184298
184545
  online_bookable?: boolean;
184299
184546
  is_entry?: boolean | null;
184547
+ agent_bookable?: boolean | null;
184300
184548
  lab_bearing?: boolean;
184301
184549
  /** Format: uuid */
184302
184550
  requires_consent_template_id?: string | null;
@@ -184526,6 +184774,239 @@ interface paths {
184526
184774
  patch?: never;
184527
184775
  trace?: never;
184528
184776
  };
184777
+ "/clinic/services/agent-bookable-count": {
184778
+ parameters: {
184779
+ query?: never;
184780
+ header?: never;
184781
+ path?: never;
184782
+ cookie?: never;
184783
+ };
184784
+ /**
184785
+ * How many active prestaciones the AI agent may book
184786
+ * @description `{ bookable, reception_only, total }` over ACTIVE services, by the EFFECTIVE agent-bookable value (`agent_bookable`, or the tenant default `settings.clinic_attendance.agent_bookable_default` when the row is undecided). `arancel` (repeatable or comma-separated) counts only rows priced in those vendor aranceles.
184787
+ *
184788
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184789
+ */
184790
+ get: {
184791
+ parameters: {
184792
+ query?: {
184793
+ arancel?: string[] | null;
184794
+ };
184795
+ header?: never;
184796
+ path?: never;
184797
+ cookie?: never;
184798
+ };
184799
+ requestBody?: never;
184800
+ responses: {
184801
+ /** @description Agent-bookable split */
184802
+ 200: {
184803
+ headers: {
184804
+ [name: string]: unknown;
184805
+ };
184806
+ content: {
184807
+ /**
184808
+ * @example {
184809
+ * "data": {
184810
+ * "bookable": 12,
184811
+ * "reception_only": 383,
184812
+ * "total": 395
184813
+ * }
184814
+ * }
184815
+ */
184816
+ "application/json": {
184817
+ data: components["schemas"]["ClinicServiceAgentBookableCount"];
184818
+ };
184819
+ };
184820
+ };
184821
+ /** @description Validation error */
184822
+ 400: {
184823
+ headers: {
184824
+ [name: string]: unknown;
184825
+ };
184826
+ content: {
184827
+ "application/json": components["schemas"]["Error"];
184828
+ };
184829
+ };
184830
+ /** @description Unauthorized */
184831
+ 401: {
184832
+ headers: {
184833
+ [name: string]: unknown;
184834
+ };
184835
+ content: {
184836
+ "application/json": components["schemas"]["Error"];
184837
+ };
184838
+ };
184839
+ /** @description Forbidden */
184840
+ 403: {
184841
+ headers: {
184842
+ [name: string]: unknown;
184843
+ };
184844
+ content: {
184845
+ "application/json": components["schemas"]["Error"];
184846
+ };
184847
+ };
184848
+ /** @description Not found */
184849
+ 404: {
184850
+ headers: {
184851
+ [name: string]: unknown;
184852
+ };
184853
+ content: {
184854
+ "application/json": components["schemas"]["Error"];
184855
+ };
184856
+ };
184857
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
184858
+ 409: {
184859
+ headers: {
184860
+ [name: string]: unknown;
184861
+ };
184862
+ content: {
184863
+ "application/json": components["schemas"]["Error"];
184864
+ };
184865
+ };
184866
+ /** @description Rate limited */
184867
+ 429: {
184868
+ headers: {
184869
+ [name: string]: unknown;
184870
+ };
184871
+ content: {
184872
+ "application/json": components["schemas"]["Error"];
184873
+ };
184874
+ };
184875
+ };
184876
+ };
184877
+ put?: never;
184878
+ post?: never;
184879
+ delete?: never;
184880
+ options?: never;
184881
+ head?: never;
184882
+ patch?: never;
184883
+ trace?: never;
184884
+ };
184885
+ "/clinic/services/agent-bookable": {
184886
+ parameters: {
184887
+ query?: never;
184888
+ header?: never;
184889
+ path?: never;
184890
+ cookie?: never;
184891
+ };
184892
+ get?: never;
184893
+ put?: never;
184894
+ /**
184895
+ * Set which prestaciones the AI agent may book, in bulk
184896
+ * @description Sets `agent_bookable` to `value` — `true` (the agent may offer and book it), `false` (reception-only: the agent knows it exists, tells the patient reception schedules it and never books it) or `null` (back to the tenant default) — on up to 500 `ids`, OR on every row matching `all_matching` (the same filters, in the same string form, as the `GET /clinic/services` query). Exactly one of the two. Works on ANY source — the flag is Vitrina-owned and never reaches the vendor. `updated` is how many rows matched; ids of another tenant match nothing.
184897
+ *
184898
+ * **Connected apps:** every patient and contact in the response is a Seudónimo de paciente — initials plus a stable number, `"M.F. · #1001"` — unless the clinic allowed patient names, with RUT, phone and email masked in free text and `meta.patient_privacy` saying so. Clinical alerts (`flags`) are withheld in both modes, and a non-JSON body (an export, a file) is refused with `403 CONNECTED_APP_SENSITIVE_DATA`.
184899
+ */
184900
+ post: {
184901
+ parameters: {
184902
+ query?: never;
184903
+ header?: {
184904
+ /** @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. */
184905
+ "Idempotency-Key"?: string;
184906
+ };
184907
+ path?: never;
184908
+ cookie?: never;
184909
+ };
184910
+ requestBody?: {
184911
+ content: {
184912
+ /**
184913
+ * @example {
184914
+ * "value": false,
184915
+ * "all_matching": {
184916
+ * "search": "control",
184917
+ * "active": "true",
184918
+ * "arancel": "0"
184919
+ * }
184920
+ * }
184921
+ */
184922
+ "application/json": {
184923
+ value: boolean | null;
184924
+ ids?: string[];
184925
+ all_matching?: components["schemas"]["ClinicServiceMatchFilter"];
184926
+ };
184927
+ };
184928
+ };
184929
+ responses: {
184930
+ /** @description Rows updated */
184931
+ 200: {
184932
+ headers: {
184933
+ [name: string]: unknown;
184934
+ };
184935
+ content: {
184936
+ /**
184937
+ * @example {
184938
+ * "data": {
184939
+ * "updated": 37
184940
+ * }
184941
+ * }
184942
+ */
184943
+ "application/json": {
184944
+ data: components["schemas"]["ClinicServiceEntryFlagsResult"];
184945
+ };
184946
+ };
184947
+ };
184948
+ /** @description Validation error */
184949
+ 400: {
184950
+ headers: {
184951
+ [name: string]: unknown;
184952
+ };
184953
+ content: {
184954
+ "application/json": components["schemas"]["Error"];
184955
+ };
184956
+ };
184957
+ /** @description Unauthorized */
184958
+ 401: {
184959
+ headers: {
184960
+ [name: string]: unknown;
184961
+ };
184962
+ content: {
184963
+ "application/json": components["schemas"]["Error"];
184964
+ };
184965
+ };
184966
+ /** @description Forbidden */
184967
+ 403: {
184968
+ headers: {
184969
+ [name: string]: unknown;
184970
+ };
184971
+ content: {
184972
+ "application/json": components["schemas"]["Error"];
184973
+ };
184974
+ };
184975
+ /** @description Not found */
184976
+ 404: {
184977
+ headers: {
184978
+ [name: string]: unknown;
184979
+ };
184980
+ content: {
184981
+ "application/json": components["schemas"]["Error"];
184982
+ };
184983
+ };
184984
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
184985
+ 409: {
184986
+ headers: {
184987
+ [name: string]: unknown;
184988
+ };
184989
+ content: {
184990
+ "application/json": components["schemas"]["Error"];
184991
+ };
184992
+ };
184993
+ /** @description Rate limited */
184994
+ 429: {
184995
+ headers: {
184996
+ [name: string]: unknown;
184997
+ };
184998
+ content: {
184999
+ "application/json": components["schemas"]["Error"];
185000
+ };
185001
+ };
185002
+ };
185003
+ };
185004
+ delete?: never;
185005
+ options?: never;
185006
+ head?: never;
185007
+ patch?: never;
185008
+ trace?: never;
185009
+ };
184529
185010
  "/clinic/services/{id}": {
184530
185011
  parameters: {
184531
185012
  query?: never;
@@ -184651,6 +185132,7 @@ interface paths {
184651
185132
  is_telehealth?: boolean;
184652
185133
  online_bookable?: boolean;
184653
185134
  is_entry?: boolean | null;
185135
+ agent_bookable?: boolean | null;
184654
185136
  lab_bearing?: boolean;
184655
185137
  /** Format: uuid */
184656
185138
  requires_consent_template_id?: string | null;
@@ -186873,6 +187355,8 @@ interface components {
186873
187355
  is_telehealth: boolean;
186874
187356
  online_bookable: boolean;
186875
187357
  is_entry: boolean | null;
187358
+ agent_bookable: boolean | null;
187359
+ agent_bookable_effective: boolean;
186876
187360
  lab_bearing: boolean;
186877
187361
  requires_consent_template_id: string | null;
186878
187362
  eligibility_min_age_years: number | null;
@@ -194266,6 +194750,27 @@ interface components {
194266
194750
  /** @description The Flow JSON, as a string. */
194267
194751
  flow_json: string;
194268
194752
  };
194753
+ ClinicServiceEntryFlagsResult: {
194754
+ updated: number;
194755
+ };
194756
+ ClinicServiceAgentBookableCount: {
194757
+ bookable: number;
194758
+ reception_only: number;
194759
+ total: number;
194760
+ };
194761
+ ClinicServiceMatchFilter: {
194762
+ search?: string;
194763
+ /** @enum {string} */
194764
+ active?: "true" | "false";
194765
+ /** @enum {string} */
194766
+ review_state?: "pending" | "stale" | "draft" | "reviewed";
194767
+ /** @enum {string} */
194768
+ is_entry?: "true" | "false" | "unclassified";
194769
+ arancel?: string[] | null;
194770
+ categoria?: string;
194771
+ /** @enum {string} */
194772
+ agent_bookable?: "yes" | "no";
194773
+ };
194269
194774
  };
194270
194775
  responses: never;
194271
194776
  parameters: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "14.44.1",
3
+ "version": "14.45.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",