@heycar/heycars-map 2.6.1 → 2.7.1

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.
Files changed (62) hide show
  1. package/README.md +4 -0
  2. package/dist/v2/api/gaodeDirectionDriving.d.ts +50 -0
  3. package/dist/v2/api/gaodeDirectionDriving.js +157 -0
  4. package/dist/v2/api/gaodeDirectionWalking.d.ts +15 -0
  5. package/dist/v2/api/gaodeDirectionWalking.js +105 -0
  6. package/dist/v2/api/geometry.js +3 -3
  7. package/dist/v2/api/googleDirections.d.ts +2 -2
  8. package/dist/v2/api/googleDirections.js +9 -6
  9. package/dist/v2/components/MapProvider/MapProvider.d.ts +1 -1
  10. package/dist/v2/components/MapProvider/MapProvider.js +1 -1
  11. package/dist/v2/hooks/useDrivingRoute.js +4 -3
  12. package/dist/v2/hooks/useMapCoordinatify.js +1 -1
  13. package/dist/v2/hooks/useMapGCJ02.js +11 -1
  14. package/dist/v2/hooks/useMapGraspRoad.js +3 -3
  15. package/dist/v2/hooks/useMapInChina.d.ts +1 -0
  16. package/dist/v2/hooks/useMapInChina.js +166 -0
  17. package/dist/v2/hooks/useMapSupplier.d.ts +2 -0
  18. package/dist/v2/hooks/useWalkingRoute.js +6 -3
  19. package/dist/v2/types/amap/driving.d.ts +3 -2
  20. package/dist/v2/types/amap/walking.d.ts +1 -1
  21. package/dist/v2/utils/compatibleDrivingRoute.d.ts +1 -0
  22. package/dist/v2/utils/compatibleDrivingRoute.js +39 -0
  23. package/dist/v2/utils/compatibleGraspRoad.d.ts +1 -0
  24. package/dist/v2/utils/compatibleGraspRoad.js +7 -0
  25. package/dist/v2/utils/compatibleWalkingRoute.d.ts +1 -0
  26. package/dist/v2/utils/compatibleWalkingRoute.js +26 -0
  27. package/dist/v2/utils/log.js +1 -1
  28. package/dist/v2/utils/platform.js +1 -1
  29. package/dist/v2/utils/transform.d.ts +3 -0
  30. package/dist/v2/utils/transform.js +14 -2
  31. package/dist/v2/utils/typeChecking.js +1 -0
  32. package/dist/v3/api/gaodeDirectionDriving.d.ts +50 -0
  33. package/dist/v3/api/gaodeDirectionDriving.js +157 -0
  34. package/dist/v3/api/gaodeDirectionWalking.d.ts +15 -0
  35. package/dist/v3/api/gaodeDirectionWalking.js +105 -0
  36. package/dist/v3/api/geometry.js +3 -3
  37. package/dist/v3/api/googleDirections.d.ts +2 -2
  38. package/dist/v3/api/googleDirections.js +9 -6
  39. package/dist/v3/components/MapProvider/MapProvider.d.ts +1 -1
  40. package/dist/v3/components/MapProvider/MapProvider.js +1 -1
  41. package/dist/v3/hooks/useDrivingRoute.js +4 -3
  42. package/dist/v3/hooks/useMapCoordinatify.js +1 -1
  43. package/dist/v3/hooks/useMapGCJ02.js +11 -1
  44. package/dist/v3/hooks/useMapGraspRoad.js +3 -3
  45. package/dist/v3/hooks/useMapInChina.d.ts +1 -0
  46. package/dist/v3/hooks/useMapInChina.js +166 -0
  47. package/dist/v3/hooks/useMapSupplier.d.ts +2 -0
  48. package/dist/v3/hooks/useWalkingRoute.js +6 -3
  49. package/dist/v3/types/amap/driving.d.ts +3 -2
  50. package/dist/v3/types/amap/walking.d.ts +1 -1
  51. package/dist/v3/utils/compatibleDrivingRoute.d.ts +1 -0
  52. package/dist/v3/utils/compatibleDrivingRoute.js +39 -0
  53. package/dist/v3/utils/compatibleGraspRoad.d.ts +1 -0
  54. package/dist/v3/utils/compatibleGraspRoad.js +7 -0
  55. package/dist/v3/utils/compatibleWalkingRoute.d.ts +1 -0
  56. package/dist/v3/utils/compatibleWalkingRoute.js +26 -0
  57. package/dist/v3/utils/log.js +1 -1
  58. package/dist/v3/utils/platform.js +1 -1
  59. package/dist/v3/utils/transform.d.ts +3 -0
  60. package/dist/v3/utils/transform.js +14 -2
  61. package/dist/v3/utils/typeChecking.js +1 -0
  62. package/package.json +1 -1
