{"version":3,"sources":["components/Business/Business.js","components/BusinessList/BusinessList.js","components/SearchBar/SearchBar.js","util/Address.js","components/App/App.js","serviceWorker.js","index.js"],"names":["Business","className","this","props","business","ip","country_name","region_name","city","zip_code","time_zone","React","Component","BusinessList","businesses","map","key","SearchBar","state","term","sortBy","handleTermChange","bind","handleSearch","handleSortByChange","sortByOptions","sortByOption","setState","event","target","value","searchAddress","preventDefault","Object","keys","sortByOptionValue","getSortByClass","onClick","renderSortByOptions","placeholder","onChange","Address","search","fetch","then","response","json","jsonResponse","App","Boolean","window","location","hostname","match","ReactDOM","render","StrictMode","document","getElementById","navigator","serviceWorker","ready","registration","unregister","catch","error","console","message"],"mappings":"yTAwBeA,G,yLAnBP,OACI,yBAAKC,UAAU,YACX,2CAAiBC,KAAKC,MAAMC,SAASC,IACrC,yBAAKJ,UAAU,wBACX,yBAAKA,UAAU,oBACX,uCAAaC,KAAKC,MAAMC,SAASE,cACjC,sCAAYJ,KAAKC,MAAMC,SAASG,aAChC,8CAAaL,KAAKC,MAAMC,SAASI,OACjC,kDAAiBN,KAAKC,MAAMC,SAASK,YAEzC,yBAAKR,UAAU,oBACX,0CAAgBC,KAAKC,MAAMC,SAASM,kB,GAbrCC,IAAMC,YCgBdC,E,uKAZP,OACI,yBAAKZ,UAAU,gBAEPC,KAAKC,MAAMW,WAAWC,KAAI,SAAAX,GACtB,OAAO,kBAAC,EAAD,CAAUA,SAAUA,EAAUY,IAAKZ,EAASC,a,GANhDM,IAAMC,WCyElBK,G,wDA1EX,WAAYd,GAAQ,IAAD,8BACf,cAAMA,IAGDe,MAAQ,CACTC,KAAM,GACNC,OAAQ,cAIZ,EAAKC,iBAAmB,EAAKA,iBAAiBC,KAAtB,gBACxB,EAAKC,aAAe,EAAKA,aAAaD,KAAlB,gBACpB,EAAKE,mBAAqB,EAAKA,mBAAmBF,KAAxB,gBAI1B,EAAKG,cAAgB,CACjB,MAAS,cAjBE,E,2DAuBJC,GACX,OAAIxB,KAAKgB,MAAME,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K,SAAA9B,GAC9B,EAAKa,SAAS,CAACb,WAAYA,S,+BAK/B,OACI,yBAAKb,UAAU,OACX,uCACA,gEACA,kBAAC,EAAD,CAAW8B,cAAe7B,KAAK6B,gBAC/B,kBAAC,EAAD,CAAcjB,WAAYZ,KAAKgB,MAAMJ,kB,GAvBnCH,IAAMC,WCIJqC,QACW,cAA7BC,OAAOC,SAASC,UAEe,UAA7BF,OAAOC,SAASC,UAEhBF,OAAOC,SAASC,SAASC,MACvB,2DCZNC,IAASC,OACP,kBAAC,IAAMC,WAAP,KACE,kBAAC,EAAD,OAEFC,SAASC,eAAe,SDyHpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MACrBjB,MAAK,SAAAkB,GACJA,EAAaC,gBAEdC,OAAM,SAAAC,GACLC,QAAQD,MAAMA,EAAME,c","file":"static/js/main.bda42f96.chunk.js","sourcesContent":["import React from 'react';\r\nimport './Business.css';\r\n\r\nclass Business extends React.Component {\r\n render() {\r\n return (\r\n
\r\n

ip address: {this.props.business.ip}

\r\n
\r\n
\r\n

country: {this.props.business.country_name}

\r\n

region: {this.props.business.region_name}

\r\n

city: {`${this.props.business.city}`}

\r\n

zip code: {`${this.props.business.zip_code}`}

\r\n
\r\n
\r\n

time zone: {this.props.business.time_zone}

\r\n
\r\n
\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default Business;","import React from 'react';\r\nimport './BusinessList.css';\r\n\r\nimport Business from '../Business/Business';\r\n\r\nclass BusinessList extends React.Component {\r\n render() {\r\n return (\r\n
\r\n {\r\n this.props.businesses.map(business => {\r\n return \r\n })\r\n }\r\n
\r\n );\r\n }\r\n}\r\n\r\nexport default BusinessList;","import React from 'react';\r\nimport './SearchBar.css';\r\n\r\nclass SearchBar extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n\r\n // sortBy is the field to pass to get to the correct api endpoint\r\n this.state = {\r\n term: '',\r\n sortBy: 'datalookup'\r\n };\r\n\r\n // term is the search term that will be passed ipAddress=${term}\r\n this.handleTermChange = this.handleTermChange.bind(this);\r\n this.handleSearch = this.handleSearch.bind(this);\r\n this.handleSortByChange = this.handleSortByChange.bind(this);\r\n\r\n // current functionality only supports GeoIP,\r\n // but really easy to refactor the backend script and give it a new endpoint to extend the whois api\r\n this.sortByOptions = {\r\n 'GeoIP': 'datalookup'/*,\r\n 'WhoIs': 'whois',\r\n 'GeoIP and WhoIs': 'both'*/\r\n };\r\n }\r\n\r\n getSortByClass(sortByOption) {\r\n if (this.state.sortBy === sortByOption) {\r\n return 'active';\r\n }\r\n return '';\r\n }\r\n\r\n handleSortByChange(sortByOption) {\r\n this.setState({sortBy: sortByOption});\r\n }\r\n\r\n handleTermChange(event) {\r\n this.setState({term: event.target.value});\r\n }\r\n\r\n handleSearch(event) {\r\n this.props.searchAddress(this.state.term, this.state.sortBy);\r\n\r\n event.preventDefault();\r\n }\r\n\r\n renderSortByOptions() {\r\n return Object.keys(this.sortByOptions).map(sortByOption => {\r\n let sortByOptionValue = this.sortByOptions[sortByOption];\r\n return (
  • \r\n {sortByOption}\r\n
  • );\r\n });\r\n }\r\n\r\n render() {\r\n return (\r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n Let's Go\r\n
    \r\n
    \r\n );\r\n }\r\n}\r\n\r\nexport default SearchBar;","const Address = {\r\n search(term, sortBy) {\r\n return fetch(`https://cors-anywhere.herokuapp.com/https://vylwyqxl3e.execute-api.us-west-2.amazonaws.com/beta/${sortBy}?ipAddress=${term}`).then(response => {\r\n return response.json();\r\n }).then(jsonResponse => {\r\n if (jsonResponse.businesses) {\r\n return jsonResponse.businesses.map(business => ({\r\n ip: business.ip,\r\n country_name: business.country_name,\r\n city: business.city,\r\n region_name: business.region_name,\r\n zip_code: business.zip_code,\r\n time_zone: business.time_zone,\r\n }));\r\n }\r\n });\r\n }\r\n};\r\n\r\nexport default Address;\r\n","import React from 'react';\nimport './App.css';\n\nimport BusinessList from '../BusinessList/BusinessList';\nimport SearchBar from '../SearchBar/SearchBar';\n\nimport Address from '../../util/Address';\n\nclass App extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n businesses: []\n };\n\n this.searchAddress = this.searchAddress.bind(this);\n }\n\n searchAddress(term, sortBy) {\n Address.search(term, sortBy).then(businesses => {\n this.setState({businesses: businesses});\n });\n }\n\n render() {\n return (\n
    \n

    mildred

    \n

    find the tree through the forest

    \n \n \n
    \n );\n }\n}\n\nexport default App;","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' },\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './components/App/App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}