@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.js CHANGED
@@ -20,8 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ AMENITY_FALLBACK_LABELS: () => AMENITY_FALLBACK_LABELS,
23
24
  FORBIDDEN_SEARCH_QUERY_KEYS: () => FORBIDDEN_SEARCH_QUERY_KEYS,
24
25
  GaragemSdkError: () => GaragemSdkError,
26
+ LISTING_AMENITY_TITLES: () => LISTING_AMENITY_TITLES,
27
+ LISTING_DESCRIPTION_CLAMP: () => LISTING_DESCRIPTION_CLAMP,
25
28
  LeadSubmitError: () => LeadSubmitError,
26
29
  SEARCH_CSS_RECIPE: () => SEARCH_CSS_RECIPE,
27
30
  SEARCH_CSS_VARS: () => SEARCH_CSS_VARS,
@@ -66,10 +69,20 @@ __export(src_exports, {
66
69
  isListingDetailPath: () => isListingDetailPath,
67
70
  isStudioPreviewHost: () => isStudioPreviewHost,
68
71
  isVisitSlotAllowed: () => isVisitSlotAllowed,
72
+ labelAmenities: () => labelAmenities,
73
+ listingAmenityGroups: () => listingAmenityGroups,
74
+ listingBreadcrumb: () => listingBreadcrumb,
69
75
  listingBusinessLabel: () => listingBusinessLabel,
76
+ listingDescriptionPreview: () => listingDescriptionPreview,
77
+ listingDetailModel: () => listingDetailModel,
78
+ listingFacts: () => listingFacts,
79
+ listingLocationBlock: () => listingLocationBlock,
70
80
  listingLocationLabel: () => listingLocationLabel,
71
81
  listingLookupKey: () => listingLookupKey,
82
+ listingMapsHref: () => listingMapsHref,
83
+ listingMediaOverlays: () => listingMediaOverlays,
72
84
  listingPublicPath: () => listingPublicPath,
85
+ listingValues: () => listingValues,
73
86
  mergeAppliedSearchQueryIntoSearch: () => mergeAppliedSearchQueryIntoSearch2,
74
87
  normalizeVisitDate: () => normalizeVisitDate,
75
88
  normalizeVisitTime: () => normalizeVisitTime,
@@ -93,11 +106,13 @@ __export(src_exports, {
93
106
  searchSortOptions: () => searchSortOptions,
94
107
  serializeAppliedSearchQuery: () => serializeAppliedSearchQuery2,
95
108
  slotsForDate: () => slotsForDate,
109
+ studioAmenityInstruction: () => studioAmenityInstruction,
96
110
  studioChromeInstruction: () => studioChromeInstruction,
97
111
  studioCodegenContractViolations: () => studioCodegenContractViolations,
98
112
  studioDefaultLeadUi: () => studioDefaultLeadUi,
99
113
  studioLayoutInstruction: () => studioLayoutInstruction,
100
114
  studioLeadInstruction: () => studioLeadInstruction,
115
+ studioListingDetailInstruction: () => studioListingDetailInstruction,
101
116
  studioSdkPinInstruction: () => studioSdkPinInstruction,
102
117
  studioSearchLandmarkInstruction: () => studioSearchLandmarkInstruction,
103
118
  studioSiteWidthCss: () => studioSiteWidthCss,
@@ -842,6 +857,342 @@ async function submitContactLead(input) {
842
857
  });
843
858
  }
844
859
 
860
+ // src/amenity-labels.ts
861
+ var LISTING_AMENITY_TITLES = {
862
+ unit: "Comodidades",
863
+ building: "Comodidades do condom\xEDnio"
864
+ };
865
+ var AMENITY_FALLBACK_LABELS = {
866
+ // ==================== PROPERTY FEATURES ====================
867
+ // Amenities
868
+ arCondicionado: "Ar condicionado",
869
+ banheira: "Banheira",
870
+ carregadorEletrico: "Carregador el\xE9trico",
871
+ churrasqueira: "Churrasqueira",
872
+ chuveiroGas: "Chuveiro a g\xE1s",
873
+ chuveiroEletrico: "Chuveiro el\xE9trico",
874
+ energiaSolar: "Energia solar",
875
+ fechaduraDigital: "Fechadura digital",
876
+ fechaduraEletronica: "Fechadura eletr\xF4nica",
877
+ geradorEletrico: "Gerador el\xE9trico",
878
+ gesso: "Gesso",
879
+ hidromassagem: "Hidromassagem",
880
+ lareira: "Lareira",
881
+ ofuro: "Ofur\xF4",
882
+ spa: "Spa",
883
+ painelSolar: "Painel solar",
884
+ portaoEletronico: "Port\xE3o eletr\xF4nico",
885
+ sistemaAlarme: "Sistema de alarme",
886
+ homeTheater: "Home theater",
887
+ adega: "Adega",
888
+ split: "Split",
889
+ arCentral: "Ar central",
890
+ esperaSplit: "Espera para split",
891
+ vistaMar: "Vista para o mar",
892
+ vistaPanoramica: "Vista panor\xE2mica",
893
+ aguaQuente: "\xC1gua quente",
894
+ reformado: "Reformado",
895
+ tvCabo: "TV a cabo",
896
+ gradeado: "Gradeado",
897
+ antenaParabolica: "Antena parab\xF3lica",
898
+ aquecimento: "Aquecimento",
899
+ aquecimentoEletrico: "Aquecimento el\xE9trico",
900
+ aquecimentoCentral: "Aquecimento central",
901
+ cercaEletrica: "Cerca el\xE9trica",
902
+ monitoramento: "Monitoramento",
903
+ vigiaInterno: "Vigia interno",
904
+ vigiaExterno: "Vigia externo",
905
+ alarme: "Alarme",
906
+ agua: "\xC1gua",
907
+ redeEsgoto: "Rede de esgoto",
908
+ pavimentacao: "Pavimenta\xE7\xE3o",
909
+ energiaEletrica: "Energia el\xE9trica",
910
+ // Furniture
911
+ mobiliado: "Mobiliado",
912
+ armarioEmbutido: "Arm\xE1rio embutido",
913
+ armarioEmbutidoQuarto: "Arm\xE1rio embutido quarto",
914
+ armarioCozinha: "Arm\xE1rio cozinha",
915
+ armarioBanheiro: "Arm\xE1rio banheiro",
916
+ cozinhaPlanejada: "Cozinha planejada",
917
+ fogao: "Fog\xE3o",
918
+ fornoPizza: "Forno de pizza",
919
+ freezer: "Freezer",
920
+ dormitorioComArmario: "Dormit\xF3rio com arm\xE1rio",
921
+ semiMobiliado: "Semi mobiliado",
922
+ salaArmarios: "Sala com arm\xE1rios",
923
+ // Structure
924
+ piscina: "Piscina",
925
+ piscinaAquecida: "Piscina aquecida",
926
+ piscinaCoberta: "Piscina coberta",
927
+ poco: "Po\xE7o",
928
+ pocoArtesiano: "Po\xE7o artesiano",
929
+ bar: "Bar",
930
+ jardim: "Jardim",
931
+ lago: "Lago",
932
+ lavabo: "Lavabo",
933
+ quintal: "Quintal",
934
+ solarium: "Solarium",
935
+ quartoServico: "Quarto de servi\xE7o",
936
+ varanda: "Varanda",
937
+ varandaFechadaVidro: "Varanda fechada com vidro",
938
+ varandaGourmet: "Varanda gourmet",
939
+ banheiroServico: "Banheiro de servi\xE7o",
940
+ areaServico: "\xC1rea de servi\xE7o",
941
+ cinema: "Cinema",
942
+ closet: "Closet",
943
+ cozinhaAmericana: "Cozinha americana",
944
+ cozinhaGourmet: "Cozinha gourmet",
945
+ despensa: "Despensa",
946
+ escritorio: "Escrit\xF3rio",
947
+ edicula: "Ed\xEDcula",
948
+ horta: "Horta",
949
+ sacada: "Sacada",
950
+ salaJantar: "Sala de jantar",
951
+ cozinha: "Cozinha",
952
+ banheiroSocial: "Banheiro social",
953
+ terraco: "Terra\xE7o",
954
+ copa: "Copa",
955
+ suiteMaster: "Su\xEDte master",
956
+ wcEmpregada: "WC empregada",
957
+ dependenciaEmpregada: "Depend\xEAncia de empregada",
958
+ dependenciadeEmpregada: "Depend\xEAncia empregada",
959
+ salaTv: "Sala de TV",
960
+ copaCozinha: "Copa cozinha",
961
+ sacadaComChurrasqueira: "Sacada com churrasqueira",
962
+ hallPrivativo: "Hall privativo",
963
+ estarIntimo: "Estar \xEDntimo",
964
+ livingHall: "Living hall",
965
+ piscinaInterna: "Piscina interna",
966
+ deck: "Deck",
967
+ jardimInverno: "Jardim de inverno",
968
+ rouparia: "Rouparia",
969
+ living: "Living",
970
+ familyRoom: "Family room",
971
+ salafitness: "Sala fitness",
972
+ salaEstar: "Sala de estar",
973
+ mezanino: "Mezanino",
974
+ pisoElevado: "Piso elevado",
975
+ entradaServicoIndependente: "Entrada de servi\xE7o independente",
976
+ forro: "Forro",
977
+ vitrine: "Vitrine",
978
+ banheiroAuxiliar: "Banheiro auxiliar",
979
+ gabinete: "Gabinete",
980
+ quadraTenisPrivativa: "Quadra de t\xEAnis privativa",
981
+ porao: "Por\xE3o",
982
+ sotao: "S\xF3t\xE3o",
983
+ patio: "P\xE1tio",
984
+ canaletasNoRodape: "Canaletas no rodap\xE9",
985
+ // Accessibility
986
+ barraApoioVaso: "Barra de apoio vaso",
987
+ barraApoioChuveiro: "Barra de apoio chuveiro",
988
+ entradaSemDegrau: "Entrada sem degrau",
989
+ rampasAcesso: "Rampas de acesso",
990
+ vagaDeficientes: "Vaga para deficientes",
991
+ // Flooring
992
+ cimentoQueimado: "Cimento queimado",
993
+ madeira: "Madeira",
994
+ pisoFrio: "Piso frio",
995
+ laminado: "Laminado",
996
+ vinilico: "Vin\xEDlico",
997
+ porcelanato: "Porcelanato",
998
+ // ==================== BUILDING FEATURES ====================
999
+ // Amenities
1000
+ elevador: "Elevador",
1001
+ bicicletario: "Biciclet\xE1rio",
1002
+ carregadorEletronico: "Carregador eletr\xF4nico",
1003
+ concierge: "Concierge",
1004
+ coworking: "Coworking",
1005
+ deposito: "Dep\xF3sito",
1006
+ lavanderia: "Lavanderia",
1007
+ petPlace: "Pet place",
1008
+ recebimentoEncomendas: "Recebimento de encomendas",
1009
+ salaReuniao: "Sala de reuni\xE3o",
1010
+ salaoFestas: "Sal\xE3o de festas",
1011
+ valet: "Valet",
1012
+ garagemCoberta: "Garagem coberta",
1013
+ elevadorServico: "Elevador de servi\xE7o",
1014
+ // Leisure
1015
+ academia: "Academia",
1016
+ campoFutebol: "Campo de futebol",
1017
+ espacoGourmet: "Espa\xE7o gourmet",
1018
+ piscinaInfantil: "Piscina infantil",
1019
+ pistaCaminhada: "Pista de caminhada",
1020
+ playground: "Playground",
1021
+ quadraPoliesportiva: "Quadra poliesportiva",
1022
+ quadraTenis: "Quadra de t\xEAnis",
1023
+ salaJogos: "Sala de jogos",
1024
+ salaVapor: "Sala de vapor",
1025
+ sauna: "Sauna",
1026
+ // Security
1027
+ circuitoTv: "Circuito fechado de TV",
1028
+ controleAcessoEletronico: "Controle de acesso eletr\xF4nico",
1029
+ interfone: "Interfone",
1030
+ portaria24h: "Portaria 24h",
1031
+ porteiroFisico: "Porteiro f\xEDsico",
1032
+ seguranca24h: "Seguran\xE7a 24h",
1033
+ segurancaPatrimonial: "Seguran\xE7a patrimonial",
1034
+ condominioFechado: "Condom\xEDnio fechado",
1035
+ // Accessibility
1036
+ banheiroAcessivel: "Banheiro acess\xEDvel",
1037
+ elevadorAcessivel: "Elevador acess\xEDvel",
1038
+ pisoTatil: "Piso t\xE1til",
1039
+ // ==================== CANONICAL HAS*/IS* KEYS ====================
1040
+ has24hConcierge: "Portaria 24h",
1041
+ has24hSecurity: "Seguran\xE7a 24h",
1042
+ hasAccessRamps: "Rampas de acesso",
1043
+ hasAccessibleBathroom: "Banheiro acess\xEDvel",
1044
+ hasAccessibleElevator: "Elevador acess\xEDvel",
1045
+ hasAirConditioning: "Ar condicionado",
1046
+ hasAlarmSystem: "Sistema de alarme",
1047
+ hasBalcony: "Varanda",
1048
+ hasBikeStorage: "Biciclet\xE1rio",
1049
+ hasBuiltInWardrobe: "Arm\xE1rio embutido",
1050
+ hasCCTV: "CFTV",
1051
+ hasCloset: "Closet",
1052
+ hasConcierge: "Portaria",
1053
+ hasControlledAccess: "Condom\xEDnio fechado",
1054
+ hasCoworking: "Coworking",
1055
+ hasDisabledParking: "Vaga para deficientes",
1056
+ hasElectricCharger: "Carregador eletr\xF4nico",
1057
+ hasElectronicGate: "Port\xE3o eletr\xF4nico",
1058
+ hasElevator: "Elevador",
1059
+ hasFireplace: "Lareira",
1060
+ hasGarden: "Jardim",
1061
+ hasGasShower: "Chuveiro a g\xE1s",
1062
+ hasGenerator: "Gerador",
1063
+ hasGourmetBalcony: "Varanda gourmet",
1064
+ hasGourmetKitchen: "Cozinha gourmet",
1065
+ hasGrill: "Churrasqueira",
1066
+ hasGuestParking: "Estacionamento para visitantes",
1067
+ hasGym: "Academia",
1068
+ hasHeating: "Aquecimento",
1069
+ hasHomeOffice: "Home office",
1070
+ hasIntercom: "Interfone",
1071
+ hasJacuzzi: "Hidromassagem",
1072
+ hasKidsPool: "Piscina infantil",
1073
+ hasLaundry: "Lavanderia",
1074
+ hasMeetingRoom: "Sala de reuni\xE3o",
1075
+ hasOffice: "Escrit\xF3rio",
1076
+ hasOpenKitchen: "Cozinha americana",
1077
+ hasPackageReceival: "Recebimento de encomendas",
1078
+ hasPantry: "Despensa",
1079
+ hasParkingGarage: "Garagem coberta",
1080
+ hasPartySaloon: "Sal\xE3o de festas",
1081
+ hasPetArea: "Pet place",
1082
+ hasPipedGas: "G\xE1s encanado",
1083
+ hasPlayground: "Playground",
1084
+ hasPowderRoom: "Lavabo",
1085
+ hasPrivatePool: "Piscina privativa",
1086
+ hasSauna: "Sauna",
1087
+ hasSecurity: "Seguran\xE7a",
1088
+ hasServiceArea: "\xC1rea de servi\xE7o",
1089
+ hasSolarPanel: "Painel solar",
1090
+ hasSpa: "Spa",
1091
+ hasSportsCourt: "Quadra de esportes",
1092
+ hasStepFreeEntrance: "Entrada sem degrau",
1093
+ hasStorage: "Dep\xF3sito",
1094
+ hasSwimmingPool: "Piscina",
1095
+ hasTennisCourt: "Quadra de t\xEAnis",
1096
+ hasValetParking: "Valet",
1097
+ homeOffice: "Home office",
1098
+ isPetFriendly: "Pet friendly",
1099
+ isFurnished: "Mobiliado",
1100
+ isPartiallyFurnished: "Semi-mobiliado",
1101
+ petFriendly: "Pet friendly",
1102
+ piscinaPrivativa: "Piscina privativa",
1103
+ pisoLaminado: "Piso laminado",
1104
+ pisoMadeira: "Piso de madeira",
1105
+ pisoPorcelanato: "Piso porcelanato",
1106
+ quadraEsportes: "Quadra de esportes",
1107
+ rooftop: "Rooftop",
1108
+ suite: "Su\xEDte",
1109
+ triplex: "Triplex",
1110
+ duplex: "Duplex",
1111
+ cobertura: "Cobertura",
1112
+ forroGesso: "Forro de gesso",
1113
+ gerador: "Gerador",
1114
+ armariosCozinha: "Arm\xE1rios na cozinha",
1115
+ armariosQuarto: "Arm\xE1rios nos quartos",
1116
+ cftv: "CFTV"
1117
+ };
1118
+ function lookupLabel(id, options) {
1119
+ const fromDictionary = options?.find((option) => option.id === id)?.label;
1120
+ if (fromDictionary?.trim()) return fromDictionary.trim();
1121
+ return AMENITY_FALLBACK_LABELS[id];
1122
+ }
1123
+ function labelAmenities(ids, dictionary) {
1124
+ if (!ids?.length) return [];
1125
+ const labels = [];
1126
+ const seen = /* @__PURE__ */ new Set();
1127
+ for (const id of ids) {
1128
+ if (!id) continue;
1129
+ const label = lookupLabel(id, dictionary);
1130
+ if (!label || seen.has(label)) continue;
1131
+ seen.add(label);
1132
+ labels.push(label);
1133
+ }
1134
+ return labels.sort((a, b) => a.localeCompare(b, "pt-BR"));
1135
+ }
1136
+ function presentIds(ids) {
1137
+ return (ids ?? []).filter((id) => Boolean(id));
1138
+ }
1139
+ function buildingIdsFromMergedAmenities(listing, unitIds) {
1140
+ if (!listing.amenities || listing.propertyFeatures == null) return [];
1141
+ const unitCounts = /* @__PURE__ */ new Map();
1142
+ for (const id of unitIds) {
1143
+ unitCounts.set(id, (unitCounts.get(id) ?? 0) + 1);
1144
+ }
1145
+ return listing.amenities.filter((id) => {
1146
+ if (!id) return false;
1147
+ const count = unitCounts.get(id);
1148
+ if (count === void 0 || count === 0) return true;
1149
+ unitCounts.set(id, count - 1);
1150
+ return false;
1151
+ });
1152
+ }
1153
+ function unitAmenityIds(listing) {
1154
+ if (listing.propertyFeatures != null) {
1155
+ return presentIds(listing.propertyFeatures);
1156
+ }
1157
+ const building = new Set(
1158
+ listing.building?.amenities ?? listing.buildingAmenities ?? []
1159
+ );
1160
+ return (listing.amenities ?? []).filter((id) => id && !building.has(id));
1161
+ }
1162
+ function buildingAmenityIds(listing) {
1163
+ if (listing.building != null && listing.building.amenities != null) {
1164
+ return presentIds(listing.building.amenities);
1165
+ }
1166
+ if (listing.buildingAmenities != null) {
1167
+ return presentIds(listing.buildingAmenities);
1168
+ }
1169
+ return buildingIdsFromMergedAmenities(listing, unitAmenityIds(listing));
1170
+ }
1171
+ function listingAmenityGroups(listing, dictionary) {
1172
+ const groups = [];
1173
+ const unitIds = unitAmenityIds(listing);
1174
+ const unitLabels = labelAmenities(unitIds, dictionary?.propertyFeatures);
1175
+ if (unitLabels.length > 0) {
1176
+ groups.push({
1177
+ key: "unit",
1178
+ title: LISTING_AMENITY_TITLES.unit,
1179
+ labels: unitLabels
1180
+ });
1181
+ }
1182
+ const buildingLabels = labelAmenities(
1183
+ buildingAmenityIds(listing),
1184
+ dictionary?.buildingAmenities
1185
+ );
1186
+ if (buildingLabels.length > 0) {
1187
+ groups.push({
1188
+ key: "building",
1189
+ title: LISTING_AMENITY_TITLES.building,
1190
+ labels: buildingLabels
1191
+ });
1192
+ }
1193
+ return groups;
1194
+ }
1195
+
845
1196
  // src/presentation.ts
846
1197
  var SEARCH_CSS_VARS = {
847
1198
  cardRadius: "--garagem-listing-card-radius",
@@ -1695,6 +2046,261 @@ function paginationPages(currentPage, totalPages, padding) {
1695
2046
  return pages;
1696
2047
  }
1697
2048
 
2049
+ // src/listing-detail.ts
2050
+ var LISTING_DESCRIPTION_CLAMP = 280;
2051
+ var VIDEO_HOST_HINTS = [
2052
+ "youtube.com",
2053
+ "youtu.be",
2054
+ "vimeo.com",
2055
+ "wistia.com",
2056
+ "wistia.net"
2057
+ ];
2058
+ var BREADCRUMB_LABELS = {
2059
+ imoveis: "Im\xF3veis",
2060
+ venda: "Venda",
2061
+ aluguel: "Aluguel",
2062
+ rental: "Aluguel",
2063
+ sale: "Venda"
2064
+ };
2065
+ function finiteNumber(value) {
2066
+ if (typeof value === "number" && Number.isFinite(value)) return value;
2067
+ if (typeof value === "string" && value.trim() !== "") {
2068
+ const parsed = Number(value);
2069
+ if (Number.isFinite(parsed)) return parsed;
2070
+ }
2071
+ return null;
2072
+ }
2073
+ function positiveCount(value) {
2074
+ const amount = finiteNumber(value);
2075
+ return amount != null && amount > 0 ? amount : null;
2076
+ }
2077
+ function formatFloorFact(value) {
2078
+ if (typeof value === "number" && Number.isFinite(value)) {
2079
+ return value === 0 ? "T\xE9rreo" : String(value);
2080
+ }
2081
+ if (typeof value !== "string") return null;
2082
+ const trimmed = value.trim();
2083
+ if (!trimmed) return null;
2084
+ const parsed = Number(trimmed);
2085
+ if (Number.isFinite(parsed) && trimmed === String(parsed)) {
2086
+ return parsed === 0 ? "T\xE9rreo" : trimmed;
2087
+ }
2088
+ return trimmed;
2089
+ }
2090
+ function httpsUrl(raw) {
2091
+ if (!raw) return null;
2092
+ try {
2093
+ const url = new URL(raw);
2094
+ if (url.protocol !== "https:") return null;
2095
+ return url.toString();
2096
+ } catch {
2097
+ return null;
2098
+ }
2099
+ }
2100
+ function isVideoPlatformUrl(url) {
2101
+ const host = new URL(url).hostname.toLowerCase();
2102
+ return VIDEO_HOST_HINTS.some(
2103
+ (hint) => host === hint || host.endsWith(`.${hint}`)
2104
+ );
2105
+ }
2106
+ function overlayKind(type, src) {
2107
+ if (type === "image" || type === "photo") return null;
2108
+ const host = new URL(src).hostname.toLowerCase();
2109
+ if (type === "tour" || type === "virtual_tour" || host.includes("matterport")) {
2110
+ return "tour";
2111
+ }
2112
+ if (isVideoPlatformUrl(src) || type === "video") return "video";
2113
+ return type ? "tour" : null;
2114
+ }
2115
+ var VIMEO_ID_RE = /vimeo\.com\/(?:video\/|channels\/[^/]+\/|groups\/[^/]+\/videos\/)?(\d+)/i;
2116
+ var WISTIA_ID_RE = /\/(?:medias|embed\/(?:iframe|medias))\/([a-zA-Z0-9]+)/i;
2117
+ function vimeoPrivacyHash(url, id) {
2118
+ const fromQuery = url.searchParams.get("h");
2119
+ if (fromQuery) return fromQuery;
2120
+ const segments = url.pathname.split("/").filter(Boolean);
2121
+ const idIndex = segments.indexOf(id);
2122
+ const next = idIndex >= 0 ? segments[idIndex + 1] : void 0;
2123
+ return next && /^[a-f0-9]{6,12}$/i.test(next) ? next : null;
2124
+ }
2125
+ function embedSrc(src) {
2126
+ const url = new URL(src);
2127
+ const host = url.hostname.toLowerCase();
2128
+ if (host === "youtu.be" || host.endsWith(".youtu.be")) {
2129
+ const id = url.pathname.replace(/^\//, "").split("/")[0];
2130
+ return id ? `https://www.youtube.com/embed/${id}` : src;
2131
+ }
2132
+ if (host.includes("youtube.com")) {
2133
+ const id = url.searchParams.get("v") || url.pathname.split("/").pop();
2134
+ return id ? `https://www.youtube.com/embed/${id}` : src;
2135
+ }
2136
+ if (host.includes("player.vimeo.com")) return src;
2137
+ if (host.includes("vimeo.com")) {
2138
+ const id = src.match(VIMEO_ID_RE)?.[1];
2139
+ if (!id) return src;
2140
+ const hash = vimeoPrivacyHash(url, id);
2141
+ return hash ? `https://player.vimeo.com/video/${id}?h=${encodeURIComponent(hash)}` : `https://player.vimeo.com/video/${id}`;
2142
+ }
2143
+ if (host.includes("wistia.com") || host.includes("wistia.net")) {
2144
+ if (src.includes("/embed/iframe/")) return src;
2145
+ const id = src.match(WISTIA_ID_RE)?.[1];
2146
+ return id ? `https://fast.wistia.net/embed/iframe/${id}` : src;
2147
+ }
2148
+ return src;
2149
+ }
2150
+ function crumbLabel(segment) {
2151
+ const mapped = BREADCRUMB_LABELS[segment];
2152
+ if (mapped) return mapped;
2153
+ if (/^[a-z]{2}$/.test(segment)) return segment.toUpperCase();
2154
+ return segment.split("-").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
2155
+ }
2156
+ function listingValues(listing) {
2157
+ const values = [
2158
+ {
2159
+ key: "price",
2160
+ label: "Pre\xE7o",
2161
+ text: listing.priceVisibility === "private" ? "Sob consulta" : formatListingPrice(listing.price)
2162
+ }
2163
+ ];
2164
+ const condoFee = positiveCount(listing.property?.condoFee);
2165
+ if (condoFee != null) {
2166
+ values.push({
2167
+ key: "condoFee",
2168
+ label: "Condom\xEDnio",
2169
+ text: formatListingPrice(condoFee)
2170
+ });
2171
+ }
2172
+ const propertyTax = positiveCount(listing.property?.propertyTax);
2173
+ if (propertyTax != null) {
2174
+ values.push({
2175
+ key: "propertyTax",
2176
+ label: "IPTU",
2177
+ text: formatListingPrice(propertyTax)
2178
+ });
2179
+ }
2180
+ return values;
2181
+ }
2182
+ function listingFacts(listing) {
2183
+ const property = listing.property ?? {};
2184
+ const facts = [];
2185
+ const area = formatAreaM2(
2186
+ positiveCount(property.usableArea) ?? positiveCount(property.totalArea)
2187
+ );
2188
+ if (area) facts.push({ key: "area", label: "\xC1rea", text: area });
2189
+ const bedrooms = positiveCount(property.bedrooms);
2190
+ if (bedrooms != null) {
2191
+ facts.push({
2192
+ key: "bedrooms",
2193
+ label: "Dormit\xF3rios",
2194
+ text: String(bedrooms)
2195
+ });
2196
+ }
2197
+ const suites = positiveCount(property.suites);
2198
+ if (suites != null) {
2199
+ facts.push({ key: "suites", label: "Su\xEDtes", text: String(suites) });
2200
+ }
2201
+ const parking = positiveCount(property.parkingSpaces);
2202
+ if (parking != null) {
2203
+ facts.push({ key: "parkingSpaces", label: "Vagas", text: String(parking) });
2204
+ }
2205
+ const rooms = positiveCount(property.rooms);
2206
+ if (rooms != null) {
2207
+ facts.push({ key: "rooms", label: "Salas", text: String(rooms) });
2208
+ }
2209
+ const floorText = formatFloorFact(property.floor);
2210
+ if (floorText) {
2211
+ facts.push({ key: "floor", label: "Andar", text: floorText });
2212
+ }
2213
+ return facts;
2214
+ }
2215
+ function listingMapsHref(location) {
2216
+ if (!location) return null;
2217
+ const lat = finiteNumber(location.coordinates?.lat);
2218
+ const lng = finiteNumber(location.coordinates?.lng);
2219
+ if (lat != null && lng != null && !(lat === 0 && lng === 0)) {
2220
+ return `https://www.google.com/maps/search/?api=1&query=${lat},${lng}`;
2221
+ }
2222
+ const query = [
2223
+ [location.street, location.number].filter(Boolean).join(" ").trim(),
2224
+ location.neighborhood,
2225
+ location.city,
2226
+ location.state
2227
+ ].map((part) => part ? String(part).trim() : "").filter(Boolean).join(", ");
2228
+ if (!query) return null;
2229
+ return `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(query)}`;
2230
+ }
2231
+ function listingLocationBlock(listing) {
2232
+ const location = listing?.location;
2233
+ if (!location) return null;
2234
+ const street = [location.street, location.number].filter(Boolean).join(" ").trim();
2235
+ const label = street || listingLocationLabel(location);
2236
+ const mapsHref = listingMapsHref(location);
2237
+ if (!label && !mapsHref) return null;
2238
+ return { label, mapsHref };
2239
+ }
2240
+ function listingBreadcrumb(listing) {
2241
+ const path = listingPublicPath(listing);
2242
+ const segments = path.split("/").filter(Boolean);
2243
+ if (segments[0] !== "imoveis") return [];
2244
+ const crumbs = [
2245
+ { label: "Im\xF3veis", href: "/imoveis" }
2246
+ ];
2247
+ let href = "/imoveis";
2248
+ for (const segment of segments.slice(1)) {
2249
+ if (segment.startsWith("id-")) break;
2250
+ href = `${href}/${segment}`;
2251
+ if (isListingDetailPath(href)) continue;
2252
+ crumbs.push({ label: crumbLabel(segment), href });
2253
+ }
2254
+ return crumbs;
2255
+ }
2256
+ function listingDescriptionPreview(description, expanded = false) {
2257
+ const text = description?.trim() ?? "";
2258
+ if (!text) return null;
2259
+ if (text.length <= LISTING_DESCRIPTION_CLAMP) {
2260
+ return { text, truncated: false, toggleLabel: null };
2261
+ }
2262
+ if (expanded) {
2263
+ return { text, truncated: true, toggleLabel: "Ler menos" };
2264
+ }
2265
+ return {
2266
+ text: `${text.slice(0, LISTING_DESCRIPTION_CLAMP).trimEnd()}\u2026`,
2267
+ truncated: true,
2268
+ toggleLabel: "Ler mais"
2269
+ };
2270
+ }
2271
+ function listingMediaOverlays(listing) {
2272
+ const overlays = [];
2273
+ const seen = /* @__PURE__ */ new Set();
2274
+ for (const item of listing.media ?? []) {
2275
+ const src = httpsUrl(item.src);
2276
+ if (!src) continue;
2277
+ const kind = overlayKind(item.type, src);
2278
+ if (!kind || seen.has(kind)) continue;
2279
+ seen.add(kind);
2280
+ overlays.push({
2281
+ key: kind,
2282
+ hash: kind,
2283
+ title: kind === "video" ? "V\xEDdeo" : "Tour virtual",
2284
+ href: `#${kind}`,
2285
+ embedSrc: embedSrc(src)
2286
+ });
2287
+ }
2288
+ return overlays;
2289
+ }
2290
+ function listingDetailModel(listing, options) {
2291
+ return {
2292
+ breadcrumb: listingBreadcrumb(listing),
2293
+ values: listingValues(listing),
2294
+ facts: listingFacts(listing),
2295
+ location: listingLocationBlock(listing),
2296
+ description: listingDescriptionPreview(
2297
+ listing.description,
2298
+ options?.descriptionExpanded === true
2299
+ ),
2300
+ mediaOverlays: listingMediaOverlays(listing)
2301
+ };
2302
+ }
2303
+
1698
2304
  // src/studio-contract.ts
1699
2305
  var STUDIO_SDK_PACKAGE = "@garagem-ai/site-sdk";
1700
2306
  var STUDIO_SDK_CONTRACT = {
@@ -1702,10 +2308,11 @@ var STUDIO_SDK_CONTRACT = {
1702
2308
  /**
1703
2309
  * Exact pin for generated Studio sites. Must be ≥ `selfInjectSince` so
1704
2310
  * prompts that skip the layout chrome tag match the tarball v0 installs.
1705
- * 0.4.7 lets SearchPage fill the site wrapper (`as="div"`) with no
1706
- * nested 80rem inset and no padding on the search slot.
2311
+ * 0.4.9 adds listingDetailModel (values, facts, location, breadcrumb,
2312
+ * description clamp, video/tour), getSimilarListings, and
2313
+ * listingAmenityGroups so listing detail never prints amenity ids.
1707
2314
  */
1708
- minNpmVersion: "0.4.7",
2315
+ minNpmVersion: "0.4.9",
1709
2316
  /** First release where ListingCard and ResultsSkeleton inject the sheet. */
1710
2317
  selfInjectSince: "0.4.2",
1711
2318
  chromeStrategy: "self-inject",
@@ -1737,7 +2344,9 @@ var STUDIO_SDK_CONTRACT = {
1737
2344
  "expandVisitTimeSlots",
1738
2345
  "isVisitSlotAllowed",
1739
2346
  "STUDIO_DEFAULT_VISIT_SCHEDULE"
1740
- ]
2347
+ ],
2348
+ listingDetailExports: ["listingDetailModel", "getSimilarListings"],
2349
+ amenityExports: ["listingAmenityGroups"]
1741
2350
  };
1742
2351
  var STUDIO_SITE_LAYOUT = {
1743
2352
  maxWidthRem: "80rem",
@@ -1831,6 +2440,14 @@ function studioLeadInstruction() {
1831
2440
  const names = STUDIO_SDK_CONTRACT.leadExports.join(", ");
1832
2441
  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.`;
1833
2442
  }
2443
+ function studioListingDetailInstruction() {
2444
+ const names = STUDIO_SDK_CONTRACT.listingDetailExports.join(", ");
2445
+ 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.`;
2446
+ }
2447
+ function studioAmenityInstruction() {
2448
+ const names = STUDIO_SDK_CONTRACT.amenityExports.join(", ");
2449
+ 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".`;
2450
+ }
1834
2451
  function studioChromeInstruction() {
1835
2452
  const injectors = compareSemver(
1836
2453
  STUDIO_SDK_CONTRACT.minNpmVersion,
@@ -2016,8 +2633,11 @@ function createGaragemClient(options = {}) {
2016
2633
  }
2017
2634
  // Annotate the CommonJS export names for ESM import in node:
2018
2635
  0 && (module.exports = {
2636
+ AMENITY_FALLBACK_LABELS,
2019
2637
  FORBIDDEN_SEARCH_QUERY_KEYS,
2020
2638
  GaragemSdkError,
2639
+ LISTING_AMENITY_TITLES,
2640
+ LISTING_DESCRIPTION_CLAMP,
2021
2641
  LeadSubmitError,
2022
2642
  SEARCH_CSS_RECIPE,
2023
2643
  SEARCH_CSS_VARS,
@@ -2062,10 +2682,20 @@ function createGaragemClient(options = {}) {
2062
2682
  isListingDetailPath,
2063
2683
  isStudioPreviewHost,
2064
2684
  isVisitSlotAllowed,
2685
+ labelAmenities,
2686
+ listingAmenityGroups,
2687
+ listingBreadcrumb,
2065
2688
  listingBusinessLabel,
2689
+ listingDescriptionPreview,
2690
+ listingDetailModel,
2691
+ listingFacts,
2692
+ listingLocationBlock,
2066
2693
  listingLocationLabel,
2067
2694
  listingLookupKey,
2695
+ listingMapsHref,
2696
+ listingMediaOverlays,
2068
2697
  listingPublicPath,
2698
+ listingValues,
2069
2699
  mergeAppliedSearchQueryIntoSearch,
2070
2700
  normalizeVisitDate,
2071
2701
  normalizeVisitTime,
@@ -2089,11 +2719,13 @@ function createGaragemClient(options = {}) {
2089
2719
  searchSortOptions,
2090
2720
  serializeAppliedSearchQuery,
2091
2721
  slotsForDate,
2722
+ studioAmenityInstruction,
2092
2723
  studioChromeInstruction,
2093
2724
  studioCodegenContractViolations,
2094
2725
  studioDefaultLeadUi,
2095
2726
  studioLayoutInstruction,
2096
2727
  studioLeadInstruction,
2728
+ studioListingDetailInstruction,
2097
2729
  studioSdkPinInstruction,
2098
2730
  studioSearchLandmarkInstruction,
2099
2731
  studioSiteWidthCss,