@capgo/nativegeocoder 0.1.13 → 0.1.16

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Capgo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -54,12 +54,16 @@ This API requires the following permissions be added to your `AndroidManifest.xm
54
54
  reverseGeocode(options: reverseOptions) => Promise<{ addresses: Adress[]; }>
55
55
  ```
56
56
 
57
+ Convert latitude and longitude to an address
58
+
57
59
  | Param | Type |
58
60
  | ------------- | --------------------------------------------------------- |
59
61
  | **`options`** | <code><a href="#reverseoptions">reverseOptions</a></code> |
60
62
 
61
63
  **Returns:** <code>Promise&lt;{ addresses: Adress[]; }&gt;</code>
62
64
 
65
+ **Since:** 0.0.1
66
+
63
67
  --------------------
64
68
 
65
69
 
@@ -69,12 +73,16 @@ reverseGeocode(options: reverseOptions) => Promise<{ addresses: Adress[]; }>
69
73
  forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
70
74
  ```
71
75
 
76
+ Convert an address to latitude and longitude
77
+
72
78
  | Param | Type |
73
79
  | ------------- | --------------------------------------------------------- |
74
80
  | **`options`** | <code><a href="#forwardoptions">ForwardOptions</a></code> |
75
81
 
76
82
  **Returns:** <code>Promise&lt;{ addresses: Adress[]; }&gt;</code>
77
83
 
84
+ **Since:** 0.0.1
85
+
78
86
  --------------------
79
87
 
80
88
 
@@ -88,6 +96,7 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
88
96
  | **`latitude`** | <code>number</code> |
89
97
  | **`longitude`** | <code>number</code> |
90
98
  | **`countryCode`** | <code>string</code> |
99
+ | **`countryName`** | <code>string</code> |
91
100
  | **`postalCode`** | <code>string</code> |
92
101
  | **`administrativeArea`** | <code>string</code> |
93
102
  | **`subAdministrativeArea`** | <code>string</code> |
@@ -96,21 +105,31 @@ forwardGeocode(options: ForwardOptions) => Promise<{ addresses: Adress[]; }>
96
105
  | **`thoroughfare`** | <code>string</code> |
97
106
  | **`subThoroughfare`** | <code>string</code> |
98
107
  | **`areasOfInterest`** | <code>string[]</code> |
99
- | **`formatted_address`** | <code>string</code> |
100
108
 
101
109
 
102
110
  #### reverseOptions
103
111
 
104
- | Prop | Type |
105
- | --------------- | ------------------- |
106
- | **`latitude`** | <code>number</code> |
107
- | **`longitude`** | <code>number</code> |
112
+ | Prop | Type | Description |
113
+ | ------------------- | -------------------- | ------------------------------------------------------------------------ |
114
+ | **`latitude`** | <code>number</code> | latitude is a number representing the latitude of the location. |
115
+ | **`longitude`** | <code>number</code> | longitude is a number representing the longitude of the location. |
116
+ | **`useLocale`** | <code>boolean</code> | Localise the results to the given locale. |
117
+ | **`defaultLocale`** | <code>string</code> | locale is a string in the format of language_country, for example en_US. |
118
+ | **`maxResults`** | <code>number</code> | Max number of results to return. |
119
+ | **`apiKey`** | <code>string</code> | Only used for web platform to use google api |
108
120
 
109
121
 
110
122
  #### ForwardOptions
111
123
 
112
- | Prop | Type |
113
- | ------------------- | ------------------- |
114
- | **`addressString`** | <code>string</code> |
124
+ | Prop | Type | Description |
125
+ | ------------------- | -------------------- | ------------------------------------------------------------------------ |
126
+ | **`addressString`** | <code>string</code> | address is a string of the address to be geocoded. |
127
+ | **`useLocale`** | <code>boolean</code> | Localise the results to the given locale. |
128
+ | **`defaultLocale`** | <code>string</code> | locale is a string in the format of language_country, for example en_US. |
129
+ | **`maxResults`** | <code>number</code> | Max number of results to return. |
130
+ | **`apiKey`** | <code>string</code> | Only used for web platform to use google api |
115
131
 
116
132
  </docgen-api>
133
+
134
+ ## Thanks
135
+ To [@sebastianbaar](https://github.com/sebastianbaar) and his work on [cordova-plugin-nativegeocoder](https://github.com/sebastianbaar/cordova-plugin-nativegeocoder) what he made was very inspiring
package/dist/docs.json CHANGED
@@ -16,8 +16,25 @@
16
16
  }
17
17
  ],
18
18
  "returns": "Promise<{ addresses: Adress[]; }>",
19
- "tags": [],
20
- "docs": "",
19
+ "tags": [
20
+ {
21
+ "name": "param",
22
+ "text": "id The bundle id to delete (note, this is the bundle id, NOT the version name)"
23
+ },
24
+ {
25
+ "name": "returns",
26
+ "text": "an Promise with the list of addresses according to maxResults"
27
+ },
28
+ {
29
+ "name": "throws",
30
+ "text": "An error if the something went wrong"
31
+ },
32
+ {
33
+ "name": "since",
34
+ "text": "0.0.1"
35
+ }
36
+ ],
37
+ "docs": "Convert latitude and longitude to an address",
21
38
  "complexTypes": [
22
39
  "Adress",
23
40
  "reverseOptions"
@@ -35,8 +52,21 @@
35
52
  }
36
53
  ],
37
54
  "returns": "Promise<{ addresses: Adress[]; }>",
38
- "tags": [],
39
- "docs": "",
55
+ "tags": [
56
+ {
57
+ "name": "returns",
58
+ "text": "an Promise with the list of addresses according to maxResults"
59
+ },
60
+ {
61
+ "name": "throws",
62
+ "text": "An error if the something went wrong"
63
+ },
64
+ {
65
+ "name": "since",
66
+ "text": "0.0.1"
67
+ }
68
+ ],
69
+ "docs": "Convert an address to latitude and longitude",
40
70
  "complexTypes": [
41
71
  "Adress",
42
72
  "ForwardOptions"
@@ -75,6 +105,13 @@
75
105
  "complexTypes": [],
76
106
  "type": "string"
77
107
  },
108
+ {
109
+ "name": "countryName",
110
+ "tags": [],
111
+ "docs": "",
112
+ "complexTypes": [],
113
+ "type": "string"
114
+ },
78
115
  {
79
116
  "name": "postalCode",
80
117
  "tags": [],
@@ -130,13 +167,6 @@
130
167
  "docs": "",
131
168
  "complexTypes": [],
132
169
  "type": "string[]"
133
- },
134
- {
135
- "name": "formatted_address",
136
- "tags": [],
137
- "docs": "",
138
- "complexTypes": [],
139
- "type": "string"
140
170
  }
141
171
  ]
142
172
  },
@@ -150,16 +180,44 @@
150
180
  {
151
181
  "name": "latitude",
152
182
  "tags": [],
153
- "docs": "",
183
+ "docs": "latitude is a number representing the latitude of the location.",
154
184
  "complexTypes": [],
155
185
  "type": "number"
156
186
  },
157
187
  {
158
188
  "name": "longitude",
159
189
  "tags": [],
160
- "docs": "",
190
+ "docs": "longitude is a number representing the longitude of the location.",
161
191
  "complexTypes": [],
162
192
  "type": "number"
193
+ },
194
+ {
195
+ "name": "useLocale",
196
+ "tags": [],
197
+ "docs": "Localise the results to the given locale.",
198
+ "complexTypes": [],
199
+ "type": "boolean | undefined"
200
+ },
201
+ {
202
+ "name": "defaultLocale",
203
+ "tags": [],
204
+ "docs": "locale is a string in the format of language_country, for example en_US.",
205
+ "complexTypes": [],
206
+ "type": "string | undefined"
207
+ },
208
+ {
209
+ "name": "maxResults",
210
+ "tags": [],
211
+ "docs": "Max number of results to return.",
212
+ "complexTypes": [],
213
+ "type": "number | undefined"
214
+ },
215
+ {
216
+ "name": "apiKey",
217
+ "tags": [],
218
+ "docs": "Only used for web platform to use google api",
219
+ "complexTypes": [],
220
+ "type": "string | undefined"
163
221
  }
164
222
  ]
165
223
  },
@@ -173,9 +231,37 @@
173
231
  {
174
232
  "name": "addressString",
175
233
  "tags": [],
176
- "docs": "",
234
+ "docs": "address is a string of the address to be geocoded.",
177
235
  "complexTypes": [],
178
236
  "type": "string"
237
+ },
238
+ {
239
+ "name": "useLocale",
240
+ "tags": [],
241
+ "docs": "Localise the results to the given locale.",
242
+ "complexTypes": [],
243
+ "type": "boolean | undefined"
244
+ },
245
+ {
246
+ "name": "defaultLocale",
247
+ "tags": [],
248
+ "docs": "locale is a string in the format of language_country, for example en_US.",
249
+ "complexTypes": [],
250
+ "type": "string | undefined"
251
+ },
252
+ {
253
+ "name": "maxResults",
254
+ "tags": [],
255
+ "docs": "Max number of results to return.",
256
+ "complexTypes": [],
257
+ "type": "number | undefined"
258
+ },
259
+ {
260
+ "name": "apiKey",
261
+ "tags": [],
262
+ "docs": "Only used for web platform to use google api",
263
+ "complexTypes": [],
264
+ "type": "string | undefined"
179
265
  }
180
266
  ]
181
267
  }
@@ -2,6 +2,7 @@ export interface Adress {
2
2
  latitude: number;
3
3
  longitude: number;
4
4
  countryCode: string;
5
+ countryName: string;
5
6
  postalCode: string;
6
7
  administrativeArea: string;
7
8
  subAdministrativeArea: string;
@@ -10,25 +11,74 @@ export interface Adress {
10
11
  thoroughfare: string;
11
12
  subThoroughfare: string;
12
13
  areasOfInterest: string[];
13
- formatted_address: string;
14
14
  }
15
- export interface baseOption {
15
+ export interface ForwardOptions {
16
+ /**
17
+ * address is a string of the address to be geocoded.
18
+ */
19
+ addressString: string;
20
+ /**
21
+ * Localise the results to the given locale.
22
+ */
16
23
  useLocale?: boolean;
24
+ /**
25
+ * locale is a string in the format of language_country, for example en_US.
26
+ */
17
27
  defaultLocale?: string;
28
+ /**
29
+ * Max number of results to return.
30
+ */
18
31
  maxResults?: number;
32
+ /**
33
+ * Only used for web platform to use google api
34
+ */
19
35
  apiKey?: string;
20
36
  }
21
- export interface ForwardOptions extends baseOption {
22
- addressString: string;
23
- }
24
- export interface reverseOptions extends baseOption {
37
+ export interface reverseOptions {
38
+ /**
39
+ * latitude is a number representing the latitude of the location.
40
+ */
25
41
  latitude: number;
42
+ /**
43
+ * longitude is a number representing the longitude of the location.
44
+ */
26
45
  longitude: number;
46
+ /**
47
+ * Localise the results to the given locale.
48
+ */
49
+ useLocale?: boolean;
50
+ /**
51
+ * locale is a string in the format of language_country, for example en_US.
52
+ */
53
+ defaultLocale?: string;
54
+ /**
55
+ * Max number of results to return.
56
+ */
57
+ maxResults?: number;
58
+ /**
59
+ * Only used for web platform to use google api
60
+ */
61
+ apiKey?: string;
27
62
  }
28
63
  export interface NativeGeocoderPlugin {
64
+ /**
65
+ * Convert latitude and longitude to an address
66
+ *
67
+ * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)
68
+ * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults
69
+ * @throws An error if the something went wrong
70
+ * @since 0.0.1
71
+ */
29
72
  reverseGeocode(options: reverseOptions): Promise<{
30
73
  addresses: Adress[];
31
74
  }>;
75
+ /**
76
+ * Convert an address to latitude and longitude
77
+ *
78
+ * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults
79
+ * @throws An error if the something went wrong
80
+ * @since 0.0.1
81
+ */
32
82
  forwardGeocode(options: ForwardOptions): Promise<{
33
83
  addresses: Adress[];
34
84
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Adress {\n latitude:\tnumber\n longitude:\tnumber\n countryCode:\tstring\n postalCode:\tstring\n administrativeArea:\tstring\n subAdministrativeArea:\tstring\n locality:\tstring\n subLocality:\tstring\n thoroughfare:\tstring\n subThoroughfare:\tstring\n areasOfInterest:\tstring[]\n formatted_address: string\n}\n\nexport interface baseOption {\n /*\n * Localise the results to the given locale.\n */\n useLocale?:\tboolean\n /*\n * locale is a string in the format of language_country, for example en_US.\n */\n defaultLocale?:\tstring\n /*\n * Max number of results to return.\n */\n maxResults?:\tnumber\n /*\n * Only used for web platform to use google api\n */\n apiKey?:\tstring\n}\nexport interface ForwardOptions extends baseOption {\n /*\n * address is a string of the address to be geocoded.\n */\n addressString:\tstring\n}\nexport interface reverseOptions extends baseOption {\n /*\n * latitude is a number representing the latitude of the location.\n */\n latitude:\tnumber\n /*\n * longitude is a number representing the longitude of the location.\n */\n longitude:\tnumber\n}\nexport interface NativeGeocoderPlugin {\n /*\n * Convert latitude and longitude to an address\n *\n * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n reverseGeocode(options: reverseOptions): Promise<{ addresses:\tAdress[] }>;\n /*\n * Convert an address to latitude and longitude\n *\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n forwardGeocode(options: ForwardOptions): Promise<{ addresses:\tAdress[] }>;\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface Adress {\n latitude:\tnumber\n longitude:\tnumber\n countryCode:\tstring\n countryName:\tstring\n postalCode:\tstring\n administrativeArea:\tstring\n subAdministrativeArea:\tstring\n locality:\tstring\n subLocality:\tstring\n thoroughfare:\tstring\n subThoroughfare:\tstring\n areasOfInterest:\tstring[]\n}\n\nexport interface ForwardOptions {\n /**\n * address is a string of the address to be geocoded.\n */\n addressString:\tstring\n /**\n * Localise the results to the given locale.\n */\n useLocale?:\tboolean\n /**\n * locale is a string in the format of language_country, for example en_US.\n */\n defaultLocale?:\tstring\n /**\n * Max number of results to return.\n */\n maxResults?:\tnumber\n /**\n * Only used for web platform to use google api\n */\n apiKey?:\tstring\n}\nexport interface reverseOptions {\n /**\n * latitude is a number representing the latitude of the location.\n */\n latitude:\tnumber\n /**\n * longitude is a number representing the longitude of the location.\n */\n longitude:\tnumber\n /**\n * Localise the results to the given locale.\n */\n useLocale?:\tboolean\n /**\n * locale is a string in the format of language_country, for example en_US.\n */\n defaultLocale?:\tstring\n /**\n * Max number of results to return.\n */\n maxResults?:\tnumber\n /**\n * Only used for web platform to use google api\n */\n apiKey?:\tstring\n}\nexport interface NativeGeocoderPlugin {\n /**\n * Convert latitude and longitude to an address\n *\n * @param id The bundle id to delete (note, this is the bundle id, NOT the version name)\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n reverseGeocode(options: reverseOptions): Promise<{ addresses:\tAdress[] }>;\n /**\n * Convert an address to latitude and longitude\n *\n * @returns {Promise<{addresses: Adress[]}>} an Promise with the list of addresses according to maxResults\n * @throws An error if the something went wrong\n * @since 0.0.1\n */\n forwardGeocode(options: ForwardOptions): Promise<{ addresses:\tAdress[] }>;\n}\n"]}
package/dist/esm/web.js CHANGED
@@ -1,4 +1,7 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
+ const findAC = (address_components, type) => {
3
+ return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };
4
+ };
2
5
  export class NativeGeocoderWeb extends WebPlugin {
3
6
  async reverseGeocode(options) {
4
7
  if (!options.apiKey) {
@@ -7,25 +10,27 @@ export class NativeGeocoderWeb extends WebPlugin {
7
10
  const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
8
11
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
9
12
  .then(response => response.json())
10
- .then(data => {
11
- return data.results.forEach((result) => {
12
- // transform the response in Adress[]
13
- // use the restul from google geocoder and transform it in Adress
14
- return {
15
- latitude: result.geometry.location.lat,
16
- longitude: result.geometry.location.lng,
17
- countryCode: result.address_components[0].long_name,
18
- postalCode: result.address_components[1].long_name,
19
- administrativeArea: result.address_components[2].long_name,
20
- subAdministrativeArea: result.address_components[3].long_name,
21
- locality: result.address_components[4].long_name,
22
- subLocality: result.address_components[5].long_name,
23
- thoroughfare: result.address_components[6].long_name,
24
- subThoroughfare: result.address_components[7].long_name,
25
- areasOfInterest: result.address_components[8].long_name,
26
- formatted_address: result.formatted_address,
27
- };
28
- }).slice(0, options.maxResults || 1);
13
+ .then((data) => {
14
+ return {
15
+ addresses: data.results.forEach((result) => {
16
+ // transform the response in Adress[]
17
+ // use the restul from google geocoder and transform it in Adress
18
+ return {
19
+ latitude: result.geometry.location.lat,
20
+ longitude: result.geometry.location.lng,
21
+ countryCode: findAC(result.address_components, 'country').short_name,
22
+ countryName: findAC(result.address_components, 'country').long_name,
23
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
24
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
25
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
26
+ locality: findAC(result.address_components, 'locality').long_name,
27
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
28
+ thoroughfare: findAC(result.address_components, 'route').long_name,
29
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
30
+ areasOfInterest: [],
31
+ };
32
+ }).slice(0, options.maxResults || 1)
33
+ };
29
34
  });
30
35
  }
31
36
  ;
@@ -36,25 +41,27 @@ export class NativeGeocoderWeb extends WebPlugin {
36
41
  const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
37
42
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
38
43
  .then(response => response.json())
39
- .then(data => {
40
- return data.results.forEach((result) => {
41
- // transform the response in Adress[]
42
- // use the restul from google geocoder and transform it in Adress
43
- return {
44
- latitude: result.geometry.location.lat,
45
- longitude: result.geometry.location.lng,
46
- countryCode: result.address_components[0].long_name,
47
- postalCode: result.address_components[1].long_name,
48
- administrativeArea: result.address_components[2].long_name,
49
- subAdministrativeArea: result.address_components[3].long_name,
50
- locality: result.address_components[4].long_name,
51
- subLocality: result.address_components[5].long_name,
52
- thoroughfare: result.address_components[6].long_name,
53
- subThoroughfare: result.address_components[7].long_name,
54
- areasOfInterest: result.address_components[8].long_name,
55
- formatted_address: result.formatted_address,
56
- };
57
- }).slice(0, options.maxResults || 1);
44
+ .then((data) => {
45
+ return {
46
+ addresses: data.results.forEach((result) => {
47
+ // transform the response in Adress[]
48
+ // use the restul from google geocoder and transform it in Adress
49
+ return {
50
+ latitude: result.geometry.location.lat,
51
+ longitude: result.geometry.location.lng,
52
+ countryCode: findAC(result.address_components, 'country').short_name,
53
+ countryName: findAC(result.address_components, 'country').long_name,
54
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
55
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
56
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
57
+ locality: findAC(result.address_components, 'locality').long_name,
58
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
59
+ thoroughfare: findAC(result.address_components, 'route').long_name,
60
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
61
+ areasOfInterest: [],
62
+ };
63
+ }).slice(0, options.maxResults || 1)
64
+ };
58
65
  });
59
66
  }
60
67
  ;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA8B5C,MAAM,OAAO,iBACX,SAAQ,SAAS;IAEf,KAAK,CAAC,cAAc,CAAC,OAAuB;QAC1C,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC/C;QACD,MAAM,MAAM,iCACV,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,EAClD,GAAG,EAAE,OAAO,CAAC,MAAM,IAChB,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,CAAC,CAAC,SAAS;oBAC7D,QAAQ,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;oBAChD,WAAW,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACnD,YAAY,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACpD,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACvD,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;oBACvD,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;iBAC5C,CAAA;YACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC,CAAA;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAAA,CAAC;CACP","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { NativeGeocoderPlugin, reverseOptions, ForwardOptions, Adress } from './definitions';\n\ninterface GeocoderResult {\n address_components: {\n long_name: string;\n short_name: string;\n types: string[];\n }[];\n formatted_address: string;\n geometry: {\n location: {\n lat: number;\n lng: number;\n };\n location_type: string;\n viewport: {\n northeast: {\n lat: number;\n lng: number;\n };\n southwest: {\n lat: number;\n lng: number;\n };\n };\n };\n }\n\nexport class NativeGeocoderWeb\n extends WebPlugin\n implements NativeGeocoderPlugin {\n async reverseGeocode(options: reverseOptions): Promise<{ addresses:\tAdress[] }> {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = {\n latlng: `${options.latitude},${options.longitude}`,\n key: options.apiKey,\n ...(options.defaultLocale && {language: options.defaultLocale}),\n result_type: 'street_address',\n }\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result: GeocoderResult) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n }\n }).slice(0, options.maxResults || 1)\n });\n };\n async forwardGeocode(options: ForwardOptions): Promise<{ addresses:\tAdress[] }> {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = {\n address: options.addressString,\n key: options.apiKey,\n ...(options.defaultLocale && {language: options.defaultLocale}),\n result_type: 'street_address',\n }\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result: GeocoderResult) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n }\n }).slice(0, options.maxResults || 1)\n });\n };\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA+B5C,MAAM,MAAM,GAAG,CAAC,kBAAsC,EAAE,IAAY,EAAoB,EAAE;IACxF,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC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A;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAAA,CAAC;CACP","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { NativeGeocoderPlugin, reverseOptions, ForwardOptions, Adress } from './definitions';\n\ninterface AddressComponent {\n long_name: string;\n short_name: string;\n types: string[];\n}\n interface GeocoderResult {\n address_components: AddressComponent[];\n formatted_address: string;\n geometry: {\n location: {\n lat: number;\n lng: number;\n };\n location_type: string;\n viewport: {\n northeast: {\n lat: number;\n lng: number;\n };\n southwest: {\n lat: number;\n lng: number;\n };\n };\n };\n }\n\nconst findAC = (address_components: AddressComponent[], type: string): AddressComponent => {\n return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };\n}\nexport class NativeGeocoderWeb\n extends WebPlugin\n implements NativeGeocoderPlugin {\n async reverseGeocode(options: reverseOptions): Promise<{ addresses:\tAdress[] }> {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = {\n latlng: `${options.latitude},${options.longitude}`,\n key: options.apiKey,\n ...(options.defaultLocale && {language: options.defaultLocale}),\n result_type: 'street_address',\n }\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data): { addresses:\tAdress[] } => {\n return { \n addresses: data.results.forEach((result: GeocoderResult): Adress => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n }\n }).slice(0, options.maxResults || 1)\n }\n });\n };\n async forwardGeocode(options: ForwardOptions): Promise<{ addresses:\tAdress[] }> {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = {\n address: options.addressString,\n key: options.apiKey,\n ...(options.defaultLocale && {language: options.defaultLocale}),\n result_type: 'street_address',\n }\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data): { addresses:\tAdress[] } => {\n return { \n addresses: data.results.forEach((result: GeocoderResult): Adress => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n }\n }).slice(0, options.maxResults || 1)\n }\n })\n };\n}\n"]}
@@ -8,6 +8,9 @@ const NativeGeocoder = core.registerPlugin('NativeGeocoder', {
8
8
  web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NativeGeocoderWeb()),
9
9
  });
10
10
 
11
+ const findAC = (address_components, type) => {
12
+ return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };
13
+ };
11
14
  class NativeGeocoderWeb extends core.WebPlugin {
12
15
  async reverseGeocode(options) {
13
16
  if (!options.apiKey) {
@@ -16,25 +19,27 @@ class NativeGeocoderWeb extends core.WebPlugin {
16
19
  const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
17
20
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
18
21
  .then(response => response.json())
19
- .then(data => {
20
- return data.results.forEach((result) => {
21
- // transform the response in Adress[]
22
- // use the restul from google geocoder and transform it in Adress
23
- return {
24
- latitude: result.geometry.location.lat,
25
- longitude: result.geometry.location.lng,
26
- countryCode: result.address_components[0].long_name,
27
- postalCode: result.address_components[1].long_name,
28
- administrativeArea: result.address_components[2].long_name,
29
- subAdministrativeArea: result.address_components[3].long_name,
30
- locality: result.address_components[4].long_name,
31
- subLocality: result.address_components[5].long_name,
32
- thoroughfare: result.address_components[6].long_name,
33
- subThoroughfare: result.address_components[7].long_name,
34
- areasOfInterest: result.address_components[8].long_name,
35
- formatted_address: result.formatted_address,
36
- };
37
- }).slice(0, options.maxResults || 1);
22
+ .then((data) => {
23
+ return {
24
+ addresses: data.results.forEach((result) => {
25
+ // transform the response in Adress[]
26
+ // use the restul from google geocoder and transform it in Adress
27
+ return {
28
+ latitude: result.geometry.location.lat,
29
+ longitude: result.geometry.location.lng,
30
+ countryCode: findAC(result.address_components, 'country').short_name,
31
+ countryName: findAC(result.address_components, 'country').long_name,
32
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
33
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
34
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
35
+ locality: findAC(result.address_components, 'locality').long_name,
36
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
37
+ thoroughfare: findAC(result.address_components, 'route').long_name,
38
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
39
+ areasOfInterest: [],
40
+ };
41
+ }).slice(0, options.maxResults || 1)
42
+ };
38
43
  });
39
44
  }
40
45
  ;
@@ -45,25 +50,27 @@ class NativeGeocoderWeb extends core.WebPlugin {
45
50
  const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
46
51
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
47
52
  .then(response => response.json())
48
- .then(data => {
49
- return data.results.forEach((result) => {
50
- // transform the response in Adress[]
51
- // use the restul from google geocoder and transform it in Adress
52
- return {
53
- latitude: result.geometry.location.lat,
54
- longitude: result.geometry.location.lng,
55
- countryCode: result.address_components[0].long_name,
56
- postalCode: result.address_components[1].long_name,
57
- administrativeArea: result.address_components[2].long_name,
58
- subAdministrativeArea: result.address_components[3].long_name,
59
- locality: result.address_components[4].long_name,
60
- subLocality: result.address_components[5].long_name,
61
- thoroughfare: result.address_components[6].long_name,
62
- subThoroughfare: result.address_components[7].long_name,
63
- areasOfInterest: result.address_components[8].long_name,
64
- formatted_address: result.formatted_address,
65
- };
66
- }).slice(0, options.maxResults || 1);
53
+ .then((data) => {
54
+ return {
55
+ addresses: data.results.forEach((result) => {
56
+ // transform the response in Adress[]
57
+ // use the restul from google geocoder and transform it in Adress
58
+ return {
59
+ latitude: result.geometry.location.lat,
60
+ longitude: result.geometry.location.lng,
61
+ countryCode: findAC(result.address_components, 'country').short_name,
62
+ countryName: findAC(result.address_components, 'country').long_name,
63
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
64
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
65
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
66
+ locality: findAC(result.address_components, 'locality').long_name,
67
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
68
+ thoroughfare: findAC(result.address_components, 'route').long_name,
69
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
70
+ areasOfInterest: [],
71
+ };
72
+ }).slice(0, options.maxResults || 1)
73
+ };
67
74
  });
68
75
  }
69
76
  ;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst NativeGeocoder = registerPlugin('NativeGeocoder', {\n web: () => import('./web').then(m => new m.NativeGeocoderWeb()),\n});\nexport * from './definitions';\nexport { NativeGeocoder };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativeGeocoderWeb extends WebPlugin {\n async reverseGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n };\n }).slice(0, options.maxResults || 1);\n });\n }\n ;\n async forwardGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n };\n }).slice(0, options.maxResults || 1);\n });\n }\n ;\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACnE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,MAAM,cAAc,CAAC,OAAO,EAAE;AAClC,QAAQ,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;AAC7B,YAAY,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAC1D,SAAS;AACT,QAAQ,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACpO,QAAQ,OAAO,KAAK,CAAC,CAAC,iDAAiD,EAAE,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAClH,aAAa,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC9C,aAAa,IAAI,CAAC,IAAI,IAAI;AAC1B,YAAY,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,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CAAC,SAAS;AACvE,oBAAoB,YAAY,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;AACxE,oBAAoB,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;AAC3E,oBAAoB,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;AAC3E,oBAAoB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;AAC/D,iBAAiB,CAAC;AAClB,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;AACjD,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst NativeGeocoder = registerPlugin('NativeGeocoder', {\n web: () => import('./web').then(m => new m.NativeGeocoderWeb()),\n});\nexport * from './definitions';\nexport { NativeGeocoder };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst findAC = (address_components, type) => {\n return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };\n};\nexport class NativeGeocoderWeb extends WebPlugin {\n async reverseGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data) => {\n return {\n addresses: data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n };\n }).slice(0, options.maxResults || 1)\n };\n });\n }\n ;\n async forwardGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data) => {\n return {\n addresses: data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n };\n }).slice(0, options.maxResults || 1)\n };\n });\n }\n ;\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACnE,CAAC;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AAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,6BAA6B,CAAC,CAAC,SAAS;AACzH,wBAAwB,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC,SAAS;AACzF,wBAAwB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC,SAAS;AAC/F,wBAAwB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;AAC1F,wBAAwB,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC,SAAS;AACrG,wBAAwB,eAAe,EAAE,EAAE;AAC3C,qBAAqB,CAAC;AACtB,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;AACpD,aAAa,CAAC;AACd,SAAS,CAAC,CAAC;AACX,KAAK;AACL;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -5,6 +5,9 @@ var capacitorNativeGeocoder = (function (exports, core) {
5
5
  web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NativeGeocoderWeb()),
6
6
  });
7
7
 
8
+ const findAC = (address_components, type) => {
9
+ return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };
10
+ };
8
11
  class NativeGeocoderWeb extends core.WebPlugin {
9
12
  async reverseGeocode(options) {
10
13
  if (!options.apiKey) {
@@ -13,25 +16,27 @@ var capacitorNativeGeocoder = (function (exports, core) {
13
16
  const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
14
17
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
15
18
  .then(response => response.json())
16
- .then(data => {
17
- return data.results.forEach((result) => {
18
- // transform the response in Adress[]
19
- // use the restul from google geocoder and transform it in Adress
20
- return {
21
- latitude: result.geometry.location.lat,
22
- longitude: result.geometry.location.lng,
23
- countryCode: result.address_components[0].long_name,
24
- postalCode: result.address_components[1].long_name,
25
- administrativeArea: result.address_components[2].long_name,
26
- subAdministrativeArea: result.address_components[3].long_name,
27
- locality: result.address_components[4].long_name,
28
- subLocality: result.address_components[5].long_name,
29
- thoroughfare: result.address_components[6].long_name,
30
- subThoroughfare: result.address_components[7].long_name,
31
- areasOfInterest: result.address_components[8].long_name,
32
- formatted_address: result.formatted_address,
33
- };
34
- }).slice(0, options.maxResults || 1);
19
+ .then((data) => {
20
+ return {
21
+ addresses: data.results.forEach((result) => {
22
+ // transform the response in Adress[]
23
+ // use the restul from google geocoder and transform it in Adress
24
+ return {
25
+ latitude: result.geometry.location.lat,
26
+ longitude: result.geometry.location.lng,
27
+ countryCode: findAC(result.address_components, 'country').short_name,
28
+ countryName: findAC(result.address_components, 'country').long_name,
29
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
30
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
31
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
32
+ locality: findAC(result.address_components, 'locality').long_name,
33
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
34
+ thoroughfare: findAC(result.address_components, 'route').long_name,
35
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
36
+ areasOfInterest: [],
37
+ };
38
+ }).slice(0, options.maxResults || 1)
39
+ };
35
40
  });
36
41
  }
37
42
  ;
@@ -42,25 +47,27 @@ var capacitorNativeGeocoder = (function (exports, core) {
42
47
  const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });
43
48
  return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)
44
49
  .then(response => response.json())
45
- .then(data => {
46
- return data.results.forEach((result) => {
47
- // transform the response in Adress[]
48
- // use the restul from google geocoder and transform it in Adress
49
- return {
50
- latitude: result.geometry.location.lat,
51
- longitude: result.geometry.location.lng,
52
- countryCode: result.address_components[0].long_name,
53
- postalCode: result.address_components[1].long_name,
54
- administrativeArea: result.address_components[2].long_name,
55
- subAdministrativeArea: result.address_components[3].long_name,
56
- locality: result.address_components[4].long_name,
57
- subLocality: result.address_components[5].long_name,
58
- thoroughfare: result.address_components[6].long_name,
59
- subThoroughfare: result.address_components[7].long_name,
60
- areasOfInterest: result.address_components[8].long_name,
61
- formatted_address: result.formatted_address,
62
- };
63
- }).slice(0, options.maxResults || 1);
50
+ .then((data) => {
51
+ return {
52
+ addresses: data.results.forEach((result) => {
53
+ // transform the response in Adress[]
54
+ // use the restul from google geocoder and transform it in Adress
55
+ return {
56
+ latitude: result.geometry.location.lat,
57
+ longitude: result.geometry.location.lng,
58
+ countryCode: findAC(result.address_components, 'country').short_name,
59
+ countryName: findAC(result.address_components, 'country').long_name,
60
+ postalCode: findAC(result.address_components, 'postal_code').long_name,
61
+ administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,
62
+ subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,
63
+ locality: findAC(result.address_components, 'locality').long_name,
64
+ subLocality: findAC(result.address_components, 'sublocality').long_name,
65
+ thoroughfare: findAC(result.address_components, 'route').long_name,
66
+ subThoroughfare: findAC(result.address_components, 'street_number').long_name,
67
+ areasOfInterest: [],
68
+ };
69
+ }).slice(0, options.maxResults || 1)
70
+ };
64
71
  });
65
72
  }
66
73
  ;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst NativeGeocoder = registerPlugin('NativeGeocoder', {\n web: () => import('./web').then(m => new m.NativeGeocoderWeb()),\n});\nexport * from './definitions';\nexport { NativeGeocoder };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class NativeGeocoderWeb extends WebPlugin {\n async reverseGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n };\n }).slice(0, options.maxResults || 1);\n });\n }\n ;\n async forwardGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then(data => {\n return data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: result.address_components[0].long_name,\n postalCode: result.address_components[1].long_name,\n administrativeArea: result.address_components[2].long_name,\n subAdministrativeArea: result.address_components[3].long_name,\n locality: result.address_components[4].long_name,\n subLocality: result.address_components[5].long_name,\n thoroughfare: result.address_components[6].long_name,\n subThoroughfare: result.address_components[7].long_name,\n areasOfInterest: result.address_components[8].long_name,\n formatted_address: result.formatted_address,\n };\n }).slice(0, options.maxResults || 1);\n });\n }\n ;\n}\n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IAC3E,oBAAoB,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS;IAC3E,oBAAoB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;IAC/D,iBAAiB,CAAC;IAClB,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;IACjD,SAAS,CAAC,CAAC;IACX,KAAK;IACL;IACA;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst NativeGeocoder = registerPlugin('NativeGeocoder', {\n web: () => import('./web').then(m => new m.NativeGeocoderWeb()),\n});\nexport * from './definitions';\nexport { NativeGeocoder };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst findAC = (address_components, type) => {\n return address_components.find(component => component.types.includes(type)) || { long_name: '', short_name: '', types: [] };\n};\nexport class NativeGeocoderWeb extends WebPlugin {\n async reverseGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ latlng: `${options.latitude},${options.longitude}`, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data) => {\n return {\n addresses: data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n };\n }).slice(0, options.maxResults || 1)\n };\n });\n }\n ;\n async forwardGeocode(options) {\n if (!options.apiKey) {\n throw new Error('apiKey is required for web');\n }\n const params = Object.assign(Object.assign({ address: options.addressString, key: options.apiKey }, (options.defaultLocale && { language: options.defaultLocale })), { result_type: 'street_address' });\n return fetch(`https://maps.googleapis.com/maps/api/geocode/json${new URLSearchParams(params).toString()}`)\n .then(response => response.json())\n .then((data) => {\n return {\n addresses: data.results.forEach((result) => {\n // transform the response in Adress[]\n // use the restul from google geocoder and transform it in Adress\n return {\n latitude: result.geometry.location.lat,\n longitude: result.geometry.location.lng,\n countryCode: findAC(result.address_components, 'country').short_name,\n countryName: findAC(result.address_components, 'country').long_name,\n postalCode: findAC(result.address_components, 'postal_code').long_name,\n administrativeArea: findAC(result.address_components, 'administrative_area_level_1').long_name,\n subAdministrativeArea: findAC(result.address_components, 'administrative_area_level_2').long_name,\n locality: findAC(result.address_components, 'locality').long_name,\n subLocality: findAC(result.address_components, 'sublocality').long_name,\n thoroughfare: findAC(result.address_components, 'route').long_name,\n subThoroughfare: findAC(result.address_components, 'street_number').long_name,\n areasOfInterest: [],\n };\n }).slice(0, options.maxResults || 1)\n };\n });\n }\n ;\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACnE,CAAC;;ICFD,MAAM,MAAM,GAAG,CAAC,kBAAkB,EAAE,IAAI,KAAK;IAC7C,IAAI,OAAO,kBAAkB,CAAC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,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,wBAAwB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC,SAAS;IAC/F,wBAAwB,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;IAC1F,wBAAwB,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC,SAAS;IACrG,wBAAwB,eAAe,EAAE,EAAE;IAC3C,qBAAqB,CAAC;IACtB,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;IACpD,aAAa,CAAC;IACd,SAAS,CAAC,CAAC;IACX,KAAK;IACL;IACA;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/nativegeocoder",
3
- "version": "0.1.13",
3
+ "version": "0.1.16",
4
4
  "description": "Capacitor plugin for native forward and reverse geocoding",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",