@@ -2399,6 +2399,168 @@ const hongkongBounds = [
2399
2399
  22.504768
2400
2400
  ]
2401
2401
  ];
2402
+ const koreanBounds = [
2403
+ [
2404
+ 125.637366,
2405
+ 37.690714
2406
+ ],
2407
+ [
2408
+ 125.694873,
2409
+ 37.699096
2410
+ ],
2411
+ [
2412
+ 126.005108,
2413
+ 37.687121
2414
+ ],
2415
+ [
2416
+ 126.076236,
2417
+ 37.713464
2418
+ ],
2419
+ [
2420
+ 126.174603,
2421
+ 37.717055
2422
+ ],
2423
+ [
2424
+ 126.20033,
2425
+ 37.742191
2426
+ ],
2427
+ [
2428
+ 126.185196,
2429
+ 37.802002
2430
+ ],
2431
+ [
2432
+ 126.21849,
2433
+ 37.828304
2434
+ ],
2435
+ [
2436
+ 126.409171,
2437
+ 37.846231
2438
+ ],
2439
+ [
2440
+ 126.447005,
2441
+ 37.835475
2442
+ ],
2443
+ [
2444
+ 126.468192,
2445
+ 37.812763
2446
+ ],
2447
+ [
2448
+ 126.584719,
2449
+ 37.762532
2450
+ ],
2451
+ [
2452
+ 126.659196,
2453
+ 37.782212
2454
+ ],
2455
+ [
2456
+ 126.672837,
2457
+ 37.831992
2458
+ ],
2459
+ [
2460
+ 126.688926,
2461
+ 37.841344
2462
+ ],
2463
+ [
2464
+ 126.673713,
2465
+ 37.953188
2466
+ ],
2467
+ [
2468
+ 126.713155,
2469
+ 37.954484
2470
+ ],
2471
+ [
2472
+ 126.813404,
2473
+ 38.002414
2474
+ ],
2475
+ [
2476
+ 126.861063,
2477
+ 38.048372
2478
+ ],
2479
+ [
2480
+ 126.881335,
2481
+ 38.103823
2482
+ ],
2483
+ [
2484
+ 126.956105,
2485
+ 38.136251
2486
+ ],
2487
+ [
2488
+ 126.98678,
2489
+ 38.212363
2490
+ ],
2491
+ [
2492
+ 127.137287,
2493
+ 38.314008
2494
+ ],
2495
+ [
2496
+ 127.395491,
2497
+ 38.336596
2498
+ ],
2499
+ [
2500
+ 127.510661,
2501
+ 38.301619
2502
+ ],
2503
+ [
2504
+ 127.575676,
2505
+ 38.336596
2506
+ ],
2507
+ [
2508
+ 127.793013,
2509
+ 38.338053
2510
+ ],
2511
+ [
2512
+ 127.825612,
2513
+ 38.308727
2514
+ ],
2515
+ [
2516
+ 127.890403,
2517
+ 38.334143
2518
+ ],
2519
+ [
2520
+ 128.054781,
2521
+ 38.307786
2522
+ ],
2523
+ [
2524
+ 128.20836,
2525
+ 38.374602
2526
+ ],
2527
+ [
2528
+ 128.280817,
2529
+ 38.444051
2530
+ ],
2531
+ [
2532
+ 128.302796,
2533
+ 38.480152
2534
+ ],
2535
+ [
2536
+ 128.306013,
2537
+ 38.59379
2538
+ ],
2539
+ [
2540
+ 128.35855,
2541
+ 38.618926
2542
+ ],
2543
+ [
2544
+ 131.378464,
2545
+ 37.526365
2546
+ ],
2547
+ [
2548
+ 129.520972,
2549
+ 35.161674
2550
+ ],
2551
+ [
2552
+ 127.276802,
2553
+ 33.309556
2554
+ ],
2555
+ [
2556
+ 125.675231,
2557
+ 32.793646
2558
+ ],
2559
+ [
2560
+ 124.454296,
2561
+ 34.226423
2562
+ ]
2563
+ ];
2402
2564
  const macauBounds = [
2403
2565
  [
2404
2566
  113.540194,
@@ -2627,9 +2789,13 @@ const inMacau = (point) => {
2627
2789
  const inTaiwan = (point) => {
2628
2790
  return pointInPolygon(point, taiwanBounds) >= 0;
2629
2791
  };
2792
+ const inKorean = (point) => {
2793
+ return pointInPolygon(point, koreanBounds) >= 0;
2794
+ };
2630
2795
  export {
2631
2796
  inChina,
2632
2797
  inHongkong,
2798
+ inKorean,
2633
2799
  inMacau,
2634
2800
  inTaiwan
2635
2801
  };
@@ -7,6 +7,8 @@ export interface MapSupplierPayolad extends UseMapLoaderProps {
7
7
  readyPromise: UseMapLoaderOutput["readyPromise"];
8
8
  status: Status;
9
9
  pingStatus: ConnectionStatus;
10
+ gaodeDirectionDrivingProxyUrl?: string;
11
+ gaodeDirectionWalkingProxyUrl?: string;
10
12
  googleDirectionsProxyUrl?: string;
11
13
  googleSnapRoadProxyUrl?: string;
12
14
  renderLoadFailedTitle?: (status: Status) => string | undefined;
@@ -1,7 +1,7 @@
1
1
  import { shallowRef } from "vue-demi";
2
2
  import { watchPostEffectForDeepOption } from "../utils/compare.js";
3
- import { googleServiceApiWalkingRoute, amapJsApiWalkingRoute, gmapJsApiWalkingRoute } from "../utils/compatibleWalkingRoute.js";
4
- import { inTaiwan } from "./useMapInChina.js";
3
+ import { googleServiceApiWalkingRoute, amapJsApiWalkingRoute, gaodeServiceApiWalkingRoute, gmapJsApiWalkingRoute } from "../utils/compatibleWalkingRoute.js";
4
+ import { inTaiwan, inKorean } from "./useMapInChina.js";
5
5
  import { useMapSupplier } from "./useMapSupplier.js";
6
6
  const useAWalkingRoute = (props) => {
7
7
  const { googleDirectionsProxyUrl } = useMapSupplier();
@@ -24,10 +24,13 @@ const useAWalkingRoute = (props) => {
24
24
  return pathRef;
25
25
  };
26
26
  const useGWalkingRoute = (props) => {
27
+ const { gaodeDirectionWalkingProxyUrl } = useMapSupplier();
27
28
  const pathRef = shallowRef([]);
28
29
  const gmapDirectionsService = new google.maps.DirectionsService();
29
30
  const apiMapWalkingRoute = (from, to) => {
30
- return gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
31
+ if (inKorean(from))
32
+ return Promise.resolve([]);
33
+ return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
31
34
  };
32
35
  watchPostEffectForDeepOption(
33
36
  () => {
@@ -22,7 +22,7 @@ declare global {
22
22
  tolls: number;
23
23
  tolls_distance: number;
24
24
  restriction: number;
25
- steps: (DriveStepBasic | DriveStepDetail)[];
25
+ steps: (DriveStepBasic & DriveStepDetail)[];
26
26
  }
27
27
  interface DriveStepBasic {
28
28
  start_location: LngLat;
@@ -68,7 +68,8 @@ declare global {
68
68
  taxi_cost: number;
69
69
  routes: DrivingRoute[];
70
70
  }
71
- type DrivingCallback = (status: "complete" | "error" | "no_data", result: DrivingResult | Error | 0) => void;
71
+ type DirectionCallbackStatus = "complete" | "error" | "no_data";
72
+ type DrivingCallback = (status: DirectionCallbackStatus, result: DrivingResult | Error | 0) => void;
72
73
  class Driving {
73
74
  constructor(option: DrivingOptions);
74
75
  search(origin: LngLat, destination: LngLat, opts: {
@@ -32,7 +32,7 @@ declare global {
32
32
  count: number;
33
33
  routes: WalkRoute[];
34
34
  }
35
- type WalkingCallback = (status: "complete" | "error" | "no_data", result: WalkingResult | Error | 0) => void;
35
+ type WalkingCallback = (status: DirectionCallbackStatus, result: WalkingResult | Error | 0) => void;
36
36
  class Walking {
37
37
  constructor(option: WalkingOptions);
38
38
  search(origin: LngLat, destination: LngLat, callback: WalkingCallback): void;
@@ -1,5 +1,6 @@
1
1
  /// <reference types="google.maps" />
2
2
  import type { Point, Route } from "../types/interface";
3
3
  export declare function amapJsApiDrivingRoute(from: Point, to: Point, amapDriving: AMap.Driving): Promise<Route>;
4
+ export declare function gaodeServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
4
5
  export declare function gmapJsApiDrivingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Route>;
5
6
  export declare function googleServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
@@ -1,3 +1,4 @@
1
+ import { apiGaodeDirectionDriving } from "../api/gaodeDirectionDriving.js";
1
2
  import { apiGoogleDirections } from "../api/googleDirections.js";
2
3
  function amapJsApiDrivingRoute(from, to, amapDriving) {
3
4
  return new Promise((resolve, reject) => {
@@ -41,6 +42,43 @@ function amapJsApiDrivingRoute(from, to, amapDriving) {
41
42
  );
42
43
  });
43
44
  }
45
+ async function gaodeServiceApiDrivingRoute(from, to, proxyUrl) {
46
+ const { status, routes, error_message } = await apiGaodeDirectionDriving({
47
+ proxyUrl,
48
+ origin: [from],
49
+ destination: to
50
+ });
51
+ switch (status) {
52
+ case "complete": {
53
+ let path = [];
54
+ const routeSteps = [];
55
+ const firstRoute = routes[0];
56
+ if (!firstRoute)
57
+ return { path: [], distance: 0, duration: 0, steps: [] };
58
+ for (const step of firstRoute.steps) {
59
+ const basicStep = step;
60
+ const stepPath = basicStep.path.map(({ lng, lat }) => [lng, lat]);
61
+ path = path.concat(stepPath);
62
+ routeSteps.push({
63
+ path: basicStep.path.map(({ lng, lat }) => [lng, lat]),
64
+ duration: basicStep.time,
65
+ distance: basicStep.distance
66
+ });
67
+ }
68
+ return {
69
+ path,
70
+ distance: firstRoute.distance,
71
+ duration: firstRoute.time,
72
+ tolls: firstRoute.tolls,
73
+ steps: routeSteps
74
+ };
75
+ }
76
+ case "no_data":
77
+ return { path: [], distance: 0, duration: 0, steps: [] };
78
+ default:
79
+ throw Error(error_message);
80
+ }
81
+ }
44
82
  function gmapJsApiDrivingRoute(from, to, gmapDirectionsService) {
45
83
  return new Promise((resolve, reject) => {
46
84
  gmapDirectionsService.route(
@@ -125,6 +163,7 @@ async function googleServiceApiDrivingRoute(from, to, proxyUrl) {
125
163
  }
126
164
  export {
127
165
  amapJsApiDrivingRoute,
166
+ gaodeServiceApiDrivingRoute,
128
167
  gmapJsApiDrivingRoute,
129
168
  googleServiceApiDrivingRoute
130
169
  };
@@ -6,3 +6,4 @@ export interface ApiGraspRoadOutput {
6
6
  }
7
7
  export declare function amapJsApiGraspRoad(tracks: TrackPoint[], amapGraspRoad: AMap.GraspRoad, apiMapComputeHeading: ApiMapComputeHeading): Promise<ApiGraspRoadOutput>;
8
8
  export declare function googleServiceApiGraspRoad(tracks: TrackPoint[], apiMapComputeHeading: ApiMapComputeHeading, proxyUrl?: string): Promise<ApiGraspRoadOutput>;
9
+ export declare function bypassGraspRoad(tracks: TrackPoint[], apiMapComputeHeading: ApiMapComputeHeading): Promise<ApiGraspRoadOutput>;
@@ -61,7 +61,14 @@ async function googleServiceApiGraspRoad(tracks, apiMapComputeHeading, proxyUrl)
61
61
  const angle = (_d = apiMapComputeHeading(path[path.length - 2], path[path.length - 1])) != null ? _d : 0;
62
62
  return { path, angle };
63
63
  }
64
+ async function bypassGraspRoad(tracks, apiMapComputeHeading) {
65
+ var _a;
66
+ const path = tracks.map(lnglat2point);
67
+ const angle = (_a = apiMapComputeHeading(path[0], path[1])) != null ? _a : 0;
68
+ return { path, angle };
69
+ }
64
70
  export {
65
71
  amapJsApiGraspRoad,
72
+ bypassGraspRoad,
66
73
  googleServiceApiGraspRoad
67
74
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="google.maps" />
2
2
  import type { Point } from "../types/interface";
3
3
  export declare function amapJsApiWalkingRoute(from: Point, to: Point, amapWalking: AMap.Walking): Promise<Point[]>;
4
+ export declare function gaodeServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
4
5
  export declare function gmapJsApiWalkingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Point[]>;
5
6
  export declare function googleServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
@@ -1,3 +1,4 @@
1
+ import { apiGaodeDirectionWalking } from "../api/gaodeDirectionWalking.js";
1
2
  import { apiGoogleDirections } from "../api/googleDirections.js";
2
3
  const isIgnoredAmapTimeoutError = (err) => err === "RETURN_TIMEOUT";
3
4
  function amapJsApiWalkingRoute(from, to, amapWalking) {
@@ -29,6 +30,30 @@ function amapJsApiWalkingRoute(from, to, amapWalking) {
29
30
  });
30
31
  });
31
32
  }
33
+ async function gaodeServiceApiWalkingRoute(from, to, proxyUrl) {
34
+ const { status, routes, error_message } = await apiGaodeDirectionWalking({
35
+ proxyUrl,
36
+ origin: from,
37
+ destination: to
38
+ });
39
+ switch (status) {
40
+ case "complete": {
41
+ let path = [];
42
+ if (!routes)
43
+ return [];
44
+ const firstRoute = routes[0];
45
+ for (const step of firstRoute.steps) {
46
+ const stepPath = step.path.map(({ lng, lat }) => [lng, lat]);
47
+ path = path.concat(stepPath);
48
+ }
49
+ return path;
50
+ }
51
+ case "no_data":
52
+ return [];
53
+ default:
54
+ throw Error(error_message);
55
+ }
56
+ }
32
57
  function gmapJsApiWalkingRoute(from, to, gmapDirectionsService) {
33
58
  return new Promise((resolve, reject) => {
34
59
  gmapDirectionsService.route(
@@ -76,6 +101,7 @@ async function googleServiceApiWalkingRoute(from, to, proxyUrl) {
76
101
  }
77
102
  export {
78
103
  amapJsApiWalkingRoute,
104
+ gaodeServiceApiWalkingRoute,
79
105
  gmapJsApiWalkingRoute,
80
106
  googleServiceApiWalkingRoute
81
107
  };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.6.1";
3
+ const pkgVersion = "2.7.1";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -50,7 +50,7 @@ const detectOSPlatform = () => {
50
50
  if (typeof navigator === "undefined")
51
51
  return "OTHER";
52
52
  const userAgent = navigator.userAgent || navigator.vendor;
53
- if (/android/i.test(userAgent)) {
53
+ if (/android/i.test(userAgent) || /OpenHarmony/i.test(userAgent)) {
54
54
  return "ANDROID";
55
55
  }
56
56
  if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
@@ -3,12 +3,14 @@ import type { Language, LngLatLiterial, Place, Point, TrackPoint, Zone } from ".
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
6
+ export declare const isAccuryEqual: (x: number, y?: number) => boolean;
6
7
  export declare const vec2lnglat: ([lng, lat]: [number, number]) => LngLatLiterial;
7
8
  export declare const lnglat2point: ({ lng, lat }: {
8
9
  lng: number;
9
10
  lat: number;
10
11
  }) => Point;
11
12
  export declare const googlePointsStringify: (points: Point[]) => string;
13
+ export declare const gaodePointsStringify: (points: Point[]) => string;
12
14
  export interface AsteriskItem {
13
15
  type: "normal" | "emphasize";
14
16
  value: string;
@@ -44,4 +46,5 @@ type MaybeFunctionToFunction<T> = T extends (...args: any) => any ? T : () => T;
44
46
  export declare const maybeFunctionToFunction: <T>(value: T) => MaybeFunctionToFunction<T>;
45
47
  export declare const signal2promise: (signal?: AbortSignal) => Promise<any>;
46
48
  export declare const googleEncodedPolyline2googleLatLng: (value: string) => google.maps.LatLng[];
49
+ export declare const gaodePolyline2amapLngLat: (value: string) => AMap.LngLat[];
47
50
  export {};
@@ -35,12 +35,15 @@ var decode = function(encodedPath, precision) {
35
35
  path.length = pointIndex;
36
36
  return path;
37
37
  };
38
+ const GCOORD_ACCURCY_RANGE = 1e-6;
39
+ const isAccuryEqual = (x, y) => y === void 0 ? false : Math.abs(x - y) <= GCOORD_ACCURCY_RANGE;
38
40
  const vec2lnglat = ([lng, lat]) => ({
39
41
  lng: Number(lng),
40
42
  lat: Number(lat)
41
43
  });
42
44
  const lnglat2point = ({ lng, lat }) => [lng, lat];
43
45
  const googlePointsStringify = (points) => points.map(([lng, lat]) => `${lat},${lng}`).join("|");
46
+ const gaodePointsStringify = (points) => points.map(([lng, lat]) => `${lng},${lat}`).join(";");
44
47
  const decodeAsterisk = (encodedValue) => {
45
48
  const result = [];
46
49
  const tokens = encodedValue.split("*");
@@ -99,10 +102,10 @@ const pipeOnlyLastEffect = (fn) => {
99
102
  };
100
103
  };
101
104
  const isPlaceEqual = (p1, p2) => {
102
- return p1.lng === (p2 == null ? void 0 : p2.lng) && p1.lat === (p2 == null ? void 0 : p2.lat);
105
+ return isAccuryEqual(p1.lng, p2 == null ? void 0 : p2.lng) && isAccuryEqual(p1.lat, p2 == null ? void 0 : p2.lat);
103
106
  };
104
107
  const isPointEqual = (p1, p2) => {
105
- return p1[0] === (p2 == null ? void 0 : p2[0]) && p1[1] === (p2 == null ? void 0 : p2[1]);
108
+ return isAccuryEqual(p1[0], p2 == null ? void 0 : p2[0]) && isAccuryEqual(p1[1], p2 == null ? void 0 : p2[1]);
106
109
  };
107
110
  const isGeoPositionEqual = (p1, p2) => {
108
111
  if (!p2)
@@ -287,6 +290,12 @@ const signal2promise = (signal) => {
287
290
  const googleEncodedPolyline2googleLatLng = (value) => {
288
291
  return decode(value).map(([lat, lng]) => new GoogleLatLng({ lng, lat }));
289
292
  };
293
+ const gaodePolyline2amapLngLat = (value) => {
294
+ return value.split(";").map((lnglatString) => {
295
+ const [lng, lat] = lnglatString.split(",").map(Number);
296
+ return { lng, lat };
297
+ });
298
+ };
290
299
  export {
291
300
  alipayMyGetLocationError2GeolocationPositionErrorCode,
292
301
  alipayMyGetLocationSuccessResponse2GeolocationPosition,
@@ -296,10 +305,13 @@ export {
296
305
  decodeAsterisk,
297
306
  deltaZoom2animationDuration,
298
307
  distanceVw2animationDuration,
308
+ gaodePointsStringify,
309
+ gaodePolyline2amapLngLat,
299
310
  geoPositionError2businessTimeout,
300
311
  gmapPlaceName2DisplayName,
301
312
  googleEncodedPolyline2googleLatLng,
302
313
  googlePointsStringify,
314
+ isAccuryEqual,
303
315
  isGeoPositionEqual,
304
316
  isPlaceEqual,
305
317
  isPointEqual,
@@ -4,6 +4,7 @@ const createTypeError = (typeName, value, detail) => {
4
4
  `MyTypeError: expect type: ${typeName}, but received: ${JSON.stringify(
5
5
  value
6
6
  )}
7
+
7
8
  Type Error Details: ${detail}`
8
9
  );
9
10
  return new Error(`MyTypeError: expect type: ${typeName}, but received: ${JSON.stringify(value)}`);
@@ -0,0 +1,50 @@
1
+ import type { Point } from "../types/interface";
2
+ type GaodeMaybeEmpty<T> = T | [];
3
+ export declare enum GaodeDirectionStatus {
4
+ SUCCESS = "1",
5
+ FAIL = "0"
6
+ }
7
+ export interface GaodeMeasurableObject {
8
+ distance: GaodeMaybeEmpty<`${number}`>;
9
+ duration: GaodeMaybeEmpty<`${number}`>;
10
+ }
11
+ export interface GaodeDirectionBasicStep extends GaodeMeasurableObject {
12
+ polyline: GaodeMaybeEmpty<string>;
13
+ }
14
+ export type GaodeDirectionResponse = {
15
+ status: GaodeDirectionStatus;
16
+ info: string;
17
+ };
18
+ export declare const gaodeDirectionStatus2amapDirectionCallbackStatus: (status: GaodeDirectionStatus) => AMap.DirectionCallbackStatus;
19
+ export declare function isGaodeDirectionResponse(value: unknown): value is GaodeDirectionResponse;
20
+ export declare function isGaodeDirectionStatus(value: unknown): value is GaodeDirectionStatus;
21
+ export declare function assertGaodeDirectionStatus(value: unknown): asserts value is GaodeDirectionStatus;
22
+ export declare function isGaodeNumberableString(value: unknown): value is GaodeMaybeEmpty<`${number}`>;
23
+ export declare function isGaodeDirectionPolyline(value: unknown): value is GaodeMaybeEmpty<string>;
24
+ export declare function isGaodeMeasurableObject(value: unknown): value is GaodeMeasurableObject;
25
+ export declare function isGaodeDirectionBasicStep(value: unknown): value is GaodeDirectionBasicStep;
26
+ export interface ApiGaodeDirectionDrivingOutput {
27
+ status: AMap.DirectionCallbackStatus;
28
+ error_message: string;
29
+ routes: AMap.DrivingRoute[];
30
+ }
31
+ interface ApiGaodeDirectionDrivingProps {
32
+ proxyUrl?: string;
33
+ origin: Point[];
34
+ destination: Point;
35
+ extensions?: "base" | "all";
36
+ destinationid?: string;
37
+ destinationtype?: string;
38
+ strategy?: AMap.DrivingOptions["policy"];
39
+ waypoints?: Point[];
40
+ avoidpolygons?: string;
41
+ province?: AMap.DrivingOptions["province"];
42
+ number?: AMap.DrivingOptions["number"];
43
+ cartype?: 0 | 1 | 2;
44
+ ferry?: AMap.DrivingOptions["ferry"];
45
+ roadaggregation?: boolean;
46
+ nosteps?: 0 | 1;
47
+ output?: "JSON" | "XML";
48
+ }
49
+ export declare function apiGaodeDirectionDriving(props: ApiGaodeDirectionDrivingProps): Promise<ApiGaodeDirectionDrivingOutput>;
50
+ export {};