@vitrina/api 14.77.2 → 14.79.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
@@ -22207,6 +22207,130 @@ interface paths {
22207
22207
  patch?: never;
22208
22208
  trace?: never;
22209
22209
  };
22210
+ "/storefront/trade-in": {
22211
+ parameters: {
22212
+ query?: never;
22213
+ header?: never;
22214
+ path?: never;
22215
+ cookie?: never;
22216
+ };
22217
+ /**
22218
+ * Buy table for the business’s own quoter (trade-in / buyback)
22219
+ * @description What the business pays at most for each used model, so its own website quoter reads the same table the agent quotes from instead of a hardcoded copy. Per model: `top` (flawless, «Impecable»), `used` (normal wear, «Con uso»), `direct_purchase` (`false` = taken only as part of the payment for another item, never bought outright) and `min_battery_pct` (a known battery under it is not bought; `null` = no minimum). Plus `not_bought` (models never bought), `currency` and `perfect_battery_pct` (from this battery health a unit with nothing else wrong counts as flawless). Readable with the storefront’s `stock:read`; the browser twin is `GET /widget/trade-in` with the site’s `pk_` key. `Cache-Control: private, max-age=300` + a strong `ETag` (send `If-None-Match` for a 304). 404 when the workspace keeps no buy table (`PUT /tenant/settings` `trade_in`).
22220
+ */
22221
+ get: {
22222
+ parameters: {
22223
+ query?: never;
22224
+ header?: never;
22225
+ path?: never;
22226
+ cookie?: never;
22227
+ };
22228
+ requestBody?: never;
22229
+ responses: {
22230
+ /** @description The public buy table */
22231
+ 200: {
22232
+ headers: {
22233
+ [name: string]: unknown;
22234
+ };
22235
+ content: {
22236
+ /**
22237
+ * @example {
22238
+ * "currency": "CLP",
22239
+ * "perfect_battery_pct": 90,
22240
+ * "models": [
22241
+ * {
22242
+ * "model": "iPhone 15",
22243
+ * "top": 350000,
22244
+ * "used": 320000,
22245
+ * "direct_purchase": false,
22246
+ * "min_battery_pct": null
22247
+ * },
22248
+ * {
22249
+ * "model": "iPhone 16 Pro",
22250
+ * "top": 600000,
22251
+ * "used": 570000,
22252
+ * "direct_purchase": true,
22253
+ * "min_battery_pct": 90
22254
+ * }
22255
+ * ],
22256
+ * "not_bought": [
22257
+ * "iPhone 13 mini",
22258
+ * "iPhone 16e"
22259
+ * ]
22260
+ * }
22261
+ */
22262
+ "application/json": {
22263
+ data?: unknown;
22264
+ meta?: {
22265
+ [key: string]: unknown;
22266
+ };
22267
+ };
22268
+ };
22269
+ };
22270
+ /** @description Validation error */
22271
+ 400: {
22272
+ headers: {
22273
+ [name: string]: unknown;
22274
+ };
22275
+ content: {
22276
+ "application/json": components["schemas"]["Error"];
22277
+ };
22278
+ };
22279
+ /** @description Unauthorized */
22280
+ 401: {
22281
+ headers: {
22282
+ [name: string]: unknown;
22283
+ };
22284
+ content: {
22285
+ "application/json": components["schemas"]["Error"];
22286
+ };
22287
+ };
22288
+ /** @description Forbidden */
22289
+ 403: {
22290
+ headers: {
22291
+ [name: string]: unknown;
22292
+ };
22293
+ content: {
22294
+ "application/json": components["schemas"]["Error"];
22295
+ };
22296
+ };
22297
+ /** @description Not found */
22298
+ 404: {
22299
+ headers: {
22300
+ [name: string]: unknown;
22301
+ };
22302
+ content: {
22303
+ "application/json": components["schemas"]["Error"];
22304
+ };
22305
+ };
22306
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
22307
+ 409: {
22308
+ headers: {
22309
+ [name: string]: unknown;
22310
+ };
22311
+ content: {
22312
+ "application/json": components["schemas"]["Error"];
22313
+ };
22314
+ };
22315
+ /** @description Rate limited */
22316
+ 429: {
22317
+ headers: {
22318
+ [name: string]: unknown;
22319
+ };
22320
+ content: {
22321
+ "application/json": components["schemas"]["Error"];
22322
+ };
22323
+ };
22324
+ };
22325
+ };
22326
+ put?: never;
22327
+ post?: never;
22328
+ delete?: never;
22329
+ options?: never;
22330
+ head?: never;
22331
+ patch?: never;
22332
+ trace?: never;
22333
+ };
22210
22334
  "/storefront/events": {
22211
22335
  parameters: {
22212
22336
  query?: never;
@@ -142436,6 +142560,323 @@ interface paths {
142436
142560
  patch?: never;
142437
142561
  trace?: never;
142438
142562
  };
142563
+ "/insights/intent-mix": {
142564
+ parameters: {
142565
+ query?: never;
142566
+ header?: never;
142567
+ path?: never;
142568
+ cookie?: never;
142569
+ };
142570
+ /**
142571
+ * Who wrote, by what they came for (sell / trade-in / buy)
142572
+ * @description For a business that buys AND sells: the people (distinct contacts) whose first message or lead fell in the window, split by what they came for — `sell` (sell us theirs), `trade_in` (give theirs and take another), `buy` — with the trend against the previous window of equal length, the funnel per intent (reached the board’s quote step, its visit step, won), and the split by entry: Meta campaign and ad set (the ad that opened the conversation, or a website form’s first-touch UTMs), the website, or the organic channel. Campaign spend and cost per person come from Vitrina Ads when the workspace has it (`spend_state`). A person with both a sell and a buy lead in the window counts as `trade_in`. `applies: false` when the workspace has no sell side (fewer than 10 people asking to sell or trade in over the last 90 days). Counts only. Requires `analytics:read`. Takes the insights `?window=` vocabulary.
142573
+ */
142574
+ get: {
142575
+ parameters: {
142576
+ query?: {
142577
+ /** @description Which period. Omit it (with `from`/`to`) for an explicit range — the shape every ranged Insights report has always accepted, and which still works unchanged. The calendar windows are the DEALERSHIP’s (America/Santiago), so a month closes when a person would say it closed. */
142578
+ window?: "24h" | "7d" | "30d" | "90d" | "calendar_month" | "calendar_year" | "custom";
142579
+ /** @description `window=calendar_month` only. ISO month, `YYYY-MM`. Defaults to the month in progress. */
142580
+ month?: string;
142581
+ /** @description `window=calendar_year` only. `YYYY`. Defaults to the year in progress. */
142582
+ year?: string;
142583
+ /** @description Explicit range only. Checked for non-emptiness and handed to Postgres, so a malformed value surfaces as a 500 from the query rather than a 400 from the edge — send an ISO-8601 instant. */
142584
+ from?: string;
142585
+ /** @description Explicit range only. ISO instant, see `from`. */
142586
+ to?: string;
142587
+ };
142588
+ header?: never;
142589
+ path?: never;
142590
+ cookie?: never;
142591
+ };
142592
+ requestBody?: never;
142593
+ responses: {
142594
+ /** @description The intent mix */
142595
+ 200: {
142596
+ headers: {
142597
+ [name: string]: unknown;
142598
+ };
142599
+ content: {
142600
+ /**
142601
+ * @example {
142602
+ * "data": {
142603
+ * "applies": true,
142604
+ * "previous_window": {
142605
+ * "from": "2026-09-22T03:00:00.000Z",
142606
+ * "to": "2026-10-22T03:00:00.000Z"
142607
+ * },
142608
+ * "totals": {
142609
+ * "people": 120,
142610
+ * "previous_people": 96,
142611
+ * "delta_pct": 25
142612
+ * },
142613
+ * "intents": [
142614
+ * {
142615
+ * "intent": "sell",
142616
+ * "people": 70,
142617
+ * "share_pct": 58.3,
142618
+ * "previous_people": 60,
142619
+ * "delta_pct": 17,
142620
+ * "funnel": {
142621
+ * "quoted": 52,
142622
+ * "visit_booked": 9,
142623
+ * "won": 3
142624
+ * }
142625
+ * },
142626
+ * {
142627
+ * "intent": "trade_in",
142628
+ * "people": 24,
142629
+ * "share_pct": 20,
142630
+ * "previous_people": 14,
142631
+ * "delta_pct": 71,
142632
+ * "funnel": {
142633
+ * "quoted": 18,
142634
+ * "visit_booked": 4,
142635
+ * "won": 1
142636
+ * }
142637
+ * },
142638
+ * {
142639
+ * "intent": "buy",
142640
+ * "people": 26,
142641
+ * "share_pct": 21.7,
142642
+ * "previous_people": 22,
142643
+ * "delta_pct": 18,
142644
+ * "funnel": {
142645
+ * "quoted": 12,
142646
+ * "visit_booked": 3,
142647
+ * "won": 2
142648
+ * }
142649
+ * },
142650
+ * {
142651
+ * "intent": "unknown",
142652
+ * "people": 0,
142653
+ * "share_pct": 0,
142654
+ * "previous_people": 0,
142655
+ * "delta_pct": null,
142656
+ * "funnel": {
142657
+ * "quoted": 0,
142658
+ * "visit_booked": 0,
142659
+ * "won": 0
142660
+ * }
142661
+ * }
142662
+ * ],
142663
+ * "entries": [
142664
+ * {
142665
+ * "kind": "campaign",
142666
+ * "channel": null,
142667
+ * "campaign_external_id": "52595750511957",
142668
+ * "campaign_name": "Compramos tu iPhone | CL",
142669
+ * "people": 48,
142670
+ * "by_intent": {
142671
+ * "sell": 40,
142672
+ * "trade_in": 6,
142673
+ * "buy": 2,
142674
+ * "unknown": 0
142675
+ * },
142676
+ * "spend": 180000,
142677
+ * "cost_per_person": 3750,
142678
+ * "cost_per_intent": {
142679
+ * "sell": 4500,
142680
+ * "trade_in": 30000,
142681
+ * "buy": 90000,
142682
+ * "unknown": null
142683
+ * },
142684
+ * "ad_sets": [
142685
+ * {
142686
+ * "ad_set_external_id": null,
142687
+ * "ad_set_name": "Amplio - CL | ADV+",
142688
+ * "people": 48,
142689
+ * "by_intent": {
142690
+ * "sell": 40,
142691
+ * "trade_in": 6,
142692
+ * "buy": 2,
142693
+ * "unknown": 0
142694
+ * }
142695
+ * }
142696
+ * ]
142697
+ * },
142698
+ * {
142699
+ * "kind": "organic",
142700
+ * "channel": "whatsapp",
142701
+ * "campaign_external_id": null,
142702
+ * "campaign_name": null,
142703
+ * "people": 20,
142704
+ * "by_intent": {
142705
+ * "sell": 8,
142706
+ * "trade_in": 4,
142707
+ * "buy": 8,
142708
+ * "unknown": 0
142709
+ * },
142710
+ * "spend": null,
142711
+ * "cost_per_person": null,
142712
+ * "cost_per_intent": {
142713
+ * "sell": null,
142714
+ * "trade_in": null,
142715
+ * "buy": null,
142716
+ * "unknown": null
142717
+ * },
142718
+ * "ad_sets": []
142719
+ * }
142720
+ * ],
142721
+ * "spend_state": "ok",
142722
+ * "spend_total": 320000,
142723
+ * "rule": "People (distinct contacts) whose first message or lead fell in the window. …"
142724
+ * }
142725
+ * }
142726
+ */
142727
+ "application/json": {
142728
+ data: {
142729
+ /** @description False when the workspace had fewer than 10 people asking to sell or trade in over the last 90 days — a screen draws nothing then. */
142730
+ applies: boolean;
142731
+ /** @description The window of equal length right before, for the trend. */
142732
+ previous_window: {
142733
+ from: string;
142734
+ to: string;
142735
+ };
142736
+ totals: {
142737
+ people: number;
142738
+ previous_people: number;
142739
+ delta_pct: number | null;
142740
+ };
142741
+ intents: {
142742
+ /**
142743
+ * @description `sell` they sell us theirs · `trade_in` they give theirs and take another · `buy` they buy · `unknown` no lead said why.
142744
+ * @enum {string}
142745
+ */
142746
+ intent: "sell" | "trade_in" | "buy" | "unknown";
142747
+ people: number;
142748
+ /** @description Share of the window’s people, one decimal. */
142749
+ share_pct: number;
142750
+ previous_people: number;
142751
+ /** @description % change vs the previous window; `null` when it had nobody. */
142752
+ delta_pct: number | null;
142753
+ funnel: {
142754
+ quoted: number;
142755
+ visit_booked: number;
142756
+ won: number;
142757
+ };
142758
+ }[];
142759
+ entries: {
142760
+ /**
142761
+ * @description `campaign` a Meta campaign (ad that opened the conversation, or a website form’s first-touch UTMs) · `ad_unmapped` a Meta ad whose campaign is unknown · `website` the site with no ad behind it · `organic` a thread no ad opened (`channel` says where).
142762
+ * @enum {string}
142763
+ */
142764
+ kind: "campaign" | "ad_unmapped" | "website" | "organic";
142765
+ /** @description `organic` only: the channel. */
142766
+ channel: string | null;
142767
+ campaign_external_id: string | null;
142768
+ campaign_name: string | null;
142769
+ people: number;
142770
+ /** @description People per intent. */
142771
+ by_intent: {
142772
+ sell: number;
142773
+ trade_in: number;
142774
+ buy: number;
142775
+ unknown: number;
142776
+ };
142777
+ /** @description Meta spend of the campaign over the window. */
142778
+ spend: number | null;
142779
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142780
+ cost_per_person: number | null;
142781
+ cost_per_intent: {
142782
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142783
+ sell: number | null;
142784
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142785
+ trade_in: number | null;
142786
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142787
+ buy: number | null;
142788
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142789
+ unknown: number | null;
142790
+ };
142791
+ ad_sets: {
142792
+ ad_set_external_id: string | null;
142793
+ ad_set_name: string | null;
142794
+ people: number;
142795
+ /** @description People per intent. */
142796
+ by_intent: {
142797
+ sell: number;
142798
+ trade_in: number;
142799
+ buy: number;
142800
+ unknown: number;
142801
+ };
142802
+ }[];
142803
+ }[];
142804
+ /**
142805
+ * @description `no_ads` the workspace has no Vitrina Ads · `unavailable` the Ads read failed — spend fields are `null`.
142806
+ * @enum {string}
142807
+ */
142808
+ spend_state: "ok" | "unavailable" | "no_ads";
142809
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142810
+ spend_total: number | null;
142811
+ rule: string;
142812
+ };
142813
+ };
142814
+ };
142815
+ };
142816
+ /** @description Validation error */
142817
+ 400: {
142818
+ headers: {
142819
+ [name: string]: unknown;
142820
+ };
142821
+ content: {
142822
+ "application/json": components["schemas"]["Error"];
142823
+ };
142824
+ };
142825
+ /** @description Unauthorized */
142826
+ 401: {
142827
+ headers: {
142828
+ [name: string]: unknown;
142829
+ };
142830
+ content: {
142831
+ "application/json": components["schemas"]["Error"];
142832
+ };
142833
+ };
142834
+ /** @description Forbidden */
142835
+ 403: {
142836
+ headers: {
142837
+ [name: string]: unknown;
142838
+ };
142839
+ content: {
142840
+ "application/json": components["schemas"]["Error"];
142841
+ };
142842
+ };
142843
+ /** @description Not found */
142844
+ 404: {
142845
+ headers: {
142846
+ [name: string]: unknown;
142847
+ };
142848
+ content: {
142849
+ "application/json": components["schemas"]["Error"];
142850
+ };
142851
+ };
142852
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142853
+ 409: {
142854
+ headers: {
142855
+ [name: string]: unknown;
142856
+ };
142857
+ content: {
142858
+ "application/json": components["schemas"]["Error"];
142859
+ };
142860
+ };
142861
+ /** @description Rate limited */
142862
+ 429: {
142863
+ headers: {
142864
+ [name: string]: unknown;
142865
+ };
142866
+ content: {
142867
+ "application/json": components["schemas"]["Error"];
142868
+ };
142869
+ };
142870
+ };
142871
+ };
142872
+ put?: never;
142873
+ post?: never;
142874
+ delete?: never;
142875
+ options?: never;
142876
+ head?: never;
142877
+ patch?: never;
142878
+ trace?: never;
142879
+ };
142439
142880
  "/insights/overview/live": {
142440
142881
  parameters: {
142441
142882
  query?: never;
@@ -201225,13 +201666,14 @@ interface components {
201225
201666
  push_enabled?: boolean;
201226
201667
  };
201227
201668
  TenantSettingsPublic: {
201228
- /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool, which gives customers only a wide range of what they would still pay. Replaced whole on write; `null` clears it. */
201669
+ /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?, direct_purchase?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value; `direct_purchase: false` = the model is taken only as part of the payment for another item, never bought outright — absent = true), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool (a wide range of what the customer would still pay) and the `quote_buyback` tool (the most paid for one device sold outright, or the discount for a `direct_purchase: false` model); the business’s own site reads it at `GET /storefront/trade-in`. Replaced whole on write; `null` clears it. */
201229
201670
  trade_in?: {
201230
201671
  price_table: {
201231
201672
  model: string;
201232
201673
  top: number;
201233
201674
  used: number;
201234
201675
  min_battery_pct?: number;
201676
+ direct_purchase?: boolean;
201235
201677
  }[];
201236
201678
  not_bought?: string[];
201237
201679
  floor_factor?: number;
@@ -201439,13 +201881,14 @@ interface components {
201439
201881
  };
201440
201882
  };
201441
201883
  TenantSettingsPublicWrite: {
201442
- /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool, which gives customers only a wide range of what they would still pay. Replaced whole on write; `null` clears it. */
201884
+ /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?, direct_purchase?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value; `direct_purchase: false` = the model is taken only as part of the payment for another item, never bought outright — absent = true), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool (a wide range of what the customer would still pay) and the `quote_buyback` tool (the most paid for one device sold outright, or the discount for a `direct_purchase: false` model); the business’s own site reads it at `GET /storefront/trade-in`. Replaced whole on write; `null` clears it. */
201443
201885
  trade_in?: {
201444
201886
  price_table: {
201445
201887
  model: string;
201446
201888
  top: number;
201447
201889
  used: number;
201448
201890
  min_battery_pct?: number;
201891
+ direct_purchase?: boolean;
201449
201892
  }[];
201450
201893
  not_bought?: string[];
201451
201894
  floor_factor?: number;
package/dist/index.d.ts CHANGED
@@ -22207,6 +22207,130 @@ interface paths {
22207
22207
  patch?: never;
22208
22208
  trace?: never;
22209
22209
  };
22210
+ "/storefront/trade-in": {
22211
+ parameters: {
22212
+ query?: never;
22213
+ header?: never;
22214
+ path?: never;
22215
+ cookie?: never;
22216
+ };
22217
+ /**
22218
+ * Buy table for the business’s own quoter (trade-in / buyback)
22219
+ * @description What the business pays at most for each used model, so its own website quoter reads the same table the agent quotes from instead of a hardcoded copy. Per model: `top` (flawless, «Impecable»), `used` (normal wear, «Con uso»), `direct_purchase` (`false` = taken only as part of the payment for another item, never bought outright) and `min_battery_pct` (a known battery under it is not bought; `null` = no minimum). Plus `not_bought` (models never bought), `currency` and `perfect_battery_pct` (from this battery health a unit with nothing else wrong counts as flawless). Readable with the storefront’s `stock:read`; the browser twin is `GET /widget/trade-in` with the site’s `pk_` key. `Cache-Control: private, max-age=300` + a strong `ETag` (send `If-None-Match` for a 304). 404 when the workspace keeps no buy table (`PUT /tenant/settings` `trade_in`).
22220
+ */
22221
+ get: {
22222
+ parameters: {
22223
+ query?: never;
22224
+ header?: never;
22225
+ path?: never;
22226
+ cookie?: never;
22227
+ };
22228
+ requestBody?: never;
22229
+ responses: {
22230
+ /** @description The public buy table */
22231
+ 200: {
22232
+ headers: {
22233
+ [name: string]: unknown;
22234
+ };
22235
+ content: {
22236
+ /**
22237
+ * @example {
22238
+ * "currency": "CLP",
22239
+ * "perfect_battery_pct": 90,
22240
+ * "models": [
22241
+ * {
22242
+ * "model": "iPhone 15",
22243
+ * "top": 350000,
22244
+ * "used": 320000,
22245
+ * "direct_purchase": false,
22246
+ * "min_battery_pct": null
22247
+ * },
22248
+ * {
22249
+ * "model": "iPhone 16 Pro",
22250
+ * "top": 600000,
22251
+ * "used": 570000,
22252
+ * "direct_purchase": true,
22253
+ * "min_battery_pct": 90
22254
+ * }
22255
+ * ],
22256
+ * "not_bought": [
22257
+ * "iPhone 13 mini",
22258
+ * "iPhone 16e"
22259
+ * ]
22260
+ * }
22261
+ */
22262
+ "application/json": {
22263
+ data?: unknown;
22264
+ meta?: {
22265
+ [key: string]: unknown;
22266
+ };
22267
+ };
22268
+ };
22269
+ };
22270
+ /** @description Validation error */
22271
+ 400: {
22272
+ headers: {
22273
+ [name: string]: unknown;
22274
+ };
22275
+ content: {
22276
+ "application/json": components["schemas"]["Error"];
22277
+ };
22278
+ };
22279
+ /** @description Unauthorized */
22280
+ 401: {
22281
+ headers: {
22282
+ [name: string]: unknown;
22283
+ };
22284
+ content: {
22285
+ "application/json": components["schemas"]["Error"];
22286
+ };
22287
+ };
22288
+ /** @description Forbidden */
22289
+ 403: {
22290
+ headers: {
22291
+ [name: string]: unknown;
22292
+ };
22293
+ content: {
22294
+ "application/json": components["schemas"]["Error"];
22295
+ };
22296
+ };
22297
+ /** @description Not found */
22298
+ 404: {
22299
+ headers: {
22300
+ [name: string]: unknown;
22301
+ };
22302
+ content: {
22303
+ "application/json": components["schemas"]["Error"];
22304
+ };
22305
+ };
22306
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
22307
+ 409: {
22308
+ headers: {
22309
+ [name: string]: unknown;
22310
+ };
22311
+ content: {
22312
+ "application/json": components["schemas"]["Error"];
22313
+ };
22314
+ };
22315
+ /** @description Rate limited */
22316
+ 429: {
22317
+ headers: {
22318
+ [name: string]: unknown;
22319
+ };
22320
+ content: {
22321
+ "application/json": components["schemas"]["Error"];
22322
+ };
22323
+ };
22324
+ };
22325
+ };
22326
+ put?: never;
22327
+ post?: never;
22328
+ delete?: never;
22329
+ options?: never;
22330
+ head?: never;
22331
+ patch?: never;
22332
+ trace?: never;
22333
+ };
22210
22334
  "/storefront/events": {
22211
22335
  parameters: {
22212
22336
  query?: never;
@@ -142436,6 +142560,323 @@ interface paths {
142436
142560
  patch?: never;
142437
142561
  trace?: never;
142438
142562
  };
142563
+ "/insights/intent-mix": {
142564
+ parameters: {
142565
+ query?: never;
142566
+ header?: never;
142567
+ path?: never;
142568
+ cookie?: never;
142569
+ };
142570
+ /**
142571
+ * Who wrote, by what they came for (sell / trade-in / buy)
142572
+ * @description For a business that buys AND sells: the people (distinct contacts) whose first message or lead fell in the window, split by what they came for — `sell` (sell us theirs), `trade_in` (give theirs and take another), `buy` — with the trend against the previous window of equal length, the funnel per intent (reached the board’s quote step, its visit step, won), and the split by entry: Meta campaign and ad set (the ad that opened the conversation, or a website form’s first-touch UTMs), the website, or the organic channel. Campaign spend and cost per person come from Vitrina Ads when the workspace has it (`spend_state`). A person with both a sell and a buy lead in the window counts as `trade_in`. `applies: false` when the workspace has no sell side (fewer than 10 people asking to sell or trade in over the last 90 days). Counts only. Requires `analytics:read`. Takes the insights `?window=` vocabulary.
142573
+ */
142574
+ get: {
142575
+ parameters: {
142576
+ query?: {
142577
+ /** @description Which period. Omit it (with `from`/`to`) for an explicit range — the shape every ranged Insights report has always accepted, and which still works unchanged. The calendar windows are the DEALERSHIP’s (America/Santiago), so a month closes when a person would say it closed. */
142578
+ window?: "24h" | "7d" | "30d" | "90d" | "calendar_month" | "calendar_year" | "custom";
142579
+ /** @description `window=calendar_month` only. ISO month, `YYYY-MM`. Defaults to the month in progress. */
142580
+ month?: string;
142581
+ /** @description `window=calendar_year` only. `YYYY`. Defaults to the year in progress. */
142582
+ year?: string;
142583
+ /** @description Explicit range only. Checked for non-emptiness and handed to Postgres, so a malformed value surfaces as a 500 from the query rather than a 400 from the edge — send an ISO-8601 instant. */
142584
+ from?: string;
142585
+ /** @description Explicit range only. ISO instant, see `from`. */
142586
+ to?: string;
142587
+ };
142588
+ header?: never;
142589
+ path?: never;
142590
+ cookie?: never;
142591
+ };
142592
+ requestBody?: never;
142593
+ responses: {
142594
+ /** @description The intent mix */
142595
+ 200: {
142596
+ headers: {
142597
+ [name: string]: unknown;
142598
+ };
142599
+ content: {
142600
+ /**
142601
+ * @example {
142602
+ * "data": {
142603
+ * "applies": true,
142604
+ * "previous_window": {
142605
+ * "from": "2026-09-22T03:00:00.000Z",
142606
+ * "to": "2026-10-22T03:00:00.000Z"
142607
+ * },
142608
+ * "totals": {
142609
+ * "people": 120,
142610
+ * "previous_people": 96,
142611
+ * "delta_pct": 25
142612
+ * },
142613
+ * "intents": [
142614
+ * {
142615
+ * "intent": "sell",
142616
+ * "people": 70,
142617
+ * "share_pct": 58.3,
142618
+ * "previous_people": 60,
142619
+ * "delta_pct": 17,
142620
+ * "funnel": {
142621
+ * "quoted": 52,
142622
+ * "visit_booked": 9,
142623
+ * "won": 3
142624
+ * }
142625
+ * },
142626
+ * {
142627
+ * "intent": "trade_in",
142628
+ * "people": 24,
142629
+ * "share_pct": 20,
142630
+ * "previous_people": 14,
142631
+ * "delta_pct": 71,
142632
+ * "funnel": {
142633
+ * "quoted": 18,
142634
+ * "visit_booked": 4,
142635
+ * "won": 1
142636
+ * }
142637
+ * },
142638
+ * {
142639
+ * "intent": "buy",
142640
+ * "people": 26,
142641
+ * "share_pct": 21.7,
142642
+ * "previous_people": 22,
142643
+ * "delta_pct": 18,
142644
+ * "funnel": {
142645
+ * "quoted": 12,
142646
+ * "visit_booked": 3,
142647
+ * "won": 2
142648
+ * }
142649
+ * },
142650
+ * {
142651
+ * "intent": "unknown",
142652
+ * "people": 0,
142653
+ * "share_pct": 0,
142654
+ * "previous_people": 0,
142655
+ * "delta_pct": null,
142656
+ * "funnel": {
142657
+ * "quoted": 0,
142658
+ * "visit_booked": 0,
142659
+ * "won": 0
142660
+ * }
142661
+ * }
142662
+ * ],
142663
+ * "entries": [
142664
+ * {
142665
+ * "kind": "campaign",
142666
+ * "channel": null,
142667
+ * "campaign_external_id": "52595750511957",
142668
+ * "campaign_name": "Compramos tu iPhone | CL",
142669
+ * "people": 48,
142670
+ * "by_intent": {
142671
+ * "sell": 40,
142672
+ * "trade_in": 6,
142673
+ * "buy": 2,
142674
+ * "unknown": 0
142675
+ * },
142676
+ * "spend": 180000,
142677
+ * "cost_per_person": 3750,
142678
+ * "cost_per_intent": {
142679
+ * "sell": 4500,
142680
+ * "trade_in": 30000,
142681
+ * "buy": 90000,
142682
+ * "unknown": null
142683
+ * },
142684
+ * "ad_sets": [
142685
+ * {
142686
+ * "ad_set_external_id": null,
142687
+ * "ad_set_name": "Amplio - CL | ADV+",
142688
+ * "people": 48,
142689
+ * "by_intent": {
142690
+ * "sell": 40,
142691
+ * "trade_in": 6,
142692
+ * "buy": 2,
142693
+ * "unknown": 0
142694
+ * }
142695
+ * }
142696
+ * ]
142697
+ * },
142698
+ * {
142699
+ * "kind": "organic",
142700
+ * "channel": "whatsapp",
142701
+ * "campaign_external_id": null,
142702
+ * "campaign_name": null,
142703
+ * "people": 20,
142704
+ * "by_intent": {
142705
+ * "sell": 8,
142706
+ * "trade_in": 4,
142707
+ * "buy": 8,
142708
+ * "unknown": 0
142709
+ * },
142710
+ * "spend": null,
142711
+ * "cost_per_person": null,
142712
+ * "cost_per_intent": {
142713
+ * "sell": null,
142714
+ * "trade_in": null,
142715
+ * "buy": null,
142716
+ * "unknown": null
142717
+ * },
142718
+ * "ad_sets": []
142719
+ * }
142720
+ * ],
142721
+ * "spend_state": "ok",
142722
+ * "spend_total": 320000,
142723
+ * "rule": "People (distinct contacts) whose first message or lead fell in the window. …"
142724
+ * }
142725
+ * }
142726
+ */
142727
+ "application/json": {
142728
+ data: {
142729
+ /** @description False when the workspace had fewer than 10 people asking to sell or trade in over the last 90 days — a screen draws nothing then. */
142730
+ applies: boolean;
142731
+ /** @description The window of equal length right before, for the trend. */
142732
+ previous_window: {
142733
+ from: string;
142734
+ to: string;
142735
+ };
142736
+ totals: {
142737
+ people: number;
142738
+ previous_people: number;
142739
+ delta_pct: number | null;
142740
+ };
142741
+ intents: {
142742
+ /**
142743
+ * @description `sell` they sell us theirs · `trade_in` they give theirs and take another · `buy` they buy · `unknown` no lead said why.
142744
+ * @enum {string}
142745
+ */
142746
+ intent: "sell" | "trade_in" | "buy" | "unknown";
142747
+ people: number;
142748
+ /** @description Share of the window’s people, one decimal. */
142749
+ share_pct: number;
142750
+ previous_people: number;
142751
+ /** @description % change vs the previous window; `null` when it had nobody. */
142752
+ delta_pct: number | null;
142753
+ funnel: {
142754
+ quoted: number;
142755
+ visit_booked: number;
142756
+ won: number;
142757
+ };
142758
+ }[];
142759
+ entries: {
142760
+ /**
142761
+ * @description `campaign` a Meta campaign (ad that opened the conversation, or a website form’s first-touch UTMs) · `ad_unmapped` a Meta ad whose campaign is unknown · `website` the site with no ad behind it · `organic` a thread no ad opened (`channel` says where).
142762
+ * @enum {string}
142763
+ */
142764
+ kind: "campaign" | "ad_unmapped" | "website" | "organic";
142765
+ /** @description `organic` only: the channel. */
142766
+ channel: string | null;
142767
+ campaign_external_id: string | null;
142768
+ campaign_name: string | null;
142769
+ people: number;
142770
+ /** @description People per intent. */
142771
+ by_intent: {
142772
+ sell: number;
142773
+ trade_in: number;
142774
+ buy: number;
142775
+ unknown: number;
142776
+ };
142777
+ /** @description Meta spend of the campaign over the window. */
142778
+ spend: number | null;
142779
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142780
+ cost_per_person: number | null;
142781
+ cost_per_intent: {
142782
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142783
+ sell: number | null;
142784
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142785
+ trade_in: number | null;
142786
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142787
+ buy: number | null;
142788
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142789
+ unknown: number | null;
142790
+ };
142791
+ ad_sets: {
142792
+ ad_set_external_id: string | null;
142793
+ ad_set_name: string | null;
142794
+ people: number;
142795
+ /** @description People per intent. */
142796
+ by_intent: {
142797
+ sell: number;
142798
+ trade_in: number;
142799
+ buy: number;
142800
+ unknown: number;
142801
+ };
142802
+ }[];
142803
+ }[];
142804
+ /**
142805
+ * @description `no_ads` the workspace has no Vitrina Ads · `unavailable` the Ads read failed — spend fields are `null`.
142806
+ * @enum {string}
142807
+ */
142808
+ spend_state: "ok" | "unavailable" | "no_ads";
142809
+ /** @description CLP, whole pesos. `null` — never 0 — when unknown or with no denominator. */
142810
+ spend_total: number | null;
142811
+ rule: string;
142812
+ };
142813
+ };
142814
+ };
142815
+ };
142816
+ /** @description Validation error */
142817
+ 400: {
142818
+ headers: {
142819
+ [name: string]: unknown;
142820
+ };
142821
+ content: {
142822
+ "application/json": components["schemas"]["Error"];
142823
+ };
142824
+ };
142825
+ /** @description Unauthorized */
142826
+ 401: {
142827
+ headers: {
142828
+ [name: string]: unknown;
142829
+ };
142830
+ content: {
142831
+ "application/json": components["schemas"]["Error"];
142832
+ };
142833
+ };
142834
+ /** @description Forbidden */
142835
+ 403: {
142836
+ headers: {
142837
+ [name: string]: unknown;
142838
+ };
142839
+ content: {
142840
+ "application/json": components["schemas"]["Error"];
142841
+ };
142842
+ };
142843
+ /** @description Not found */
142844
+ 404: {
142845
+ headers: {
142846
+ [name: string]: unknown;
142847
+ };
142848
+ content: {
142849
+ "application/json": components["schemas"]["Error"];
142850
+ };
142851
+ };
142852
+ /** @description Conflict (incl. Idempotency-Key reuse with different body) */
142853
+ 409: {
142854
+ headers: {
142855
+ [name: string]: unknown;
142856
+ };
142857
+ content: {
142858
+ "application/json": components["schemas"]["Error"];
142859
+ };
142860
+ };
142861
+ /** @description Rate limited */
142862
+ 429: {
142863
+ headers: {
142864
+ [name: string]: unknown;
142865
+ };
142866
+ content: {
142867
+ "application/json": components["schemas"]["Error"];
142868
+ };
142869
+ };
142870
+ };
142871
+ };
142872
+ put?: never;
142873
+ post?: never;
142874
+ delete?: never;
142875
+ options?: never;
142876
+ head?: never;
142877
+ patch?: never;
142878
+ trace?: never;
142879
+ };
142439
142880
  "/insights/overview/live": {
142440
142881
  parameters: {
142441
142882
  query?: never;
@@ -201225,13 +201666,14 @@ interface components {
201225
201666
  push_enabled?: boolean;
201226
201667
  };
201227
201668
  TenantSettingsPublic: {
201228
- /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool, which gives customers only a wide range of what they would still pay. Replaced whole on write; `null` clears it. */
201669
+ /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?, direct_purchase?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value; `direct_purchase: false` = the model is taken only as part of the payment for another item, never bought outright — absent = true), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool (a wide range of what the customer would still pay) and the `quote_buyback` tool (the most paid for one device sold outright, or the discount for a `direct_purchase: false` model); the business’s own site reads it at `GET /storefront/trade-in`. Replaced whole on write; `null` clears it. */
201229
201670
  trade_in?: {
201230
201671
  price_table: {
201231
201672
  model: string;
201232
201673
  top: number;
201233
201674
  used: number;
201234
201675
  min_battery_pct?: number;
201676
+ direct_purchase?: boolean;
201235
201677
  }[];
201236
201678
  not_bought?: string[];
201237
201679
  floor_factor?: number;
@@ -201439,13 +201881,14 @@ interface components {
201439
201881
  };
201440
201882
  };
201441
201883
  TenantSettingsPublicWrite: {
201442
- /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool, which gives customers only a wide range of what they would still pay. Replaced whole on write; `null` clears it. */
201884
+ /** @description Trade-in buy table («parte de pago»), for a business that buys used devices: `price_table` rows `{model, top, used, min_battery_pct?, direct_purchase?}` (`top` = max paid for a flawless unit, `used` = with normal wear, whole currency units; capacity does not change the value; `direct_purchase: false` = the model is taken only as part of the payment for another item, never bought outright — absent = true), `not_bought` (models never bought), `floor_factor` (0–1, default 0.7: the low end for a unit with issues or unknown condition is `used × floor_factor`), `perfect_floor_factor` (0–1, default 0.85: the low end for a flawless unit is `used × perfect_floor_factor`, its high end is `top`), `rounding` (default 10000), `perfect_battery_pct` (default 90), `currency` (default CLP). On an ecommerce workspace its presence offers the agents the `estimate_trade_in` tool (a wide range of what the customer would still pay) and the `quote_buyback` tool (the most paid for one device sold outright, or the discount for a `direct_purchase: false` model); the business’s own site reads it at `GET /storefront/trade-in`. Replaced whole on write; `null` clears it. */
201443
201885
  trade_in?: {
201444
201886
  price_table: {
201445
201887
  model: string;
201446
201888
  top: number;
201447
201889
  used: number;
201448
201890
  min_battery_pct?: number;
201891
+ direct_purchase?: boolean;
201449
201892
  }[];
201450
201893
  not_bought?: string[];
201451
201894
  floor_factor?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrina/api",
3
- "version": "14.77.2",
3
+ "version": "14.79.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",