react-native-map4d-services 1.1.0 → 1.2.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.
@@ -3,7 +3,6 @@ buildscript {
3
3
  repositories {
4
4
  google()
5
5
  mavenCentral()
6
- jcenter()
7
6
  }
8
7
 
9
8
  dependencies {
@@ -19,10 +18,10 @@ def safeExtGet(prop, fallback) {
19
18
  }
20
19
 
21
20
  android {
22
- compileSdkVersion safeExtGet('Map4dServices_compileSdkVersion', 29)
21
+ compileSdkVersion safeExtGet('Map4dServices_compileSdkVersion', 33)
23
22
  defaultConfig {
24
- minSdkVersion safeExtGet('Map4dServices_minSdkVersion', 16)
25
- targetSdkVersion safeExtGet('Map4dServices_targetSdkVersion', 29)
23
+ minSdkVersion safeExtGet('Map4dServices_minSdkVersion', 21)
24
+ targetSdkVersion safeExtGet('Map4dServices_targetSdkVersion', 33)
26
25
  versionCode 1
27
26
  versionName "1.0"
28
27
 
@@ -50,11 +49,10 @@ repositories {
50
49
  }
51
50
  google()
52
51
  mavenCentral()
53
- jcenter()
54
52
  }
55
53
 
56
54
  dependencies {
57
55
  //noinspection GradleDynamicVersion
58
56
  implementation "com.facebook.react:react-native:+" // From node_modules
59
- implementation 'vn.map4d:Map4dServices:2.0.0'
57
+ implementation 'vn.map4d:Map4dServices:2.3.+'
60
58
  }
@@ -70,22 +70,9 @@ public class Map4dServicesModule extends ReactContextBaseJavaModule {
70
70
  SClient.fireRequest(servicesOptions, SRequest.buildDirectionsRequestWithData(params), promise);
71
71
  }
72
72
 
73
- /* Route | ETA */
74
- @ReactMethod
75
- public void fetchRouteETA(ReadableMap params, @NonNull Promise promise) {
76
- SClient.fireRequest(servicesOptions, SRequest.buildRouteETARequestWithData(params), promise);
77
- }
78
-
79
73
  /* Route | Distance matrix */
80
74
  @ReactMethod
81
75
  public void fetchDistanceMatrix(ReadableMap params, @NonNull Promise promise) {
82
76
  SClient.fireRequest(servicesOptions, SRequest.buildDistanceMatrixRequestWithData(params), promise);
83
77
  }
84
-
85
- /* Route | Graph route */
86
- @ReactMethod
87
- public void fetchGraphRoute(ReadableMap params, @NonNull Promise promise) {
88
- SClient.fireRequest(servicesOptions, SRequest.buildGraphRouteRequestWithData(params), promise);
89
- }
90
-
91
78
  }
@@ -229,58 +229,6 @@ public class SRequest {
229
229
  return serviceOptionsBuilder.build();
230
230
  }
231
231
 
232
- static MFServiceOptions buildRouteETARequestWithData(@NonNull ReadableMap params) {
233
- MFServiceOptions.Builder serviceOptionsBuilder = new MFServiceOptions.Builder();
234
- serviceOptionsBuilder.url("/sdk/route/eta");
235
- serviceOptionsBuilder.method(MFMethod.POST);
236
-
237
- JSONObject jsonObject = new JSONObject();
238
- try {
239
- if (params.hasKey("origins") && !params.isNull("origins")) {
240
- JSONArray origins = SConverter.toOriginJsonArray(params.getArray("origins"));
241
- jsonObject.put("origins", origins);
242
- }
243
-
244
- if (params.hasKey("destination") && !params.isNull("destination")) {
245
- String destination = SConverter.toLocation(params.getMap("destination"));
246
- jsonObject.put("destination", destination);
247
- }
248
-
249
- if (params.hasKey("mode") && !params.isNull("mode")) {
250
- String mode = params.getString("mode");
251
- jsonObject.put("mode", mode);
252
- }
253
-
254
- if (params.hasKey("weighting") && !params.isNull("weighting")) {
255
- int weighting = SConverter.toWeighting(params.getString("weighting"));
256
- jsonObject.put("weighting", String.valueOf(weighting));
257
- }
258
-
259
- if (params.hasKey("language") && !params.isNull("language")) {
260
- String language = params.getString("language");
261
- jsonObject.put("language", language);
262
- }
263
-
264
- if (params.hasKey("restriction") && !params.isNull("restriction")) {
265
- ReadableMap restrictionMap = params.getMap("restriction");
266
- String avoid = SConverter.toAvoid(restrictionMap);
267
- if (avoid != null && !avoid.isEmpty()) {
268
- jsonObject.put("avoid", avoid);
269
- }
270
-
271
- String avoidRoads = SConverter.toAvoidRoads(restrictionMap);
272
- if (avoidRoads != null) {
273
- jsonObject.put("avoidRoads", avoidRoads);
274
- }
275
- }
276
- } catch (JSONException e) {
277
- e.printStackTrace();
278
- }
279
-
280
- serviceOptionsBuilder.json(jsonObject.toString());
281
- return serviceOptionsBuilder.build();
282
- }
283
-
284
232
  static MFServiceOptions buildDistanceMatrixRequestWithData(@NonNull ReadableMap params) {
285
233
  MFServiceOptions.Builder serviceOptionsBuilder = new MFServiceOptions.Builder();
286
234
  serviceOptionsBuilder.url("/sdk/route/matrix");
@@ -329,48 +277,4 @@ public class SRequest {
329
277
  serviceOptionsBuilder.params(requestParams);
330
278
  return serviceOptionsBuilder.build();
331
279
  }
332
-
333
- static MFServiceOptions buildGraphRouteRequestWithData(@NonNull ReadableMap params) {
334
- MFServiceOptions.Builder serviceOptionsBuilder = new MFServiceOptions.Builder();
335
- serviceOptionsBuilder.url("/sdk/route/graph");
336
- serviceOptionsBuilder.method(MFMethod.GET);
337
-
338
- MFRequestParams requestParams = new MFRequestParams();
339
-
340
- if (params.hasKey("locations") && !params.isNull("locations")) {
341
- String points = SConverter.toLocationList(params.getArray("locations"));
342
- requestParams.put("points", points);
343
- }
344
-
345
- if (params.hasKey("mode") && !params.isNull("mode")) {
346
- String mode = params.getString("mode");
347
- requestParams.put("mode", mode);
348
- }
349
-
350
- if (params.hasKey("weighting") && !params.isNull("weighting")) {
351
- int weighting = SConverter.toWeighting(params.getString("weighting"));
352
- requestParams.put("weighting", String.valueOf(weighting));
353
- }
354
-
355
- if (params.hasKey("language") && !params.isNull("language")) {
356
- String language = params.getString("language");
357
- requestParams.put("language", language);
358
- }
359
-
360
- if (params.hasKey("restriction") && !params.isNull("restriction")) {
361
- ReadableMap restrictionMap = params.getMap("restriction");
362
- String avoid = SConverter.toAvoid(restrictionMap);
363
- if (avoid != null && !avoid.isEmpty()) {
364
- requestParams.put("avoid", avoid);
365
- }
366
-
367
- String avoidRoads = SConverter.toAvoidRoads(restrictionMap);
368
- if (avoidRoads != null) {
369
- requestParams.put("avoidRoads", avoidRoads);
370
- }
371
- }
372
-
373
- serviceOptionsBuilder.params(requestParams);
374
- return serviceOptionsBuilder.build();
375
- }
376
280
  }
package/ios/SRequest.m CHANGED
@@ -83,7 +83,7 @@
83
83
  MFLocationComponent *origin = [SParamConvert MFLocationComponent:data[@"origin"]];
84
84
  MFLocationComponent *destination = [SParamConvert MFLocationComponent:data[@"destination"]];
85
85
  MFDirectionsParams *params = [[MFDirectionsParams alloc] initWithOrigin:origin destination:destination];
86
- params.waypoints = [SParamConvert MFLocationComponentArray:data[@"points"]];
86
+ params.waypoints = [SParamConvert MFLocationComponentArray:data[@"waypoints"]];
87
87
  params.mode = [SParamConvert MFTravelMode:data[@"mode"] fallback:params.mode];
88
88
  params.language = [SParamConvert MFLanguageResult:data[@"language"] fallback:params.language];
89
89
  params.weighting = [SParamConvert MFRouteWeighting:data[@"weighting"] fallback:params.weighting];
@@ -63,35 +63,49 @@ exports.MFRouteType = MFRouteType;
63
63
  MFRouteType["tunnel"] = "tunnel";
64
64
  })(MFRouteType || (exports.MFRouteType = MFRouteType = {}));
