@garagem-ai/site-sdk 0.4.8 → 0.4.11

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.mjs CHANGED
@@ -730,6 +730,342 @@ async function submitContactLead(input) {
730
730
  });
731
731
  }
732
732
 
733
+ // src/amenity-labels.ts
734
+ var LISTING_AMENITY_TITLES = {
735
+ unit: "Comodidades",
736
+ building: "Comodidades do condom\xEDnio"
737
+ };
738
+ var AMENITY_FALLBACK_LABELS = {
739
+ // ==================== PROPERTY FEATURES ====================
740
+ // Amenities
741
+ arCondicionado: "Ar condicionado",
742
+ banheira: "Banheira",
743
+ carregadorEletrico: "Carregador el\xE9trico",
744
+ churrasqueira: "Churrasqueira",
745
+ chuveiroGas: "Chuveiro a g\xE1s",
746
+ chuveiroEletrico: "Chuveiro el\xE9trico",
747
+ energiaSolar: "Energia solar",
748
+ fechaduraDigital: "Fechadura digital",
749
+ fechaduraEletronica: "Fechadura eletr\xF4nica",
750
+ geradorEletrico: "Gerador el\xE9trico",
751
+ gesso: "Gesso",
752
+ hidromassagem: "Hidromassagem",
753
+ lareira: "Lareira",
754
+ ofuro: "Ofur\xF4",
755
+ spa: "Spa",
756
+ painelSolar: "Painel solar",
757
+ portaoEletronico: "Port\xE3o eletr\xF4nico",
758
+ sistemaAlarme: "Sistema de alarme",
759
+ homeTheater: "Home theater",
760
+ adega: "Adega",
761
+ split: "Split",
762
+ arCentral: "Ar central",
763
+ esperaSplit: "Espera para split",
764
+ vistaMar: "Vista para o mar",
765
+ vistaPanoramica: "Vista panor\xE2mica",
766
+ aguaQuente: "\xC1gua quente",
767
+ reformado: "Reformado",
768
+ tvCabo: "TV a cabo",
769
+ gradeado: "Gradeado",
770
+ antenaParabolica: "Antena parab\xF3lica",
771
+ aquecimento: "Aquecimento",
772
+ aquecimentoEletrico: "Aquecimento el\xE9trico",
773
+ aquecimentoCentral: "Aquecimento central",
774
+ cercaEletrica: "Cerca el\xE9trica",
775
+ monitoramento: "Monitoramento",
776
+ vigiaInterno: "Vigia interno",
777
+ vigiaExterno: "Vigia externo",
778
+ alarme: "Alarme",
779
+ agua: "\xC1gua",
780
+ redeEsgoto: "Rede de esgoto",
781
+ pavimentacao: "Pavimenta\xE7\xE3o",
782
+ energiaEletrica: "Energia el\xE9trica",
783
+ // Furniture
784
+ mobiliado: "Mobiliado",
785
+ armarioEmbutido: "Arm\xE1rio embutido",
786
+ armarioEmbutidoQuarto: "Arm\xE1rio embutido quarto",
787
+ armarioCozinha: "Arm\xE1rio cozinha",
788
+ armarioBanheiro: "Arm\xE1rio banheiro",
789
+ cozinhaPlanejada: "Cozinha planejada",
790
+ fogao: "Fog\xE3o",
791
+ fornoPizza: "Forno de pizza",
792
+ freezer: "Freezer",
793
+ dormitorioComArmario: "Dormit\xF3rio com arm\xE1rio",
794
+ semiMobiliado: "Semi mobiliado",
795
+ salaArmarios: "Sala com arm\xE1rios",
796
+ // Structure
797
+ piscina: "Piscina",
798
+ piscinaAquecida: "Piscina aquecida",
799
+ piscinaCoberta: "Piscina coberta",
800
+ poco: "Po\xE7o",
801
+ pocoArtesiano: "Po\xE7o artesiano",
802
+ bar: "Bar",
803
+ jardim: "Jardim",
804
+ lago: "Lago",
805
+ lavabo: "Lavabo",
806
+ quintal: "Quintal",
807
+ solarium: "Solarium",
808
+ quartoServico: "Quarto de servi\xE7o",
809
+ varanda: "Varanda",
810
+ varandaFechadaVidro: "Varanda fechada com vidro",
811
+ varandaGourmet: "Varanda gourmet",
812
+ banheiroServico: "Banheiro de servi\xE7o",
813
+ areaServico: "\xC1rea de servi\xE7o",
814
+ cinema: "Cinema",
815
+ closet: "Closet",
816
+ cozinhaAmericana: "Cozinha americana",
817
+ cozinhaGourmet: "Cozinha gourmet",
818
+ despensa: "Despensa",
819
+ escritorio: "Escrit\xF3rio",
820
+ edicula: "Ed\xEDcula",
821
+ horta: "Horta",
822
+ sacada: "Sacada",
823
+ salaJantar: "Sala de jantar",
824
+ cozinha: "Cozinha",
825
+ banheiroSocial: "Banheiro social",
826
+ terraco: "Terra\xE7o",
827
+ copa: "Copa",
828
+ suiteMaster: "Su\xEDte master",
829
+ wcEmpregada: "WC empregada",
830
+ dependenciaEmpregada: "Depend\xEAncia de empregada",
831
+ dependenciadeEmpregada: "Depend\xEAncia empregada",
832
+ salaTv: "Sala de TV",
833
+ copaCozinha: "Copa cozinha",
834
+ sacadaComChurrasqueira: "Sacada com churrasqueira",
835
+ hallPrivativo: "Hall privativo",
836
+ estarIntimo: "Estar \xEDntimo",
837
+ livingHall: "Living hall",
838
+ piscinaInterna: "Piscina interna",
839
+ deck: "Deck",
840
+ jardimInverno: "Jardim de inverno",
841
+ rouparia: "Rouparia",
842
+ living: "Living",
843
+ familyRoom: "Family room",
844
+ salafitness: "Sala fitness",
845
+ salaEstar: "Sala de estar",
846
+ mezanino: "Mezanino",
847
+ pisoElevado: "Piso elevado",
848
+ entradaServicoIndependente: "Entrada de servi\xE7o independente",
849
+ forro: "Forro",
850
+ vitrine: "Vitrine",
851
+ banheiroAuxiliar: "Banheiro auxiliar",
852
+ gabinete: "Gabinete",
853
+ quadraTenisPrivativa: "Quadra de t\xEAnis privativa",
854
+ porao: "Por\xE3o",
855
+ sotao: "S\xF3t\xE3o",
856
+ patio: "P\xE1tio",
857
+ canaletasNoRodape: "Canaletas no rodap\xE9",
858
+ // Accessibility
859
+ barraApoioVaso: "Barra de apoio vaso",
860
+ barraApoioChuveiro: "Barra de apoio chuveiro",
861
+ entradaSemDegrau: "Entrada sem degrau",
862
+ rampasAcesso: "Rampas de acesso",
863
+ vagaDeficientes: "Vaga para deficientes",
864
+ // Flooring
865
+ cimentoQueimado: "Cimento queimado",
866
+ madeira: "Madeira",
867
+ pisoFrio: "Piso frio",
868
+ laminado: "Laminado",
869
+ vinilico: "Vin\xEDlico",
870
+ porcelanato: "Porcelanato",
871
+ // ==================== BUILDING FEATURES ====================
872
+ // Amenities
873
+ elevador: "Elevador",
874
+ bicicletario: "Biciclet\xE1rio",
875
+ carregadorEletronico: "Carregador eletr\xF4nico",
876
+ concierge: "Concierge",
877
+ coworking: "Coworking",
878
+ deposito: "Dep\xF3sito",
879
+ lavanderia: "Lavanderia",
880
+ petPlace: "Pet place",
881
+ recebimentoEncomendas: "Recebimento de encomendas",
882
+ salaReuniao: "Sala de reuni\xE3o",
883
+ salaoFestas: "Sal\xE3o de festas",
884
+ valet: "Valet",
885
+ garagemCoberta: "Garagem coberta",
886
+ elevadorServico: "Elevador de servi\xE7o",
887
+ // Leisure
888
+ academia: "Academia",
889
+ campoFutebol: "Campo de futebol",
890
+ espacoGourmet: "Espa\xE7o gourmet",
891
+ piscinaInfantil: "Piscina infantil",
892
+ pistaCaminhada: "Pista de caminhada",
893
+ playground: "Playground",
894
+ quadraPoliesportiva: "Quadra poliesportiva",
895
+ quadraTenis: "Quadra de t\xEAnis",
896
+ salaJogos: "Sala de jogos",
897
+ salaVapor: "Sala de vapor",
898
+ sauna: "Sauna",
899
+ // Security
900
+ circuitoTv: "Circuito fechado de TV",
901
+ controleAcessoEletronico: "Controle de acesso eletr\xF4nico",
902
+ interfone: "Interfone",
903
+ portaria24h: "Portaria 24h",
904
+ porteiroFisico: "Porteiro f\xEDsico",
905
+ seguranca24h: "Seguran\xE7a 24h",
906
+ segurancaPatrimonial: "Seguran\xE7a patrimonial",
907
+ condominioFechado: "Condom\xEDnio fechado",
908
+ // Accessibility
909
+ banheiroAcessivel: "Banheiro acess\xEDvel",
910
+ elevadorAcessivel: "Elevador acess\xEDvel",
911
+ pisoTatil: "Piso t\xE1til",
912
+ // ==================== CANONICAL HAS*/IS* KEYS ====================
913
+ has24hConcierge: "Portaria 24h",
914
+ has24hSecurity: "Seguran\xE7a 24h",
915
+ hasAccessRamps: "Rampas de acesso",
916
+ hasAccessibleBathroom: "Banheiro acess\xEDvel",
917
+ hasAccessibleElevator: "Elevador acess\xEDvel",
918
+ hasAirConditioning: "Ar condicionado",
919
+ hasAlarmSystem: "Sistema de alarme",
920
+ hasBalcony: "Varanda",
921
+ hasBikeStorage: "Biciclet\xE1rio",
922
+ hasBuiltInWardrobe: "Arm\xE1rio embutido",
923
+ hasCCTV: "CFTV",
924
+ hasCloset: "Closet",
925
+ hasConcierge: "Portaria",
926
+ hasControlledAccess: "Condom\xEDnio fechado",
927
+ hasCoworking: "Coworking",
928
+ hasDisabledParking: "Vaga para deficientes",
929
+ hasElectricCharger: "Carregador eletr\xF4nico",
930
+ hasElectronicGate: "Port\xE3o eletr\xF4nico",
931
+ hasElevator: "Elevador",
932
+ hasFireplace: "Lareira",
933
+ hasGarden: "Jardim",
934
+ hasGasShower: "Chuveiro a g\xE1s",
935
+ hasGenerator: "Gerador",
936
+ hasGourmetBalcony: "Varanda gourmet",
937
+ hasGourmetKitchen: "Cozinha gourmet",
938
+ hasGrill: "Churrasqueira",
939
+ hasGuestParking: "Estacionamento para visitantes",
940
+ hasGym: "Academia",
941
+ hasHeating: "Aquecimento",
942
+ hasHomeOffice: "Home office",
943
+ hasIntercom: "Interfone",
944
+ hasJacuzzi: "Hidromassagem",
945
+ hasKidsPool: "Piscina infantil",
946
+ hasLaundry: "Lavanderia",
947
+ hasMeetingRoom: "Sala de reuni\xE3o",
948
+ hasOffice: "Escrit\xF3rio",
949
+ hasOpenKitchen: "Cozinha americana",
950
+ hasPackageReceival: "Recebimento de encomendas",
951
+ hasPantry: "Despensa",
952
+ hasParkingGarage: "Garagem coberta",
953
+ hasPartySaloon: "Sal\xE3o de festas",
954
+ hasPetArea: "Pet place",
955
+ hasPipedGas: "G\xE1s encanado",
956
+ hasPlayground: "Playground",
957
+ hasPowderRoom: "Lavabo",
958
+ hasPrivatePool: "Piscina privativa",
959
+ hasSauna: "Sauna",
960
+ hasSecurity: "Seguran\xE7a",
961
+ hasServiceArea: "\xC1rea de servi\xE7o",
962
+ hasSolarPanel: "Painel solar",
963
+ hasSpa: "Spa",
964
+ hasSportsCourt: "Quadra de esportes",
965
+ hasStepFreeEntrance: "Entrada sem degrau",
966
+ hasStorage: "Dep\xF3sito",
967
+ hasSwimmingPool: "Piscina",
968
+ hasTennisCourt: "Quadra de t\xEAnis",
969
+ hasValetParking: "Valet",
970
+ homeOffice: "Home office",
971
+ isPetFriendly: "Pet friendly",
972
+ isFurnished: "Mobiliado",
973
+ isPartiallyFurnished: "Semi-mobiliado",
974
+ petFriendly: "Pet friendly",
975
+ piscinaPrivativa: "Piscina privativa",
976
+ pisoLaminado: "Piso laminado",
977
+ pisoMadeira: "Piso de madeira",
978
+ pisoPorcelanato: "Piso porcelanato",
979
+ quadraEsportes: "Quadra de esportes",
980
+ rooftop: "Rooftop",
981
+ suite: "Su\xEDte",
982
+ triplex: "Triplex",
983
+ duplex: "Duplex",
984
+ cobertura: "Cobertura",
985
+ forroGesso: "Forro de gesso",
986
+ gerador: "Gerador",
987
+ armariosCozinha: "Arm\xE1rios na cozinha",
988
+ armariosQuarto: "Arm\xE1rios nos quartos",
989
+ cftv: "CFTV"
990
+ };
991
+ function lookupLabel(id, options) {
992
+ const fromDictionary = options?.find((option) => option.id === id)?.label;
993
+ if (fromDictionary?.trim()) return fromDictionary.trim();
994
+ return AMENITY_FALLBACK_LABELS[id];
995
+ }
996
+ function labelAmenities(ids, dictionary) {
997
+ if (!ids?.length) return [];
998
+ const labels = [];
999
+ const seen = /* @__PURE__ */ new Set();
1000
+ for (const id of ids) {
1001
+ if (!id) continue;
1002
+ const label = lookupLabel(id, dictionary);
1003
+ if (!label || seen.has(label)) continue;
1004
+ seen.add(label);
1005
+ labels.push(label);
1006
+ }
1007
+ return labels.sort((a, b) => a.localeCompare(b, "pt-BR"));
1008
+ }
1009
+ function presentIds(ids) {
1010
+ return (ids ?? []).filter((id) => Boolean(id));
1011
+ }
1012
+ function buildingIdsFromMergedAmenities(listing, unitIds) {
1013
+ if (!listing.amenities || listing.propertyFeatures == null) return [];
1014
+ const unitCounts = /* @__PURE__ */ new Map();
1015
+ for (const id of unitIds) {
1016
+ unitCounts.set(id, (unitCounts.get(id) ?? 0) + 1);
1017
+ }
1018
+ return listing.amenities.filter((id) => {
1019
+ if (!id) return false;
1020
+ const count = unitCounts.get(id);
1021
+ if (count === void 0 || count === 0) return true;
1022
+ unitCounts.set(id, count - 1);
1023
+ return false;
1024
+ });
1025
+ }
1026
+ function unitAmenityIds(listing) {
1027
+ if (listing.propertyFeatures != null) {
1028
+ return presentIds(listing.propertyFeatures);
1029
+ }
1030
+ const building = new Set(
1031
+ listing.building?.amenities ?? listing.buildingAmenities ?? []
1032
+ );
1033
+ return (listing.amenities ?? []).filter((id) => id && !building.has(id));
1034
+ }
1035
+ function buildingAmenityIds(listing) {
1036
+ if (listing.building != null && listing.building.amenities != null) {
1037
+ return presentIds(listing.building.amenities);
1038
+ }
1039
+ if (listing.buildingAmenities != null) {
1040
+ return presentIds(listing.buildingAmenities);
1041
+ }
1042
+ return buildingIdsFromMergedAmenities(listing, unitAmenityIds(listing));
1043
+ }
1044
+ function listingAmenityGroups(listing, dictionary) {
1045
+ const groups = [];
1046
+ const unitIds = unitAmenityIds(listing);
1047
+ const unitLabels = labelAmenities(unitIds, dictionary?.propertyFeatures);
1048
+ if (unitLabels.length > 0) {
1049
+ groups.push({
1050
+ key: "unit",
1051
+ title: LISTING_AMENITY_TITLES.unit,
1052
+ labels: unitLabels
1053
+ });
1054
+ }
1055
+ const buildingLabels = labelAmenities(
1056
+ buildingAmenityIds(listing),
1057
+ dictionary?.buildingAmenities
1058
+ );
1059
+ if (buildingLabels.length > 0) {
1060
+ groups.push({
1061
+ key: "building",
1062
+ title: LISTING_AMENITY_TITLES.building,
1063
+ labels: buildingLabels
1064
+ });
1065
+ }
1066
+ return groups;
1067
+ }
1068
+
733
1069
  // src/presentation.ts
