· 7 years ago · Nov 21, 2018, 03:04 PM
1function Search(t) {
2 _classCallCheck(this, Search);
3 var e = _possibleConstructorReturn(this, (Search.__proto__ || Object.getPrototypeOf(Search)).call(this, Object.assign({}, {
4 autobind: ["toggle", "close"]
5 }, t))),
6 n = e;
7 console.log(n)
8 return e.query = "", e.modalTimeout, e.minQueryLength = 3, e.maxSuggestions = 5, e.maxResults = 20, e.maxHistory = 10, e.imageWidth = 60, e.imageHeight = 60, e.lastSearch, e.apiClient = "dia", e.apiKey = "6AiYVW9lux1pwyj4JaIE2Q==", e.apiEndpoint = "https://dia.neemu.com/searchapi/v3/search?apiKey=" + n.apiClient + "&secretKey=" + n.apiKey + "&resultsQueries=" + n.maxSuggestions + "&resultsProducts=" + n.maxResults + "&terms=", e.apiEndpointHistory = "https://dia.neemu.com/searchapi/v3/autocompletes/popular?apiKey=" + n.apiClient + "&secretKey=" + n.apiKey, e.removeUrl = "www.dia.com.br", e.doSearch = (0, a.debounce)(function() {
9 var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
10 (t = t || n.query || "") !== n.lastSearch && (n.status("loading", !!t), t && $.getJSON("" + n.apiEndpoint + t).done(function(e) {
11 n.query = t, n.autocomplete.call(n, e)
12 }).fail(function() {
13 return n.clear.call(n)
14 }).always(function() {
15 n.status("loading", !1)
16 }))
17 }, 1200 )