@pretto/places 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,8 @@ export interface CountriesApiResult {
10
10
  libenr: string;
11
11
  }
12
12
  interface Options {
13
- limit: number;
13
+ limit?: number;
14
+ language?: 'fr' | 'en';
14
15
  }
15
16
  export declare const init: (appId: string, apiKey: string, options?: AlgoliaSearchOptions | undefined) => "An error occurred." | {
16
17
  get(search: string, options?: Options | undefined): Promise<CountriesSearchResult[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"countrySearch.d.ts","sourceRoot":"","sources":["../src/countrySearch.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAA;AAIjF,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAsBD,eAAO,MAAM,IAAI,UAAW,MAAM,UAAU,MAAM;gBAK1B,MAAM;CAS7B,CAAA"}
1
+ {"version":3,"file":"countrySearch.d.ts","sourceRoot":"","sources":["../src/countrySearch.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAA;AAIjF,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,OAAO;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACvB;AAyBD,eAAO,MAAM,IAAI,UAAW,MAAM,UAAU,MAAM;gBAK1B,MAAM;CAS7B,CAAA"}
package/dist/index.js CHANGED
@@ -230,10 +230,12 @@ var addressSearch = /*#__PURE__*/Object.freeze({
230
230
  });
231
231
 
232
232
  const get$2 = (instance, search, options) => __awaiter(void 0, void 0, void 0, function* () {
233
+ const selectedLanguage = (options === null || options === void 0 ? void 0 : options.language) || 'fr';
234
+ const indexName = selectedLanguage === 'fr' ? 'Countries' : 'CountriesEN';
233
235
  if (!search)
234
236
  return [];
235
237
  const { limit = 5 } = options || {};
236
- const data = yield instance.initIndex('Countries').search(search, {
238
+ const data = yield instance.initIndex(indexName).search(search, {
237
239
  hitsPerPage: limit,
238
240
  });
239
241
  return data.hits.reduce((acc, { codeiso2, cog, libcog, libenr }) => {
package/dist/module.js CHANGED
@@ -220,10 +220,12 @@ var addressSearch = /*#__PURE__*/Object.freeze({
220
220
  });
221
221
 
222
222
  const get$2 = (instance, search, options) => __awaiter(void 0, void 0, void 0, function* () {
223
+ const selectedLanguage = (options === null || options === void 0 ? void 0 : options.language) || 'fr';
224
+ const indexName = selectedLanguage === 'fr' ? 'Countries' : 'CountriesEN';
223
225
  if (!search)
224
226
  return [];
225
227
  const { limit = 5 } = options || {};
226
- const data = yield instance.initIndex('Countries').search(search, {
228
+ const data = yield instance.initIndex(indexName).search(search, {
227
229
  hitsPerPage: limit,
228
230
  });
229
231
  return data.hits.reduce((acc, { codeiso2, cog, libcog, libenr }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",