734
1070
  var SEARCH_CSS_VARS = {
735
1071
  cardRadius: "--garagem-listing-card-radius",
@@ -1583,6 +1919,261 @@ function paginationPages(currentPage, totalPages, padding) {
1583
1919
  return pages;
1584
1920
  }
1585
1921
 
1922
+ // src/listing-detail.ts
1923
+ var LISTING_DESCRIPTION_CLAMP = 280;
1924
+ var VIDEO_HOST_HINTS = [
1925
+ "youtube.com",
1926
+ "youtu.be",
1927
+ "vimeo.com",
1928
+ "wistia.com",
1929
+ "wistia.net"
1930
+ ];
1931
+ var BREADCRUMB_LABELS = {
1932
+ imoveis: "Im\xF3veis",
1933
+ venda: "Venda",
1934
+ aluguel: "Aluguel",
1935
+ rental: "Aluguel",
1936
+ sale: "Venda"
1937
+ };
1938
+ function finiteNumber(value) {
1939
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1940
+ if (typeof value === "string" && value.trim() !== "") {
1941
+ const parsed = Number(value);
1942
+ if (Number.isFinite(parsed)) return parsed;
1943
+ }
1944
+ return null;
1945
+ }
1946
+ function positiveCount(value) {
1947
+ const amount = finiteNumber(value);
1948
+ return amount != null && amount > 0 ? amount : null;
1949
+ }
1950
+ function formatFloorFact(value) {
1951
+ if (typeof value === "number" && Number.isFinite(value)) {
1952
+ return value === 0 ? "T\xE9rreo" : String(value);
1953
+ }
1954
+ if (typeof value !== "string") return null;
1955
+ const trimmed = value.trim();
1956
+ if (!trimmed) return null;
1957
+ const parsed = Number(trimmed);
1958
+ if (Number.isFinite(parsed) && trimmed === String(parsed)) {
1959
+ return parsed === 0 ? "T\xE9rreo" : trimmed;
1960
+ }
1961
+ return trimmed;
1962
+ }
1963
+ function httpsUrl(raw) {
1964
+ if (!raw) return null;
1965
+ try {
1966
+ const url = new URL(raw);
1967
+ if (url.protocol !== "https:") return null;
1968
+ return url.toString();
1969
+ } catch {
1970
+ return null;
1971
+ }
1972
+ }
1973
+ function isVideoPlatformUrl(url) {
1974
+ const host = new URL(url).hostname.toLowerCase();
1975
+ return VIDEO_HOST_HINTS.some(
1976
+ (hint) => host === hint || host.endsWith(`.${hint}`)
1977
+ );
1978
+ }
1979
+ function overlayKind(type, src) {
1980
+ if (type === "image" || type === "photo") return null;
1981
+ const host = new URL(src).hostname.toLowerCase();
1982
+ if (type === "tour" || type === "virtual_tour" || host.includes("matterport")) {
1983
+ return "tour";
1984
+ }
1985
+ if (isVideoPlatformUrl(src) || type === "video") return "video";
1986
+ return type ? "tour" : null;
1987
+ }
1988
+ var VIMEO_ID_RE = /vimeo\.com\/(?:video\/|channels\/[^/]+\/|groups\/[^/]+\/videos\/)?(\d+)/i;
1989
+ var WISTIA_ID_RE = /\/(?:medias|embed\/(?:iframe|medias))\/([a-zA-Z0-9]+)/i;
1990
+ function vimeoPrivacyHash(url, id) {
1991
+ const fromQuery = url.searchParams.get("h");
1992
+ if (fromQuery) return fromQuery;
1993
+ const segments = url.pathname.split("/").filter(Boolean);
1994
+ const idIndex = segments.indexOf(id);
1995
+ const next = idIndex >= 0 ? segments[idIndex + 1] : void 0;
1996
+ return next && /^[a-f0-9]{6,12}$/i.test(next) ? next : null;
1997
+ }
1998
+ function embedSrc(src) {
1999
+ const url = new URL(src);
2000
+ const host = url.hostname.toLowerCase();
2001
+ if (host === "youtu.be" || host.endsWith(".youtu.be")) {
2002
+ const id = url.pathname.replace(/^\//, "").split("/")[0];
2003
+ return id ? `https://www.youtube.com/embed/${id}` : src;
2004
+ }
2005
+ if (host.includes("youtube.com")) {
2006
+ const id = url.searchParams.get("v") || url.pathname.split("/").pop();
2007
+ return id ? `https://www.youtube.com/embed/${id}` : src;
2008
+ }
2009
+ if (host.includes("player.vimeo.com")) return src;
2010
+ if (host.includes("vimeo.com")) {
2011
+ const id = src.match(VIMEO_ID_RE)?.[1];
2012
+ if (!id) return src;
2013
+ const hash = vimeoPrivacyHash(url, id);
2014
+ return hash ? `https://player.vimeo.com/video/${id}?h=${encodeURIComponent(hash)}` : `https://player.vimeo.com/video/${id}`;
2015
+ }
2016
+ if (host.includes("wistia.com") || host.includes("wistia.net")) {
2017
+ if (src.includes("/embed/iframe/")) return src;
2018
+ const id = src.match(WISTIA_ID_RE)?.[1];
2019
+ return id ? `https://fast.wistia.net/embed/iframe/${id}` : src;
2020
+ }
2021
+ return src;
2022
+ }
2023
+ function crumbLabel(segment) {
2024
+ const mapped = BREADCRUMB_LABELS[segment];
2025
+ if (mapped) return mapped;
2026
+ if (/^[a-z]{2}$/.test(segment)) return segment.toUpperCase();
2027
+ return segment.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
2028
+ }
2029
+ function listingValues(listing) {
2030
+ const values = [
2031
+ {
2032
+ key: "price",
2033
+ label: "Pre\xE7o",
2034
+ text: listing.priceVisibility === "private" ? "Sob consulta" : formatListingPrice(listing.price)
2035
+ }
2036
+ ];
2037
+ const condoFee = positiveCount(listing.property?.condoFee);
2038
+ if (condoFee != null) {
2039
+ values.push({
2040
+ key: "condoFee",
2041
+ label: "Condom\xEDnio",
2042
+ text: formatListingPrice(condoFee)
2043
+ });
2044
+ }
2045
+ const propertyTax = positiveCount(listing.property?.propertyTax);
2046
+ if (propertyTax != null) {
2047
+ values.push({
2048
+ key: "propertyTax",
2049
+ label: "IPTU",
2050
+ text: formatListingPrice(propertyTax)
2051
+ });
2052
+ }
2053
+ return values;
2054
+ }
2055
+ function listingFacts(listing) {
2056
+ const property = listing.property ?? {};
2057
+ const facts = [];
2058
+ const area = formatAreaM2(
2059
+ positiveCount(property.usableArea) ?? positiveCount(property.totalArea)
2060
+ );
2061
+ if (area) facts.push({ key: "area", label: "\xC1rea", text: area });
2062
+ const bedrooms = positiveCount(property.bedrooms);
2063
+ if (bedrooms != null) {
2064
+ facts.push({
2065
+ key: "bedrooms",
2066
+ label: "Dormit\xF3rios",
2067
+ text: String(bedrooms)
2068
+ });
2069
+ }
2070
+ const suites = positiveCount(property.suites);
2071
+ if (suites != null) {
2072
+ facts.push({ key: "suites", label: "Su\xEDtes", text: String(suites) });
2073
+ }
2074
+ const parking = positiveCount(property.parkingSpaces);
2075
+ if (parking != null) {
2076
+ facts.push({ key: "parkingSpaces", label: "Vagas", text: String(parking) });
2077
+ }
2078
+ const rooms = positiveCount(property.rooms);
2079
+ if (rooms != null) {
2080
+ facts.push({ key: "rooms", label: "Salas", text: String(rooms) });
2081
+ }
2082
+ const floorText = formatFloorFact(property.floor);
2083
+ if (floorText) {
2084
+ facts.push({ key: "floor", label: "Andar", text: floorText });
2085
+ }
2086
+ return facts;
2087
+ }
2088
+ function listingMapsHref(location) {
2089
+ if (!location) return null;
2090
+ const lat = finiteNumber(location.coordinates?.lat);
2091
+ const lng = finiteNumber(location.coordinates?.lng);
2092
+ if (lat != null && lng != null && !(lat === 0 && lng === 0)) {
2093
+ return `https://www.google.com/maps/search/?api=1&query=${lat},${lng}`;
2094
+ }
2095
+ const query = [
2096
+ [location.street, location.number].filter(Boolean).join(" ").trim(),
2097
+ location.neighborhood,
2098
+ location.city,
2099
+ location.state
2100
+ ].map((part) => part ? String(part).trim() : "").filter(Boolean).join(", ");
2101
+ if (!query) return null;
2102
+ return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`;
2103
+ }
2104
+ function listingLocationBlock(listing) {
2105
+ const location = listing?.location;
2106
+ if (!location) return null;
2107
+ const street = [location.street, location.number].filter(Boolean).join(" ").trim();
2108
+ const label = street || listingLocationLabel(location);
2109
+ const mapsHref = listingMapsHref(location);
2110
+ if (!label && !mapsHref) return null;
2111
+ return { label, mapsHref };
2112
+ }
2113
+ function listingBreadcrumb(listing) {
2114
+ const path = listingPublicPath(listing);
2115
+ const segments = path.split("/").filter(Boolean);
2116
+ if (segments[0] !== "imoveis") return [];
2117
+ const crumbs = [
2118
+ { label: "Im\xF3veis", href: "/imoveis" }
2119
+ ];
2120
+ let href = "/imoveis";
2121
+ for (const segment of segments.slice(1)) {
2122
+ if (segment.startsWith("id-")) break;
2123
+ href = `${href}/${segment}`;
2124
+ if (isListingDetailPath(href)) continue;
2125
+ crumbs.push({ label: crumbLabel(segment), href });
2126
+ }
2127
+ return crumbs;
2128
+ }
2129
+ function listingDescriptionPreview(description, expanded = false) {
2130
+ const text = description?.trim() ?? "";
2131
+ if (!text) return null;
2132
+ if (text.length <= LISTING_DESCRIPTION_CLAMP) {
2133
+ return { text, truncated: false, toggleLabel: null };
2134
+ }
2135
+ if (expanded) {
2136
+ return { text, truncated: true, toggleLabel: "Ler menos" };
2137
+ }
2138
+ return {
2139
+ text: `${text.slice(0, LISTING_DESCRIPTION_CLAMP).trimEnd()}\u2026`,
2140
+ truncated: true,
2141
+ toggleLabel: "Ler mais"
2142
+ };
2143
+ }
2144
+ function listingMediaOverlays(listing) {
2145
+ const overlays = [];
2146
+ const seen = /* @__PURE__ */ new Set();
2147
+ for (const item of listing.media ?? []) {
2148
+ const src = httpsUrl(item.src);
2149
+ if (!src) continue;
2150
+ const kind = overlayKind(item.type, src);
2151
+ if (!kind || seen.has(kind)) continue;
2152
+ seen.add(kind);
2153
+ overlays.push({
2154
+ key: kind,
2155
+ hash: kind,
2156
+ title: kind === "video" ? "V\xEDdeo" : "Tour virtual",
2157
+ href: `#${kind}`,
2158
+ embedSrc: embedSrc(src)
2159
+ });
2160
+ }
2161
+ return overlays;
2162
+ }
2163
+ function listingDetailModel(listing, options) {
2164
+ return {
2165
+ breadcrumb: listingBreadcrumb(listing),
2166
+ values: listingValues(listing),
2167
+ facts: listingFacts(listing),
2168
+ location: listingLocationBlock(listing),
2169
+ description: listingDescriptionPreview(
2170
+ listing.description,
2171
+ options?.descriptionExpanded === true
2172
+ ),
2173
+ mediaOverlays: listingMediaOverlays(listing)
2174
+ };
2175
+ }
2176
+
1586
2177
  // src/studio-contract.ts
