diff --git a/README.md b/README.md index 914b6d2..2985f15 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ This library is an Afosto search client plugin for the open-source InstantSearch.js library (powered by Algolia). With this plugin you can use the amazing widgets of the InstantSearch.js library, while communicating with the Afosto search API.

-## 🚧 Currently in development 🚧 - ## Installation ### Basic @@ -114,7 +112,7 @@ For more information check the React InstantSearch [documentation](https://www.a ## Compatibility - InstantSearch.js v4 -- Node >= 12.10 +- Node >= 14 ## License diff --git a/package.json b/package.json index 94ef079..32793d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@afosto/instant-search-client", - "version": "0.3.3", + "version": "1.0.0", "private": false, "description": "The Afosto InstantSearch client", "main": "./dist/afosto-instant-search.min.js", diff --git a/playground/index.html b/playground/index.html index e810ae7..0849cb1 100644 --- a/playground/index.html +++ b/playground/index.html @@ -37,10 +37,10 @@

Brands

-

Color

-
+

Supplier

+
-

Price

+

Length

@@ -80,7 +80,7 @@

Products

instantsearch.widgets.refinementList({ container: '#brand-list', - attribute: 'merk', + attribute: 'Brand', operator: 'and', searchable: false, showMore: true, @@ -88,17 +88,17 @@

Products

}), instantsearch.widgets.refinementList({ - container: '#color-list', - attribute: 'kleur', + container: '#supplier-list', + attribute: 'Supplier', operator: 'and', - searchable: true, + searchable: false, showMore: true, showMoreLimit: 500, }), instantsearch.widgets.rangeSlider({ container: '#range-slider', - attribute: 'price', + attribute: 'Length', precision: 0, step: 1, }), @@ -126,11 +126,15 @@

Products

{{metadata.name}}
- {{metadata.name}} + {{title}}
-
Brand: {{metadata.brand}}
+
Brand: {{Brand}}
+
Length: {{Length}}
- €{{metadata.price}} + {{description}} +
+
+ €{{price}}
`, diff --git a/src/afostoInstantSearch.js b/src/afostoInstantSearch.js index 505e9a8..da9b374 100644 --- a/src/afostoInstantSearch.js +++ b/src/afostoInstantSearch.js @@ -30,7 +30,7 @@ const afostoInstantSearch = (proxyId, options) => { Accept: 'application/vnd.instantsearch+json', ...(requestOptions.headers || {}), }, - body: JSON.stringify(payload), + body: JSON.stringify({ data: payload }), }); const response = await searchResponse.json(); diff --git a/src/constants.js b/src/constants.js index 210f312..5a73a6c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,6 +1,6 @@ export const DEFAULT_OPTIONS = { allowEmptyQuery: true, - baseUrl: 'https://api.afosto.io/cnt/instant/search/{proxyId}', + baseUrl: 'https://afosto.io/api/instant/search/{proxyId}', hitsPerPage: 10, requestOptions: {}, threshold: 1,