@pretto/places 0.44.0 → 0.46.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.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { CustomFetchOptions, LongLat, MunicipalitySearchResult } from './types';
2
- declare type SearchType = 'city' | 'zipcode' | 'coordinates';
3
- export declare const searchPlaces: (searchValue: string | LongLat, options?: CustomFetchOptions | undefined, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
4
- export declare const searchDepartment: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<import("./types").DepartmentSearchResult[]>;
5
- export declare const searchAddress: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<import("./types").AddressSearchResult[]>;
2
+ type SearchType = 'city' | 'zipcode' | 'coordinates';
3
+ export declare const searchPlaces: (searchValue: string | LongLat, options?: CustomFetchOptions, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
4
+ export declare const searchDepartment: (searchValue: string, options?: CustomFetchOptions) => Promise<import("./types").DepartmentSearchResult[]>;
5
+ export declare const searchAddress: (searchValue: string, options?: CustomFetchOptions) => Promise<import("./types").AddressSearchResult[]>;
6
6
  export * as searchCountry from './searchByCountry';
7
7
  /**
8
8
  * @deprecated Use searchPlaces instead
9
9
  */
10
- export declare const municipalitySearch: (searchValue: string | LongLat, options?: CustomFetchOptions | undefined, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
10
+ export declare const municipalitySearch: (searchValue: string | LongLat, options?: CustomFetchOptions, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
11
11
  /**
12
12
  * @deprecated Use searchPlaces instead
13
13
  */
14
- export declare const geolocSearch: (searchValue: string | LongLat, options?: CustomFetchOptions | undefined, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
14
+ export declare const geolocSearch: (searchValue: string | LongLat, options?: CustomFetchOptions, searchType?: SearchType[]) => Promise<MunicipalitySearchResult[]>;
15
15
  /**
16
16
  * @deprecated Use searchByCoordinates instead
17
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEhF,aAAK,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAA;AAEpD,eAAO,MAAM,YAAY,gBACV,MAAM,GAAG,OAAO,yDAEjB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAmCpC,CAAA;AAED,eAAO,MAAM,gBAAgB,gBAAuB,MAAM,kGAWzD,CAAA;AAED,eAAO,MAAM,aAAa,gBAAuB,MAAM,+FAOtD,CAAA;AAED,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAA;AAIlD;;GAEG;AACH,eAAO,MAAM,kBAAkB,gBArEhB,MAAM,GAAG,OAAO,yDAEjB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAkES,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,YAAY,gBA1EV,MAAM,GAAG,OAAO,yDAEjB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAuEG,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,mBAAmB,qHAAsB,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,aAAa,qHAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEhF,KAAK,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CAAA;AAEpD,eAAO,MAAM,YAAY,gBACV,MAAM,GAAG,OAAO,YACnB,kBAAkB,eAChB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAmCpC,CAAA;AAED,eAAO,MAAM,gBAAgB,gBAAuB,MAAM,YAAY,kBAAkB,wDAWvF,CAAA;AAED,eAAO,MAAM,aAAa,gBAAuB,MAAM,YAAY,kBAAkB,qDAOpF,CAAA;AAED,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAA;AAIlD;;GAEG;AACH,eAAO,MAAM,kBAAkB,gBArEhB,MAAM,GAAG,OAAO,YACnB,kBAAkB,eAChB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAkES,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,YAAY,gBA1EV,MAAM,GAAG,OAAO,YACnB,kBAAkB,eAChB,UAAU,EAAE,KACvB,QAAQ,wBAAwB,EAAE,CAuEG,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,mBAAmB,qHAAsB,CAAA;AAEtD;;GAEG;AACH,eAAO,MAAM,aAAa,qHAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var algoliasearch__default = /*#__PURE__*/_interopDefaultLegacy(algoliasearch);
10
10
 
11
- /*! *****************************************************************************
11
+ /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
13
13
 
14
14
  Permission to use, copy, modify, and/or distribute this software for any
@@ -31,7 +31,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
31
31
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
32
  step((generator = generator.apply(thisArg, _arguments || [])).next());
33
33
  });
34
- }
34
+ }
35
+
36
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
37
+ var e = new Error(message);
38
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
39
+ };
35
40
 
36
41
  let controller = { current: null };
37
42
  const getSignal = () => {
@@ -53,20 +58,9 @@ const DEFAULT_DEBOUNCE_TIME = 300;
53
58
  let getDelayedData = null;
54
59
  const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* () {
55
60
  try {
56
- const response = yield fetch(url, {
57
- signal,
58
- headers: {
59
- Accept: 'application/json',
60
- 'Content-Type': 'application/json',
61
- },
62
- mode: 'cors',
63
- credentials: 'same-origin',
64
- cache: 'no-cache',
65
- redirect: 'follow',
66
- referrerPolicy: 'no-referrer',
67
- });
61
+ const response = yield fetch(url, { signal });
68
62
  if (!response.ok) {
69
- throw new Error(`Erreur HTTP: ${response.status} - ${response.statusText}`);
63
+ throw new Error('Error: ' + response.status);
70
64
  }
71
65
  return response;
72
66
  }
@@ -74,9 +68,6 @@ const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* (
74
68
  if (error instanceof DOMException && error.name === 'AbortError') {
75
69
  return new Promise(() => { });
76
70
  }
77
- if (error instanceof Error) {
78
- throw new Error(`Erreur lors de la requête: ${error.message}`);
79
- }
80
71
  throw error;
81
72
  }
82
73
  });
@@ -269,8 +260,7 @@ const get = (instance, search, options) => __awaiter(void 0, void 0, void 0, fun
269
260
  return acc;
270
261
  const formatCountryName = convertFirstLetterToUpperCase(libcog.includes('(') ? libenr : libcog);
271
262
  const formatCog = !cog.includes('X') ? `(${cog})` : '';
272
- const label = `${formatCountryName} ${formatCog}`;
273
- return [...acc, { label, value: codeiso2.toLowerCase() }];
263
+ return [...acc, { label: formatCountryName, value: codeiso2.toLowerCase(), cog: formatCog }];
274
264
  }, []);
275
265
  });
276
266
  const init = (appId, apiKey, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"customFetch.d.ts","sourceRoot":"","sources":["../../src/lib/customFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsC9C,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA"}
1
+ {"version":3,"file":"customFetch.d.ts","sourceRoot":"","sources":["../../src/lib/customFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAwB9C,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC3G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA"}
package/dist/module.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import algoliasearch from 'algoliasearch';
2
2
 
3
- /*! *****************************************************************************
3
+ /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
5
5
 
6
6
  Permission to use, copy, modify, and/or distribute this software for any
@@ -23,7 +23,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
23
23
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24
24
  step((generator = generator.apply(thisArg, _arguments || [])).next());
25
25
  });
26
- }
26
+ }
27
+
28
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
29
+ var e = new Error(message);
30
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
31
+ };
27
32
 
28
33
  let controller = { current: null };
29
34
  const getSignal = () => {
@@ -45,20 +50,9 @@ const DEFAULT_DEBOUNCE_TIME = 300;
45
50
  let getDelayedData = null;
46
51
  const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* () {
47
52
  try {
48
- const response = yield fetch(url, {
49
- signal,
50
- headers: {
51
- Accept: 'application/json',
52
- 'Content-Type': 'application/json',
53
- },
54
- mode: 'cors',
55
- credentials: 'same-origin',
56
- cache: 'no-cache',
57
- redirect: 'follow',
58
- referrerPolicy: 'no-referrer',
59
- });
53
+ const response = yield fetch(url, { signal });
60
54
  if (!response.ok) {
61
- throw new Error(`Erreur HTTP: ${response.status} - ${response.statusText}`);
55
+ throw new Error('Error: ' + response.status);
62
56
  }
63
57
  return response;
64
58
  }
@@ -66,9 +60,6 @@ const fetchData = (url, signal) => __awaiter(void 0, void 0, void 0, function* (
66
60
  if (error instanceof DOMException && error.name === 'AbortError') {
67
61
  return new Promise(() => { });
68
62
  }
69
- if (error instanceof Error) {
70
- throw new Error(`Erreur lors de la requête: ${error.message}`);
71
- }
72
63
  throw error;
73
64
  }
74
65
  });
@@ -261,8 +252,7 @@ const get = (instance, search, options) => __awaiter(void 0, void 0, void 0, fun
261
252
  return acc;
262
253
  const formatCountryName = convertFirstLetterToUpperCase(libcog.includes('(') ? libenr : libcog);
263
254
  const formatCog = !cog.includes('X') ? `(${cog})` : '';
264
- const label = `${formatCountryName} ${formatCog}`;
265
- return [...acc, { label, value: codeiso2.toLowerCase() }];
255
+ return [...acc, { label: formatCountryName, value: codeiso2.toLowerCase(), cog: formatCog }];
266
256
  }, []);
267
257
  });
268
258
  const init = (appId, apiKey, options) => {
@@ -1,3 +1,3 @@
1
1
  import { AddressSearchResult, CustomFetchOptions } from './types';
2
- export declare const searchByAddress: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<AddressSearchResult[]>;
2
+ export declare const searchByAddress: (searchValue: string, options?: CustomFetchOptions) => Promise<AddressSearchResult[]>;
3
3
  //# sourceMappingURL=searchByAddress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByAddress.d.ts","sourceRoot":"","sources":["../src/searchByAddress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAalE,eAAO,MAAM,eAAe,gBACb,MAAM,+CAElB,QAAQ,mBAAmB,EAAE,CAuB/B,CAAA"}
1
+ {"version":3,"file":"searchByAddress.d.ts","sourceRoot":"","sources":["../src/searchByAddress.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAalE,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,mBAAmB,EAAE,CAuB/B,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { CustomFetchOptions, LongLat, MunicipalitySearchResult } from './types';
2
- export declare const searchByCoordinates: ({ latitude, longitude }: LongLat, options?: CustomFetchOptions | undefined) => Promise<MunicipalitySearchResult[]>;
2
+ export declare const searchByCoordinates: ({ latitude, longitude }: LongLat, options?: CustomFetchOptions) => Promise<MunicipalitySearchResult[]>;
3
3
  //# sourceMappingURL=searchByCoordinates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByCoordinates.d.ts","sourceRoot":"","sources":["../src/searchByCoordinates.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE9F,eAAO,MAAM,mBAAmB,4BACL,OAAO,+CAE/B,QAAQ,wBAAwB,EAAE,CAiBpC,CAAA"}
1
+ {"version":3,"file":"searchByCoordinates.d.ts","sourceRoot":"","sources":["../src/searchByCoordinates.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAE9F,eAAO,MAAM,mBAAmB,4BACL,OAAO,YACtB,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CAiBpC,CAAA"}
@@ -4,8 +4,8 @@ interface Options {
4
4
  limit?: number;
5
5
  language?: 'fr' | 'en';
6
6
  }
7
- export declare const init: (appId: string, apiKey: string, options?: AlgoliaSearchOptions | undefined) => "An error occurred." | {
8
- get(search: string, options?: Options | undefined): Promise<CountriesSearchResult[]>;
7
+ export declare const init: (appId: string, apiKey: string, options?: AlgoliaSearchOptions) => "An error occurred." | {
8
+ get(search: string, options?: Options): Promise<CountriesSearchResult[]>;
9
9
  };
10
10
  export {};
11
11
  //# sourceMappingURL=searchByCountry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByCountry.d.ts","sourceRoot":"","sources":["../src/searchByCountry.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAC;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAShD,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"}
1
+ {"version":3,"file":"searchByCountry.d.ts","sourceRoot":"","sources":["../src/searchByCountry.ts"],"names":[],"mappings":"AAAA,OAAsB,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAA;AAGjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAS/C,UAAU,OAAO;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;CACvB;AAwBD,eAAO,MAAM,IAAI,UAAW,MAAM,UAAU,MAAM,YAAY,oBAAoB;gBAK1D,MAAM,YAAY,OAAO;CAShD,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { CustomFetchOptions, DepartmentSearchResult } from './types';
2
- export declare const searchByDepartment: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<DepartmentSearchResult[]>;
2
+ export declare const searchByDepartment: (searchValue: string, options?: CustomFetchOptions) => Promise<DepartmentSearchResult[]>;
3
3
  //# sourceMappingURL=searchByDepartment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByDepartment.d.ts","sourceRoot":"","sources":["../src/searchByDepartment.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,kBAAkB,EAAE,sBAAsB,EAC7C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,gBAChB,MAAM,+CAElB,QAAQ,sBAAsB,EAAE,CA4BlC,CAAA"}
1
+ {"version":3,"file":"searchByDepartment.d.ts","sourceRoot":"","sources":["../src/searchByDepartment.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,kBAAkB,EAAE,sBAAsB,EAC7C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kBAAkB,gBAChB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,sBAAsB,EAAE,CA4BlC,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { CustomFetchOptions, MunicipalitySearchResult } from './types';
2
- export declare const searchByMunicipality: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<MunicipalitySearchResult[]>;
2
+ export declare const searchByMunicipality: (searchValue: string, options?: CustomFetchOptions) => Promise<MunicipalitySearchResult[]>;
3
3
  //# sourceMappingURL=searchByMunicipality.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByMunicipality.d.ts","sourceRoot":"","sources":["../src/searchByMunicipality.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAoBrF,eAAO,MAAM,oBAAoB,gBAClB,MAAM,+CAElB,QAAQ,wBAAwB,EAAE,CA+CpC,CAAA"}
1
+ {"version":3,"file":"searchByMunicipality.d.ts","sourceRoot":"","sources":["../src/searchByMunicipality.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAoBrF,eAAO,MAAM,oBAAoB,gBAClB,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CA+CpC,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { CustomFetchOptions, MunicipalitySearchResult } from './types';
2
- export declare const searchByZipcode: (searchValue: string, options?: CustomFetchOptions | undefined) => Promise<MunicipalitySearchResult[]>;
2
+ export declare const searchByZipcode: (searchValue: string, options?: CustomFetchOptions) => Promise<MunicipalitySearchResult[]>;
3
3
  //# sourceMappingURL=searchByZipcode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchByZipcode.d.ts","sourceRoot":"","sources":["../src/searchByZipcode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAErF,eAAO,MAAM,eAAe,gBACb,MAAM,+CAElB,QAAQ,wBAAwB,EAAE,CAUpC,CAAA"}
1
+ {"version":3,"file":"searchByZipcode.d.ts","sourceRoot":"","sources":["../src/searchByZipcode.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAgB,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAErF,eAAO,MAAM,eAAe,gBACb,MAAM,YACT,kBAAkB,KAC3B,QAAQ,wBAAwB,EAAE,CAUpC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pretto/places",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,7 +16,6 @@
16
16
  "dist/**/*"
17
17
  ],
18
18
  "dependencies": {
19
- "@pretto/places": "^0.43.0",
20
19
  "@types/algoliasearch": "^4.0.0",
21
20
  "algoliasearch": "4.22.1",
22
21
  "array.prototype.flat": "^1.3.0",