1587
2178
  var STUDIO_SDK_PACKAGE = "@garagem-ai/site-sdk";
1588
2179
  var STUDIO_SDK_CONTRACT = {
@@ -1590,10 +2181,11 @@ var STUDIO_SDK_CONTRACT = {
1590
2181
  /**
1591
2182
  * Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
1592
2183
  * prompts that skip the layout chrome tag match the tarball v0 installs.
1593
- * 0.4.7 lets SearchPage fill the site wrapper (`as="div"`) with no
1594
- * nested 80rem inset and no padding on the search slot.
2184
+ * 0.4.9 adds listingDetailModel (values, facts, location, breadcrumb,
2185
+ * description clamp, video/tour), getSimilarListings, and
2186
+ * listingAmenityGroups so listing detail never prints amenity ids.
1595
2187
  */
1596
- minNpmVersion: "0.4.7",
2188
+ minNpmVersion: "0.4.9",
1597
2189
  /** First release where ListingCard and ResultsSkeleton inject the sheet. */
1598
2190
  selfInjectSince: "0.4.2",
1599
2191
  chromeStrategy: "self-inject",
@@ -1625,7 +2217,9 @@ var STUDIO_SDK_CONTRACT = {
1625
2217
  "expandVisitTimeSlots",
1626
2218
  "isVisitSlotAllowed",
1627
2219
  "STUDIO_DEFAULT_VISIT_SCHEDULE"
1628
- ]
2220
+ ],
2221
+ listingDetailExports: ["listingDetailModel", "getSimilarListings"],
2222
+ amenityExports: ["listingAmenityGroups"]
1629
2223
  };
