@vitrina/api 11.29.0 → 11.30.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
@@ -13399,7 +13399,7 @@ interface paths {
13399
13399
  };
13400
13400
  /**
13401
13401
  * Read the channel AI availability policy and current status
13402
- * @description Returns the per-channel coverage clock and its current evaluation. Schedule availability does not override agent assignment, channel kill switches, or a human takeover. An account without a saved policy reports `configured: false` and preserves the legacy always-eligible schedule. `policy.timezone` and `status.effective_timezone` report the server-resolved clock inherited from General settings or selected business hours. `policy.human_silence_resume` and `policy.handoff_renotify` are always present in the response with defaults applied (enabled, 30 minutes).
13402
+ * @description Returns the per-channel coverage clock and its current evaluation. Schedule availability does not override agent assignment, channel kill switches, or a human takeover. An account without a saved policy reports `configured: false` and preserves the legacy always-eligible schedule. `policy.timezone` and `status.effective_timezone` report the server-resolved clock inherited from General settings or selected business hours. `policy.human_silence_resume` and `policy.handoff_renotify` are always present in the response with defaults applied (resume: enabled, 30 minutes; re-notify: disabled, 30 minutes once enabled).
13403
13403
  */
13404
13404
  get: {
13405
13405
  parameters: {
@@ -13432,7 +13432,7 @@ interface paths {
13432
13432
  * "minutes": 30
13433
13433
  * },
13434
13434
  * "handoff_renotify": {
13435
- * "enabled": true,
13435
+ * "enabled": false,
13436
13436
  * "minutes": 30
13437
13437
  * },
13438
13438
  * "timezone": "America/Santiago"
@@ -13546,7 +13546,7 @@ interface paths {
13546
13546
  * "minutes": 30
13547
13547
  * },
13548
13548
  * "handoff_renotify": {
13549
- * "enabled": true,
13549
+ * "enabled": false,
13550
13550
  * "minutes": 30
13551
13551
  * }
13552
13552
  * }
@@ -13573,7 +13573,7 @@ interface paths {
13573
13573
  enabled: boolean;
13574
13574
  minutes: number;
13575
13575
  };
13576
- /** @description The AI handed the conversation off explicitly, so it stays out. While the customer's message stays unanswered, notify the assignee (or, when nobody is assigned, the channel roster) every `minutes`, with owners and admins copied. Checked on a 10-minute tick; stops 24 hours after the customer's message. Absent = enabled, 30 minutes. */
13576
+ /** @description The AI handed the conversation off explicitly, so it stays out. While the customer's message stays unanswered, notify the assignee (or, when nobody is assigned, the channel roster) every `minutes`, with owners and admins copied. Checked on a 10-minute tick; stops 24 hours after the customer's message. Absent = DISABLED (opt-in per channel); once enabled, the default cadence is 30 minutes. */
13577
13577
  handoff_renotify?: {
13578
13578
  enabled: boolean;
13579
13579
  minutes: number;
@@ -13602,7 +13602,7 @@ interface paths {
13602
13602
  * "minutes": 30
13603
13603
  * },
13604
13604
  * "handoff_renotify": {
13605
- * "enabled": true,
13605
+ * "enabled": false,
13606
13606
  * "minutes": 30
13607
13607
  * },
13608
13608
  * "timezone": "America/Santiago"
@@ -68683,6 +68683,10 @@ interface paths {
68683
68683
  * "lock": null,
68684
68684
  * "awaiting_switch": false,
68685
68685
  * "source": "available",
68686
+ * "ready": true,
68687
+ * "ready_reason": null,
68688
+ * "count_28d": 212,
68689
+ * "weekly_28d": 53,
68686
68690
  * "verdict": "below_threshold",
68687
68691
  * "active_ad_sets": 0,
68688
68692
  * "last_sent_at": "2026-09-25T12:40:00.000Z",
@@ -68737,6 +68741,10 @@ interface paths {
68737
68741
  * "lock": null,
68738
68742
  * "awaiting_switch": false,
68739
68743
  * "source": "available",
68744
+ * "ready": true,
68745
+ * "ready_reason": null,
68746
+ * "count_28d": 96,
68747
+ * "weekly_28d": 24,
68740
68748
  * "verdict": "not_checked",
68741
68749
  * "active_ad_sets": 0,
68742
68750
  * "last_sent_at": "2026-09-25T11:40:00.000Z",
@@ -68791,6 +68799,10 @@ interface paths {
68791
68799
  * "lock": null,
68792
68800
  * "awaiting_switch": false,
68793
68801
  * "source": "available",
68802
+ * "ready": false,
68803
+ * "ready_reason": "off",
68804
+ * "count_28d": 71,
68805
+ * "weekly_28d": 17.8,
68794
68806
  * "verdict": "not_checked",
68795
68807
  * "active_ad_sets": 0,
68796
68808
  * "last_sent_at": "2026-09-25T10:40:00.000Z",
@@ -68845,6 +68857,10 @@ interface paths {
68845
68857
  * "lock": null,
68846
68858
  * "awaiting_switch": false,
68847
68859
  * "source": "available",
68860
+ * "ready": true,
68861
+ * "ready_reason": null,
68862
+ * "count_28d": 40,
68863
+ * "weekly_28d": 10,
68848
68864
  * "verdict": "not_checked",
68849
68865
  * "active_ad_sets": 0,
68850
68866
  * "last_sent_at": "2026-09-25T09:40:00.000Z",
@@ -68899,6 +68915,10 @@ interface paths {
68899
68915
  * "lock": null,
68900
68916
  * "awaiting_switch": false,
68901
68917
  * "source": "available",
68918
+ * "ready": true,
68919
+ * "ready_reason": null,
68920
+ * "count_28d": 22,
68921
+ * "weekly_28d": 5.5,
68902
68922
  * "verdict": "wired",
68903
68923
  * "active_ad_sets": 2,
68904
68924
  * "last_sent_at": "2026-09-25T08:40:00.000Z",
@@ -68953,6 +68973,10 @@ interface paths {
68953
68973
  * "lock": null,
68954
68974
  * "awaiting_switch": false,
68955
68975
  * "source": "definition_missing",
68976
+ * "ready": false,
68977
+ * "ready_reason": "definition_missing",
68978
+ * "count_28d": 64,
68979
+ * "weekly_28d": 16,
68956
68980
  * "verdict": "not_checked",
68957
68981
  * "active_ad_sets": 0,
68958
68982
  * "last_sent_at": null,
@@ -69007,6 +69031,10 @@ interface paths {
69007
69031
  * "lock": "installments",
69008
69032
  * "awaiting_switch": false,
69009
69033
  * "source": "available",
69034
+ * "ready": false,
69035
+ * "ready_reason": "installments",
69036
+ * "count_28d": 58,
69037
+ * "weekly_28d": 14.5,
69010
69038
  * "verdict": "not_checked",
69011
69039
  * "active_ad_sets": 0,
69012
69040
  * "last_sent_at": "2026-09-25T07:40:00.000Z",
@@ -69052,7 +69080,14 @@ interface paths {
69052
69080
  * }
69053
69081
  * ],
69054
69082
  * "enabled_count": 4,
69083
+ * "waiting_count": 0,
69055
69084
  * "stage_count": 6,
69085
+ * "first_payment_candidates": {
69086
+ * "count_28d": 64,
69087
+ * "weekly_28d": 16,
69088
+ * "mirror_count_28d": null,
69089
+ * "mirror_weekly_28d": null
69090
+ * },
69056
69091
  * "restriction": {
69057
69092
  * "kind": "unknown",
69058
69093
  * "since": null
@@ -69060,8 +69095,8 @@ interface paths {
69060
69095
  * "protected_dataset": null,
69061
69096
  * "recommended_optimization_stage": {
69062
69097
  * "stage": "appointment_attended",
69063
- * "reason": "default",
69064
- * "rate": null
69098
+ * "reason": "rate_band",
69099
+ * "rate": 0.33490566037735847
69065
69100
  * },
69066
69101
  * "purchase_stage": "first_payment",
69067
69102
  * "purchase_switch_available": false,
@@ -69224,16 +69259,19 @@ interface paths {
69224
69259
  /**
69225
69260
  * @example {
69226
69261
  * "data": {
69227
- * "stage": "closed_won",
69262
+ * "stage": "first_payment",
69228
69263
  * "source": "own",
69229
69264
  * "vitrina": {
69230
- * "stage_label": "Presupuesto aceptado",
69265
+ * "stage_label": "Primer pago",
69231
69266
  * "occurred_at": "2026-09-25T08:40:00.000Z",
69232
69267
  * "value_clp": 1200000,
69233
69268
  * "contact_tail": "a3f2"
69234
69269
  * },
69235
69270
  * "meta": {
69236
- * "event": "closed_won",
69271
+ * "event": "Purchase",
69272
+ * "value_clp": 1038075,
69273
+ * "capped": true,
69274
+ * "value_cap_clp": 1038075,
69237
69275
  * "reaches_meta": true,
69238
69276
  * "not_sent_reason": null,
69239
69277
  * "fields": [
@@ -69241,7 +69279,7 @@ interface paths {
69241
69279
  * "key": "event",
69242
69280
  * "label": "Evento",
69243
69281
  * "state": "sent",
69244
- * "display": "closed_won"
69282
+ * "display": "Purchase"
69245
69283
  * },
69246
69284
  * {
69247
69285
  * "key": "time",
@@ -69252,13 +69290,15 @@ interface paths {
69252
69290
  * {
69253
69291
  * "key": "value",
69254
69292
  * "label": "Valor",
69255
- * "state": "withheld"
69293
+ * "state": "sent",
69294
+ * "display": "1.038.075 CLP"
69256
69295
  * },
69257
69296
  * {
69258
69297
  * "key": "action_source",
69259
69298
  * "label": "Dónde pasó",
69260
69299
  * "state": "sent",
69261
- * "display": "business_messaging"
69300
+ * "display": "business_messaging",
69301
+ * "display_channel": "whatsapp"
69262
69302
  * },
69263
69303
  * {
69264
69304
  * "key": "email",
@@ -94004,6 +94044,8 @@ interface paths {
94004
94044
  before?: string;
94005
94045
  /** @description Rows per page (default 20, max 50). */
94006
94046
  limit?: number;
94047
+ /** @description Only one screen’s executions. `envio` = «Enviar a Meta»: `send_setup`, `send_stage`, `send_dataset`, `send_stop`, `send_protected_move` and their rollbacks. Omitted = every execution. */
94048
+ screen?: "envio";
94007
94049
  /** @description `1` serves the deterministic sample dataset («Ver con datos de ejemplo»): same shapes, invented but internally consistent figures, no entitlement required (the scope still is). A sandbox workspace is always served the sample, with or without this parameter. */
94008
94050
  sample?: "1" | "true";
94009
94051
  };
@@ -115513,6 +115555,17 @@ interface components {
115513
115555
  * @enum {string}
115514
115556
  */
115515
115557
  source: "available" | "no_payments_source" | "definition_missing";
115558
+ /** @description If the stage happened now, it would reach Meta: switched on and its source has what it needs. */
115559
+ ready: boolean;
115560
+ /**
115561
+ * @description Why it would not reach Meta now; `null` when `ready`. Precedence: `installments` > `awaiting_switch` > `definition_missing` > `no_payments_yet` > `off`.
115562
+ * @enum {string|null}
115563
+ */
115564
+ ready_reason: "installments" | "awaiting_switch" | "definition_missing" | "no_payments_yet" | "off" | null;
115565
+ /** @description Outcomes of the stage that happened in Vitrina over the last 28 days, sent or not. `first_payment`: first payments of accepted plans in Vitrina’s payment ledger, before the switch too. */
115566
+ count_28d: number;
115567
+ /** @description `count_28d / 4`, one decimal — «por semana». */
115568
+ weekly_28d: number;
115516
115569
  /** @enum {string} */
115517
115570
  verdict: "wired" | "sent_not_used" | "below_threshold" | "custom_conversion_broken" | "missing_custom_conversion" | "connection_broken" | "check_failed" | "not_checked";
115518
115571
  active_ad_sets: number;
@@ -115540,9 +115593,22 @@ interface components {
115540
115593
  /** @description Sample mode only: when the scripted arrival plays. */
115541
115594
  sample_arrival_ms?: number;
115542
115595
  }[];
115596
+ /** @description Counted stages that are `ready` — «{enabled_count} de {stage_count} etapas llegan a Meta». A switched-on stage whose source has no data yet is in `waiting_count` instead. */
115543
115597
  enabled_count: number;
115544
- /** @description «{enabled_count} de {stage_count} etapas»; locked stages excluded. */
115598
+ /** @description Counted stages switched on but not `ready` yet («1 espera pagos»). `enabled_count + waiting_count` = the switched-on counted stages. */
115599
+ waiting_count: number;
115600
+ /** @description «{enabled_count} de {stage_count} etapas»; locked stages and the first payment before the switch excluded. */
115545
115601
  stage_count: number;
115602
+ /** @description Clinics: the Purchase volume of the first payment, counted before the switch too. `null` outside clinics or when it could not be read. */
115603
+ first_payment_candidates: {
115604
+ /** @description First payments of accepted plans over the last 28 days in Vitrina’s payment ledger — what reaches Meta as Purchase once switched. */
115605
+ count_28d: number;
115606
+ /** @description `count_28d / 4`, one decimal. */
115607
+ weekly_28d: number;
115608
+ /** @description The same volume in the clinic system’s mirror, for information: mirrored payments do not reach Meta. `null` without a mirror opt-in. */
115609
+ mirror_count_28d: number | null;
115610
+ mirror_weekly_28d: number | null;
115611
+ } | null;
115546
115612
  /** @description Health-dataset restriction by Meta (clinics): `blocked` = Meta counted none of the Lead / Schedule / Purchase sent on ≥ 3 of the last 7 days. `unknown` when it could not be read; `none` outside clinics. */
115547
115613
  restriction: {
115548
115614
  /** @enum {string} */
@@ -115607,12 +115673,19 @@ interface components {
115607
115673
  vitrina: {
115608
115674
  stage_label: string;
115609
115675
  occurred_at: string;
115676
+ /** @description The workspace’s full value, CLP (before Meta’s cap). */
115610
115677
  value_clp: number | null;
115611
115678
  /** @description Last 4 characters of the contact’s opaque reference; never a name or a contact detail. */
115612
115679
  contact_tail: string | null;
115613
115680
  };
115614
115681
  meta: {
115615
115682
  event: string;
115683
+ /** @description The value Meta receives, CLP; `null` when Meta gets no value. */
115684
+ value_clp: number | null;
115685
+ /** @description Meta receives the workspace’s 95th-percentile cap instead of the full value (`vitrina.value_clp`). */
115686
+ capped: boolean;
115687
+ /** @description The cap applied, CLP, when `capped`. */
115688
+ value_cap_clp: number | null;
115616
115689
  reaches_meta: boolean;
115617
115690
  /** @enum {string|null} */
115618
115691
  not_sent_reason: "marketing_opt_out" | "stage_off" | "stage_locked" | null;
@@ -115627,6 +115700,11 @@ interface components {
115627
115700
  state: "sent" | "hashed" | "withheld" | "absent";
115628
115701
  /** @description Non-identifying fields only (event, time, value, where it happened). */
115629
115702
  display?: string;
115703
+ /**
115704
+ * @description `action_source` only: the conversation’s channel when the event was born in a messaging thread; `null` when not, or unknown.
115705
+ * @enum {string|null}
115706
+ */
115707
+ display_channel?: "whatsapp" | "instagram" | "messenger" | null;
115630
115708
  }[];
115631
115709
  };
115632
115710
  /** @description What never leaves Vitrina, as keys (`national_id`, `clinical_data`, `notes`, …). */
@@ -116278,8 +116356,11 @@ interface components {
116278
116356
  AdsFeedItem: {
116279
116357
  /** Format: uuid */
116280
116358
  id: string;
116281
- /** @enum {string} */
116282
- stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
116359
+ /**
116360
+ * @description The outcome stage. `first_payment` = a clinic’s first payment of an accepted plan («Primer pago»), the Purchase Meta receives after the switch.
116361
+ * @enum {string}
116362
+ */
116363
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
116283
116364
  /** @description When the outcome happened. */
116284
116365
  occurred_at: string;
116285
116366
  /** @description When Vitrina recorded it — the cursor field, microsecond-exact. */
package/dist/index.d.ts CHANGED
@@ -13399,7 +13399,7 @@ interface paths {
13399
13399
  };
13400
13400
  /**
13401
13401
  * Read the channel AI availability policy and current status
13402
- * @description Returns the per-channel coverage clock and its current evaluation. Schedule availability does not override agent assignment, channel kill switches, or a human takeover. An account without a saved policy reports `configured: false` and preserves the legacy always-eligible schedule. `policy.timezone` and `status.effective_timezone` report the server-resolved clock inherited from General settings or selected business hours. `policy.human_silence_resume` and `policy.handoff_renotify` are always present in the response with defaults applied (enabled, 30 minutes).
13402
+ * @description Returns the per-channel coverage clock and its current evaluation. Schedule availability does not override agent assignment, channel kill switches, or a human takeover. An account without a saved policy reports `configured: false` and preserves the legacy always-eligible schedule. `policy.timezone` and `status.effective_timezone` report the server-resolved clock inherited from General settings or selected business hours. `policy.human_silence_resume` and `policy.handoff_renotify` are always present in the response with defaults applied (resume: enabled, 30 minutes; re-notify: disabled, 30 minutes once enabled).
13403
13403
  */
13404
13404
  get: {
13405
13405
  parameters: {
@@ -13432,7 +13432,7 @@ interface paths {
13432
13432
  * "minutes": 30
13433
13433
  * },
13434
13434
  * "handoff_renotify": {
13435
- * "enabled": true,
13435
+ * "enabled": false,
13436
13436
  * "minutes": 30
13437
13437
  * },
13438
13438
  * "timezone": "America/Santiago"
@@ -13546,7 +13546,7 @@ interface paths {
13546
13546
  * "minutes": 30
13547
13547
  * },
13548
13548
  * "handoff_renotify": {
13549
- * "enabled": true,
13549
+ * "enabled": false,
13550
13550
  * "minutes": 30
13551
13551
  * }
13552
13552
  * }
@@ -13573,7 +13573,7 @@ interface paths {
13573
13573
  enabled: boolean;
13574
13574
  minutes: number;
13575
13575
  };
13576
- /** @description The AI handed the conversation off explicitly, so it stays out. While the customer's message stays unanswered, notify the assignee (or, when nobody is assigned, the channel roster) every `minutes`, with owners and admins copied. Checked on a 10-minute tick; stops 24 hours after the customer's message. Absent = enabled, 30 minutes. */
13576
+ /** @description The AI handed the conversation off explicitly, so it stays out. While the customer's message stays unanswered, notify the assignee (or, when nobody is assigned, the channel roster) every `minutes`, with owners and admins copied. Checked on a 10-minute tick; stops 24 hours after the customer's message. Absent = DISABLED (opt-in per channel); once enabled, the default cadence is 30 minutes. */
13577
13577
  handoff_renotify?: {
13578
13578
  enabled: boolean;
13579
13579
  minutes: number;
@@ -13602,7 +13602,7 @@ interface paths {
13602
13602
  * "minutes": 30
13603
13603
  * },
13604
13604
  * "handoff_renotify": {
13605
- * "enabled": true,
13605
+ * "enabled": false,
13606
13606
  * "minutes": 30
13607
13607
  * },
13608
13608
  * "timezone": "America/Santiago"
@@ -68683,6 +68683,10 @@ interface paths {
68683
68683
  * "lock": null,
68684
68684
  * "awaiting_switch": false,
68685
68685
  * "source": "available",
68686
+ * "ready": true,
68687
+ * "ready_reason": null,
68688
+ * "count_28d": 212,
68689
+ * "weekly_28d": 53,
68686
68690
  * "verdict": "below_threshold",
68687
68691
  * "active_ad_sets": 0,
68688
68692
  * "last_sent_at": "2026-09-25T12:40:00.000Z",
@@ -68737,6 +68741,10 @@ interface paths {
68737
68741
  * "lock": null,
68738
68742
  * "awaiting_switch": false,
68739
68743
  * "source": "available",
68744
+ * "ready": true,
68745
+ * "ready_reason": null,
68746
+ * "count_28d": 96,
68747
+ * "weekly_28d": 24,
68740
68748
  * "verdict": "not_checked",
68741
68749
  * "active_ad_sets": 0,
68742
68750
  * "last_sent_at": "2026-09-25T11:40:00.000Z",
@@ -68791,6 +68799,10 @@ interface paths {
68791
68799
  * "lock": null,
68792
68800
  * "awaiting_switch": false,
68793
68801
  * "source": "available",
68802
+ * "ready": false,
68803
+ * "ready_reason": "off",
68804
+ * "count_28d": 71,
68805
+ * "weekly_28d": 17.8,
68794
68806
  * "verdict": "not_checked",
68795
68807
  * "active_ad_sets": 0,
68796
68808
  * "last_sent_at": "2026-09-25T10:40:00.000Z",
@@ -68845,6 +68857,10 @@ interface paths {
68845
68857
  * "lock": null,
68846
68858
  * "awaiting_switch": false,
68847
68859
  * "source": "available",
68860
+ * "ready": true,
68861
+ * "ready_reason": null,
68862
+ * "count_28d": 40,
68863
+ * "weekly_28d": 10,
68848
68864
  * "verdict": "not_checked",
68849
68865
  * "active_ad_sets": 0,
68850
68866
  * "last_sent_at": "2026-09-25T09:40:00.000Z",
@@ -68899,6 +68915,10 @@ interface paths {
68899
68915
  * "lock": null,
68900
68916
  * "awaiting_switch": false,
68901
68917
  * "source": "available",
68918
+ * "ready": true,
68919
+ * "ready_reason": null,
68920
+ * "count_28d": 22,
68921
+ * "weekly_28d": 5.5,
68902
68922
  * "verdict": "wired",
68903
68923
  * "active_ad_sets": 2,
68904
68924
  * "last_sent_at": "2026-09-25T08:40:00.000Z",
@@ -68953,6 +68973,10 @@ interface paths {
68953
68973
  * "lock": null,
68954
68974
  * "awaiting_switch": false,
68955
68975
  * "source": "definition_missing",
68976
+ * "ready": false,
68977
+ * "ready_reason": "definition_missing",
68978
+ * "count_28d": 64,
68979
+ * "weekly_28d": 16,
68956
68980
  * "verdict": "not_checked",
68957
68981
  * "active_ad_sets": 0,
68958
68982
  * "last_sent_at": null,
@@ -69007,6 +69031,10 @@ interface paths {
69007
69031
  * "lock": "installments",
69008
69032
  * "awaiting_switch": false,
69009
69033
  * "source": "available",
69034
+ * "ready": false,
69035
+ * "ready_reason": "installments",
69036
+ * "count_28d": 58,
69037
+ * "weekly_28d": 14.5,
69010
69038
  * "verdict": "not_checked",
69011
69039
  * "active_ad_sets": 0,
69012
69040
  * "last_sent_at": "2026-09-25T07:40:00.000Z",
@@ -69052,7 +69080,14 @@ interface paths {
69052
69080
  * }
69053
69081
  * ],
69054
69082
  * "enabled_count": 4,
69083
+ * "waiting_count": 0,
69055
69084
  * "stage_count": 6,
69085
+ * "first_payment_candidates": {
69086
+ * "count_28d": 64,
69087
+ * "weekly_28d": 16,
69088
+ * "mirror_count_28d": null,
69089
+ * "mirror_weekly_28d": null
69090
+ * },
69056
69091
  * "restriction": {
69057
69092
  * "kind": "unknown",
69058
69093
  * "since": null
@@ -69060,8 +69095,8 @@ interface paths {
69060
69095
  * "protected_dataset": null,
69061
69096
  * "recommended_optimization_stage": {
69062
69097
  * "stage": "appointment_attended",
69063
- * "reason": "default",
69064
- * "rate": null
69098
+ * "reason": "rate_band",
69099
+ * "rate": 0.33490566037735847
69065
69100
  * },
69066
69101
  * "purchase_stage": "first_payment",
69067
69102
  * "purchase_switch_available": false,
@@ -69224,16 +69259,19 @@ interface paths {
69224
69259
  /**
69225
69260
  * @example {
69226
69261
  * "data": {
69227
- * "stage": "closed_won",
69262
+ * "stage": "first_payment",
69228
69263
  * "source": "own",
69229
69264
  * "vitrina": {
69230
- * "stage_label": "Presupuesto aceptado",
69265
+ * "stage_label": "Primer pago",
69231
69266
  * "occurred_at": "2026-09-25T08:40:00.000Z",
69232
69267
  * "value_clp": 1200000,
69233
69268
  * "contact_tail": "a3f2"
69234
69269
  * },
69235
69270
  * "meta": {
69236
- * "event": "closed_won",
69271
+ * "event": "Purchase",
69272
+ * "value_clp": 1038075,
69273
+ * "capped": true,
69274
+ * "value_cap_clp": 1038075,
69237
69275
  * "reaches_meta": true,
69238
69276
  * "not_sent_reason": null,
69239
69277
  * "fields": [
@@ -69241,7 +69279,7 @@ interface paths {
69241
69279
  * "key": "event",
69242
69280
  * "label": "Evento",
69243
69281
  * "state": "sent",
69244
- * "display": "closed_won"
69282
+ * "display": "Purchase"
69245
69283
  * },
69246
69284
  * {
69247
69285
  * "key": "time",
@@ -69252,13 +69290,15 @@ interface paths {
69252
69290
  * {
69253
69291
  * "key": "value",
69254
69292
  * "label": "Valor",
69255
- * "state": "withheld"
69293
+ * "state": "sent",
69294
+ * "display": "1.038.075 CLP"
69256
69295
  * },
69257
69296
  * {
69258
69297
  * "key": "action_source",
69259
69298
  * "label": "Dónde pasó",
69260
69299
  * "state": "sent",
69261
- * "display": "business_messaging"
69300
+ * "display": "business_messaging",
69301
+ * "display_channel": "whatsapp"
69262
69302
  * },
69263
69303
  * {
69264
69304
  * "key": "email",
@@ -94004,6 +94044,8 @@ interface paths {
94004
94044
  before?: string;
94005
94045
  /** @description Rows per page (default 20, max 50). */
94006
94046
  limit?: number;
94047
+ /** @description Only one screen’s executions. `envio` = «Enviar a Meta»: `send_setup`, `send_stage`, `send_dataset`, `send_stop`, `send_protected_move` and their rollbacks. Omitted = every execution. */
94048
+ screen?: "envio";
94007
94049
  /** @description `1` serves the deterministic sample dataset («Ver con datos de ejemplo»): same shapes, invented but internally consistent figures, no entitlement required (the scope still is). A sandbox workspace is always served the sample, with or without this parameter. */
94008
94050
  sample?: "1" | "true";
94009
94051
  };
@@ -115513,6 +115555,17 @@ interface components {
115513
115555
  * @enum {string}
115514
115556
  */
115515
115557
  source: "available" | "no_payments_source" | "definition_missing";
115558
+ /** @description If the stage happened now, it would reach Meta: switched on and its source has what it needs. */
115559
+ ready: boolean;
115560
+ /**
115561
+ * @description Why it would not reach Meta now; `null` when `ready`. Precedence: `installments` > `awaiting_switch` > `definition_missing` > `no_payments_yet` > `off`.
115562
+ * @enum {string|null}
115563
+ */
115564
+ ready_reason: "installments" | "awaiting_switch" | "definition_missing" | "no_payments_yet" | "off" | null;
115565
+ /** @description Outcomes of the stage that happened in Vitrina over the last 28 days, sent or not. `first_payment`: first payments of accepted plans in Vitrina’s payment ledger, before the switch too. */
115566
+ count_28d: number;
115567
+ /** @description `count_28d / 4`, one decimal — «por semana». */
115568
+ weekly_28d: number;
115516
115569
  /** @enum {string} */
115517
115570
  verdict: "wired" | "sent_not_used" | "below_threshold" | "custom_conversion_broken" | "missing_custom_conversion" | "connection_broken" | "check_failed" | "not_checked";
115518
115571
  active_ad_sets: number;
@@ -115540,9 +115593,22 @@ interface components {
115540
115593
  /** @description Sample mode only: when the scripted arrival plays. */
115541
115594
  sample_arrival_ms?: number;
115542
115595
  }[];
115596
+ /** @description Counted stages that are `ready` — «{enabled_count} de {stage_count} etapas llegan a Meta». A switched-on stage whose source has no data yet is in `waiting_count` instead. */
115543
115597
  enabled_count: number;
115544
- /** @description «{enabled_count} de {stage_count} etapas»; locked stages excluded. */
115598
+ /** @description Counted stages switched on but not `ready` yet («1 espera pagos»). `enabled_count + waiting_count` = the switched-on counted stages. */
115599
+ waiting_count: number;
115600
+ /** @description «{enabled_count} de {stage_count} etapas»; locked stages and the first payment before the switch excluded. */
115545
115601
  stage_count: number;
115602
+ /** @description Clinics: the Purchase volume of the first payment, counted before the switch too. `null` outside clinics or when it could not be read. */
115603
+ first_payment_candidates: {
115604
+ /** @description First payments of accepted plans over the last 28 days in Vitrina’s payment ledger — what reaches Meta as Purchase once switched. */
115605
+ count_28d: number;
115606
+ /** @description `count_28d / 4`, one decimal. */
115607
+ weekly_28d: number;
115608
+ /** @description The same volume in the clinic system’s mirror, for information: mirrored payments do not reach Meta. `null` without a mirror opt-in. */
115609
+ mirror_count_28d: number | null;
115610
+ mirror_weekly_28d: number | null;
115611
+ } | null;
115546
115612
  /** @description Health-dataset restriction by Meta (clinics): `blocked` = Meta counted none of the Lead / Schedule / Purchase sent on ≥ 3 of the last 7 days. `unknown` when it could not be read; `none` outside clinics. */
115547
115613
  restriction: {
115548
115614
  /** @enum {string} */
@@ -115607,12 +115673,19 @@ interface components {
115607
115673
  vitrina: {
115608
115674
  stage_label: string;
115609
115675
  occurred_at: string;
115676
+ /** @description The workspace’s full value, CLP (before Meta’s cap). */
115610
115677
  value_clp: number | null;
115611
115678
  /** @description Last 4 characters of the contact’s opaque reference; never a name or a contact detail. */
115612
115679
  contact_tail: string | null;
115613
115680
  };
115614
115681
  meta: {
115615
115682
  event: string;
115683
+ /** @description The value Meta receives, CLP; `null` when Meta gets no value. */
115684
+ value_clp: number | null;
115685
+ /** @description Meta receives the workspace’s 95th-percentile cap instead of the full value (`vitrina.value_clp`). */
115686
+ capped: boolean;
115687
+ /** @description The cap applied, CLP, when `capped`. */
115688
+ value_cap_clp: number | null;
115616
115689
  reaches_meta: boolean;
115617
115690
  /** @enum {string|null} */
115618
115691
  not_sent_reason: "marketing_opt_out" | "stage_off" | "stage_locked" | null;
@@ -115627,6 +115700,11 @@ interface components {
115627
115700
  state: "sent" | "hashed" | "withheld" | "absent";
115628
115701
  /** @description Non-identifying fields only (event, time, value, where it happened). */
115629
115702
  display?: string;
115703
+ /**
115704
+ * @description `action_source` only: the conversation’s channel when the event was born in a messaging thread; `null` when not, or unknown.
115705
+ * @enum {string|null}
115706
+ */
115707
+ display_channel?: "whatsapp" | "instagram" | "messenger" | null;
115630
115708
  }[];
115631
115709
  };
115632
115710
  /** @description What never leaves Vitrina, as keys (`national_id`, `clinical_data`, `notes`, …). */
@@ -116278,8 +116356,11 @@ interface components {
116278
116356
  AdsFeedItem: {
116279
116357
  /** Format: uuid */
116280
116358
  id: string;
116281
- /** @enum {string} */
116282
- stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "payment_received";
116359
+ /**
116360
+ * @description The outcome stage. `first_payment` = a clinic’s first payment of an accepted plan («Primer pago»), the Purchase Meta receives after the switch.
116361
+ * @enum {string}
116362
+ */
116363
+ stage: "lead_created" | "appointment_booked" | "appointment_attended" | "quote_presented" | "closed_won" | "first_payment" | "payment_received";
116283
116364
  /** @description When the outcome happened. */
116284
116365
  occurred_at: string;
116285
116366
  /** @description When Vitrina recorded it — the cursor field, microsecond-exact. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "11.29.0",
3
+ "version": "11.30.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",