var beansUrlParameter = function(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } } var getBaseConfig = function(urlFromRequest) { return { address: '', useGroundElevation: false, elevation: 0, canonicalUrl: urlFromRequest }; } var convertUnitsArr2 = function(address, unitsArr, hideMarkers) { var convertedArr = []; for (var i = 0; i < unitsArr.length; i++) { var bedText = (unitsArr[i].bed && unitsArr[i].bed !== '0') ? (unitsArr[i].bed + ' Bed') : 'Studio'; var td = new Date().toISOString().substring(0, 10); var as = (unitsArr[i].availability ? ('on ' + unitsArr[i].availability) : 'Now'); if (unitsArr[i].availability && unitsArr[i].availability <= td) { as = 'Now'; } var onPreviewData; if (unitsArr.floorplanImg) { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: 'img:' + unitsArr[i].floorplanImg }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } else { onPreviewData = [ { value: bedText + ' / ' + unitsArr[i].bath + ' Bath / ' + (unitsArr[i].sqft ? unitsArr[i].sqft.toLocaleString() : '0') + ' sq. ft.' }, { value: '$' + (unitsArr[i].rent ? unitsArr[i].rent.toLocaleString() : '0') + '/ mo' }, { value: 'Available ' + as } ]; } if (unitsArr[i].floorplan) { onPreviewData.push({ value: unitsArr[i].floorplan, icon: 'floorplan' }); } convertedArr.push({ address: address, unit: unitsArr[i].unit, options: { markers: { display: hideMarkers ? false : true }, poi: [ { name: "ALL", display: false }, { name: "CLUBHOUSE", display: true }, { name: "SWIMMINGPOOL", display: true }, { name: "OFFICE", display: true }, { name: "GYM", display: true }, { name: "MAILROOM", display: true }, { name: "LAUNDRY", display: true }, { name: "PLAYGROUND", display: true } ], onPreviewData: onPreviewData, onClickData: { name: unitsArr[i].unit ? unitsArr[i].unit.replaceAll('||', ' - ') : '', bed: unitsArr[i].bed, bath: unitsArr[i].bath, sqft: unitsArr[i].sqft, rent: unitsArr[i].rent, // floorplan: unitsArr[i].floorplan, floorplanImg: unitsArr[i].floorplanImg, availability: unitsArr[i].availability, link: unitsArr[i].link ? unitsArr[i].link.replaceAll('&', '&') : '' } } }); } return convertedArr; } var convertUnitsArr = function(config, unitsArr, hideMarkers, skipSort) { var addressAndUnitWithOptions; if (unitsArr.length === 0) { unitsArr.push({ unit: '' }); addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); addressAndUnitWithOptions[0].isPlaceHolder = true; } else { if (!skipSort) { unitsArr.sort((a, b) => { var aa = a.unit ? a.unit : ''; var bb = b.unit ? b.unit : ''; return aa.localeCompare(bb); }); } addressAndUnitWithOptions = convertUnitsArr2(config.address, unitsArr, hideMarkers); } if (config.unitShapeConfig) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { addressAndUnitWithOptions[i].options.unitShape = config.unitShapeConfig(addressAndUnitWithOptions[i]); } } if (config.poi) { for (var i = 0; i < addressAndUnitWithOptions.length; i++) { for (var j = 0; j < config.poi.length; j++) { addressAndUnitWithOptions[i].options.poi.push(config.poi[j]); } } } return addressAndUnitWithOptions; } var commonImmersives = [ { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/0", elevationInfo: { mode: "absolute-height", offset: 0.1, }, opacity: 0.5, immersiveType: 'trees', renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Apricot", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 6, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/PrunusArmeniaca.glb" } } ] } }, { value: "Mountain Mahogany", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 2, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/CercocarpusMontanus.glb" } } ] } }, { value: "Rose", symbol: { type: "point-3d", symbolLayers: [ { type: "object", "height": 2, "anchor": "origin", "resource": { "href": "https://static.arcgis.com/arcgis/styleItems/RealisticTrees/gltf/resource/RosaGrandiflora.glb" } } ] } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/1", elevationInfo: { mode: "absolute-height", offset: 0.2, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Walkway", symbol: { type: "line-3d", symbolLayers: [ { type: "path", profile: "quad", material: { color: "#fcf5de" }, width: 2, // the width in m height: 0.3, // the height in m profileRotation: "heading" } ] // type: "simple-line", // width: 16, // color: "#aaaaaa" } }, { value: "Road", symbol: { type: "line-3d", symbolLayers: [ { type: "path", profile: "quad", material: { color: "#aaaaaa" }, width: 6, // the width in m height: 0.4, // the height in m profileRotation: "heading" } ] } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 0.1, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Lawn", symbol: { type: "simple-fill", outline: { width: 0 }, color: "rgba(178, 195, 136, 0.35)" } }, { value: "Concrete", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#CCCCCC" } }, { value: "Mulch", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#DBCEA2" } } ] }, isFeature: true }, { url: "https://gis-server.beans.ai/arcgis/rest/services/Hosted/Immersive_Layers/FeatureServer/2", elevationInfo: { mode: "absolute-height", offset: 0.2, }, renderer: { type: "unique-value", field: "type", uniqueValueInfos: [ { value: "Water", symbol: { type: "simple-fill", outline: { width: 0 }, color: "#a5c2d1" } } ] }, isFeature: true }, ]; var getDisplayOptions = function( config, unitShape_, // Default shape selectedUnitShape_, // Selected shape selectableUnitShape_, // Selectable shape hoverUnitShape_ ) { return { propertyAddress: config.address, offsetGroundElevation: config.elevation, useGroundElevation: config.useGroundElevation, filters: config.filters, hideBeansCard: config.hideBeansCard, standaloneFilters: config.standaloneFilters, overrideHeight: config.overrideHeight, amenityPopupHeight: config.amenityPopupHeight, iconSizeMultiplier: config.iconSizeMultiplier, showUnitList: true, showUnitShape: true, outsideButtons: true, showDirections: false, showPath: false, propertyId: config.propertyId, propertyIdUrl: config.propertyIdUrl, pricing: config.pricing, showPricingAsDropdown: config.showPricingAsDropdown, colorsConfig: config.colorsConfig, camera: config.camera, mobileCamera: config.mobileCamera, renameAmenities: config.renameAmenities ? config.renameAmenities : null, shadowModeUnitShape: config.shadowModeUnitShape ? config.shadowModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborModeUnitShape: config.neighborModeUnitShape ? config.neighborModeUnitShape : { fillColor: '#D8D7D4', fillOpacity: 1.0, }, unitShape: config.unitShape ? config.unitShape : { fillColor: '#DDE3E0', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 0.5, strokeColor: '#000000', ...unitShape_ }, selectedUnitShape: config.selectedUnitShape ? config.selectedUnitShape : { fillColor: '#A6671D', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectedUnitShape_ }, selectableUnitShape: config.selectableUnitShape ? config.selectableUnitShape : { fillColor: '#24453E', fillOpacity: 1.0, strokeWeight: 1.0, strokeOpacity: 1.0, strokeColor: '#ffffff', ...selectableUnitShape_ }, satelliteModeUnitShape: config.satelliteModeUnitShape ? config.satelliteModeUnitShape : { fillColor: '#ffffff', fillOpacity: 1.0, }, neighborShape: config.neighborShape, immersiveModeUnitShape: config.immersiveModeUnitShape, poiShape: config.poiShape, hoverUnitShape: hoverUnitShape_ ? hoverUnitShape_ : null, }; } var renderWithUnits = function(be1, renderType, config, address, unitsArr) { var addressAndUnitWithOptions = convertUnitsArr(config, unitsArr, true); if (!renderType || renderType.toLowerCase() === '3d') { var displayOptions = getDisplayOptions( config, { fillColor: '#EAD6C3', fillOpacity: 0.2, strokeWeight: 0.5, strokeOpacity: 0.2, strokeColor: '#000000', }, // Default color { fillColor: '#CDA349', }, // Selected color { fillColor: '#3F1F08', } // Selectable color ); be1.render( "body-inner-1", "9ea5c008b6a44fb:6237633261346266373030363436343538366439", addressAndUnitWithOptions, { hideNavigateButton: true, hideMyLocationButton: true }, { beansMapType: 'ESRI', initialMap: 'STREET', prettyLayer: config.prettyLayer ? config.prettyLayer : '', // "https://basemaps.arcgis.com/arcgis/rest/services/OpenStreetMap_v2/VectorTileServer" modernButtons: true, modernBeansCard: displayOptions.hideBeansCard ? false : true, outsideButtons: true, showCompass: true, showFullScreenMode: false, showNeighbors: false, showPOIButton: true, showSeparateFacilitiesCard: true, immersiveConfig: config.immersiveConfig, showImmersive: config.showImmersive, showImmersiveBalloons: config.showImmersiveBalloons, showImmersiveLight: config.showImmersiveLight, showImmersiveOnLoad: config.showImmersiveOnLoad, overrideBaseHeightFn: config.overrideBaseHeightFn, overrideHeight: config.overrideHeight ? config.overrideHeight : 0, overrideHeightFn: config.overrideHeightFn, renameAmenities: config.renameAmenities ? config.renameAmenities : null, poiShape: config.poiShape, initialTilt: 30, initialZ: 400, initialHeading: 270, initialPosition: { address: address }, show2DButton: true, event2D: () => { document.getElementById('body-inner-2').style.visibility = 'visible'; document.getElementById('body-inner-1').style.visibility = 'hidden'; }, ...displayOptions } ); } else { config.unitShape = null; var displayOptions = getDisplayOptions( config, { fillColor: '#FFFFFF', fillOpacity: 1.0, strokeWeight: 0.5, strokeOpacity: 1.0, strokeColor: '#000000' }, // Default color { fillColor: '#CDA349', }, // Selected color { fillColor: '#3F1F08', } // Selectable color ); if (displayOptions.unitShape) { displayOptions.unitShape.fillOpacity = 1.0; } be1.render( "body-inner-2", "9ea5c008b6a44fb:6237633261346266373030363436343538366439", addressAndUnitWithOptions, { hideNavigateButton: true, hideMyLocationButton: true }, { initialMap: "STREET", modernBeansCard: displayOptions.hideBeansCard ? false : true, hideFloorSelector: false, hideRotateControl: true, hideSatelliteButton: true, hideShadow: true, outsideButtons: true, modernButtons: true, showNeighbors: false, showPOIButton: false, showSeparateFacilitiesCard: true, showNumbers: true, numbersConfig: config.numbersConfig, showBuildingShape: config.showBuildingShape, backgroundImage: config.backgroundImage, show3DButton: true, event3D: () => { document.getElementById('body-inner-2').style.visibility = 'hidden'; document.getElementById('body-inner-1').style.visibility = 'visible'; }, unitsToExclude: config.unitsToExclude, ...displayOptions } ); } }; var BeansHaley = function() { }; BeansHaley.prototype.getConfigFromUrl = function(urlFromRequest) { var canonicalUrl = urlFromRequest ? urlFromRequest : window.location.hostname; if (beansUrlParameter('canonicalUrl')) { canonicalUrl = beansUrlParameter('canonicalUrl'); } var baseConfig = getBaseConfig(canonicalUrl); var config = {}; config["www.liveathiddenponds.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 57.27861439122986, heading: 306.9141415351503, position: {x: -85.5718048375689, y: 40.480216537038764, z: 209.16072807926685}}, address: "1 Creekside Dr, Gas City, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.stevenscreekcommons.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 55.00813125835803, heading: 241.0903790684398, position: {x: -82.03726064861065, y: 33.52117628657482, z: 269.44827638193965}}, address: "100 Bon Air Dr, Augusta, GA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.emberwood-apts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 54.304539556438236, heading: 141.59192549459863, position: {x: -92.05550362887857, y: 30.150944480368995, z: 245.42205273732543}}, address: "100 S Meyers Dr, Lafayette, LA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.fairwayestateswy.com"] = { isYardiData: true, yardiDomain: "haley", address: "1020 Country Club Rd, Gillette, WY", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.deerwoodapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 61.60448300533145, heading: 185.4725104617139, position: {x: -94.72918526691448, y: 31.28894174975541, z: 197.46920408681035}}, address: "110 Champions Dr, Lufkin, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.hickorygroveapts.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 42.18086251900202, heading: 139.41658361038762, position: {x: -95.80207323145028, y: 36.04712871712538, z: 239.39396338444203}}, address: "1101 W Houston St, Broken Arrow, OK", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.sturbridgetownhomes.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 61.50367788154933, heading: 318.34105815421174, position: {x: -92.38066284291575, y: 34.76315374804405, z: 180.92535659763962}}, address: "1400 Old Forge Dr, Little Rock, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.liveatgardenglen.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 52.542532158756636, heading: 269.902348668167, position: {x: -88.93061360578945, y: 38.300913230085996, z: 227.50488304626197}}, address: "1407 S 34th St, Mount Vernon, IL", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.meadowsatgreentree.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 47.70368762181003, heading: 80.76938360316008, position: {x: -85.77778959425454, y: 38.32101621735141, z: 311.6360881673172}}, address: "1418 Marlowe Dr, Clarksville, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.cottonwoodapartmenthomes.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 51.016085768247905, heading: 283.19070809975574, position: {x: -91.02408867477901, y: 33.38278461583973, z: 259.54920781590044}}, address: "1462 S Colorado St, Greenville, MS", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.springhillaptsmo.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 51.18463967054457, heading: 341.0794188968242, position: {x: -93.45509407081417, y: 37.1245526962325, z: 216.93324813526124}}, address: "1605 E Hines St, Republic, MO", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.markschurchcommons.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 60.496020575937095, heading: 35.15883631625258, position: {x: -82.0893372778802, y: 33.476646774133634, z: 223.92861060332507}}, address: "1700 Bowdoin Dr, Augusta, GA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.pryorcreekapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 38.27629195418595, heading: 178.70716379971813, position: {x: -95.3089681829093, y: 36.286622778546544, z: 270.2185982717201}}, address: "1707 S Elliott St, Pryor, OK", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.creeksidelandingapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 52.10293743953081, heading: 20.74430945422568, position: {x: -78.93523061783789, y: 36.05339314301026, z: 329.4702238366008}}, address: "18 Weather Hill Cir, Durham, NC", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.patriotpointetownhomes.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 53.136197819496225, heading: 81.43224101539295, position: {x: -96.87090119920711, y: 39.03909944400012, z: 265.11628195270896}}, address: "1901 Victory Ln, Junction City, KS", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.villagesquarehotsprings.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 62.15723565032871, heading: 297.05437270153215, position: {x: -93.06654701278553, y: 34.44784956880934, z: 178.28139717504382}}, address: "200 Lakeland Dr, Hot Springs National Park, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.pinesatsouthridge.com"] = { isAtlanticData: true, rentcafeLink: "https://pinesatsouthridge.securecafe.com/onlineleasing/pinesatsouthridge/oleapplication.aspx?stepname=RentalOptions", camera: {tilt: 65.43488583101428, heading: 152.28558030786152, position: {x: -94.98205993828128, y: 35.87986136227646, z: 199.22890519723296}}, address: "201 Southridge Rd, Tahlequah, OK", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.georgetownparkapartments.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 50.18892812943963, heading: 232.75850431898235, position: {x: -83.71380610211921, y: 42.81375024125678, z: 459.8997167479247}}, address: "2100 Georgetown Pkwy, Fenton, MI", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.wildwoodapthomes.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.55859385211743, heading: 2.151193470778534, position: {x: -83.95950572342015, y: 30.838140813269998, z: 256.49827447906137}}, address: "220 Covington Ave, Thomasville, GA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.bristolaptslawton.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 44.38594032638241, heading: 285.7103520412534, position: {x: -98.41754175307972, y: 34.60488454419758, z: 262.21352191548795}}, address: "2202 SW B Ave, Lawton, OK", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.pembrookplaceapartments.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 57.82406787924628, heading: 347.7519900204465, position: {x: -89.00704346124445, y: 42.23149076065213, z: 377.6097849197686}}, address: "2775 Stowmarket Ave, Rockford, IL", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.liveatcuestas.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.610539696099124, heading: 58.17130431339004, position: {x: -106.75318602594562, y: 32.35323597692219, z: 102.87504352163523}}, address: "2800 N Roadrunner Pkwy, Las Cruces, NM", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.amberwoodkokomo.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 56.984304481428495, heading: 268.0754627063422, position: {x: -86.12992534460513, y: 40.5188614833105, z: 235.56239166017622}}, address: "2864 Amberwood Pl, Kokomo, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.thereserveatlakeside.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 54.10636154196831, heading: 269.8178038097804, position: {x: -84.36299931503416, y: 42.250758738333936, z: 261.9162836112082}}, address: "2921 Woods Circle Dr, Jackson, MI", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.deercrossapartments.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 45.14456914317773, heading: 355.87989710846387, position: {x: -94.73000092271594, y: 31.289854232540666, z: 247.17887769360095}}, address: "3000 S 1st St, Lufkin, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.forestlakeatoysterpoint.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 42.92651268853561, heading: 269.69984993886067, position: {x: -76.48402313322089, y: 37.09128156374785, z: 390.22963461093605}}, address: "307 Saint Thomas Dr, Newport News, VA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.fieldcrestapt.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 53.90758668460677, heading: 287.33950208419884, position: {x: -85.39503237873843, y: 31.185532506268352, z: 273.0777888102457}}, address: "31 Trillium Cir, Dothan, AL", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.westbrookkokomo.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 49.69746815885723, heading: 0.7395023502422504, position: {x: -86.16404368318749, y: 40.44589084181949, z: 228.78235799260437}}, address: "3334 Dixon Ln, Kokomo, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.oldorchardestatesapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 62.573957171435325, heading: 237.20719980176432, position: {x: -90.399541814944, y: 41.4844477147754, z: 170.02331781573594}}, address: "3402 Orchard Ln, Carbon Cliff, IL", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.autumnwoodsmi.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 55.05649048103107, heading: 283.05075764856485, position: {x: -84.45237241177787, y: 42.244511750472505, z: 426.7878479771316}}, address: "3500 Commons Blvd, Jackson, MI", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.cottonwoodcreekapts.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 53.494389246268675, heading: 52.19625931924432, position: {x: -94.80786567822659, y: 39.791432968705735, z: 291.4087089570239}}, address: "3601 Gene Field Rd, Saint Joseph, MO", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.threeoaksapartments.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 53.10560126604743, heading: 216.31632431452434, position: {x: -83.28620123777614, y: 30.891776634062023, z: 327.4625461809337}}, address: "3833 N Oak Street Ext, Valdosta, GA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.villagesquarecabot.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.721666878178524, heading: 5.852641282249737, position: {x: -92.04484148485467, y: 34.97587146853778, z: 153.84389912057668}}, address: "400 Northport Dr, Cabot, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.pheasantrunaptssidney.com"] = { isYardiData: true, yardiDomain: "haley", address: "400 NW Lincoln Ave, Sidney, MT", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.arborcreekapartments.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 55.55675413074738, heading: 154.47706900351366, position: {x: -98.51393097854694, y: 33.87360989208291, z: 278.60061726905406}}, address: "4000 Weeks Park Ln, Wichita Falls, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.villagesquaresearcy.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 58.45477899262436, heading: 181.18982913271657, position: {x: -91.73036039353832, y: 35.22512391045243, z: 130.95855129137635}}, address: "401 E Booth Rd, Searcy, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.ashbrookeapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 50.2682050075459, heading: 271.5956269582615, position: {x: -93.57658972321127, y: 41.73480996372535, z: 198.9567626817152}}, address: "415 NE Delaware Ave, Ankeny, IA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.forestridgeapartments.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.55598343812329, heading: 249.27744114727562, position: {x: -81.47291958659828, y: 41.14039759320382, z: 129.59397476911545}}, address: "420 Munroe Falls Ave, Cuyahoga Falls, OH", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.northwoodplaceapartments.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.05480123067226, heading: 73.10180061996736, position: {x: -88.68563259133799, y: 32.40263896978778, z: 227.5954292966053}}, address: "4315 Highway 39 N, Meridian, MS", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.turtlelakeapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 49.81770591333252, heading: 250.57423014636305, position: {x: -85.7123863272181, y: 30.187795912398737, z: 427.9470023084432}}, address: "4324 W 20th St, Panama City, FL", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.willowsofcoventry.biz"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 60.626289309066436, heading: 166.16369391305568, position: {x: -85.2559837539381, y: 41.04739544665267, z: 285.71427442505956}}, address: "4499 Coventry Pkwy, Fort Wayne, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.nantucketharbor.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 49.88815532216007, heading: 48.392955433759425, position: {x: -93.82213872375765, y: 32.484673408189686, z: 330.66591111104935}}, address: "4650 Lakeshore Dr, Shreveport, LA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.parkwayvillas.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 56.84335392007446, heading: 324.9600503070334, position: {x: -98.56130249589644, y: 33.8524100924044, z: 207.85912896227092}}, address: "4800 Brookdale Dr, Wichita Falls, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.residencesatbelleville.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 58.13161616311206, heading: 269.03807312272954, position: {x: -86.30942087000173, y: 41.657856561518614, z: 266.2888491721824}}, address: "4940 Belleville Cir, South Bend, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.cambridgeapartmenthomesms.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 59.20924293873409, heading: 293.6446687438528, position: {x: -90.00070366640796, y: 32.35708315249377, z: 224.06567134615034}}, address: "520 Vine Dr, Flowood, MS", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.woodbrookapt.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 48.95630278337334, heading: 188.86352969608393, position: {x: -86.24209188365687, y: 39.851260517941235, z: 348.6956714326516}}, address: "5302 Woodbrook Dr, Indianapolis, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.thepointe-elpaso.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 58.20887584065065, heading: 241.5127080212764, position: {x: -106.50496481093163, y: 31.826519790130753, z: 250.606296681799}}, address: "5525 N Stanton St, El Paso, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.woodscapeapt.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 67.26521199341798, heading: 201.97393569570409, position: {x: -76.53225841302391, y: 37.15671334318897, z: 143.59328701533377}}, address: "581 Calla Ct, Newport News, VA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.ashtonpinesshreveport.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 53.96729047223717, heading: 270.4641063551077, position: {x: -93.85631957867582, y: 32.443042789748866, z: 209.3009271370247}}, address: "6000 W 70th St, Shreveport, LA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.parkhillatfairlawn.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 57.8402130691911, heading: 340.99468626257004, position: {x: -81.61351592988416, y: 41.11185212554112, z: 166.79087764117867}}, address: "619 Park Hill Dr, Fairlawn, OH", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.bayoakapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 68.04448639430287, heading: 281.4067602681011, position: {x: -88.84775920425595, y: 40.48392310058509, z: 3939.739849017933}}, address: "619 W Orlando Ave, Normal, IL", selectableUnitShape: { fillColor: '#53666E', }, poi: [ { name: 'COMMUNITY', iconUrl: "https://www.beans.ai/m/assets/community_0.png", display: true, location: { lat: 40.497980825532714, lng: -88.94852556142375 } }, { name: 'COMMUNITY', iconUrl: "https://www.beans.ai/m/assets/community_0.png", display: true, location: { lat: 40.52585147606343, lng: -88.99817286963118 } } ], }; config["www.stonegateamarillo.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 44.24437999407234, heading: 180.90922381976054, position: {x: -101.9032170614412, y: 35.14215941175696, z: 247.79085830133408}}, address: "6400 Bell St, Amarillo, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.maison-bocage.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 40.04830952660823, heading: 147.72367096064718, position: {x: -92.06573036343936, y: 30.213142217445373, z: 440.6967598963529}}, address: "655 Marie Antoinette St, Lafayette, LA", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.huntingtonpointeapthomes.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 47.878384570070835, heading: 270.368855075437, position: {x: -101.91118973628794, y: 35.190546004947734, z: 170.52152897417545}}, address: "6801 Wolflin Ave, Amarillo, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.ptinverness.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 55.82882777803866, heading: 88.43096244638141, position: {x: -85.2382933635541, y: 41.07160775650956, z: 201.8014329522848}}, address: "7051 Pointe Inverness Way, Fort Wayne, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.liveathuntersrunapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 57.62765085939689, heading: 296.6557503202508, position: {x: -85.6478690949055, y: 40.51302680480546, z: 197.3780066613108}}, address: "717 Hunters Run Dr, Marion, IN", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.lagodelmarapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 58.38569637792741, heading: 269.37923656123644, position: {x: -99.4612984005776, y: 27.574142174244276, z: 172.3299632659182}}, address: "7550 Country Club Dr, Laredo, TX", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.parkmeadowsapts.net"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 52.399915569393585, heading: 273.823067362798, position: {x: -94.49021291660353, y: 38.97954832916114, z: 268.3906235154718}}, address: "7929 Sycamore Ave, Kansas City, MO", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.buffalorunwy.com"] = { isYardiData: true, yardiDomain: "haley", address: "828 W Buffalo St, Rawlins, WY", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.villageatconwayapts.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 46.23894334985662, heading: 270.83778743879884, position: {x: -92.43486806652699, y: 35.10636059092957, z: 183.79441775660962}}, address: "867 Fendley Dr, Conway, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.meadowwalkks.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 60.01699971662264, heading: 278.70987869948, position: {x: -97.04656642210676, y: 37.098485418239875, z: 197.93864029739052}}, address: "925 W Skyline Rd, Arkansas City, KS", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.villagesquarejacksonville.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 56.78407419854022, heading: 51.45875756345606, position: {x: -92.10519062899435, y: 34.85112905004345, z: 289.2882294487208}}, address: "950 Military Rd, Jacksonville, AR", selectableUnitShape: { fillColor: '#53666E', }, }; config["www.ambervalleyestateswy.com"] = { isYardiData: true, yardiDomain: "haley", camera: {tilt: 62.05271969844185, heading: 165.6792884379355, position: {x: -106.3897987115455, y: 42.84102157578603, z: 89.4498251536861}}, address: "998 Badger Lane, Mills, WY", selectableUnitShape: { fillColor: '#53666E', }, }; if (config[canonicalUrl]) { return {...baseConfig, ...config[canonicalUrl]}; } return baseConfig; } BeansHaley.prototype.getFloorPlans = function(callback) { var so = this; var canonicalUrl = so.getConfigFromUrl().canonicalUrl; var DONE = 4; // readyState 4 means the request is done. var OK = 200; // status 200 is a successful return. var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://' + canonicalUrl + '/floorplans', false); xhr.send(); if (xhr.readyState !== DONE || xhr.status !== OK) { return; } var c = xhr.responseText.split('\n'); var floorplansData = []; var imgs = []; var lastKnownImage = ''; for (var i in c) { var j = c[i]; var y = /.*Floor Plan.*?card-img-top.*?src="(.*?)".*/.exec(j); if (y) { lastKnownImage = y[1]; } if (!y) { y = /.*src="(.*?)".*?card-img-top.*?Floor Plan.*/.exec(j); if (y) { lastKnownImage = y[1]; } } if (!y) { y = /.*src="(.*?)".*?card-img-top.*/.exec(j); if (y) { lastKnownImage = y[1]; } } if (!y) { y = /.*data-selenium-id="Floorplan.*?data-src="(http.*?)".*/.exec(j); if (y) { lastKnownImage = y[1]; } } var y = /.*a href="(.*?)".*floorplan-action-button.*/.exec(j); if (y) { floorplansData.push( { url: y[1], img: lastKnownImage, units: [] } ); lastKnownImage = ''; } } var d = c.join(''); var y = /.*(."@context":.*?)}<\/script>.*/.exec(d); if (y) { var z = '{' + y[1] + '}'; var jo = JSON.parse(z); for (var j = 0; j < jo['accommodationFloorPlan'].length; j++) { floorplansData[j].beds = jo['accommodationFloorPlan'][j]['numberOfBedrooms']; floorplansData[j].baths = jo['accommodationFloorPlan'][j]['numberOfFullBathrooms']; } } for (var i = 0; i < floorplansData.length; i++) { var xhr = new XMLHttpRequest(); xhr.open('GET', floorplansData[i].url, false); xhr.send(); if (xhr.readyState !== DONE || xhr.status !== OK) { continue; } var c = xhr.responseText.split('\n'); var z = []; for (var k in c) { var j = c[k]; if (j.indexOf('"url":') !== -1) { mainUrl = j.replaceAll('"url": "', '').replaceAll('"', '').trim(); } var y = /.*type="button".*?id="(.*?)".*?applyGAClick.(.*?)." href='(.*?)'.*/.exec(j); if (y) { floorplansData[i].units.push({ unit: y[1], data: y[2], link: y[3] }); } else { y = /.*type="button".*?id="(.*?)".*?applyGAClick.(.*?)." href="(.*?)".*/.exec(j); if (y) { floorplansData[i].units.push({ unit: y[1], data: y[2], link: y[3] }); } } } } var data = new FormData(); data.append('url', canonicalUrl); data.append('unit', JSON.stringify(floorplansData)); var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://www.beans.ai/mapswidget/client/haley'); xhr.send(data); } BeansHaley.prototype.render = function(be1, urlFromRequest) { var so = this; if (urlFromRequest && !urlFromRequest.startsWith('www')) { urlFromRequest = ''; } var config = so.getConfigFromUrl(urlFromRequest); var address = config.address; console.log(address); if (beansUrlParameter('getData') === 'true') { so.getFloorPlans(); return; } var renderType = '3d'; if (config.unitsArr) { renderWithUnits(be1, renderType, config, address, config.unitsArr); } else if (config.isEntrataData) { fetch('https://www.beans.ai/mapswidget/client/entrata?dom=' + config.entrataDomain + '&propertyId=' + config.propertyId, { headers: { 'Content-Type': 'APPLICATION/JSON; CHARSET=UTF-8', 'X-Api-Key': '28f71a3b-0925-41be-b71a-3b092501be14' } } ) .then(response => response.json()) .then(json => { var floorplans = {}; if (json.response && json.response.result && json.response.result.Properties) { for (var i in json.response.result.Properties.Property[0].Floorplans.Floorplan) { var fp = json.response.result.Properties.Property[0].Floorplans.Floorplan[i]; var val = '' + fp.Identification.IDValue; var beds = 0; var baths = 0; var sqft = 0; for (var j in fp.Room) { var rm = fp.Room[j]; if (rm['@attributes']['RoomType'] === 'Bedroom') { beds = rm.Count; } if (rm['@attributes']['RoomType'] === 'Bathroom') { baths = rm.Count; } } if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Min) { sqft = fp.SquareFeet['@attributes'].Min; } else if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Max) { sqft = fp.SquareFeet['@attributes'].Max; } else if (fp.SquareFeet && fp.SquareFeet['@attributes'] && fp.SquareFeet['@attributes'].Avg) { sqft = fp.SquareFeet['@attributes'].Avg; } floorplans[val] = { beds: beds, baths: baths, sqft: sqft }; } } var unitsArr = []; if (!config.placeHolder && json.response && json.response.result && json.response.result.ILS_Units) { for (var i in json.response.result.ILS_Units.Unit) { var obj = json.response.result.ILS_Units.Unit[i]; if (!obj['@attributes']['Availability'] || obj['@attributes']['Availability'] !== 'Available') { continue; } var availability = 'Now'; if (obj['@attributes']['AvailableOn']) { availability = ' from ' + obj['@attributes']['AvailableOn']; } var pp = '' + obj['@attributes']['PropertyId']; var up = '' + obj['@attributes']['PropertyUnitId']; var fp = '' + obj['@attributes']['FloorplanId']; var beds = 0; var baths = 0; var sqft = 0; var rent = 0; if (obj.Rent && obj.Rent['@attributes'].MinRent) { rent = Number(obj.Rent['@attributes'].MinRent.replace(/[^0-9\.]/, '')); } else if (obj.Rent && obj.Rent['@attributes'].MaxRent) { rent = Number(obj.Rent['@attributes'].MaxRent.replace(/[^0-9\.]/, '')); } if (floorplans[fp]) { beds = floorplans[fp].beds; baths = floorplans[fp].baths; sqft = floorplans[fp].sqft; } var un = obj['@attributes']['UnitNumber']; if (obj['@attributes']['BuildingName']) { if (obj['@attributes']['BuildingName'].indexOf(' ') !== -1) { un = obj['@attributes']['BuildingName'] + '||' + un; } else { un = obj['@attributes']['BuildingName'] + '-' + un; } } unitsArr.push({ unit: un, bed: beds, bath: baths, sqft: sqft, availability: availability, rent: rent, link: 'https://' + config.canonicalUrl + '/Apartments/module/application_authentication/popup/false/kill_session/1/property[id]/%20' + pp + '/property_floorplan[id]/' + fp + '/unit_space[id]/' + up + '/show_in_popup/false/from_check_availability/1' }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isAtlanticData) { fetch('https://www.beans.ai/mapswidget/client/atlantic-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; for (var i in json) { if (i.indexOf(config.canonicalUrl) !== -1) { var x = JSON.parse(json[i]); for (var j = 0; j < x.length; j++) { if (!x[j].units || x[j].units.length === 0) { continue; } for (var k = 0; k < x[j].units.length; k++) { var av = x[j].units[k].available; if (av.indexOf('/') !== -1) { var m = String(av.split('/')[0]).padStart(2, '0'); var d = String(av.split('/')[1]).padStart(2, '0'); var y = av.split('/')[2]; av = y + '-' + m + '-' + d; } var unit = x[j].units[k]['unit']; var beds = x[j].beds ? x[j].beds : 0; var baths = x[j].baths ? x[j].baths : 0; var sqft = x[j].units[k]['area']; var rent = x[j].units[k]['rent']; var floorplan = x[j].name; var floorplanImg = x[j].img ? x[j].img : ''; var avail = av; var link = config.rentcafeLink + '&FloorPlanID=' + x[j].id + '&UnitID=' + x[j].units[k].id + '&MoveInDate=' + x[j].units[k].available; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, floorplan: floorplan, link: link, floorplanImg: floorplanImg, availability: avail}); } } } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isYardiData) { fetch('https://www.beans.ai/mapswidget/client/' + config.yardiDomain + '-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; for (var i in json) { if (i.indexOf(config.canonicalUrl) !== -1) { var x = JSON.parse(json[i]); for (var j = 0; j < x.length; j++) { for (var k = 0; k < x[j].units.length; k++) { var unit = x[j].units[k]['unit']; var unitData = x[j].units[k]['data']; var y = /.*'(.*)', '(.*)', '(.*)', '(.*)', '(.*)', '(.*)'.*/.exec(unitData); var beds = x[j].beds ? x[j].beds : 0; var baths = x[j].baths ? x[j].baths : 0; var sqft = 0; var rent = 0; floorplanImg = x[j].img ? x[j].img : ''; if (y) { sqft = Number(y[3]); rent = Number(y[4]); } var avail = ''; if (x[j].units[k]['link']) { var ix = x[j].units[k]['link'].lastIndexOf('='); if (ix !== -1) { avail = x[j].units[k]['link'].substring(ix + 1); if (avail.indexOf('&') !== -1) { avail = avail.substring(0, avail.indexOf('&')); } } } if (address == '200 NW 2nd St, Waukee, IA' && avail) { monthAvail = Number(avail.split('/')[0]); var currentMonth = new Date().getMonth() + 1; if (monthAvail <= currentMonth) { unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: x[j].units[k]['link'] ,floorplanImg: floorplanImg, availability: avail}); } } else { unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: x[j].units[k]['link'] ,floorplanImg: floorplanImg, availability: avail}); } } } } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isTurboTenantData) { fetch('https://www.beans.ai/mapswidget/client/graphqlturbo?property_id=' + config.propertyId) .then(response => response.json()) .then(json => { var unitsArr = []; if (json.data && json.data.viewer && json.data.viewer.ownerListings) { for (var i in json.data.viewer && json.data.viewer.ownerListings) { var obj = json.data.viewer.ownerListings[i]; var unit = obj.unit; var address = obj.address; if (address.indexOf(' ') !== -1) { address = address.split(' ')[0]; } if (address.indexOf('Rudder') !== -1) { address = address + 'R'; } unit = address + '-' + unit; unitsArr.push({ unit: unit, bed: obj.details.property_details.bedrooms, bath: obj.details.property_details.bathrooms, sqft: obj.details.property_details.square_feet, availability: 'Now', rent: obj.rent_amount, link: 'https://renter.turbotenant.com/applications/' + obj.id }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isGraphqlData) { fetch('https://www.beans.ai/mapswidget/client/graphql.php?property_id=' + config.canonicalUrl + '&location=' + config.locationUrl + '&force=' + (beansUrlParameter('force') ? beansUrlParameter('force') : '')) .then(response => response.json()) .then(json => { if (json.data && json.data.apartmentComplex && json.data.apartmentComplex.floorplans) { var floorplans = []; for (var i = 0; i < json.data.apartmentComplex.floorplans.length; i++) { floorplans.push(json.data.apartmentComplex.floorplans[i]); } var unitsArr = []; var proms = []; for (var i = 0; i < floorplans.length; i++) { const floorplan = floorplans[i]; proms.push( fetch('https://www.beans.ai/mapswidget/client/graphqlfp.php?property_id=' + config.canonicalUrl + '&location=' + config.locationUrl + '&floorplan_id=' + floorplan.id + '&force=' + (beansUrlParameter('force') ? beansUrlParameter('force') : '')) .then(response => response.json()) .then(jsonI => { if (jsonI.data && jsonI.data.units) { for (var i = 0; i < jsonI.data.units.length; i++) { var unitObj = jsonI.data.units[i]; var lnk = unitObj.callToActions && unitObj.callToActions.length ? unitObj.callToActions[0].url : ''; lnk = lnk.replace('{widget.moveInDate.YYYY-MM-DD}', unitObj.availabilityDate ? unitObj.availabilityDate : ''); unitsArr.push({ unit: unitObj.name, bed: floorplan.beds, bath: floorplan.baths, floorplan: floorplan.name, sqft: unitObj.sqftDisplay ? Number(unitObj.sqftDisplay.replace(/[^0-9\.]/, '')) : floorplan.sqft, rent: unitObj.prices && unitObj.prices.length ? unitObj.prices[0].value : 0, availability: unitObj.availabilityDate ? unitObj.availabilityDate : '', link: lnk, floorplanImg: floorplan.imageUrl }); } } }) ); } Promise.all(proms).then((values) => { renderWithUnits(be1, renderType, config, address, unitsArr); }); } else { renderWithUnits(be1, renderType, config, address, []); } }); } else if (config.isAppfolioData) { fetch('https://www.beans.ai/mapswidget/client/appfolio.php?propertyId=' + config.propertyId + '&url=' + urlFromRequest) .then(response => response.json()) .then(json => { var unitsArr = []; for (var k = 0; k < json.values.length; k++) { var unit = json.values[k].data.address_address1; var beds = json.values[k].data.bedrooms; var baths = json.values[k].data.bathrooms; var sqft = json.values[k].data.square_feet; var rent = json.values[k].data.market_rent; var avail = json.values[k].data.available_date; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: '' ,floorplanImg: '', availability: avail}); } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isQuickbaseData) { fetch('https://www.beans.ai/mapswidget/client/perry-data.json') .then(response => response.json()) .then(json => { var unitsArr = []; var x = json[config.propertyId]; if (x) { for (var j = 0; j < x.length; j++) { if (!x[j].Available) { continue; } var unit = x[j].Unit; var beds = x[j].Bedrooms ? x[j].Bedrooms : 0; var baths = x[j].Bathrooms ? x[j].Bathrooms : 0; var sqft = x[j].SqFt ? x[j].SqFt : 0; var rent = x[j].Rent ? Number(x[j].Rent.replace(',', '')) : 0; var floorplan = x[j].Model ? x[j].Model : ''; unitsArr.push({ unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: '' ,floorplan: floorplan, availability: ''}); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.isGisData) { fetch('https://gis-server.beans.ai/arcgis/rest/services/Hosted/' + config.gisDomain + '/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&defaultSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Foot&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&havingClause=&gdbVersion=&historicMoment=&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&multipatchOption=xyFootprint&resultOffset=&resultRecordCount=&returnTrueCurves=false&returnCentroid=false&timeReferenceUnknownClient=false&maxRecordCountFactor=&sqlFormat=none&resultType=&datumTransformation=&lodType=geohash&lod=&lodSR=&f=pjson') .then(response => response.json()) .then(json => { var unitsArr = []; if (json.features) { for (var i = 0; i < json.features.length; i++) { if (!config.addressList[json.features[i].attributes.address]) { continue; } if (json.features[i].attributes.availability !== 'Available') { continue; } var type = json.features[i].attributes.type ? json.features[i].attributes.type : ''; var bedrooms = 0; var bathrooms = 0; if (type === 'Studio') { bathrooms = 1; } else { var y = /.*([0-9+]) Bed.*/.exec(type); if (y) { bedrooms = Number(y[1]); } var z = /.*([0-9+]) Bath.*/.exec(type); if (z) { bathrooms = Number(z[1]); } } var unit = '' + json.features[i].attributes.unit; var bldg = '' + json.features[i].attributes.address.substring(0, json.features[i].attributes.address.indexOf(' ')); if (!config.skipBuildingNumberinSearch) { unit = bldg + '-' + unit; } var floorplan = json.features[i].attributes.floor_plan_name ? json.features[i].attributes.floor_plan_name : ''; floorplan = floorplan.trim(); var floorplanImg = ''; if (floorplan) { if (floorplan.toLowerCase() === 'ace' || floorplan.toLowerCase() === 'aviator' || floorplan.toLowerCase() === 'bandit' || floorplan.toLowerCase() === 'baron' || floorplan.toLowerCase() === 'captain' || floorplan.toLowerCase() === 'clipper' || floorplan.toLowerCase() === 'curve' || floorplan.toLowerCase() === 'lookout' || floorplan.toLowerCase() === 'traveler' || floorplan.toLowerCase() === 'surge' || floorplan.toLowerCase() === 'alley-oop' || floorplan.toLowerCase() === 'assist' || floorplan.toLowerCase() === 'baseline' || floorplan.toLowerCase() === 'fast break' || floorplan.toLowerCase() === 'free throw' || floorplan.toLowerCase() === 'shot clock' || floorplan.toLowerCase() === 'slam dunk' || floorplan.toLowerCase() === 'swish' || floorplan.toLowerCase() === 'tip off') { floorplanImg = 'https://www.beans.ai/mapswidget/client/mfpro-images/' + floorplan.toLowerCase() + '.png'; } } var link = json.features[i].attributes.learn_more__url ? json.features[i].attributes.learn_more__url : ''; unitsArr.push({ unit: unit, bed: bedrooms, bath: bathrooms ? bathrooms : 1, sqft: json.features[i].attributes.sqft ? json.features[i].attributes.sqft : 0, rent: json.features[i].attributes.price ? json.features[i].attributes.price : 0, floorplan: floorplan, floorplanImg: floorplanImg, link: link }); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else if (config.knockrentalPropertyId) { fetch('https://doorway-api.knockrentals.com/v1/property/' + config.knockrentalPropertyId + '/units') .then(response => response.json()) .then(jsonKnock => { var buildings = {}; if (jsonKnock.units_data && jsonKnock.units_data.buildings) { for (var i = 0; i < jsonKnock.units_data.buildings.length; i++) { var unitObj = jsonKnock.units_data.buildings[i]; if (!unitObj.name || !unitObj.id) { continue; } buildings[unitObj.id] = jsonKnock.units_data.buildings[i]; } } var layouts = {}; if (jsonKnock.units_data && jsonKnock.units_data.layouts) { for (var i = 0; i < jsonKnock.units_data.layouts.length; i++) { var unitObj = jsonKnock.units_data.layouts[i]; if (!unitObj.name || !unitObj.id) { continue; } layouts[unitObj.id] = jsonKnock.units_data.layouts[i]; } } var unitsArr = []; if (jsonKnock.units_data && jsonKnock.units_data.units) { for (var i = 0; i < jsonKnock.units_data.units.length; i++) { var unitObj = jsonKnock.units_data.units[i]; if (!unitObj.available) { continue; } var unit = unitObj.name; if (unitObj.buildingId && buildings[unitObj.buildingId] && buildings[unitObj.buildingId].name) { unit = buildings[unitObj.buildingId].name + '-' + unit; } // if (!config.unitsData[unit]) { // continue; // } var beds = unitObj.bedrooms; var baths = unitObj.bathrooms; var sqft = unitObj.area; var rent = unitObj.displayPrice; var link = 'https://' + config.realpagePropertyId + '.onlineleasing.realpage.com/?UnitId='; var floorplan = unitObj.layoutName; var floorplanImg = layouts[unitObj.layoutId].img; var avail = unitObj.availableOn; unitsArr.push({unit: unit, bed: beds, bath: baths, sqft: sqft, rent: rent, link: link, floorplan: floorplan, floorplanImg: floorplanImg, availability: avail}); } } renderWithUnits(be1, renderType, config, address, unitsArr); }); } else { renderWithUnits(be1, renderType, config, address, []); } }