1630
2224
  var STUDIO_SITE_LAYOUT = {
1631
2225
  maxWidthRem: "80rem",
@@ -1719,6 +2313,14 @@ function studioLeadInstruction() {
1719
2313
  const names = STUDIO_SDK_CONTRACT.leadExports.join(", ");
1720
2314
  return `Listing-detail visit/contact leads: import ${names} from \`${STUDIO_SDK_PACKAGE}\` (the main package, not \`/react\`). Call \`submitVisitLead\` / \`submitContactLead\` \u2014 never concatenate a leads webhook URL and never POST the Showcase demo leads route.`;
1721
2315
  }
2316
+ function studioListingDetailInstruction() {
2317
+ const names = STUDIO_SDK_CONTRACT.listingDetailExports.join(", ");
2318
+ return `Listing detail blocks: import ${names} from \`${STUDIO_SDK_PACKAGE}\` and \`ListingCard\` from \`${STUDIO_SDK_PACKAGE}/react\`. Render \`listingDetailModel(listing)\` for breadcrumb (hrefs are search prefixes of \`listing.path\`, never invented paths), values (price / sob consulta, condo, IPTU), facts (omit empty zeros; bedrooms \u2260 salas), location plus a discreet Google Maps \`<a target="_blank" rel="noopener noreferrer">\`, and description with the helper clamp + toggle (keep the full text; do not drop the remainder). Video/tour: \`model.mediaOverlays\` as hash links (\`#video\` / \`#tour\`) and a fullscreen overlay that closes with browser back; omit when empty. Similar listings: \`getSimilarListings({ siteId, listingId, baseUrl })\` + \`ListingCard\`; hide the section when the list is empty. Do not invent a local recommendation loop.`;
2319
+ }
2320
+ function studioAmenityInstruction() {
2321
+ const names = STUDIO_SDK_CONTRACT.amenityExports.join(", ");
2322
+ return `Listing amenities: import ${names} from \`${STUDIO_SDK_PACKAGE}\`. Render \`listingAmenityGroups(listing)\` (optional second arg: \`getSearchUi().dictionary\`). Use the helper titles (\`Comodidades\` / \`Comodidades do condom\xEDnio\`). Labels are already alphabetical (pt-BR) \u2014 keep that order. Omit empty groups. Never print amenity ids, never invent a local label map, and never title a section "Comodidades da unidade".`;
2323
+ }
1722
2324
  function studioChromeInstruction() {
1723
2325
  const injectors = compareSemver(
1724
2326
  STUDIO_SDK_CONTRACT.minNpmVersion,
@@ -1903,8 +2505,11 @@ function createGaragemClient(options = {}) {
1903
2505
  };
1904
2506
  }
1905
2507
  export {
2508
+ AMENITY_FALLBACK_LABELS,
1906
2509
  FORBIDDEN_SEARCH_QUERY_KEYS,
1907
2510
  GaragemSdkError,
2511
+ LISTING_AMENITY_TITLES,
2512
+ LISTING_DESCRIPTION_CLAMP,
1908
2513
  LeadSubmitError,
1909
2514
  SEARCH_CSS_RECIPE,
1910
2515
  SEARCH_CSS_VARS,
@@ -1949,10 +2554,20 @@ export {
1949
2554
  isListingDetailPath,
1950
2555
  isStudioPreviewHost,
1951
2556
  isVisitSlotAllowed,
2557
+ labelAmenities,
2558
+ listingAmenityGroups,
2559
+ listingBreadcrumb,
1952
2560
  listingBusinessLabel,
2561
+ listingDescriptionPreview,
2562
+ listingDetailModel,
2563
+ listingFacts,
2564
+ listingLocationBlock,
1953
2565
  listingLocationLabel,
1954
2566
  listingLookupKey,
2567
+ listingMapsHref,
2568
+ listingMediaOverlays,
1955
2569
  listingPublicPath,
2570
+ listingValues,
1956
2571
  mergeAppliedSearchQueryIntoSearch2 as mergeAppliedSearchQueryIntoSearch,
1957
2572
  normalizeVisitDate,
1958
2573
  normalizeVisitTime,
@@ -1976,11 +2591,13 @@ export {
1976
2591
  searchSortOptions,
1977
2592
  serializeAppliedSearchQuery2 as serializeAppliedSearchQuery,
1978
2593
  slotsForDate,
2594
+ studioAmenityInstruction,
1979
2595
  studioChromeInstruction,
1980
2596
  studioCodegenContractViolations,
1981
2597
  studioDefaultLeadUi,
1982
2598
  studioLayoutInstruction,
1983
2599
  studioLeadInstruction,
2600
+ studioListingDetailInstruction,
1984
2601
  studioSdkPinInstruction,
1985
2602
  studioSearchLandmarkInstruction,
1986
2603
  studioSiteWidthCss,