addsearch-js-client
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -1,2 +0,2 @@ | ||
/*! addsearch-js-client 0.5.2 */ | ||
/*! addsearch-js-client 0.6.0 */ | ||
window.AddSearchClient=function(t){var e={};function s(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)s.d(n,i,function(e){return t[e]}.bind(null,i));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=4)}([function(t,e,s){(function(e,s){ | ||
@@ -9,2 +9,2 @@ /*! | ||
* @version v4.2.8+1e68dce6 | ||
*/var n;n=function(){"use strict";function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,o=void 0,a=function(t,e){p[i]=t,p[i+1]=e,2===(i+=2)&&(o?o(g):w())},u="undefined"!=typeof window?window:void 0,c=u||{},h=c.MutationObserver||c.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var p=new Array(1e3);function g(){for(var t=0;t<i;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;i=0}var y,m,v,b,w=void 0;function F(t,e){var s=this,n=new this.constructor(A);void 0===n[_]&&C(n);var i=s._state;if(i){var r=arguments[i-1];a((function(){return B(i,n,r,s._result)}))}else k(s,n,t,e);return n}function T(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(A);return x(e,t),e}f?w=function(){return e.nextTick(g)}:h?(m=0,v=new h(g),b=document.createTextNode(""),v.observe(b,{characterData:!0}),w=function(){b.data=m=++m%2}):l?((y=new MessageChannel).port1.onmessage=g,w=function(){return y.port2.postMessage(0)}):w=void 0===u?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(g)}:d()}catch(t){return d()}}():d();var _=Math.random().toString(36).substring(2);function A(){}function S(e,s,n){s.constructor===e.constructor&&n===F&&s.constructor.resolve===T?function(t,e){1===e._state?E(t,e._result):2===e._state?P(t,e._result):k(e,void 0,(function(e){return x(t,e)}),(function(e){return P(t,e)}))}(e,s):void 0===n?E(e,s):t(n)?function(t,e,s){a((function(t){var n=!1,i=function(t,e,s,n){try{t.call(e,s,n)}catch(t){return t}}(s,e,(function(s){n||(n=!0,e!==s?x(t,s):E(t,s))}),(function(e){n||(n=!0,P(t,e))}),t._label);!n&&i&&(n=!0,P(t,i))}),t)}(e,s,n):E(e,s)}function x(t,e){if(t===e)P(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(n=e),null===n||"object"!==i&&"function"!==i)E(t,e);else{var s=void 0;try{s=e.then}catch(e){return void P(t,e)}S(t,e,s)}var n,i}function O(t){t._onerror&&t._onerror(t._result),j(t)}function E(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&a(j,t))}function P(t,e){void 0===t._state&&(t._state=2,t._result=e,a(O,t))}function k(t,e,s,n){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+1]=s,i[r+2]=n,0===r&&t._state&&a(j,t)}function j(t){var e=t._subscribers,s=t._state;if(0!==e.length){for(var n=void 0,i=void 0,r=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+s],n?B(s,n,i,r):i(r);t._subscribers.length=0}}function B(e,s,n,i){var r=t(n),o=void 0,a=void 0,u=!0;if(r){try{o=n(i)}catch(t){u=!1,a=t}if(s===o)return void P(s,new TypeError("A promises callback cannot return that same promise."))}else o=i;void 0!==s._state||(r&&u?x(s,o):!1===u?P(s,a):1===e?E(s,o):2===e&&P(s,o))}var z=0;function C(t){t[_]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}var D=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(A),this.promise[_]||C(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&E(this.promise,this._result))):P(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var s=this._instanceConstructor,n=s.resolve;if(n===T){var i=void 0,r=void 0,o=!1;try{i=t.then}catch(t){o=!0,r=t}if(i===F&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(s===R){var a=new s(A);o?P(a,r):S(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new s((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,s){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?P(n,s):this._result[e]=s),0===this._remaining&&E(n,this._result)},t.prototype._willSettleAt=function(t,e){var s=this;k(t,void 0,(function(t){return s._settledAt(1,e,t)}),(function(t){return s._settledAt(2,e,t)}))},t}(),R=function(){function e(t){this[_]=z++,this._result=this._state=void 0,this._subscribers=[],A!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){x(t,e)}),(function(e){P(t,e)}))}catch(e){P(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var s=this.constructor;return t(e)?this.then((function(t){return s.resolve(e()).then((function(){return t}))}),(function(t){return s.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return R.prototype.then=F,R.all=function(t){return new D(this,t).promise},R.race=function(t){var e=this;return n(t)?new e((function(s,n){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(s,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},R.resolve=T,R.reject=function(t){var e=new this(A);return P(e,t),e},R._setScheduler=function(t){o=t},R._setAsap=function(t){a=t},R._asap=a,R.polyfill=function(){var t=void 0;if(void 0!==s)t=s;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=R},R.Promise=R,R},t.exports=n()}).call(this,s(6),s(2))},function(t,e,s){s(7),t.exports=self.fetch.bind(self)},function(t,e){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){(function(e){t.exports={isFunction:function(t){return t&&"[object Function]"==={}.toString.call(t)},base64:function(t){return e.window={},window&&window.btoa?window.btoa(t):Buffer?Buffer.from(t).toString("base64"):void 0}}}).call(this,s(2))},function(t,e,s){"use strict";var n=s(5),i=s(8),r=s(9),o=s(10),a=s(3),u=s(11),c=200;t.exports=function(t,e){this.sitekey=t,this.privatekey=e,this.apiHostname="api.addsearch.com",this.settings=new o,this.sessionId=("a-"+1e8*Math.random()).substring(0,10),this.search=function(t,e){var s=null,i=null;if(t&&a.isFunction(e))s=t,i=e;else if(!e&&a.isFunction(t))s=this.settings.getSettings().keyword,i=t;else{if(!this.settings.getSettings().callback)throw"Illegal search parameters. Should be (keyword, callbackFunction) or (callbackFunction)";s=this.settings.getSettings().keyword,i=this.settings.getSettings().callback}this.settings.setCallback(i),this.settings.setKeyword(s),this.throttledSearchFetch||(this.throttledSearchFetch=u(c,n)),this.throttledSearchFetch(this.apiHostname,this.sitekey,"search",this.settings.getSettings(),i)},this.suggestions=function(t,e){if(!t||!e||!a.isFunction(e))throw"Illegal suggestions parameters. Should be (prefix, callbackFunction)";this.settings.setSuggestionsPrefix(t),this.throttledSuggestionsFetch||(this.throttledSuggestionsFetch=u(c,n)),this.throttledSuggestionsFetch(this.apiHostname,this.sitekey,"suggest",this.settings.getSettings(),e)},this.autocomplete=function(t,e,s){if(!(t&&e&&s&&a.isFunction(s)))throw"Illegal autocomplete parameters. Should be (field, prefix, callbackFunction)";this.settings.setAutocompleteParams(t,e),this.throttledAutocompleteFetch||(this.throttledAutocompleteFetch=u(c,n)),this.throttledAutocompleteFetch(this.apiHostname,this.sitekey,"autocomplete",this.settings.getSettings(),s)},this.getDocument=function(t){return i.getDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.saveDocument=function(t){return i.saveDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.saveDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of documents: {documents: []}";return i.saveDocumentsBatch(this.apiHostname,this.sitekey,this.privatekey,t)},this.deleteDocument=function(t){return i.deleteDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.deleteDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of document ids: {documents: []}";return i.deleteDocumentsBatch(this.apiHostname,this.sitekey,this.privatekey,t)},this.setApiHostname=function(t){this.apiHostname=t},this.getSettings=function(){return this.settings.getSettings()},this.setLanguage=function(t){this.settings.setLanguage(t)},this.setCategoryFilters=function(t){this.settings.setCategoryFilters(t)},this.addCustomFieldFilter=function(t,e){this.settings.addCustomFieldFilter(t,e)},this.removeCustomFieldFilter=function(t,e){this.settings.removeCustomFieldFilter(t,e)},this.setPriceRangeFilter=function(t,e){this.settings.setPriceRangeFilter(t,e)},this.setDateFilter=function(t,e){this.settings.setDateFilter(t,e)},this.setJWT=function(t){this.settings.setJWT(t)},this.setUserToken=function(t){this.settings.setUserToken(t)},this.setPaging=function(t,e,s,n){this.settings.setPaging(t,e,s,n)},this.nextPage=function(){this.settings.nextPage()},this.previousPage=function(){this.settings.previousPage()},this.setSuggestionsSize=function(t){this.settings.setSuggestionsSize(t)},this.setAutocompleteSize=function(t){this.settings.setAutocompleteSize(t)},this.addFacetField=function(t){this.settings.addFacetField(t)},this.addRangeFacet=function(t,e){this.settings.addRangeFacet(t,e)},this.addStatsField=function(t){this.settings.addStatsField(t)},this.setNumberOfFacets=function(t){this.settings.setNumberOfFacets(t)},this.setResultType=function(t){this.settings.setResultType(t)},this.setPersonalizationEvents=function(t){this.settings.setPersonalizationEvents(t)},this.setFilterObject=function(t){this.settings.setFilterObject(t)},this.setShuffleAndLimitTo=function(t){this.settings.setShuffleAndLimitTo(t)},this.setFuzzyMatch=function(t){this.settings.setFuzzyMatch(t)},this.setPostfixWildcard=function(t){this.settings.setPostfixWildcard(t)},this.setCollectAnalytics=function(t){this.settings.setCollectAnalytics(t)},this.setThrottleTime=function(t){c=t},this.setStatsSessionId=function(t){this.sessionId=t},this.getStatsSessionId=function(){return this.sessionId},this.sendStatsEvent=function(t,e,s){if("search"===t){s={action:"search",session:this.sessionId,keyword:e,numberOfResults:s.numberOfResults};r(this.apiHostname,this.sitekey,s)}else{if("click"!==t)throw"Illegal sendStatsEvent type parameters. Should be search or click)";s={action:"click",session:this.sessionId,keyword:e,docid:s.documentId,position:s.position};r(this.apiHostname,this.sitekey,s)}},this.searchResultClicked=function(t,e){this.sendStatsEvent("click",this.settings.getSettings().keyword,{documentId:t,position:e})}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function t(e,s,n,i,r,o){var a=function(t,e){return t||!1===t?"&"+e+"="+t:""};if("search"===n||"suggest"===n||"autocomplete"===n){var u="",c="",h=null;if("search"===n){h=n,u=(u=i.keyword).replace(/ and /g," AND ").replace(/ or /g," OR ").replace(/ not /g," NOT "),u=encodeURIComponent(u);var f=i.fuzzy;if("retry"===f&&(f=!0===o),"search"===n){if(c=a(i.lang,"lang")+a(f,"fuzzy")+a(i.collectAnalytics,"collectAnalytics")+a(i.postfixWildcard,"postfixWildcard")+a(i.categories,"categories")+a(i.priceFromCents,"priceFromCents")+a(i.priceToCents,"priceToCents")+a(i.dateFrom,"dateFrom")+a(i.dateTo,"dateTo")+a(i.paging.page,"page")+a(i.paging.pageSize,"limit")+a(i.paging.sortBy,"sort")+a(i.paging.sortOrder,"order")+a(i.shuffleAndLimitTo,"shuffleAndLimitTo")+a(i.jwt,"jwt")+a(i.resultType,"resultType")+a(i.userToken,"userToken")+a(i.numFacets,"numFacets"),i.customFieldFilters)for(var l=0;l<i.customFieldFilters.length;l++)c=c+"&customField="+i.customFieldFilters[l];if(i.facetFields)for(l=0;l<i.facetFields.length;l++)c=c+"&facet="+i.facetFields[l];if(i.rangeFacets&&(c=c+"&rangeFacets="+JSON.stringify(i.rangeFacets)),i.statsFields)for(l=0;l<i.statsFields.length;l++)c=c+"&fieldStat="+i.statsFields[l];if(i.personalizationEvents&&Array.isArray(i.personalizationEvents))for(l=0;l<i.personalizationEvents.length;l++){var d=i.personalizationEvents[l],p=Object.keys(d);c=c+"&personalizationEvent="+encodeURIComponent(p+"="+d[p])}i.filterObject&&(c=c+"&filter="+JSON.stringify(i.filterObject))}}else"suggest"===n?(h=n,c=a(i.suggestionsSize,"size"),u=i.suggestionsPrefix):"autocomplete"===n&&(h="autocomplete/document-field",c=a(i.autocomplete.field,"source")+a(i.autocomplete.size,"size"),u=i.autocomplete.prefix);fetch("https://"+e+"/v1/"+h+"/"+s+"?term="+u+c).then((function(t){return t.json()})).then((function(e){if("search"===n&&"retry"===i.fuzzy&&0===e.total_hits&&!0!==o)t(s,n,i,r,!0);else{if(!0===o){var a=i.paging.pageSize;e.total_hits>=a&&(e.total_hits=a)}r(e)}})).catch((function(t){console.log(t),r({error:{response:500,message:"invalid server response"}})}))}else r({error:{response:400,message:"invalid query type"}})}},function(t,e){var s,n,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(s===setTimeout)return setTimeout(t,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(t,0);try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(t){s=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=a(l);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)e[s-1]=arguments[s];c.push(new p(t,e)),1!==c.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,s){"use strict";s.r(e),s.d(e,"Headers",(function(){return p})),s.d(e,"Request",(function(){return F})),s.d(e,"Response",(function(){return _})),s.d(e,"DOMException",(function(){return S})),s.d(e,"fetch",(function(){return x}));var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,i="URLSearchParams"in n,r="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in n,u="ArrayBuffer"in n;if(u)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function g(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(e,s){t.onload=function(){e(t.result)},t.onerror=function(){s(t.error)}}))}function m(t){var e=new FileReader,s=y(e);return e.readAsArrayBuffer(t),s}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=g(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=g(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var t,e,s,n=g(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,s=y(e),e.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),s=new Array(e.length),n=0;n<e.length;n++)s[n]=String.fromCharCode(e[n]);return s.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=f(t),e=l(e);var s=this.map[t];this.map[t]=s?s+", "+e:e},p.prototype.delete=function(t){delete this.map[f(t)]},p.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},p.prototype.set=function(t,e){this.map[f(t)]=l(e)},p.prototype.forEach=function(t,e){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(e,this.map[s],s,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,s){t.push(s)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,s){t.push([s,e])})),d(t)},r&&(p.prototype[Symbol.iterator]=p.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function F(t,e){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var s,n,i=(e=e||{}).body;if(t instanceof F){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(s=e.method||this.method||"GET",n=s.toUpperCase(),w.indexOf(n)>-1?n:s),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function T(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var s=t.split("="),n=s.shift().replace(/\+/g," "),i=s.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})},b.call(F.prototype),b.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];_.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})};var S=n.DOMException;try{new S}catch(t){(S=function(t,e){this.message=t,this.name=e;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),S.prototype.constructor=S}function x(t,e){return new Promise((function(s,i){var r=new F(t,e);if(r.signal&&r.signal.aborted)return i(new S("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var s=t.split(":"),n=s.shift().trim();if(n){var i=s.join(":").trim();e.append(n,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;setTimeout((function(){s(new _(i,n))}),0)},a.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.onabort=function(){setTimeout((function(){i(new S("Aborted","AbortError"))}),0)},a.open(r.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(r.url),!0),"include"===r.credentials?a.withCredentials=!0:"omit"===r.credentials&&(a.withCredentials=!1),"responseType"in a&&(o?a.responseType="blob":u&&r.headers.get("Content-Type")&&-1!==r.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof p?r.headers.forEach((function(t,e){a.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){a.setRequestHeader(t,l(e.headers[t]))})),r.signal&&(r.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&r.signal.removeEventListener("abort",c)}),a.send(void 0===r._bodyInit?null:r._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=p,n.Request=F,n.Response=_)},function(t,e,s){"use strict";s(1);var n=s(3),i=s(0).Promise,r=function(t,e){return{Authorization:"Basic "+n.base64(t+":"+e),"Content-Type":"application/json"}};t.exports={getDocument:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents/"+n,{method:"GET",headers:r(e,s)}).then((function(t){200==t.status?i(t.json()):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},saveDocument:function(t,e,s,n){var o=n.id||n.url;return new i((function(i,a){fetch("https://"+t+"/v2/indices/"+e+"/documents/",{method:o?"PUT":"POST",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):a({status:t.status,text:t.statusText})})).catch((function(t){a({status:400,text:t})}))}))},saveDocumentsBatch:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents:batch",{method:"PUT",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},deleteDocument:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents/"+n,{method:"DELETE",headers:r(e,s)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},deleteDocumentsBatch:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents:batch",{method:"DELETE",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function(t,e,s){"undefined"!=typeof window&&window.navigator&&window.navigator.sendBeacon?navigator.sendBeacon("https://"+t+"/v1/stats/"+e+"/",JSON.stringify(s)):fetch("https://"+t+"/v1/stats/"+e+"/",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(s)})}},function(t,e,s){"use strict";t.exports=function(){this.settings={keyword:"*",callback:null,fuzzy:"auto",paging:{page:1,pageSize:10,sortBy:"relevance",sortOrder:"desc"},customFieldFilters:[],userToken:null,suggestionsSize:10,facetFields:[],autocomplete:{size:10}},this.getSettings=function(){return this.settings},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setCallback=function(t){this.settings.callback=t},this.setSuggestionsPrefix=function(t){this.settings.suggestionsPrefix=t},this.setSuggestionsSize=function(t){this.settings.suggestionsSize=t},this.setAutocompleteSize=function(t){this.settings.autocomplete.size=t},this.setAutocompleteParams=function(t,e){this.settings.autocomplete.field=t,this.settings.autocomplete.prefix=e},this.setLanguage=function(t){if(t&&2!==t.length)throw'use 2-char language code (e.g. "en")';this.settings.lang=t},this.setFuzzyMatch=function(t){if(!0!==t&&!1!==t&&"auto"!==t&&"retry"!==t)throw"fuzzy matching can be true, false, 'auto', or 'retry'";this.settings.fuzzy=t},this.setPostfixWildcard=function(t){this.settings.postfixWildcard=t},this.setCollectAnalytics=function(t){this.settings.collectAnalytics=t},this.setCategoryFilters=function(t){this.settings.categories=t},this.setFilterObject=function(t){this.settings.filterObject=t},this.setPriceRangeFilter=function(t,e){this.settings.priceFromCents=t,this.settings.priceToCents=e},this.addCustomFieldFilter=function(t,e){var s=encodeURIComponent(t+"="+e);-1===this.settings.customFieldFilters.indexOf(s)&&this.settings.customFieldFilters.push(s)},this.removeCustomFieldFilter=function(t,e){var s=!1,n=encodeURIComponent(t+"="+e);e||(s=!0,n=encodeURIComponent(t+"="));for(var i=this.settings.customFieldFilters.length;i>0;i--){var r=this.settings.customFieldFilters[i-1];(s&&0===r.indexOf(n)||r===n)&&this.settings.customFieldFilters.splice(i-1,1)}},this.setDateFilter=function(t,e){this.settings.dateFrom=t,this.settings.dateTo=e},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setJWT=function(t){this.settings.jwt=t},this.setUserToken=function(t){this.settings.userToken=t},this.setPersonalizationEvents=function(t){this.settings.personalizationEvents=t},this.setResultType=function(t){this.settings.resultType=t},this.addFacetField=function(t){-1===this.settings.facetFields.indexOf(t)&&this.settings.facetFields.push(t)},this.addRangeFacet=function(t,e){this.settings.rangeFacets||(this.settings.rangeFacets=[]),this.settings.rangeFacets.push({field:t,ranges:e})},this.addStatsField=function(t){this.settings.statsFields||(this.settings.statsFields=[]),-1===this.settings.statsFields.indexOf(t)&&this.settings.statsFields.push(t)},this.setNumberOfFacets=function(t){this.settings.numFacets=t},this.setPaging=function(t,e,s,n){if(t<1)throw"page must be 1 or bigger";if(e<1||e>300)throw"pageSize must be 1-300";if("asc"!==n&&"desc"!==n)throw"sortOrder must be asc or desc";this.settings.paging.page=t,this.settings.paging.pageSize=e,this.settings.paging.sortBy=s,this.settings.paging.sortOrder=n},this.setShuffleAndLimitTo=function(t){this.settings.shuffleAndLimitTo=t},this.nextPage=function(){this.settings.paging.page=this.settings.paging.page+1},this.previousPage=function(){this.settings.paging.page>0&&(this.settings.paging.page=this.settings.paging.page-1)}}},function(t,e){t.exports=function(t,e){var s,n=0;function i(){s&&clearTimeout(s)}return function(){var r=this,o=Date.now()-n,a=arguments;function u(){n=Date.now(),e.apply(r,a)}i(),o>t?u():s=setTimeout(u,t-o)}}}]); | ||
*/var n;n=function(){"use strict";function t(t){return"function"==typeof t}var n=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=0,r=void 0,o=void 0,a=function(t,e){p[i]=t,p[i+1]=e,2===(i+=2)&&(o?o(g):w())},u="undefined"!=typeof window?window:void 0,c=u||{},h=c.MutationObserver||c.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(g,1)}}var p=new Array(1e3);function g(){for(var t=0;t<i;t+=2)(0,p[t])(p[t+1]),p[t]=void 0,p[t+1]=void 0;i=0}var y,m,b,v,w=void 0;function F(t,e){var s=this,n=new this.constructor(A);void 0===n[_]&&C(n);var i=s._state;if(i){var r=arguments[i-1];a((function(){return B(i,n,r,s._result)}))}else k(s,n,t,e);return n}function T(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(A);return x(e,t),e}f?w=function(){return e.nextTick(g)}:h?(m=0,b=new h(g),v=document.createTextNode(""),b.observe(v,{characterData:!0}),w=function(){v.data=m=++m%2}):l?((y=new MessageChannel).port1.onmessage=g,w=function(){return y.port2.postMessage(0)}):w=void 0===u?function(){try{var t=Function("return this")().require("vertx");return void 0!==(r=t.runOnLoop||t.runOnContext)?function(){r(g)}:d()}catch(t){return d()}}():d();var _=Math.random().toString(36).substring(2);function A(){}function S(e,s,n){s.constructor===e.constructor&&n===F&&s.constructor.resolve===T?function(t,e){1===e._state?E(t,e._result):2===e._state?P(t,e._result):k(e,void 0,(function(e){return x(t,e)}),(function(e){return P(t,e)}))}(e,s):void 0===n?E(e,s):t(n)?function(t,e,s){a((function(t){var n=!1,i=function(t,e,s,n){try{t.call(e,s,n)}catch(t){return t}}(s,e,(function(s){n||(n=!0,e!==s?x(t,s):E(t,s))}),(function(e){n||(n=!0,P(t,e))}),t._label);!n&&i&&(n=!0,P(t,i))}),t)}(e,s,n):E(e,s)}function x(t,e){if(t===e)P(t,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(n=e),null===n||"object"!==i&&"function"!==i)E(t,e);else{var s=void 0;try{s=e.then}catch(e){return void P(t,e)}S(t,e,s)}var n,i}function O(t){t._onerror&&t._onerror(t._result),j(t)}function E(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&a(j,t))}function P(t,e){void 0===t._state&&(t._state=2,t._result=e,a(O,t))}function k(t,e,s,n){var i=t._subscribers,r=i.length;t._onerror=null,i[r]=e,i[r+1]=s,i[r+2]=n,0===r&&t._state&&a(j,t)}function j(t){var e=t._subscribers,s=t._state;if(0!==e.length){for(var n=void 0,i=void 0,r=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+s],n?B(s,n,i,r):i(r);t._subscribers.length=0}}function B(e,s,n,i){var r=t(n),o=void 0,a=void 0,u=!0;if(r){try{o=n(i)}catch(t){u=!1,a=t}if(s===o)return void P(s,new TypeError("A promises callback cannot return that same promise."))}else o=i;void 0!==s._state||(r&&u?x(s,o):!1===u?P(s,a):1===e?E(s,o):2===e&&P(s,o))}var z=0;function C(t){t[_]=z++,t._state=void 0,t._result=void 0,t._subscribers=[]}var D=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(A),this.promise[_]||C(this.promise),n(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?E(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&E(this.promise,this._result))):P(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var s=this._instanceConstructor,n=s.resolve;if(n===T){var i=void 0,r=void 0,o=!1;try{i=t.then}catch(t){o=!0,r=t}if(i===F&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(s===R){var a=new s(A);o?P(a,r):S(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new s((function(e){return e(t)})),e)}else this._willSettleAt(n(t),e)},t.prototype._settledAt=function(t,e,s){var n=this.promise;void 0===n._state&&(this._remaining--,2===t?P(n,s):this._result[e]=s),0===this._remaining&&E(n,this._result)},t.prototype._willSettleAt=function(t,e){var s=this;k(t,void 0,(function(t){return s._settledAt(1,e,t)}),(function(t){return s._settledAt(2,e,t)}))},t}(),R=function(){function e(t){this[_]=z++,this._result=this._state=void 0,this._subscribers=[],A!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e((function(e){x(t,e)}),(function(e){P(t,e)}))}catch(e){P(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var s=this.constructor;return t(e)?this.then((function(t){return s.resolve(e()).then((function(){return t}))}),(function(t){return s.resolve(e()).then((function(){throw t}))})):this.then(e,e)},e}();return R.prototype.then=F,R.all=function(t){return new D(this,t).promise},R.race=function(t){var e=this;return n(t)?new e((function(s,n){for(var i=t.length,r=0;r<i;r++)e.resolve(t[r]).then(s,n)})):new e((function(t,e){return e(new TypeError("You must pass an array to race."))}))},R.resolve=T,R.reject=function(t){var e=new this(A);return P(e,t),e},R._setScheduler=function(t){o=t},R._setAsap=function(t){a=t},R._asap=a,R.polyfill=function(){var t=void 0;if(void 0!==s)t=s;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=R},R.Promise=R,R},t.exports=n()}).call(this,s(6),s(2))},function(t,e,s){s(7),t.exports=self.fetch.bind(self)},function(t,e){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){(function(e){t.exports={isFunction:function(t){return t&&"[object Function]"==={}.toString.call(t)},base64:function(t){return e.window={},window&&window.btoa?window.btoa(t):Buffer?Buffer.from(t).toString("base64"):void 0}}}).call(this,s(2))},function(t,e,s){"use strict";var n=s(5),i=s(8),r=s(9),o=s(10),a=s(3),u=s(11),c=200;t.exports=function(t,e){this.sitekey=t,this.privatekey=e,this.apiHostname="api.addsearch.com",this.settings=new o,this.sessionId=("a-"+1e8*Math.random()).substring(0,10),this.search=function(t,e){var s=null,i=null;if(t&&a.isFunction(e))s=t,i=e;else if(!e&&a.isFunction(t))s=this.settings.getSettings().keyword,i=t;else{if(!this.settings.getSettings().callback)throw"Illegal search parameters. Should be (keyword, callbackFunction) or (callbackFunction)";s=this.settings.getSettings().keyword,i=this.settings.getSettings().callback}this.settings.setCallback(i),this.settings.setKeyword(s),this.throttledSearchFetch||(this.throttledSearchFetch=u(c,n)),this.throttledSearchFetch(this.apiHostname,this.sitekey,"search",this.settings.getSettings(),i)},this.suggestions=function(t,e){if(!t||!e||!a.isFunction(e))throw"Illegal suggestions parameters. Should be (prefix, callbackFunction)";this.settings.setSuggestionsPrefix(t),this.throttledSuggestionsFetch||(this.throttledSuggestionsFetch=u(c,n)),this.throttledSuggestionsFetch(this.apiHostname,this.sitekey,"suggest",this.settings.getSettings(),e)},this.autocomplete=function(t,e,s){if(!(t&&e&&s&&a.isFunction(s)))throw"Illegal autocomplete parameters. Should be (field, prefix, callbackFunction)";this.settings.setAutocompleteParams(t,e),this.throttledAutocompleteFetch||(this.throttledAutocompleteFetch=u(c,n)),this.throttledAutocompleteFetch(this.apiHostname,this.sitekey,"autocomplete",this.settings.getSettings(),s)},this.getDocument=function(t){return i.getDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.saveDocument=function(t){return i.saveDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.saveDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of documents: {documents: []}";return i.saveDocumentsBatch(this.apiHostname,this.sitekey,this.privatekey,t)},this.deleteDocument=function(t){return i.deleteDocument(this.apiHostname,this.sitekey,this.privatekey,t)},this.deleteDocumentsBatch=function(t){if(!t||!t.documents||!Array.isArray(t.documents))throw"Please provide an array of document ids: {documents: []}";return i.deleteDocumentsBatch(this.apiHostname,this.sitekey,this.privatekey,t)},this.setApiHostname=function(t){this.apiHostname=t},this.getSettings=function(){return this.settings.getSettings()},this.setLanguage=function(t){this.settings.setLanguage(t)},this.setCategoryFilters=function(t){this.settings.setCategoryFilters(t)},this.addCustomFieldFilter=function(t,e){this.settings.addCustomFieldFilter(t,e)},this.removeCustomFieldFilter=function(t,e){this.settings.removeCustomFieldFilter(t,e)},this.setPriceRangeFilter=function(t,e){this.settings.setPriceRangeFilter(t,e)},this.setDateFilter=function(t,e){this.settings.setDateFilter(t,e)},this.setJWT=function(t){this.settings.setJWT(t)},this.setUserToken=function(t){this.settings.setUserToken(t)},this.setPaging=function(t,e,s,n){this.settings.setPaging(t,e,s,n)},this.nextPage=function(){this.settings.nextPage()},this.previousPage=function(){this.settings.previousPage()},this.setSuggestionsSize=function(t){this.settings.setSuggestionsSize(t)},this.setAutocompleteSize=function(t){this.settings.setAutocompleteSize(t)},this.addFacetField=function(t){this.settings.addFacetField(t)},this.addRangeFacet=function(t,e){this.settings.addRangeFacet(t,e)},this.addStatsField=function(t){this.settings.addStatsField(t)},this.setNumberOfFacets=function(t){this.settings.setNumberOfFacets(t)},this.setResultType=function(t){this.settings.setResultType(t)},this.setPersonalizationEvents=function(t){this.settings.setPersonalizationEvents(t)},this.setFilterObject=function(t){this.settings.setFilterObject(t)},this.setShuffleAndLimitTo=function(t){this.settings.setShuffleAndLimitTo(t)},this.setFuzzyMatch=function(t){this.settings.setFuzzyMatch(t)},this.setPostfixWildcard=function(t){this.settings.setPostfixWildcard(t)},this.setCollectAnalytics=function(t){this.settings.setCollectAnalytics(t)},this.setThrottleTime=function(t){c=t},this.setStatsSessionId=function(t){this.sessionId=t},this.getStatsSessionId=function(){return this.sessionId},this.enableLogicalOperators=function(t){this.settings.enableLogicalOperators(t)},this.sendStatsEvent=function(t,e,s){if("search"===t){s={action:"search",session:this.sessionId,keyword:e,numberOfResults:s.numberOfResults};r(this.apiHostname,this.sitekey,s)}else{if("click"!==t)throw"Illegal sendStatsEvent type parameters. Should be search or click)";s={action:"click",session:this.sessionId,keyword:e,docid:s.documentId,position:s.position};r(this.apiHostname,this.sitekey,s)}},this.searchResultClicked=function(t,e){this.sendStatsEvent("click",this.settings.getSettings().keyword,{documentId:t,position:e})}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function t(e,s,n,i,r,o){var a=function(t,e){return t||!1===t?"&"+e+"="+t:""};if("search"===n||"suggest"===n||"autocomplete"===n){var u="",c="",h=null;if("search"===n){h=n,u=i.keyword,u=i.enableLogicalOperators?u.replace(/ and /g," AND ").replace(/ or /g," OR ").replace(/ not /g," NOT "):u.replace(/ AND /g," and ").replace(/ OR /g," or ").replace(/ NOT /g," not "),u=encodeURIComponent(u);var f=i.fuzzy;if("retry"===f&&(f=!0===o),"search"===n){if(c=a(i.lang,"lang")+a(f,"fuzzy")+a(i.collectAnalytics,"collectAnalytics")+a(i.postfixWildcard,"postfixWildcard")+a(i.categories,"categories")+a(i.priceFromCents,"priceFromCents")+a(i.priceToCents,"priceToCents")+a(i.dateFrom,"dateFrom")+a(i.dateTo,"dateTo")+a(i.paging.page,"page")+a(i.paging.pageSize,"limit")+a(i.paging.sortBy,"sort")+a(i.paging.sortOrder,"order")+a(i.shuffleAndLimitTo,"shuffleAndLimitTo")+a(i.jwt,"jwt")+a(i.resultType,"resultType")+a(i.userToken,"userToken")+a(i.numFacets,"numFacets"),i.customFieldFilters)for(var l=0;l<i.customFieldFilters.length;l++)c=c+"&customField="+i.customFieldFilters[l];if(i.facetFields)for(l=0;l<i.facetFields.length;l++)c=c+"&facet="+i.facetFields[l];if(i.rangeFacets&&(c=c+"&rangeFacets="+JSON.stringify(i.rangeFacets)),i.statsFields)for(l=0;l<i.statsFields.length;l++)c=c+"&fieldStat="+i.statsFields[l];if(i.personalizationEvents&&Array.isArray(i.personalizationEvents))for(l=0;l<i.personalizationEvents.length;l++){var d=i.personalizationEvents[l],p=Object.keys(d);c=c+"&personalizationEvent="+encodeURIComponent(p+"="+d[p])}i.filterObject&&(c=c+"&filter="+JSON.stringify(i.filterObject))}}else"suggest"===n?(h=n,c=a(i.suggestionsSize,"size"),u=i.suggestionsPrefix):"autocomplete"===n&&(h="autocomplete/document-field",c=a(i.autocomplete.field,"source")+a(i.autocomplete.size,"size"),u=i.autocomplete.prefix);fetch("https://"+e+"/v1/"+h+"/"+s+"?term="+u+c).then((function(t){return t.json()})).then((function(e){if("search"===n&&"retry"===i.fuzzy&&0===e.total_hits&&!0!==o)t(s,n,i,r,!0);else{if(!0===o){var a=i.paging.pageSize;e.total_hits>=a&&(e.total_hits=a)}r(e)}})).catch((function(t){console.log(t),r({error:{response:500,message:"invalid server response"}})}))}else r({error:{response:400,message:"invalid query type"}})}},function(t,e){var s,n,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(s===setTimeout)return setTimeout(t,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(t,0);try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(t){s=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var u,c=[],h=!1,f=-1;function l(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=a(l);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)e[s-1]=arguments[s];c.push(new p(t,e)),1!==c.length||h||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,s){"use strict";s.r(e),s.d(e,"Headers",(function(){return p})),s.d(e,"Request",(function(){return F})),s.d(e,"Response",(function(){return _})),s.d(e,"DOMException",(function(){return S})),s.d(e,"fetch",(function(){return x}));var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==n&&n,i="URLSearchParams"in n,r="Symbol"in n&&"iterator"in Symbol,o="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in n,u="ArrayBuffer"in n;if(u)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function f(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return r&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function g(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(e,s){t.onload=function(){e(t.result)},t.onerror=function(){s(t.error)}}))}function m(t){var e=new FileReader,s=y(e);return e.readAsArrayBuffer(t),s}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&o&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||h(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=g(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=g(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(m)}),this.text=function(){var t,e,s,n=g(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,s=y(e),e.readAsText(t),s;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),s=new Array(e.length),n=0;n<e.length;n++)s[n]=String.fromCharCode(e[n]);return s.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=f(t),e=l(e);var s=this.map[t];this.map[t]=s?s+", "+e:e},p.prototype.delete=function(t){delete this.map[f(t)]},p.prototype.get=function(t){return t=f(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(f(t))},p.prototype.set=function(t,e){this.map[f(t)]=l(e)},p.prototype.forEach=function(t,e){for(var s in this.map)this.map.hasOwnProperty(s)&&t.call(e,this.map[s],s,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,s){t.push(s)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,s){t.push([s,e])})),d(t)},r&&(p.prototype[Symbol.iterator]=p.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function F(t,e){if(!(this instanceof F))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var s,n,i=(e=e||{}).body;if(t instanceof F){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(s=e.method||this.method||"GET",n=s.toUpperCase(),w.indexOf(n)>-1?n:s),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function T(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var s=t.split("="),n=s.shift().replace(/\+/g," "),i=s.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(i))}})),e}function _(t,e){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}F.prototype.clone=function(){return new F(this,{body:this._bodyInit})},v.call(F.prototype),v.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},_.error=function(){var t=new _(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];_.redirect=function(t,e){if(-1===A.indexOf(e))throw new RangeError("Invalid status code");return new _(null,{status:e,headers:{location:t}})};var S=n.DOMException;try{new S}catch(t){(S=function(t,e){this.message=t,this.name=e;var s=Error(t);this.stack=s.stack}).prototype=Object.create(Error.prototype),S.prototype.constructor=S}function x(t,e){return new Promise((function(s,i){var r=new F(t,e);if(r.signal&&r.signal.aborted)return i(new S("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var s=t.split(":"),n=s.shift().trim();if(n){var i=s.join(":").trim();e.append(n,i)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;setTimeout((function(){s(new _(i,n))}),0)},a.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},a.onabort=function(){setTimeout((function(){i(new S("Aborted","AbortError"))}),0)},a.open(r.method,function(t){try{return""===t&&n.location.href?n.location.href:t}catch(e){return t}}(r.url),!0),"include"===r.credentials?a.withCredentials=!0:"omit"===r.credentials&&(a.withCredentials=!1),"responseType"in a&&(o?a.responseType="blob":u&&r.headers.get("Content-Type")&&-1!==r.headers.get("Content-Type").indexOf("application/octet-stream")&&(a.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof p?r.headers.forEach((function(t,e){a.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){a.setRequestHeader(t,l(e.headers[t]))})),r.signal&&(r.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&r.signal.removeEventListener("abort",c)}),a.send(void 0===r._bodyInit?null:r._bodyInit)}))}x.polyfill=!0,n.fetch||(n.fetch=x,n.Headers=p,n.Request=F,n.Response=_)},function(t,e,s){"use strict";s(1);var n=s(3),i=s(0).Promise,r=function(t,e){return{Authorization:"Basic "+n.base64(t+":"+e),"Content-Type":"application/json"}};t.exports={getDocument:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents/"+n,{method:"GET",headers:r(e,s)}).then((function(t){200==t.status?i(t.json()):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},saveDocument:function(t,e,s,n){var o=n.id||n.url;return new i((function(i,a){fetch("https://"+t+"/v2/indices/"+e+"/documents/",{method:o?"PUT":"POST",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):a({status:t.status,text:t.statusText})})).catch((function(t){a({status:400,text:t})}))}))},saveDocumentsBatch:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents:batch",{method:"PUT",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},deleteDocument:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents/"+n,{method:"DELETE",headers:r(e,s)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))},deleteDocumentsBatch:function(t,e,s,n){return new i((function(i,o){fetch("https://"+t+"/v2/indices/"+e+"/documents:batch",{method:"DELETE",headers:r(e,s),body:JSON.stringify(n)}).then((function(t){202==t.status?i({status:t.status,text:t.statusText}):o({status:t.status,text:t.statusText})})).catch((function(t){o({status:400,text:t})}))}))}}},function(t,e,s){"use strict";s(0).polyfill(),s(1);t.exports=function(t,e,s){"undefined"!=typeof window&&window.navigator&&window.navigator.sendBeacon?navigator.sendBeacon("https://"+t+"/v1/stats/"+e+"/",JSON.stringify(s)):fetch("https://"+t+"/v1/stats/"+e+"/",{method:"POST",headers:{"Content-Type":"text/plain"},body:JSON.stringify(s)})}},function(t,e,s){"use strict";t.exports=function(){this.settings={keyword:"*",callback:null,fuzzy:"auto",paging:{page:1,pageSize:10,sortBy:"relevance",sortOrder:"desc"},customFieldFilters:[],userToken:null,suggestionsSize:10,facetFields:[],autocomplete:{size:10},enableLogicalOperators:!1},this.getSettings=function(){return this.settings},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setCallback=function(t){this.settings.callback=t},this.setSuggestionsPrefix=function(t){this.settings.suggestionsPrefix=t},this.setSuggestionsSize=function(t){this.settings.suggestionsSize=t},this.setAutocompleteSize=function(t){this.settings.autocomplete.size=t},this.setAutocompleteParams=function(t,e){this.settings.autocomplete.field=t,this.settings.autocomplete.prefix=e},this.setLanguage=function(t){if(t&&2!==t.length)throw'use 2-char language code (e.g. "en")';this.settings.lang=t},this.setFuzzyMatch=function(t){if(!0!==t&&!1!==t&&"auto"!==t&&"retry"!==t)throw"fuzzy matching can be true, false, 'auto', or 'retry'";this.settings.fuzzy=t},this.enableLogicalOperators=function(t){this.settings.enableLogicalOperators=t},this.setPostfixWildcard=function(t){this.settings.postfixWildcard=t},this.setCollectAnalytics=function(t){this.settings.collectAnalytics=t},this.setCategoryFilters=function(t){this.settings.categories=t},this.setFilterObject=function(t){this.settings.filterObject=t},this.setPriceRangeFilter=function(t,e){this.settings.priceFromCents=t,this.settings.priceToCents=e},this.addCustomFieldFilter=function(t,e){var s=encodeURIComponent(t+"="+e);-1===this.settings.customFieldFilters.indexOf(s)&&this.settings.customFieldFilters.push(s)},this.removeCustomFieldFilter=function(t,e){var s=!1,n=encodeURIComponent(t+"="+e);e||(s=!0,n=encodeURIComponent(t+"="));for(var i=this.settings.customFieldFilters.length;i>0;i--){var r=this.settings.customFieldFilters[i-1];(s&&0===r.indexOf(n)||r===n)&&this.settings.customFieldFilters.splice(i-1,1)}},this.setDateFilter=function(t,e){this.settings.dateFrom=t,this.settings.dateTo=e},this.setKeyword=function(t){this.settings.keyword=t||"*"},this.setJWT=function(t){this.settings.jwt=t},this.setUserToken=function(t){this.settings.userToken=t},this.setPersonalizationEvents=function(t){this.settings.personalizationEvents=t},this.setResultType=function(t){this.settings.resultType=t},this.addFacetField=function(t){-1===this.settings.facetFields.indexOf(t)&&this.settings.facetFields.push(t)},this.addRangeFacet=function(t,e){this.settings.rangeFacets||(this.settings.rangeFacets=[]),this.settings.rangeFacets.push({field:t,ranges:e})},this.addStatsField=function(t){this.settings.statsFields||(this.settings.statsFields=[]),-1===this.settings.statsFields.indexOf(t)&&this.settings.statsFields.push(t)},this.setNumberOfFacets=function(t){this.settings.numFacets=t},this.setPaging=function(t,e,s,n){if(t<1)throw"page must be 1 or bigger";if(e<1||e>300)throw"pageSize must be 1-300";if("asc"!==n&&"desc"!==n)throw"sortOrder must be asc or desc";this.settings.paging.page=t,this.settings.paging.pageSize=e,this.settings.paging.sortBy=s,this.settings.paging.sortOrder=n},this.setShuffleAndLimitTo=function(t){this.settings.shuffleAndLimitTo=t},this.nextPage=function(){this.settings.paging.page=this.settings.paging.page+1},this.previousPage=function(){this.settings.paging.page>0&&(this.settings.paging.page=this.settings.paging.page-1)}}},function(t,e){t.exports=function(t,e){var s,n=0;function i(){s&&clearTimeout(s)}return function(){var r=this,o=Date.now()-n,a=arguments;function u(){n=Date.now(),e.apply(r,a)}i(),o>t?u():s=setTimeout(u,t-o)}}}]); |
{ | ||
"name": "addsearch-js-client", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "AddSearch API JavaScript client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -200,2 +200,10 @@ # AddSearch Search API Client for JavaScript | ||
#### Set enableLogicalOperators | ||
```js | ||
// (default: false) | ||
// enableLogicalOperators(true) = Support user specified logical operators (and/or/not) in the search query like "cat and dog" | ||
// enableLogicalOperators(false) = Treat logical operators in the search query as literal strings | ||
client.enableLogicalOperators(true); | ||
``` | ||
### Facets | ||
@@ -529,2 +537,2 @@ ```js | ||
Feel free to send any questions, ideas, and suggestions at [support@addsearch.com](mailto:support@addsearch.com) or | ||
visit [addsearch.com](https://www.addsearch.com/) for more information. | ||
visit [addsearch.com](https://www.addsearch.com/) for more information. |
@@ -19,3 +19,3 @@ 'use strict'; | ||
return ''; | ||
} | ||
}; | ||
@@ -45,3 +45,5 @@ | ||
// Boolean operators (AND, OR, NOT) uppercase | ||
kw = kw.replace(/ and /g, ' AND ').replace(/ or /g, ' OR ').replace(/ not /g, ' NOT '); | ||
kw = settings.enableLogicalOperators ? | ||
kw.replace(/ and /g, ' AND ').replace(/ or /g, ' OR ').replace(/ not /g, ' NOT ') : | ||
kw.replace(/ AND /g, ' and ').replace(/ OR /g, ' or ').replace(/ NOT /g, ' not '); | ||
@@ -178,2 +180,2 @@ // Escape | ||
}; | ||
module.exports = executeApiFetch; | ||
module.exports = executeApiFetch; |
@@ -162,2 +162,3 @@ 'use strict'; | ||
this.getStatsSessionId = function() { return this.sessionId; } | ||
this.enableLogicalOperators = function(enableLogicalOperators) { this.settings.enableLogicalOperators(enableLogicalOperators) } | ||
@@ -198,2 +199,2 @@ this.sendStatsEvent = function(type, keyword, data) { | ||
module.exports = client; | ||
module.exports = client; |
@@ -20,3 +20,4 @@ 'use strict'; | ||
size: 10 | ||
} | ||
}, | ||
enableLogicalOperators: false | ||
}; | ||
@@ -67,2 +68,6 @@ | ||
this.enableLogicalOperators = function(enableLogicalOperators) { | ||
this.settings.enableLogicalOperators = enableLogicalOperators; | ||
} | ||
this.setPostfixWildcard = function(wildcard) { | ||
@@ -205,2 +210,2 @@ this.settings.postfixWildcard = wildcard; | ||
module.exports = settings; | ||
module.exports = settings; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79253
872
537