65
65
 
66
- function fetchSuggestion(params) {
66
+ async function fetchSuggestion(params) {
67
67
  return Map4dServices.fetchSuggestion(params);
68
68
  }
69
+ /* Place | Detail */
69
70
 
70
- function fetchPlaceDetail(placeId) {
71
+
72
+ async function fetchPlaceDetail(placeId) {
71
73
  return Map4dServices.fetchPlaceDetail(placeId);
72
74
  }
75
+ /* Place | Text search */
76
+
73
77
 
74
- function fetchTextSearch(params) {
78
+ async function fetchTextSearch(params) {
75
79
  return Map4dServices.fetchTextSearch(params);
76
80
  }
81
+ /* Place | Nearby search */
77
82
 
78
- function fetchNearbySearch(params) {
83
+
84
+ async function fetchNearbySearch(params) {
79
85
  return Map4dServices.fetchNearbySearch(params);
80
86
  }
87
+ /* Place | Viewbox search */
88
+
81
89
 
82
- function fetchViewboxSearch(params) {
90
+ async function fetchViewboxSearch(params) {
83
91
  return Map4dServices.fetchViewboxSearch(params);
84
92
  }
93
+ /* Place | Geocode */
85
94
 
86
- function fetchGeocode(params) {
95
+
96
+ async function fetchGeocode(params) {
87
97
  return Map4dServices.fetchGeocode(params);
88
98
  }
99
+ /* Route | Directions */
100
+
89
101
 
90
- function fetchDirections(params) {
102
+ async function fetchDirections(params) {
91
103
  return Map4dServices.fetchDirections(params);
92
104
  }
105
+ /* Route | Distance matrix */
106
+
93
107
 
94
- function fetchDistanceMatrix(params) {
108
+ async function fetchDistanceMatrix(params) {
95
109
  return Map4dServices.fetchDistanceMatrix(params);
96
110
  }
97
111
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","Map4dServices","NativeModules","Proxy","get","Error","MFTravelMode","MFRouteWeighting","MFLanguageResult","MFRouteType","fetchSuggestion","params","fetchPlaceDetail","placeId","fetchTextSearch","fetchNearbySearch","fetchViewboxSearch","fetchGeocode","fetchDirections","fetchDistanceMatrix"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,sFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGC,2BAAcD,aAAd,GAClBC,2BAAcD,aADI,GAElB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;IAsBYU,Y;;;WAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,4BAAAA,Y;;IAOAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAMAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAKAC,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AAuEL,SAASC,eAAT,CAAyBC,MAAzB,EAAmE;AACxE,SAAOV,aAAa,CAACS,eAAd,CAA8BC,MAA9B,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,OAA1B,EAAyD;AAC9D,SAAOZ,aAAa,CAACW,gBAAd,CAA+BC,OAA/B,CAAP;AACD;;AAEM,SAASC,eAAT,CAAyBH,MAAzB,EAAmE;AACxE,SAAOV,aAAa,CAACa,eAAd,CAA8BH,MAA9B,CAAP;AACD;;AAEM,SAASI,iBAAT,CAA2BJ,MAA3B,EAAuE;AAC5E,SAAOV,aAAa,CAACc,iBAAd,CAAgCJ,MAAhC,CAAP;AACD;;AAEM,SAASK,kBAAT,CAA4BL,MAA5B,EAAyE;AAC9E,SAAOV,aAAa,CAACe,kBAAd,CAAiCL,MAAjC,CAAP;AACD;;AAEM,SAASM,YAAT,CAAsBN,MAAtB,EAA6D;AAClE,SAAOV,aAAa,CAACgB,YAAd,CAA2BN,MAA3B,CAAP;AACD;;AAEM,SAASO,eAAT,CAAyBP,MAAzB,EAAmE;AACxE,SAAOV,aAAa,CAACiB,eAAd,CAA8BP,MAA9B,CAAP;AACD;;AAEM,SAASQ,mBAAT,CAA6BR,MAA7B,EAA2E;AAChF,SAAOV,aAAa,CAACkB,mBAAd,CAAkCR,MAAlC,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Map4dServices = NativeModules.Map4dServices\n ? NativeModules.Map4dServices\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport type MFLocationComponent = {\n latitude: number,\n longitude: number,\n alias?: string,\n}\n\nexport type MFViewboxComponent = {\n southwest: MFLocationComponent,\n northeast: MFLocationComponent,\n}\n\nexport enum MFTravelMode {\n car = 'car',\n bike = 'bike',\n foot = 'foot',\n motorcycle = 'motorcycle',\n}\n\nexport enum MFRouteWeighting {\n shortest = 'shortest',\n fastest = 'fastest',\n balance = 'balance',\n}\n\nexport enum MFLanguageResult {\n en = 'en',\n vi = 'vi',\n}\n\nexport enum MFRouteType {\n motorway = 'motorway',\n trunk = 'trunk',\n ferry = 'ferry',\n bridge = 'bridge',\n tunnel = 'tunnel',\n}\n\nexport type MFRouteRestriction = {\n location?: MFLocationComponent,\n radius?: number,\n viewbox?: MFViewboxComponent,\n path?: MFLocationComponent[],\n types?: MFRouteType[] | string[]\n}\n\nexport type MFSuggestionParams = {\n text: string,\n location?: MFLocationComponent,\n acronym?: boolean,\n}\n\nexport type MFTextSearchParams = {\n text: string,\n types?: string[],\n datetime?: number,\n location?: MFLocationComponent,\n}\n\nexport type MFNearbySearchParams = {\n location: MFLocationComponent,\n radius: number,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFViewboxSearchParams = {\n viewbox: MFViewboxComponent,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFGeocodeParams = {\n location?: MFLocationComponent,\n address?: string,\n viewbox?: MFViewboxComponent,\n}\n\nexport type MFDirectionsParams = {\n origin: MFLocationComponent,\n destination: MFLocationComponent,\n waypoints?: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport type MFDistanceMatrixParams = {\n origins: MFLocationComponent[],\n destinations: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport function fetchSuggestion(params: MFSuggestionParams): Promise<any> {\n return Map4dServices.fetchSuggestion(params);\n}\n\nexport function fetchPlaceDetail(placeId: string): Promise<any> {\n return Map4dServices.fetchPlaceDetail(placeId);\n}\n\nexport function fetchTextSearch(params: MFTextSearchParams): Promise<any> {\n return Map4dServices.fetchTextSearch(params);\n}\n\nexport function fetchNearbySearch(params: MFNearbySearchParams): Promise<any> {\n return Map4dServices.fetchNearbySearch(params);\n}\n\nexport function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any> {\n return Map4dServices.fetchViewboxSearch(params);\n}\n\nexport function fetchGeocode(params: MFGeocodeParams): Promise<any> {\n return Map4dServices.fetchGeocode(params);\n}\n\nexport function fetchDirections(params: MFDirectionsParams): Promise<any> {\n return Map4dServices.fetchDirections(params);\n}\n\nexport function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any> {\n return Map4dServices.fetchDistanceMatrix(params);\n}\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["LINKING_ERROR","Platform","select","ios","default","Map4dServices","NativeModules","Proxy","get","Error","MFTravelMode","MFRouteWeighting","MFLanguageResult","MFRouteType","fetchSuggestion","params","fetchPlaceDetail","placeId","fetchTextSearch","fetchNearbySearch","fetchViewboxSearch","fetchGeocode","fetchDirections","fetchDistanceMatrix"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA,MAAMA,aAAa,GAChB,sFAAD,GACAC,sBAASC,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGC,2BAAcD,aAAd,GAClBC,2BAAcD,aADI,GAElB,IAAIE,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;IAsBYU,Y;;;WAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,4BAAAA,Y;;IAOAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAMAC,gB;;;WAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,gCAAAA,gB;;IAKAC,W;;;WAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;AA0FL,eAAeC,eAAf,CAA+BC,MAA/B,EAA0F;AAC/F,SAAOV,aAAa,CAACS,eAAd,CAA8BC,MAA9B,CAAP;AACD;AAED;;;AAkBO,eAAeC,gBAAf,CAAgCC,OAAhC,EAAiF;AACtF,SAAOZ,aAAa,CAACW,gBAAd,CAA+BC,OAA/B,CAAP;AACD;AAED;;;AAaO,eAAeC,eAAf,CAA+BH,MAA/B,EAA0F;AAC/F,SAAOV,aAAa,CAACa,eAAd,CAA8BH,MAA9B,CAAP;AACD;AAED;;;AAaO,eAAeI,iBAAf,CAAiCJ,MAAjC,EAAgG;AACrG,SAAOV,aAAa,CAACc,iBAAd,CAAgCJ,MAAhC,CAAP;AACD;AAED;;;AAaO,eAAeK,kBAAf,CAAkCL,MAAlC,EAAmG;AACxG,SAAOV,aAAa,CAACe,kBAAd,CAAiCL,MAAjC,CAAP;AACD;AAED;;;AAcO,eAAeM,YAAf,CAA4BN,MAA5B,EAAiF;AACtF,SAAOV,aAAa,CAACgB,YAAd,CAA2BN,MAA3B,CAAP;AACD;AAED;;;AAgBO,eAAeO,eAAf,CAA+BP,MAA/B,EAA0F;AAC/F,SAAOV,aAAa,CAACiB,eAAd,CAA8BP,MAA9B,CAAP;AACD;AAED;;;AAYO,eAAeQ,mBAAf,CAAmCR,MAAnC,EAAsG;AAC3G,SAAOV,aAAa,CAACkB,mBAAd,CAAkCR,MAAlC,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Map4dServices = NativeModules.Map4dServices\n ? NativeModules.Map4dServices\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport type MFLocationComponent = {\n latitude: number,\n longitude: number,\n alias?: string,\n}\n\nexport type MFViewboxComponent = {\n southwest: MFLocationComponent,\n northeast: MFLocationComponent,\n}\n\nexport enum MFTravelMode {\n car = 'car',\n bike = 'bike',\n foot = 'foot',\n motorcycle = 'motorcycle',\n}\n\nexport enum MFRouteWeighting {\n shortest = 'shortest',\n fastest = 'fastest',\n balance = 'balance',\n}\n\nexport enum MFLanguageResult {\n en = 'en',\n vi = 'vi',\n}\n\nexport enum MFRouteType {\n motorway = 'motorway',\n trunk = 'trunk',\n ferry = 'ferry',\n bridge = 'bridge',\n tunnel = 'tunnel',\n}\n\nexport type MFRouteRestriction = {\n location?: MFLocationComponent,\n radius?: number,\n viewbox?: MFViewboxComponent,\n path?: MFLocationComponent[],\n types?: MFRouteType[] | string[]\n}\n\nexport type MFSuggestionParams = {\n text: string,\n location?: MFLocationComponent,\n acronym?: boolean,\n}\n\nexport type MFTextSearchParams = {\n text: string,\n types?: string[],\n datetime?: number,\n location?: MFLocationComponent,\n}\n\nexport type MFNearbySearchParams = {\n location: MFLocationComponent,\n radius: number,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFViewboxSearchParams = {\n viewbox: MFViewboxComponent,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFGeocodeParams = {\n location?: MFLocationComponent,\n address?: string,\n viewbox?: MFViewboxComponent,\n}\n\nexport type MFDirectionsParams = {\n origin: MFLocationComponent,\n destination: MFLocationComponent,\n waypoints?: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport type MFDistanceMatrixParams = {\n origins: MFLocationComponent[],\n destinations: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\ntype MFServiceResponse<T> = {\n code: string,\n message?: string,\n result?: T\n}\n\n/* Place | Suggestions */\n\nexport type MFSuggestionResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFSuggestionResponse = MFServiceResponse<MFSuggestionResult>\n\nexport async function fetchSuggestion(params: MFSuggestionParams): Promise<MFSuggestionResponse> {\n return Map4dServices.fetchSuggestion(params);\n}\n\n/* Place | Detail */\n\nexport type MFPlaceDetailResult = {\n id?: string\n name?: string\n description?: string\n address?: string\n addressComponents?: Array<any>\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n tags?: string[]\n photos?: Array<any>\n metadata?: Array<any>\n [_: string]: unknown\n}\nexport type MFPlaceDetailResponse = MFServiceResponse<MFPlaceDetailResult>\n\nexport async function fetchPlaceDetail(placeId: string): Promise<MFPlaceDetailResponse> {\n return Map4dServices.fetchPlaceDetail(placeId);\n}\n\n/* Place | Text search */\n\nexport type MFTextSearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFTextSearchResponse = MFServiceResponse<MFTextSearchResult>\n\nexport async function fetchTextSearch(params: MFTextSearchParams): Promise<MFTextSearchResponse> {\n return Map4dServices.fetchTextSearch(params);\n}\n\n/* Place | Nearby search */\n\nexport type MFNearbySearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFNearbySearchResponse = MFServiceResponse<MFNearbySearchResult>\n\nexport async function fetchNearbySearch(params: MFNearbySearchParams): Promise<MFNearbySearchResponse> {\n return Map4dServices.fetchNearbySearch(params);\n}\n\n/* Place | Viewbox search */\n\nexport type MFViewboxSearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFViewboxSearchResponse = MFServiceResponse<MFViewboxSearchResult>\n\nexport async function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<MFViewboxSearchResponse> {\n return Map4dServices.fetchViewboxSearch(params);\n}\n\n/* Place | Geocode */\n\nexport type MFGeocodeResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n addressComponents?: Array<any>\n [_: string]: unknown\n}>\nexport type MFGeocodeResponse = MFServiceResponse<MFGeocodeResult>\n\nexport async function fetchGeocode(params: MFGeocodeParams): Promise<MFGeocodeResponse> {\n return Map4dServices.fetchGeocode(params);\n}\n\n/* Route | Directions */\n\nexport type MFDirectionsResult = {\n routes?: Array<{\n summary?: string\n overviewPolyline?: string\n distance?: { [key: string]: any }\n duration?: { [key: string]: any }\n legs?: Array<{ [key: string]: any }>\n snappedWaypoints?: Array<{ lat: number, lng: number }>\n [_: string]: unknown\n }>\n [_: string]: unknown\n}\nexport type MFDirectionsResponse = MFServiceResponse<MFDirectionsResult>\n\nexport async function fetchDirections(params: MFDirectionsParams): Promise<MFDirectionsResponse> {\n return Map4dServices.fetchDirections(params);\n}\n\n/* Route | Distance matrix */\n\nexport type MFDistanceMatrixResult = {\n originAddresses?: string[],\n destinationAddresses?: string[],\n routeRows: Array<{\n elements: Array<{ [key:string]: any }>\n }>\n [_: string]: unknown\n}\nexport type MFDistanceMatrixResponse = MFServiceResponse<MFDistanceMatrixResult>\n\nexport async function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<MFDistanceMatrixResponse> {\n return Map4dServices.fetchDistanceMatrix(params);\n}\n"]}
@@ -43,28 +43,42 @@ export let MFRouteType;
43
43
  MFRouteType["tunnel"] = "tunnel";
44
44
  })(MFRouteType || (MFRouteType = {}));
45
45
 
46
- export function fetchSuggestion(params) {
46
+ export async function fetchSuggestion(params) {
47
47
  return Map4dServices.fetchSuggestion(params);
48
48
  }
49
- export function fetchPlaceDetail(placeId) {
49
+ /* Place | Detail */
50
+
51
+ export async function fetchPlaceDetail(placeId) {
50
52
  return Map4dServices.fetchPlaceDetail(placeId);
51
53
  }
52
- export function fetchTextSearch(params) {
54
+ /* Place | Text search */
55
+
56
+ export async function fetchTextSearch(params) {
53
57
  return Map4dServices.fetchTextSearch(params);
54
58
  }
55
- export function fetchNearbySearch(params) {
59
+ /* Place | Nearby search */
60
+
61
+ export async function fetchNearbySearch(params) {
56
62
  return Map4dServices.fetchNearbySearch(params);
57
63
  }
58
- export function fetchViewboxSearch(params) {
64
+ /* Place | Viewbox search */
65
+
66
+ export async function fetchViewboxSearch(params) {
59
67
  return Map4dServices.fetchViewboxSearch(params);
60
68
  }
61
- export function fetchGeocode(params) {
69
+ /* Place | Geocode */
70
+
71
+ export async function fetchGeocode(params) {
62
72
  return Map4dServices.fetchGeocode(params);
63
73
  }
64
- export function fetchDirections(params) {
74
+ /* Route | Directions */
75
+
76
+ export async function fetchDirections(params) {
65
77
  return Map4dServices.fetchDirections(params);
66
78
  }
67
- export function fetchDistanceMatrix(params) {
79
+ /* Route | Distance matrix */
80
+
81
+ export async function fetchDistanceMatrix(params) {
68
82
  return Map4dServices.fetchDistanceMatrix(params);
69
83
  }
70
84
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Map4dServices","Proxy","get","Error","MFTravelMode","MFRouteWeighting","MFLanguageResult","MFRouteType","fetchSuggestion","params","fetchPlaceDetail","placeId","fetchTextSearch","fetchNearbySearch","fetchViewboxSearch","fetchGeocode","fetchDirections","fetchDistanceMatrix"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,sFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGN,aAAa,CAACM,aAAd,GAClBN,aAAa,CAACM,aADI,GAElB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,WAAYQ,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,KAAAA,Y;;AAOZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAMZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAKZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W;;AAuEZ,OAAO,SAASC,eAAT,CAAyBC,MAAzB,EAAmE;AACxE,SAAOT,aAAa,CAACQ,eAAd,CAA8BC,MAA9B,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,OAA1B,EAAyD;AAC9D,SAAOX,aAAa,CAACU,gBAAd,CAA+BC,OAA/B,CAAP;AACD;AAED,OAAO,SAASC,eAAT,CAAyBH,MAAzB,EAAmE;AACxE,SAAOT,aAAa,CAACY,eAAd,CAA8BH,MAA9B,CAAP;AACD;AAED,OAAO,SAASI,iBAAT,CAA2BJ,MAA3B,EAAuE;AAC5E,SAAOT,aAAa,CAACa,iBAAd,CAAgCJ,MAAhC,CAAP;AACD;AAED,OAAO,SAASK,kBAAT,CAA4BL,MAA5B,EAAyE;AAC9E,SAAOT,aAAa,CAACc,kBAAd,CAAiCL,MAAjC,CAAP;AACD;AAED,OAAO,SAASM,YAAT,CAAsBN,MAAtB,EAA6D;AAClE,SAAOT,aAAa,CAACe,YAAd,CAA2BN,MAA3B,CAAP;AACD;AAED,OAAO,SAASO,eAAT,CAAyBP,MAAzB,EAAmE;AACxE,SAAOT,aAAa,CAACgB,eAAd,CAA8BP,MAA9B,CAAP;AACD;AAED,OAAO,SAASQ,mBAAT,CAA6BR,MAA7B,EAA2E;AAChF,SAAOT,aAAa,CAACiB,mBAAd,CAAkCR,MAAlC,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Map4dServices = NativeModules.Map4dServices\n ? NativeModules.Map4dServices\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport type MFLocationComponent = {\n latitude: number,\n longitude: number,\n alias?: string,\n}\n\nexport type MFViewboxComponent = {\n southwest: MFLocationComponent,\n northeast: MFLocationComponent,\n}\n\nexport enum MFTravelMode {\n car = 'car',\n bike = 'bike',\n foot = 'foot',\n motorcycle = 'motorcycle',\n}\n\nexport enum MFRouteWeighting {\n shortest = 'shortest',\n fastest = 'fastest',\n balance = 'balance',\n}\n\nexport enum MFLanguageResult {\n en = 'en',\n vi = 'vi',\n}\n\nexport enum MFRouteType {\n motorway = 'motorway',\n trunk = 'trunk',\n ferry = 'ferry',\n bridge = 'bridge',\n tunnel = 'tunnel',\n}\n\nexport type MFRouteRestriction = {\n location?: MFLocationComponent,\n radius?: number,\n viewbox?: MFViewboxComponent,\n path?: MFLocationComponent[],\n types?: MFRouteType[] | string[]\n}\n\nexport type MFSuggestionParams = {\n text: string,\n location?: MFLocationComponent,\n acronym?: boolean,\n}\n\nexport type MFTextSearchParams = {\n text: string,\n types?: string[],\n datetime?: number,\n location?: MFLocationComponent,\n}\n\nexport type MFNearbySearchParams = {\n location: MFLocationComponent,\n radius: number,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFViewboxSearchParams = {\n viewbox: MFViewboxComponent,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFGeocodeParams = {\n location?: MFLocationComponent,\n address?: string,\n viewbox?: MFViewboxComponent,\n}\n\nexport type MFDirectionsParams = {\n origin: MFLocationComponent,\n destination: MFLocationComponent,\n waypoints?: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport type MFDistanceMatrixParams = {\n origins: MFLocationComponent[],\n destinations: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport function fetchSuggestion(params: MFSuggestionParams): Promise<any> {\n return Map4dServices.fetchSuggestion(params);\n}\n\nexport function fetchPlaceDetail(placeId: string): Promise<any> {\n return Map4dServices.fetchPlaceDetail(placeId);\n}\n\nexport function fetchTextSearch(params: MFTextSearchParams): Promise<any> {\n return Map4dServices.fetchTextSearch(params);\n}\n\nexport function fetchNearbySearch(params: MFNearbySearchParams): Promise<any> {\n return Map4dServices.fetchNearbySearch(params);\n}\n\nexport function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any> {\n return Map4dServices.fetchViewboxSearch(params);\n}\n\nexport function fetchGeocode(params: MFGeocodeParams): Promise<any> {\n return Map4dServices.fetchGeocode(params);\n}\n\nexport function fetchDirections(params: MFDirectionsParams): Promise<any> {\n return Map4dServices.fetchDirections(params);\n}\n\nexport function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any> {\n return Map4dServices.fetchDistanceMatrix(params);\n}\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Map4dServices","Proxy","get","Error","MFTravelMode","MFRouteWeighting","MFLanguageResult","MFRouteType","fetchSuggestion","params","fetchPlaceDetail","placeId","fetchTextSearch","fetchNearbySearch","fetchViewboxSearch","fetchGeocode","fetchDirections","fetchDistanceMatrix"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAMC,aAAa,GAChB,sFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;AAAEC,EAAAA,GAAG,EAAE,gCAAP;AAAyCC,EAAAA,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGN,aAAa,CAACM,aAAd,GAClBN,aAAa,CAACM,aADI,GAElB,IAAIC,KAAJ,CACE,EADF,EAEE;AACEC,EAAAA,GAAG,GAAG;AACJ,UAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;AACD;;AAHH,CAFF,CAFJ;AAsBA,WAAYQ,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,KAAAA,Y;;AAOZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAMZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAKZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W;;AA0FZ,OAAO,eAAeC,eAAf,CAA+BC,MAA/B,EAA0F;AAC/F,SAAOT,aAAa,CAACQ,eAAd,CAA8BC,MAA9B,CAAP;AACD;AAED;;AAkBA,OAAO,eAAeC,gBAAf,CAAgCC,OAAhC,EAAiF;AACtF,SAAOX,aAAa,CAACU,gBAAd,CAA+BC,OAA/B,CAAP;AACD;AAED;;AAaA,OAAO,eAAeC,eAAf,CAA+BH,MAA/B,EAA0F;AAC/F,SAAOT,aAAa,CAACY,eAAd,CAA8BH,MAA9B,CAAP;AACD;AAED;;AAaA,OAAO,eAAeI,iBAAf,CAAiCJ,MAAjC,EAAgG;AACrG,SAAOT,aAAa,CAACa,iBAAd,CAAgCJ,MAAhC,CAAP;AACD;AAED;;AAaA,OAAO,eAAeK,kBAAf,CAAkCL,MAAlC,EAAmG;AACxG,SAAOT,aAAa,CAACc,kBAAd,CAAiCL,MAAjC,CAAP;AACD;AAED;;AAcA,OAAO,eAAeM,YAAf,CAA4BN,MAA5B,EAAiF;AACtF,SAAOT,aAAa,CAACe,YAAd,CAA2BN,MAA3B,CAAP;AACD;AAED;;AAgBA,OAAO,eAAeO,eAAf,CAA+BP,MAA/B,EAA0F;AAC/F,SAAOT,aAAa,CAACgB,eAAd,CAA8BP,MAA9B,CAAP;AACD;AAED;;AAYA,OAAO,eAAeQ,mBAAf,CAAmCR,MAAnC,EAAsG;AAC3G,SAAOT,aAAa,CAACiB,mBAAd,CAAkCR,MAAlC,CAAP;AACD","sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-map4d-services' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Map4dServices = NativeModules.Map4dServices\n ? NativeModules.Map4dServices\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport type MFLocationComponent = {\n latitude: number,\n longitude: number,\n alias?: string,\n}\n\nexport type MFViewboxComponent = {\n southwest: MFLocationComponent,\n northeast: MFLocationComponent,\n}\n\nexport enum MFTravelMode {\n car = 'car',\n bike = 'bike',\n foot = 'foot',\n motorcycle = 'motorcycle',\n}\n\nexport enum MFRouteWeighting {\n shortest = 'shortest',\n fastest = 'fastest',\n balance = 'balance',\n}\n\nexport enum MFLanguageResult {\n en = 'en',\n vi = 'vi',\n}\n\nexport enum MFRouteType {\n motorway = 'motorway',\n trunk = 'trunk',\n ferry = 'ferry',\n bridge = 'bridge',\n tunnel = 'tunnel',\n}\n\nexport type MFRouteRestriction = {\n location?: MFLocationComponent,\n radius?: number,\n viewbox?: MFViewboxComponent,\n path?: MFLocationComponent[],\n types?: MFRouteType[] | string[]\n}\n\nexport type MFSuggestionParams = {\n text: string,\n location?: MFLocationComponent,\n acronym?: boolean,\n}\n\nexport type MFTextSearchParams = {\n text: string,\n types?: string[],\n datetime?: number,\n location?: MFLocationComponent,\n}\n\nexport type MFNearbySearchParams = {\n location: MFLocationComponent,\n radius: number,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFViewboxSearchParams = {\n viewbox: MFViewboxComponent,\n text?: string,\n types?: string[],\n tags?: string[],\n datetime?: number,\n}\n\nexport type MFGeocodeParams = {\n location?: MFLocationComponent,\n address?: string,\n viewbox?: MFViewboxComponent,\n}\n\nexport type MFDirectionsParams = {\n origin: MFLocationComponent,\n destination: MFLocationComponent,\n waypoints?: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\nexport type MFDistanceMatrixParams = {\n origins: MFLocationComponent[],\n destinations: MFLocationComponent[],\n mode?: MFTravelMode | string,\n weighting?: MFRouteWeighting | string,\n language?: MFLanguageResult | string,\n restriction?: MFRouteRestriction,\n}\n\ntype MFServiceResponse<T> = {\n code: string,\n message?: string,\n result?: T\n}\n\n/* Place | Suggestions */\n\nexport type MFSuggestionResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFSuggestionResponse = MFServiceResponse<MFSuggestionResult>\n\nexport async function fetchSuggestion(params: MFSuggestionParams): Promise<MFSuggestionResponse> {\n return Map4dServices.fetchSuggestion(params);\n}\n\n/* Place | Detail */\n\nexport type MFPlaceDetailResult = {\n id?: string\n name?: string\n description?: string\n address?: string\n addressComponents?: Array<any>\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n tags?: string[]\n photos?: Array<any>\n metadata?: Array<any>\n [_: string]: unknown\n}\nexport type MFPlaceDetailResponse = MFServiceResponse<MFPlaceDetailResult>\n\nexport async function fetchPlaceDetail(placeId: string): Promise<MFPlaceDetailResponse> {\n return Map4dServices.fetchPlaceDetail(placeId);\n}\n\n/* Place | Text search */\n\nexport type MFTextSearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFTextSearchResponse = MFServiceResponse<MFTextSearchResult>\n\nexport async function fetchTextSearch(params: MFTextSearchParams): Promise<MFTextSearchResponse> {\n return Map4dServices.fetchTextSearch(params);\n}\n\n/* Place | Nearby search */\n\nexport type MFNearbySearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFNearbySearchResponse = MFServiceResponse<MFNearbySearchResult>\n\nexport async function fetchNearbySearch(params: MFNearbySearchParams): Promise<MFNearbySearchResponse> {\n return Map4dServices.fetchNearbySearch(params);\n}\n\n/* Place | Viewbox search */\n\nexport type MFViewboxSearchResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n [_: string]: unknown\n}>\nexport type MFViewboxSearchResponse = MFServiceResponse<MFViewboxSearchResult>\n\nexport async function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<MFViewboxSearchResponse> {\n return Map4dServices.fetchViewboxSearch(params);\n}\n\n/* Place | Geocode */\n\nexport type MFGeocodeResult = Array<{\n id?: string\n name?: string\n address?: string\n distance?: number\n location?: { lat: number, lng: number }\n types?: string[]\n addressComponents?: Array<any>\n [_: string]: unknown\n}>\nexport type MFGeocodeResponse = MFServiceResponse<MFGeocodeResult>\n\nexport async function fetchGeocode(params: MFGeocodeParams): Promise<MFGeocodeResponse> {\n return Map4dServices.fetchGeocode(params);\n}\n\n/* Route | Directions */\n\nexport type MFDirectionsResult = {\n routes?: Array<{\n summary?: string\n overviewPolyline?: string\n distance?: { [key: string]: any }\n duration?: { [key: string]: any }\n legs?: Array<{ [key: string]: any }>\n snappedWaypoints?: Array<{ lat: number, lng: number }>\n [_: string]: unknown\n }>\n [_: string]: unknown\n}\nexport type MFDirectionsResponse = MFServiceResponse<MFDirectionsResult>\n\nexport async function fetchDirections(params: MFDirectionsParams): Promise<MFDirectionsResponse> {\n return Map4dServices.fetchDirections(params);\n}\n\n/* Route | Distance matrix */\n\nexport type MFDistanceMatrixResult = {\n originAddresses?: string[],\n destinationAddresses?: string[],\n routeRows: Array<{\n elements: Array<{ [key:string]: any }>\n }>\n [_: string]: unknown\n}\nexport type MFDistanceMatrixResponse = MFServiceResponse<MFDistanceMatrixResult>\n\nexport async function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<MFDistanceMatrixResponse> {\n return Map4dServices.fetchDistanceMatrix(params);\n}\n"]}
@@ -84,11 +84,134 @@ export declare type MFDistanceMatrixParams = {
84
84
  language?: MFLanguageResult | string;
85
85
  restriction?: MFRouteRestriction;
86
86
  };
87
- export declare function fetchSuggestion(params: MFSuggestionParams): Promise<any>;
88
- export declare function fetchPlaceDetail(placeId: string): Promise<any>;
89
- export declare function fetchTextSearch(params: MFTextSearchParams): Promise<any>;
90
- export declare function fetchNearbySearch(params: MFNearbySearchParams): Promise<any>;
91
- export declare function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any>;
92
- export declare function fetchGeocode(params: MFGeocodeParams): Promise<any>;
93
- export declare function fetchDirections(params: MFDirectionsParams): Promise<any>;
94
- export declare function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any>;
87
+ declare type MFServiceResponse<T> = {
88
+ code: string;
89
+ message?: string;
90
+ result?: T;
91
+ };
92
+ export declare type MFSuggestionResult = Array<{
93
+ id?: string;
94
+ name?: string;
95
+ address?: string;
96
+ distance?: number;
97
+ location?: {
98
+ lat: number;
99
+ lng: number;
100
+ };
101
+ types?: string[];
102
+ [_: string]: unknown;
103
+ }>;
104
+ export declare type MFSuggestionResponse = MFServiceResponse<MFSuggestionResult>;
105
+ export declare function fetchSuggestion(params: MFSuggestionParams): Promise<MFSuggestionResponse>;
106
+ export declare type MFPlaceDetailResult = {
107
+ id?: string;
108
+ name?: string;
109
+ description?: string;
110
+ address?: string;
111
+ addressComponents?: Array<any>;
112
+ distance?: number;
113
+ location?: {
114
+ lat: number;
115
+ lng: number;
116
+ };
117
+ types?: string[];
118
+ tags?: string[];
119
+ photos?: Array<any>;
120
+ metadata?: Array<any>;
121
+ [_: string]: unknown;
122
+ };
123
+ export declare type MFPlaceDetailResponse = MFServiceResponse<MFPlaceDetailResult>;
124
+ export declare function fetchPlaceDetail(placeId: string): Promise<MFPlaceDetailResponse>;
125
+ export declare type MFTextSearchResult = Array<{
126
+ id?: string;
127
+ name?: string;
128
+ address?: string;
129
+ distance?: number;
130
+ location?: {
131
+ lat: number;
132
+ lng: number;
133
+ };
134
+ types?: string[];
135
+ [_: string]: unknown;
136
+ }>;
137
+ export declare type MFTextSearchResponse = MFServiceResponse<MFTextSearchResult>;
138
+ export declare function fetchTextSearch(params: MFTextSearchParams): Promise<MFTextSearchResponse>;
139
+ export declare type MFNearbySearchResult = Array<{
140
+ id?: string;
141
+ name?: string;
142
+ address?: string;
143
+ distance?: number;
144
+ location?: {
145
+ lat: number;
146
+ lng: number;
147
+ };
148
+ types?: string[];
149
+ [_: string]: unknown;
150
+ }>;
151
+ export declare type MFNearbySearchResponse = MFServiceResponse<MFNearbySearchResult>;
152
+ export declare function fetchNearbySearch(params: MFNearbySearchParams): Promise<MFNearbySearchResponse>;
153
+ export declare type MFViewboxSearchResult = Array<{
154
+ id?: string;
155
+ name?: string;
156
+ address?: string;
157
+ distance?: number;
158
+ location?: {
159
+ lat: number;
160
+ lng: number;
161
+ };
162
+ types?: string[];
163
+ [_: string]: unknown;
164
+ }>;
165
+ export declare type MFViewboxSearchResponse = MFServiceResponse<MFViewboxSearchResult>;
166
+ export declare function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<MFViewboxSearchResponse>;
167
+ export declare type MFGeocodeResult = Array<{
168
+ id?: string;
169
+ name?: string;
170
+ address?: string;
171
+ distance?: number;
172
+ location?: {
173
+ lat: number;
174
+ lng: number;
175
+ };
176
+ types?: string[];
177
+ addressComponents?: Array<any>;
178
+ [_: string]: unknown;
179
+ }>;
180
+ export declare type MFGeocodeResponse = MFServiceResponse<MFGeocodeResult>;
181
+ export declare function fetchGeocode(params: MFGeocodeParams): Promise<MFGeocodeResponse>;
182
+ export declare type MFDirectionsResult = {
183
+ routes?: Array<{
184
+ summary?: string;
185
+ overviewPolyline?: string;
186
+ distance?: {
187
+ [key: string]: any;
188
+ };
189
+ duration?: {
190
+ [key: string]: any;
191
+ };
192
+ legs?: Array<{
193
+ [key: string]: any;
194
+ }>;
195
+ snappedWaypoints?: Array<{
196
+ lat: number;
197
+ lng: number;
198
+ }>;
199
+ [_: string]: unknown;
200
+ }>;
201
+ [_: string]: unknown;
202
+ };
203
+ export declare type MFDirectionsResponse = MFServiceResponse<MFDirectionsResult>;
204
+ export declare function fetchDirections(params: MFDirectionsParams): Promise<MFDirectionsResponse>;
205
+ export declare type MFDistanceMatrixResult = {
206
+ originAddresses?: string[];
207
+ destinationAddresses?: string[];
208
+ routeRows: Array<{
209
+ elements: Array<{
210
+ [key: string]: any;
211
+ }>;
212
+ }>;
213
+ [_: string]: unknown;
214
+ };
215
+ export declare type MFDistanceMatrixResponse = MFServiceResponse<MFDistanceMatrixResult>;
216
+ export declare function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<MFDistanceMatrixResponse>;
217
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-map4d-services",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "React Native Map4dServices for iOS + Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -13,6 +13,7 @@
13
13
  "android",
14
14
  "ios",
15
15
  "cpp",
16
+ "*.podspec",
16
17
  "react-native-map4d-services.podspec",
17
18
  "!lib/typescript/example",
18
19
  "!android/build",
@@ -10,11 +10,18 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- s.platforms = { :ios => "11.0" }
13
+ s.platforms = { :ios => "12.0" }
14
14
  s.source = { :git => "https://github.com/map4d/map4d-services-react-native.git", :tag => "#{s.version}" }
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm}"
17
17
 
18
+ s.dependency "Map4dServices", "~> 2.5"
19
+
20
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22
+ if respond_to?(:install_modules_dependencies, true)
23
+ install_modules_dependencies(s)
24
+ else
18
25
  s.dependency "React-Core"
19
- s.dependency "Map4dServices", "~> 2.4.0"
26
+ end
20
27
  end
package/src/index.tsx CHANGED
@@ -117,34 +117,152 @@ export type MFDistanceMatrixParams = {
117
117
  restriction?: MFRouteRestriction,
118
118
  }
119
119
 
120
- export function fetchSuggestion(params: MFSuggestionParams): Promise<any> {
120
+ type MFServiceResponse<T> = {
121
+ code: string,
122
+ message?: string,
123
+ result?: T
124
+ }
125
+
126
+ /* Place | Suggestions */
127
+
128
+ export type MFSuggestionResult = Array<{
129
+ id?: string
130
+ name?: string
131
+ address?: string
132
+ distance?: number
133
+ location?: { lat: number, lng: number }
134
+ types?: string[]
135
+ [_: string]: unknown
136
+ }>
137
+ export type MFSuggestionResponse = MFServiceResponse<MFSuggestionResult>
138
+
139
+ export async function fetchSuggestion(params: MFSuggestionParams): Promise<MFSuggestionResponse> {
121
140
  return Map4dServices.fetchSuggestion(params);
122
141
  }
123
142
 
124
- export function fetchPlaceDetail(placeId: string): Promise<any> {
143
+ /* Place | Detail */
144
+
145
+ export type MFPlaceDetailResult = {
146
+ id?: string
147
+ name?: string
148
+ description?: string
149
+ address?: string
150
+ addressComponents?: Array<any>
151
+ distance?: number
152
+ location?: { lat: number, lng: number }
153
+ types?: string[]
154
+ tags?: string[]
155
+ photos?: Array<any>
156
+ metadata?: Array<any>
157
+ [_: string]: unknown
158
+ }
159
+ export type MFPlaceDetailResponse = MFServiceResponse<MFPlaceDetailResult>
160
+
161
+ export async function fetchPlaceDetail(placeId: string): Promise<MFPlaceDetailResponse> {
125
162
  return Map4dServices.fetchPlaceDetail(placeId);
126
163
  }
127
164
 
128
- export function fetchTextSearch(params: MFTextSearchParams): Promise<any> {
165
+ /* Place | Text search */
166
+
167
+ export type MFTextSearchResult = Array<{
168
+ id?: string
169
+ name?: string
170
+ address?: string
171
+ distance?: number
172
+ location?: { lat: number, lng: number }
173
+ types?: string[]
174
+ [_: string]: unknown
175
+ }>
176
+ export type MFTextSearchResponse = MFServiceResponse<MFTextSearchResult>
177
+
178
+ export async function fetchTextSearch(params: MFTextSearchParams): Promise<MFTextSearchResponse> {
129
179
  return Map4dServices.fetchTextSearch(params);
130
180
  }
131
181
 
132
- export function fetchNearbySearch(params: MFNearbySearchParams): Promise<any> {
182
+ /* Place | Nearby search */
183
+
184
+ export type MFNearbySearchResult = Array<{
185
+ id?: string
186
+ name?: string
187
+ address?: string
188
+ distance?: number
189
+ location?: { lat: number, lng: number }
190
+ types?: string[]
191
+ [_: string]: unknown
192
+ }>
193
+ export type MFNearbySearchResponse = MFServiceResponse<MFNearbySearchResult>
194
+
195
+ export async function fetchNearbySearch(params: MFNearbySearchParams): Promise<MFNearbySearchResponse> {
133
196
  return Map4dServices.fetchNearbySearch(params);
134
197
  }
135
198
 
136
- export function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<any> {
199
+ /* Place | Viewbox search */
200
+
201
+ export type MFViewboxSearchResult = Array<{
202
+ id?: string
203
+ name?: string
204
+ address?: string
205
+ distance?: number
206
+ location?: { lat: number, lng: number }
207
+ types?: string[]
208
+ [_: string]: unknown
209
+ }>
210
+ export type MFViewboxSearchResponse = MFServiceResponse<MFViewboxSearchResult>
211
+
212
+ export async function fetchViewboxSearch(params: MFViewboxSearchParams): Promise<MFViewboxSearchResponse> {
137
213
  return Map4dServices.fetchViewboxSearch(params);
138
214
  }
139
215
 
140
- export function fetchGeocode(params: MFGeocodeParams): Promise<any> {
216
+ /* Place | Geocode */
217
+
218
+ export type MFGeocodeResult = Array<{
219
+ id?: string
220
+ name?: string
221
+ address?: string
222
+ distance?: number
223
+ location?: { lat: number, lng: number }
224
+ types?: string[]
225
+ addressComponents?: Array<any>
226
+ [_: string]: unknown
227
+ }>
228
+ export type MFGeocodeResponse = MFServiceResponse<MFGeocodeResult>
229
+
230
+ export async function fetchGeocode(params: MFGeocodeParams): Promise<MFGeocodeResponse> {
141
231
  return Map4dServices.fetchGeocode(params);
142
232
  }
143
233
 
144
- export function fetchDirections(params: MFDirectionsParams): Promise<any> {
234
+ /* Route | Directions */
235
+
236
+ export type MFDirectionsResult = {
237
+ routes?: Array<{
238
+ summary?: string
239
+ overviewPolyline?: string
240
+ distance?: { [key: string]: any }
241
+ duration?: { [key: string]: any }
242
+ legs?: Array<{ [key: string]: any }>
243
+ snappedWaypoints?: Array<{ lat: number, lng: number }>
244
+ [_: string]: unknown
245
+ }>
246
+ [_: string]: unknown
247
+ }
248
+ export type MFDirectionsResponse = MFServiceResponse<MFDirectionsResult>
249
+
250
+ export async function fetchDirections(params: MFDirectionsParams): Promise<MFDirectionsResponse> {
145
251
  return Map4dServices.fetchDirections(params);
146
252
  }
147
253
 
148
- export function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<any> {
254
+ /* Route | Distance matrix */
255
+
256
+ export type MFDistanceMatrixResult = {
257
+ originAddresses?: string[],
258
+ destinationAddresses?: string[],
259
+ routeRows: Array<{
260
+ elements: Array<{ [key:string]: any }>
261
+ }>
262
+ [_: string]: unknown
263
+ }
264
+ export type MFDistanceMatrixResponse = MFServiceResponse<MFDistanceMatrixResult>
265
+
266
+ export async function fetchDistanceMatrix(params: MFDistanceMatrixParams): Promise<MFDistanceMatrixResponse> {
149
267
  return Map4dServices.fetchDistanceMatrix(params);
150
268
  }