@heycar/heycars-map 2.10.0 → 2.11.1-APlus
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/README.md +3 -1
- package/dist/v2/App.js +9 -7
- package/dist/v2/api/cdn.d.ts +7 -7
- package/dist/v2/api/cdn.js +7 -7
- package/dist/v2/api/googleRoutes.d.ts +27 -0
- package/dist/v2/api/googleRoutes.js +135 -0
- package/dist/v2/components/MapProvider/MapProvider.d.ts +1 -1
- package/dist/v2/components/MapProvider/MapProvider.js +1 -1
- package/dist/v2/hooks/useDrivingRoute.js +4 -4
- package/dist/v2/hooks/useMapSupplier.d.ts +1 -0
- package/dist/v2/hooks/useWalkingRoute.js +4 -4
- package/dist/v2/utils/compatibleDrivingRoute.d.ts +1 -0
- package/dist/v2/utils/compatibleDrivingRoute.js +47 -1
- package/dist/v2/utils/compatibleWalkingRoute.d.ts +1 -0
- package/dist/v2/utils/compatibleWalkingRoute.js +30 -1
- package/dist/v2/utils/log.js +1 -1
- package/dist/v3/App.js +9 -7
- package/dist/v3/api/cdn.d.ts +7 -7
- package/dist/v3/api/cdn.js +7 -7
- package/dist/v3/api/googleRoutes.d.ts +27 -0
- package/dist/v3/api/googleRoutes.js +135 -0
- package/dist/v3/components/MapProvider/MapProvider.d.ts +1 -1
- package/dist/v3/components/MapProvider/MapProvider.js +1 -1
- package/dist/v3/hooks/useDrivingRoute.js +4 -4
- package/dist/v3/hooks/useMapSupplier.d.ts +1 -0
- package/dist/v3/hooks/useWalkingRoute.js +4 -4
- package/dist/v3/utils/compatibleDrivingRoute.d.ts +1 -0
- package/dist/v3/utils/compatibleDrivingRoute.js +47 -1
- package/dist/v3/utils/compatibleWalkingRoute.d.ts +1 -0
- package/dist/v3/utils/compatibleWalkingRoute.js +30 -1
- package/dist/v3/utils/log.js +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -136,8 +136,10 @@ export type RecommendType = "Restricted" | "Forbidden" | "Recommend";
|
|
|
136
136
|
gaodeDirectionWalkingProxyUrl="/overseas/amap/walkingGuide"
|
|
137
137
|
// 可选,谷歌路线纠偏代理地址
|
|
138
138
|
googleSnapRoadProxyUrl="/overseas/maps/snapToRoads"
|
|
139
|
-
//
|
|
139
|
+
// 弃用,谷歌路线规划代理地址
|
|
140
140
|
googleDirectionsProxyUrl="/overseas/maps/directions/json"
|
|
141
|
+
// 可选,谷歌路由服务代理地址
|
|
142
|
+
googleRoutesProxyUrl="/overseas/maps/routes/directions"
|
|
141
143
|
// 地图加载失败时显示的标题
|
|
142
144
|
renderLoadFailedTitle={() => (supplier === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败")}
|
|
143
145
|
// 地图加载失败时显示的描述
|
package/dist/v2/App.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { h } from "vue";
|
|
2
2
|
import { defineComponent, ref } from "vue-demi";
|
|
3
|
-
import {
|
|
3
|
+
import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
|
|
4
4
|
import { MapProvider } from "./components/MapProvider/MapProvider.js";
|
|
5
|
-
const gmapApiKey =
|
|
6
|
-
const gmapId =
|
|
7
|
-
const amapApiKey =
|
|
8
|
-
const amapApiSecret =
|
|
5
|
+
const gmapApiKey = {}.VITE_GMAP_API_KEY;
|
|
6
|
+
const gmapId = {}.VITE_GMAP_MAP_ID;
|
|
7
|
+
const amapApiKey = {}.VITE_AMAP_API_KEY;
|
|
8
|
+
const amapApiSecret = {}.VITE_AMAP_API_SECRET;
|
|
9
9
|
const App = defineComponent({
|
|
10
10
|
setup() {
|
|
11
|
-
const supplierRef = ref("
|
|
11
|
+
const supplierRef = ref("gmap");
|
|
12
12
|
window.supplierRef = supplierRef;
|
|
13
13
|
return () => h(MapProvider, {
|
|
14
14
|
"attrs": {
|
|
@@ -18,6 +18,8 @@ const App = defineComponent({
|
|
|
18
18
|
"gmapKey": gmapApiKey,
|
|
19
19
|
"language": "en",
|
|
20
20
|
"supplier": supplierRef.value,
|
|
21
|
+
"googleSnapRoadProxyUrl": "/overseas/maps/snapToRoads",
|
|
22
|
+
"googleRoutesProxyUrl": "/overseas/maps/routes/directions",
|
|
21
23
|
"renderLoadFailedTitle": () => supplierRef.value === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败",
|
|
22
24
|
"renderLoadFailedDescription": () => supplierRef.value === "gmap" ? "请确认您的网络能正常访问谷歌地图, \n或切回高德地图" : void 0
|
|
23
25
|
},
|
|
@@ -26,7 +28,7 @@ const App = defineComponent({
|
|
|
26
28
|
"fail": () => console.log(`${supplierRef.value} load failed`),
|
|
27
29
|
"downloadOptimizeEnd": () => console.log(`${supplierRef.value} load download optimize end`)
|
|
28
30
|
}
|
|
29
|
-
}, [h(
|
|
31
|
+
}, [h(DemoBusinessQuoting)]);
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
export {
|
package/dist/v2/api/cdn.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
2
|
-
export declare const ICON_FULL_SCREEN_URL = "https://
|
|
3
|
-
export declare const ICON_START_POINT_EN_URL = "https://
|
|
4
|
-
export declare const ICON_END_POINT_EN_URL = "https://
|
|
5
|
-
export declare const ICON_END_POINT_ZH_TW_URL = "https://
|
|
6
|
-
export declare const ICON_TAXI_CAR_URL = "https://
|
|
7
|
-
export declare const ICON_DOT_LOADING_URL = "https://
|
|
8
|
-
export declare const ICON_LOAD_FAILED_URL = "https://
|
|
2
|
+
export declare const ICON_FULL_SCREEN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/png/fullscreen.png";
|
|
3
|
+
export declare const ICON_START_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/start-point-en.svg";
|
|
4
|
+
export declare const ICON_END_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-en.svg";
|
|
5
|
+
export declare const ICON_END_POINT_ZH_TW_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-zh-TW.svg";
|
|
6
|
+
export declare const ICON_TAXI_CAR_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/taxi-car.svg";
|
|
7
|
+
export declare const ICON_DOT_LOADING_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
export declare const ICON_LOAD_FAILED_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/load-failed.svg";
|
package/dist/v2/api/cdn.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
2
|
-
const ICON_FULL_SCREEN_URL = "https://
|
|
3
|
-
const ICON_START_POINT_EN_URL = "https://
|
|
4
|
-
const ICON_END_POINT_EN_URL = "https://
|
|
5
|
-
const ICON_END_POINT_ZH_TW_URL = "https://
|
|
6
|
-
const ICON_TAXI_CAR_URL = "https://
|
|
7
|
-
const ICON_DOT_LOADING_URL = "https://
|
|
8
|
-
const ICON_LOAD_FAILED_URL = "https://
|
|
2
|
+
const ICON_FULL_SCREEN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/png/fullscreen.png";
|
|
3
|
+
const ICON_START_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/start-point-en.svg";
|
|
4
|
+
const ICON_END_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-en.svg";
|
|
5
|
+
const ICON_END_POINT_ZH_TW_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-zh-TW.svg";
|
|
6
|
+
const ICON_TAXI_CAR_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/taxi-car.svg";
|
|
7
|
+
const ICON_DOT_LOADING_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
const ICON_LOAD_FAILED_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/load-failed.svg";
|
|
9
9
|
export {
|
|
10
10
|
AMAP_DEFAULT_MARKER_ICON_URL,
|
|
11
11
|
ICON_DOT_LOADING_URL,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import type { protos } from "@googlemaps/routing";
|
|
3
|
+
type GoogleRoutesMeasurableObject = {
|
|
4
|
+
distanceMeters?: number;
|
|
5
|
+
staticDuration?: string;
|
|
6
|
+
staticDurationSeconds?: number;
|
|
7
|
+
duration?: string;
|
|
8
|
+
durationSeconds?: number;
|
|
9
|
+
};
|
|
10
|
+
type GoogleRoutesStep = Omit<protos.google.maps.routing.v2.IRouteLegStep, "staticDuration"> & GoogleRoutesMeasurableObject & {
|
|
11
|
+
path: google.maps.LatLng[];
|
|
12
|
+
};
|
|
13
|
+
type GoogleRoutesLeg = Omit<protos.google.maps.routing.v2.IRouteLeg, "steps" | "staticDuration" | "duration"> & GoogleRoutesMeasurableObject & {
|
|
14
|
+
steps: GoogleRoutesStep[];
|
|
15
|
+
};
|
|
16
|
+
type GoogleRoutesRoute = Omit<protos.google.maps.routing.v2.IRoute, "legs" | "staticDuration" | "duration"> & GoogleRoutesMeasurableObject & {
|
|
17
|
+
legs: GoogleRoutesLeg[];
|
|
18
|
+
path: google.maps.LatLng[];
|
|
19
|
+
};
|
|
20
|
+
export interface GoogleRoutesResponse {
|
|
21
|
+
routes: GoogleRoutesRoute[];
|
|
22
|
+
}
|
|
23
|
+
interface ApiGoogleRoutesProps extends protos.google.maps.routing.v2.IComputeRoutesRequest {
|
|
24
|
+
proxyUrl?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function apiGoogleRoutes(props: ApiGoogleRoutesProps): Promise<GoogleRoutesResponse>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
|
+
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
const ALL_ROUTES_STATUS = [
|
|
4
|
+
"OK",
|
|
5
|
+
"CANCELLED",
|
|
6
|
+
"UNKNOWN",
|
|
7
|
+
"INVALID_ARGUMENT",
|
|
8
|
+
"DEADLINE_EXCEEDED",
|
|
9
|
+
"NOT_FOUND",
|
|
10
|
+
"ALREADY_EXISTS",
|
|
11
|
+
"PERMISSION_DENIED",
|
|
12
|
+
"UNAUTHENTICATED",
|
|
13
|
+
"RESOURCE_EXHAUSTED",
|
|
14
|
+
"FAILED_PRECONDITION",
|
|
15
|
+
"ABORTED",
|
|
16
|
+
"OUT_OF_RANGE",
|
|
17
|
+
"UNIMPLEMENTED",
|
|
18
|
+
"INTERNAL",
|
|
19
|
+
"UNAVAILABLE",
|
|
20
|
+
"DATA_LOSS"
|
|
21
|
+
];
|
|
22
|
+
const isGoogleRoutesStatus = (value) => {
|
|
23
|
+
return typeof value === "string" && ALL_ROUTES_STATUS.includes(value);
|
|
24
|
+
};
|
|
25
|
+
const isGoogleRoutesError = (value) => {
|
|
26
|
+
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "object" && value.error !== null && "code" in value.error && typeof value.error.code === "number" && "message" in value.error && typeof value.error.message === "string" && "status" in value.error && isGoogleRoutesStatus(value.error.status);
|
|
27
|
+
};
|
|
28
|
+
const isGoogleRoutesMeasurableObject = (value) => {
|
|
29
|
+
if (typeof value !== "object" || value === null || !("distanceMeters" in value) || typeof value.distanceMeters !== "number" || !("staticDuration" in value) || typeof value.staticDuration !== "string" || !value.staticDuration.endsWith("s")) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
value.staticDurationSeconds = Number(
|
|
33
|
+
value.staticDuration.slice(0, -1)
|
|
34
|
+
);
|
|
35
|
+
if (!("duration" in value))
|
|
36
|
+
return true;
|
|
37
|
+
if (typeof value.duration !== "string" || !value.duration.endsWith("s"))
|
|
38
|
+
return false;
|
|
39
|
+
value.durationSeconds = Number(value.duration.slice(0, -1));
|
|
40
|
+
return true;
|
|
41
|
+
};
|
|
42
|
+
const isGoogleRoutesPolyline = (value) => {
|
|
43
|
+
return typeof value === "object" && value !== null && "encodedPolyline" in value && typeof value.encodedPolyline === "string";
|
|
44
|
+
};
|
|
45
|
+
function assertGoogleRoutesStep(value) {
|
|
46
|
+
const error = createTypeError("GoogleRoutesStep", value);
|
|
47
|
+
if (!isGoogleRoutesMeasurableObject(value))
|
|
48
|
+
throw error;
|
|
49
|
+
if (!("polyline" in value) || value.polyline === null) {
|
|
50
|
+
value.path = [];
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!isGoogleRoutesPolyline(value.polyline))
|
|
54
|
+
throw error;
|
|
55
|
+
value.path = googleEncodedPolyline2googleLatLng(
|
|
56
|
+
value.polyline.encodedPolyline
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function assertGoogleRoutesLeg(value) {
|
|
60
|
+
if (!isGoogleRoutesMeasurableObject(value) || !("steps" in value) || !Array.isArray(value.steps))
|
|
61
|
+
throw createTypeError("GoogleRoutesLeg", value);
|
|
62
|
+
try {
|
|
63
|
+
for (const step of value.steps) {
|
|
64
|
+
assertGoogleRoutesStep(step);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
const { message: detail } = error;
|
|
68
|
+
throw createTypeError("GoogleRoutesLeg", value, detail);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function assertGoogleRoutesRoute(value) {
|
|
72
|
+
if (typeof value !== "object" || value === null || !("legs" in value) || !Array.isArray(value.legs) || !("polyline" in value) || !isGoogleRoutesPolyline(value.polyline))
|
|
73
|
+
throw createTypeError("GoogleRoutesRoute", value);
|
|
74
|
+
value.path = googleEncodedPolyline2googleLatLng(
|
|
75
|
+
value.polyline.encodedPolyline
|
|
76
|
+
);
|
|
77
|
+
try {
|
|
78
|
+
for (const leg of value.legs) {
|
|
79
|
+
assertGoogleRoutesLeg(leg);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const { message: detail } = error;
|
|
83
|
+
throw createTypeError("GoogleRoutesRoute", value, detail);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertGoogleRoutesResponse(value) {
|
|
87
|
+
if (typeof value !== "object" || value === null || !("routes" in value) || !Array.isArray(value.routes))
|
|
88
|
+
throw createTypeError("GoogleRoutesResponse", value);
|
|
89
|
+
try {
|
|
90
|
+
for (const route of value.routes) {
|
|
91
|
+
assertGoogleRoutesRoute(route);
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const { message: detail } = error;
|
|
95
|
+
throw createTypeError("GoogleRoutesResponse", value, detail);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function apiGoogleRoutes(props) {
|
|
99
|
+
const { proxyUrl, ...request } = props;
|
|
100
|
+
if (!proxyUrl) {
|
|
101
|
+
console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
|
|
102
|
+
return { routes: [] };
|
|
103
|
+
}
|
|
104
|
+
const { protocol, host } = location;
|
|
105
|
+
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
106
|
+
const url = new URL(proxyUrl, baseUrl);
|
|
107
|
+
const response = await fetch(url, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: { "Content-Type": "application/json" },
|
|
110
|
+
body: JSON.stringify(request)
|
|
111
|
+
});
|
|
112
|
+
if (response.ok) {
|
|
113
|
+
const result = await response.json();
|
|
114
|
+
assertGoogleRoutesResponse(result);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
const error = await response.json();
|
|
118
|
+
if (isProxyServiceError(error)) {
|
|
119
|
+
const { code, msg } = error;
|
|
120
|
+
throw new Error(`apiGoogleRoutes proxy failed code: ${code}, msg: ${msg}`);
|
|
121
|
+
}
|
|
122
|
+
if (isGoogleRoutesError(error)) {
|
|
123
|
+
const {
|
|
124
|
+
error: { status, message }
|
|
125
|
+
} = error;
|
|
126
|
+
throw new Error(`apiGoogleRoutes failed status: ${status}, message:
|
|
127
|
+
${message}`);
|
|
128
|
+
}
|
|
129
|
+
throw new Error(
|
|
130
|
+
`apiGoogleRoutes failed with unrecognized server response: ${JSON.stringify(error)}`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
apiGoogleRoutes
|
|
135
|
+
};
|
|
@@ -5,7 +5,7 @@ import { type GmapLoaderProps, type UseMapLoaderProps } from "../../hooks/useMap
|
|
|
5
5
|
import { type MapSupplierPayolad } from "../../hooks/useMapSupplier";
|
|
6
6
|
import type { AmapMap } from "../../types/interface";
|
|
7
7
|
import { type AmapProps } from "../Amap";
|
|
8
|
-
export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "gaodeDirectionDrivingProxyUrl" | "gaodeDirectionWalkingProxyUrl" | "googleDirectionsProxyUrl" | "googleSnapRoadProxyUrl" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
|
|
8
|
+
export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "gaodeDirectionDrivingProxyUrl" | "gaodeDirectionWalkingProxyUrl" | "googleDirectionsProxyUrl" | "googleRoutesProxyUrl" | "googleSnapRoadProxyUrl" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
|
|
9
9
|
export declare const MapProvider: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<MapProviderProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<MapProviderProps, Required<MapProviderProps>>, "success" | "fail" | "downloadOptimizeEnd", MapProviderProps>;
|
|
10
10
|
export interface HeycarMapProps extends Pick<GmapLoaderProps, "fallback" | "loading">, Pick<AmapProps, "center" | "zoom"> {
|
|
11
11
|
mapRef?: SetMap<AmapMap> | SetMap<google.maps.Map>;
|
|
@@ -50,7 +50,7 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
|
50
50
|
var _a;
|
|
51
51
|
return h("div", [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
52
52
|
};
|
|
53
|
-
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "gaodeDirectionDrivingProxyUrl", "gaodeDirectionWalkingProxyUrl", "googleDirectionsProxyUrl", "googleSnapRoadProxyUrl", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
|
|
53
|
+
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "gaodeDirectionDrivingProxyUrl", "gaodeDirectionWalkingProxyUrl", "googleDirectionsProxyUrl", "googleRoutesProxyUrl", "googleSnapRoadProxyUrl", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
|
|
54
54
|
const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
55
55
|
slots,
|
|
56
56
|
emit,
|
|
@@ -4,7 +4,7 @@ import { googleServiceApiDrivingRoute, amapJsApiDrivingRoute, gaodeServiceApiDri
|
|
|
4
4
|
import { inTaiwan, inKorean } from "./useMapInChina.js";
|
|
5
5
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
6
6
|
const useADrivingRoute = (props) => {
|
|
7
|
-
const {
|
|
7
|
+
const { googleRoutesProxyUrl } = useMapSupplier();
|
|
8
8
|
const outputRoute = reactive({
|
|
9
9
|
path: [],
|
|
10
10
|
distance: 0,
|
|
@@ -15,7 +15,7 @@ const useADrivingRoute = (props) => {
|
|
|
15
15
|
});
|
|
16
16
|
const amapDriving = new AMap.Driving({});
|
|
17
17
|
const apiMapDrivingRoute = (from, to) => {
|
|
18
|
-
return
|
|
18
|
+
return googleRoutesProxyUrl && inTaiwan(from) ? googleServiceApiDrivingRoute(from, to, googleRoutesProxyUrl) : amapJsApiDrivingRoute(from, to, amapDriving);
|
|
19
19
|
};
|
|
20
20
|
watchPostEffectForDeepOption(
|
|
21
21
|
() => {
|
|
@@ -31,11 +31,11 @@ const useADrivingRoute = (props) => {
|
|
|
31
31
|
return { route: outputRoute, apiMapDrivingRoute };
|
|
32
32
|
};
|
|
33
33
|
const useGDrivingRoute = (props) => {
|
|
34
|
-
const { gaodeDirectionDrivingProxyUrl } = useMapSupplier();
|
|
34
|
+
const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
35
35
|
const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [] });
|
|
36
36
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
37
37
|
const apiMapDrivingRoute = (from, to) => {
|
|
38
|
-
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, gaodeDirectionDrivingProxyUrl) : gmapJsApiDrivingRoute(from, to, gmapDirectionsService);
|
|
38
|
+
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, gmapDirectionsService);
|
|
39
39
|
};
|
|
40
40
|
watchPostEffectForDeepOption(
|
|
41
41
|
() => {
|
|
@@ -10,6 +10,7 @@ export interface MapSupplierPayolad extends UseMapLoaderProps {
|
|
|
10
10
|
gaodeDirectionDrivingProxyUrl?: string;
|
|
11
11
|
gaodeDirectionWalkingProxyUrl?: string;
|
|
12
12
|
googleDirectionsProxyUrl?: string;
|
|
13
|
+
googleRoutesProxyUrl?: string;
|
|
13
14
|
googleSnapRoadProxyUrl?: string;
|
|
14
15
|
renderLoadFailedTitle?: (status: Status) => string | undefined;
|
|
15
16
|
renderLoadFailedDescription?: (status: Status) => string | undefined;
|
|
@@ -4,11 +4,11 @@ import { googleServiceApiWalkingRoute, amapJsApiWalkingRoute, gaodeServiceApiWal
|
|
|
4
4
|
import { inTaiwan, inKorean } from "./useMapInChina.js";
|
|
5
5
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
6
6
|
const useAWalkingRoute = (props) => {
|
|
7
|
-
const {
|
|
7
|
+
const { googleRoutesProxyUrl } = useMapSupplier();
|
|
8
8
|
const pathRef = shallowRef([]);
|
|
9
9
|
const amapWalking = new AMap.Walking({});
|
|
10
10
|
const apiMapWalkingRoute = (from, to) => {
|
|
11
|
-
return
|
|
11
|
+
return googleRoutesProxyUrl && inTaiwan(from) ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : amapJsApiWalkingRoute(from, to, amapWalking);
|
|
12
12
|
};
|
|
13
13
|
watchPostEffectForDeepOption(
|
|
14
14
|
() => {
|
|
@@ -24,13 +24,13 @@ const useAWalkingRoute = (props) => {
|
|
|
24
24
|
return pathRef;
|
|
25
25
|
};
|
|
26
26
|
const useGWalkingRoute = (props) => {
|
|
27
|
-
const { gaodeDirectionWalkingProxyUrl } = useMapSupplier();
|
|
27
|
+
const { gaodeDirectionWalkingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
28
28
|
const pathRef = shallowRef([]);
|
|
29
29
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
30
30
|
const apiMapWalkingRoute = (from, to) => {
|
|
31
31
|
if (inKorean(from))
|
|
32
32
|
return Promise.resolve([]);
|
|
33
|
-
return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
|
|
33
|
+
return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
|
|
34
34
|
};
|
|
35
35
|
watchPostEffectForDeepOption(
|
|
36
36
|
() => {
|
|
@@ -3,4 +3,5 @@ import type { Point, Route } from "../types/interface";
|
|
|
3
3
|
export declare function amapJsApiDrivingRoute(from: Point, to: Point, amapDriving: AMap.Driving): Promise<Route>;
|
|
4
4
|
export declare function gaodeServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
5
5
|
export declare function gmapJsApiDrivingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Route>;
|
|
6
|
+
export declare function googleServiceApiDrivingDirection(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
6
7
|
export declare function googleServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiGaodeDirectionDriving } from "../api/gaodeDirectionDriving.js";
|
|
2
2
|
import { apiGoogleDirections } from "../api/googleDirections.js";
|
|
3
|
+
import { apiGoogleRoutes } from "../api/googleRoutes.js";
|
|
3
4
|
import { amapTraffic2trafficStatus, stringifyPoint } from "./transform.js";
|
|
4
5
|
const amapTmcs2trafficJams = (tmcs) => {
|
|
5
6
|
const trafficJams = {};
|
|
@@ -150,7 +151,7 @@ function gmapJsApiDrivingRoute(from, to, gmapDirectionsService) {
|
|
|
150
151
|
);
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
|
-
async function
|
|
154
|
+
async function googleServiceApiDrivingDirection(from, to, proxyUrl) {
|
|
154
155
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
155
156
|
const { status, routes, error_message } = await apiGoogleDirections({
|
|
156
157
|
proxyUrl,
|
|
@@ -188,9 +189,54 @@ async function googleServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
|
188
189
|
throw Error(error_message != null ? error_message : status);
|
|
189
190
|
}
|
|
190
191
|
}
|
|
192
|
+
async function googleServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
193
|
+
var _a, _b, _c, _d, _e;
|
|
194
|
+
const { routes } = await apiGoogleRoutes({
|
|
195
|
+
proxyUrl,
|
|
196
|
+
origin: {
|
|
197
|
+
location: {
|
|
198
|
+
latLng: {
|
|
199
|
+
latitude: from[1],
|
|
200
|
+
longitude: from[0]
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
destination: {
|
|
205
|
+
location: {
|
|
206
|
+
latLng: {
|
|
207
|
+
latitude: to[1],
|
|
208
|
+
longitude: to[0]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const firstRoute = routes == null ? void 0 : routes[0];
|
|
214
|
+
if (!firstRoute)
|
|
215
|
+
return { path: [], distance: 0, duration: 0, steps: [] };
|
|
216
|
+
let path = [];
|
|
217
|
+
let distance = 0;
|
|
218
|
+
let duration = 0;
|
|
219
|
+
const routeSteps = [];
|
|
220
|
+
for (const leg of firstRoute.legs) {
|
|
221
|
+
distance += (_a = leg.distanceMeters) != null ? _a : 0;
|
|
222
|
+
duration += (_b = leg.durationSeconds) != null ? _b : 0;
|
|
223
|
+
const staticRatio = leg.staticDurationSeconds ? ((_c = leg.durationSeconds) != null ? _c : 0) / leg.staticDurationSeconds : 1;
|
|
224
|
+
for (const step of leg.steps) {
|
|
225
|
+
const stepPath = step.path.map(({ lng, lat }) => [lng(), lat()]);
|
|
226
|
+
path = path.concat(stepPath);
|
|
227
|
+
routeSteps.push({
|
|
228
|
+
path: stepPath,
|
|
229
|
+
distance: (_d = step.distanceMeters) != null ? _d : 0,
|
|
230
|
+
duration: ((_e = step.staticDurationSeconds) != null ? _e : 0) * staticRatio
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return { path, distance, duration, steps: routeSteps };
|
|
235
|
+
}
|
|
191
236
|
export {
|
|
192
237
|
amapJsApiDrivingRoute,
|
|
193
238
|
gaodeServiceApiDrivingRoute,
|
|
194
239
|
gmapJsApiDrivingRoute,
|
|
240
|
+
googleServiceApiDrivingDirection,
|
|
195
241
|
googleServiceApiDrivingRoute
|
|
196
242
|
};
|
|
@@ -3,4 +3,5 @@ import type { Point } from "../types/interface";
|
|
|
3
3
|
export declare function amapJsApiWalkingRoute(from: Point, to: Point, amapWalking: AMap.Walking): Promise<Point[]>;
|
|
4
4
|
export declare function gaodeServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
5
5
|
export declare function gmapJsApiWalkingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Point[]>;
|
|
6
|
+
export declare function googleServiceApiWalkingDirection(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
6
7
|
export declare function googleServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiGaodeDirectionWalking } from "../api/gaodeDirectionWalking.js";
|
|
2
2
|
import { apiGoogleDirections } from "../api/googleDirections.js";
|
|
3
|
+
import { apiGoogleRoutes } from "../api/googleRoutes.js";
|
|
3
4
|
const isIgnoredAmapTimeoutError = (err) => err === "RETURN_TIMEOUT";
|
|
4
5
|
function amapJsApiWalkingRoute(from, to, amapWalking) {
|
|
5
6
|
return new Promise((resolve, reject) => {
|
|
@@ -79,7 +80,7 @@ function gmapJsApiWalkingRoute(from, to, gmapDirectionsService) {
|
|
|
79
80
|
);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
async function
|
|
83
|
+
async function googleServiceApiWalkingDirection(from, to, proxyUrl) {
|
|
83
84
|
const { status, routes, error_message } = await apiGoogleDirections({
|
|
84
85
|
proxyUrl,
|
|
85
86
|
mode: "WALKING",
|
|
@@ -99,9 +100,37 @@ async function googleServiceApiWalkingRoute(from, to, proxyUrl) {
|
|
|
99
100
|
throw Error(error_message != null ? error_message : status);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
async function googleServiceApiWalkingRoute(from, to, proxyUrl) {
|
|
104
|
+
const { routes } = await apiGoogleRoutes({
|
|
105
|
+
proxyUrl,
|
|
106
|
+
travelMode: "WALK",
|
|
107
|
+
origin: {
|
|
108
|
+
location: {
|
|
109
|
+
latLng: {
|
|
110
|
+
latitude: from[1],
|
|
111
|
+
longitude: from[0]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
destination: {
|
|
116
|
+
location: {
|
|
117
|
+
latLng: {
|
|
118
|
+
latitude: to[1],
|
|
119
|
+
longitude: to[0]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const firstRoute = routes == null ? void 0 : routes[0];
|
|
125
|
+
if (!firstRoute)
|
|
126
|
+
return [];
|
|
127
|
+
const path = firstRoute.path.map(({ lng, lat }) => [lng(), lat()]);
|
|
128
|
+
return path;
|
|
129
|
+
}
|
|
102
130
|
export {
|
|
103
131
|
amapJsApiWalkingRoute,
|
|
104
132
|
gaodeServiceApiWalkingRoute,
|
|
105
133
|
gmapJsApiWalkingRoute,
|
|
134
|
+
googleServiceApiWalkingDirection,
|
|
106
135
|
googleServiceApiWalkingRoute
|
|
107
136
|
};
|
package/dist/v2/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.
|
|
3
|
+
const pkgVersion = "2.11.1-APlus";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|
package/dist/v3/App.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createVNode } from "vue";
|
|
2
2
|
import { defineComponent, ref } from "vue-demi";
|
|
3
|
-
import {
|
|
3
|
+
import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
|
|
4
4
|
import { MapProvider } from "./components/MapProvider/MapProvider.js";
|
|
5
|
-
const gmapApiKey =
|
|
6
|
-
const gmapId =
|
|
7
|
-
const amapApiKey =
|
|
8
|
-
const amapApiSecret =
|
|
5
|
+
const gmapApiKey = {}.VITE_GMAP_API_KEY;
|
|
6
|
+
const gmapId = {}.VITE_GMAP_MAP_ID;
|
|
7
|
+
const amapApiKey = {}.VITE_AMAP_API_KEY;
|
|
8
|
+
const amapApiSecret = {}.VITE_AMAP_API_SECRET;
|
|
9
9
|
const App = /* @__PURE__ */ defineComponent({
|
|
10
10
|
setup() {
|
|
11
|
-
const supplierRef = ref("
|
|
11
|
+
const supplierRef = ref("gmap");
|
|
12
12
|
window.supplierRef = supplierRef;
|
|
13
13
|
return () => createVNode(MapProvider, {
|
|
14
14
|
"amapKey": amapApiKey,
|
|
@@ -17,13 +17,15 @@ const App = /* @__PURE__ */ defineComponent({
|
|
|
17
17
|
"gmapKey": gmapApiKey,
|
|
18
18
|
"language": "en",
|
|
19
19
|
"supplier": supplierRef.value,
|
|
20
|
+
"googleSnapRoadProxyUrl": "/overseas/maps/snapToRoads",
|
|
21
|
+
"googleRoutesProxyUrl": "/overseas/maps/routes/directions",
|
|
20
22
|
"renderLoadFailedTitle": () => supplierRef.value === "gmap" ? "未能成功访问谷歌地图" : "高德地图加载失败",
|
|
21
23
|
"renderLoadFailedDescription": () => supplierRef.value === "gmap" ? "请确认您的网络能正常访问谷歌地图, \n或切回高德地图" : void 0,
|
|
22
24
|
"onSuccess": () => console.log(`${supplierRef.value} load success`),
|
|
23
25
|
"onFail": () => console.log(`${supplierRef.value} load failed`),
|
|
24
26
|
"onDownloadOptimizeEnd": () => console.log(`${supplierRef.value} load download optimize end`)
|
|
25
27
|
}, {
|
|
26
|
-
default: () => [createVNode(
|
|
28
|
+
default: () => [createVNode(DemoBusinessQuoting, null, null)]
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
});
|
package/dist/v3/api/cdn.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
2
|
-
export declare const ICON_FULL_SCREEN_URL = "https://
|
|
3
|
-
export declare const ICON_START_POINT_EN_URL = "https://
|
|
4
|
-
export declare const ICON_END_POINT_EN_URL = "https://
|
|
5
|
-
export declare const ICON_END_POINT_ZH_TW_URL = "https://
|
|
6
|
-
export declare const ICON_TAXI_CAR_URL = "https://
|
|
7
|
-
export declare const ICON_DOT_LOADING_URL = "https://
|
|
8
|
-
export declare const ICON_LOAD_FAILED_URL = "https://
|
|
2
|
+
export declare const ICON_FULL_SCREEN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/png/fullscreen.png";
|
|
3
|
+
export declare const ICON_START_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/start-point-en.svg";
|
|
4
|
+
export declare const ICON_END_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-en.svg";
|
|
5
|
+
export declare const ICON_END_POINT_ZH_TW_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-zh-TW.svg";
|
|
6
|
+
export declare const ICON_TAXI_CAR_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/taxi-car.svg";
|
|
7
|
+
export declare const ICON_DOT_LOADING_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
export declare const ICON_LOAD_FAILED_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/load-failed.svg";
|
package/dist/v3/api/cdn.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
2
|
-
const ICON_FULL_SCREEN_URL = "https://
|
|
3
|
-
const ICON_START_POINT_EN_URL = "https://
|
|
4
|
-
const ICON_END_POINT_EN_URL = "https://
|
|
5
|
-
const ICON_END_POINT_ZH_TW_URL = "https://
|
|
6
|
-
const ICON_TAXI_CAR_URL = "https://
|
|
7
|
-
const ICON_DOT_LOADING_URL = "https://
|
|
8
|
-
const ICON_LOAD_FAILED_URL = "https://
|
|
2
|
+
const ICON_FULL_SCREEN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/png/fullscreen.png";
|
|
3
|
+
const ICON_START_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/start-point-en.svg";
|
|
4
|
+
const ICON_END_POINT_EN_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-en.svg";
|
|
5
|
+
const ICON_END_POINT_ZH_TW_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/0.12/end-point-zh-TW.svg";
|
|
6
|
+
const ICON_TAXI_CAR_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/taxi-car.svg";
|
|
7
|
+
const ICON_DOT_LOADING_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/gif/dot-loading.gif";
|
|
8
|
+
const ICON_LOAD_FAILED_URL = "https://hkong-oss.oss-cn-hongkong.aliyuncs.com/heycar-map/svg/load-failed.svg";
|
|
9
9
|
export {
|
|
10
10
|
AMAP_DEFAULT_MARKER_ICON_URL,
|
|
11
11
|
ICON_DOT_LOADING_URL,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
2
|
+
import type { protos } from "@googlemaps/routing";
|
|
3
|
+
type GoogleRoutesMeasurableObject = {
|
|
4
|
+
distanceMeters?: number;
|
|
5
|
+
staticDuration?: string;
|
|
6
|
+
staticDurationSeconds?: number;
|
|
7
|
+
duration?: string;
|
|
8
|
+
durationSeconds?: number;
|
|
9
|
+
};
|
|
10
|
+
type GoogleRoutesStep = Omit<protos.google.maps.routing.v2.IRouteLegStep, "staticDuration"> & GoogleRoutesMeasurableObject & {
|
|
11
|
+
path: google.maps.LatLng[];
|
|
12
|
+
};
|
|
13
|
+
type GoogleRoutesLeg = Omit<protos.google.maps.routing.v2.IRouteLeg, "steps" | "staticDuration" | "duration"> & GoogleRoutesMeasurableObject & {
|
|
14
|
+
steps: GoogleRoutesStep[];
|
|
15
|
+
};
|
|
16
|
+
type GoogleRoutesRoute = Omit<protos.google.maps.routing.v2.IRoute, "legs" | "staticDuration" | "duration"> & GoogleRoutesMeasurableObject & {
|
|
17
|
+
legs: GoogleRoutesLeg[];
|
|
18
|
+
path: google.maps.LatLng[];
|
|
19
|
+
};
|
|
20
|
+
export interface GoogleRoutesResponse {
|
|
21
|
+
routes: GoogleRoutesRoute[];
|
|
22
|
+
}
|
|
23
|
+
interface ApiGoogleRoutesProps extends protos.google.maps.routing.v2.IComputeRoutesRequest {
|
|
24
|
+
proxyUrl?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function apiGoogleRoutes(props: ApiGoogleRoutesProps): Promise<GoogleRoutesResponse>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
|
+
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
const ALL_ROUTES_STATUS = [
|
|
4
|
+
"OK",
|
|
5
|
+
"CANCELLED",
|
|
6
|
+
"UNKNOWN",
|
|
7
|
+
"INVALID_ARGUMENT",
|
|
8
|
+
"DEADLINE_EXCEEDED",
|
|
9
|
+
"NOT_FOUND",
|
|
10
|
+
"ALREADY_EXISTS",
|
|
11
|
+
"PERMISSION_DENIED",
|
|
12
|
+
"UNAUTHENTICATED",
|
|
13
|
+
"RESOURCE_EXHAUSTED",
|
|
14
|
+
"FAILED_PRECONDITION",
|
|
15
|
+
"ABORTED",
|
|
16
|
+
"OUT_OF_RANGE",
|
|
17
|
+
"UNIMPLEMENTED",
|
|
18
|
+
"INTERNAL",
|
|
19
|
+
"UNAVAILABLE",
|
|
20
|
+
"DATA_LOSS"
|
|
21
|
+
];
|
|
22
|
+
const isGoogleRoutesStatus = (value) => {
|
|
23
|
+
return typeof value === "string" && ALL_ROUTES_STATUS.includes(value);
|
|
24
|
+
};
|
|
25
|
+
const isGoogleRoutesError = (value) => {
|
|
26
|
+
return typeof value === "object" && value !== null && "error" in value && typeof value.error === "object" && value.error !== null && "code" in value.error && typeof value.error.code === "number" && "message" in value.error && typeof value.error.message === "string" && "status" in value.error && isGoogleRoutesStatus(value.error.status);
|
|
27
|
+
};
|
|
28
|
+
const isGoogleRoutesMeasurableObject = (value) => {
|
|
29
|
+
if (typeof value !== "object" || value === null || !("distanceMeters" in value) || typeof value.distanceMeters !== "number" || !("staticDuration" in value) || typeof value.staticDuration !== "string" || !value.staticDuration.endsWith("s")) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
value.staticDurationSeconds = Number(
|
|
33
|
+
value.staticDuration.slice(0, -1)
|
|
34
|
+
);
|
|
35
|
+
if (!("duration" in value))
|
|
36
|
+
return true;
|
|
37
|
+
if (typeof value.duration !== "string" || !value.duration.endsWith("s"))
|
|
38
|
+
return false;
|
|
39
|
+
value.durationSeconds = Number(value.duration.slice(0, -1));
|
|
40
|
+
return true;
|
|
41
|
+
};
|
|
42
|
+
const isGoogleRoutesPolyline = (value) => {
|
|
43
|
+
return typeof value === "object" && value !== null && "encodedPolyline" in value && typeof value.encodedPolyline === "string";
|
|
44
|
+
};
|
|
45
|
+
function assertGoogleRoutesStep(value) {
|
|
46
|
+
const error = createTypeError("GoogleRoutesStep", value);
|
|
47
|
+
if (!isGoogleRoutesMeasurableObject(value))
|
|
48
|
+
throw error;
|
|
49
|
+
if (!("polyline" in value) || value.polyline === null) {
|
|
50
|
+
value.path = [];
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!isGoogleRoutesPolyline(value.polyline))
|
|
54
|
+
throw error;
|
|
55
|
+
value.path = googleEncodedPolyline2googleLatLng(
|
|
56
|
+
value.polyline.encodedPolyline
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function assertGoogleRoutesLeg(value) {
|
|
60
|
+
if (!isGoogleRoutesMeasurableObject(value) || !("steps" in value) || !Array.isArray(value.steps))
|
|
61
|
+
throw createTypeError("GoogleRoutesLeg", value);
|
|
62
|
+
try {
|
|
63
|
+
for (const step of value.steps) {
|
|
64
|
+
assertGoogleRoutesStep(step);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
const { message: detail } = error;
|
|
68
|
+
throw createTypeError("GoogleRoutesLeg", value, detail);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function assertGoogleRoutesRoute(value) {
|
|
72
|
+
if (typeof value !== "object" || value === null || !("legs" in value) || !Array.isArray(value.legs) || !("polyline" in value) || !isGoogleRoutesPolyline(value.polyline))
|
|
73
|
+
throw createTypeError("GoogleRoutesRoute", value);
|
|
74
|
+
value.path = googleEncodedPolyline2googleLatLng(
|
|
75
|
+
value.polyline.encodedPolyline
|
|
76
|
+
);
|
|
77
|
+
try {
|
|
78
|
+
for (const leg of value.legs) {
|
|
79
|
+
assertGoogleRoutesLeg(leg);
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const { message: detail } = error;
|
|
83
|
+
throw createTypeError("GoogleRoutesRoute", value, detail);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function assertGoogleRoutesResponse(value) {
|
|
87
|
+
if (typeof value !== "object" || value === null || !("routes" in value) || !Array.isArray(value.routes))
|
|
88
|
+
throw createTypeError("GoogleRoutesResponse", value);
|
|
89
|
+
try {
|
|
90
|
+
for (const route of value.routes) {
|
|
91
|
+
assertGoogleRoutesRoute(route);
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
const { message: detail } = error;
|
|
95
|
+
throw createTypeError("GoogleRoutesResponse", value, detail);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function apiGoogleRoutes(props) {
|
|
99
|
+
const { proxyUrl, ...request } = props;
|
|
100
|
+
if (!proxyUrl) {
|
|
101
|
+
console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
|
|
102
|
+
return { routes: [] };
|
|
103
|
+
}
|
|
104
|
+
const { protocol, host } = location;
|
|
105
|
+
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
106
|
+
const url = new URL(proxyUrl, baseUrl);
|
|
107
|
+
const response = await fetch(url, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: { "Content-Type": "application/json" },
|
|
110
|
+
body: JSON.stringify(request)
|
|
111
|
+
});
|
|
112
|
+
if (response.ok) {
|
|
113
|
+
const result = await response.json();
|
|
114
|
+
assertGoogleRoutesResponse(result);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
const error = await response.json();
|
|
118
|
+
if (isProxyServiceError(error)) {
|
|
119
|
+
const { code, msg } = error;
|
|
120
|
+
throw new Error(`apiGoogleRoutes proxy failed code: ${code}, msg: ${msg}`);
|
|
121
|
+
}
|
|
122
|
+
if (isGoogleRoutesError(error)) {
|
|
123
|
+
const {
|
|
124
|
+
error: { status, message }
|
|
125
|
+
} = error;
|
|
126
|
+
throw new Error(`apiGoogleRoutes failed status: ${status}, message:
|
|
127
|
+
${message}`);
|
|
128
|
+
}
|
|
129
|
+
throw new Error(
|
|
130
|
+
`apiGoogleRoutes failed with unrecognized server response: ${JSON.stringify(error)}`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
apiGoogleRoutes
|
|
135
|
+
};
|
|
@@ -5,7 +5,7 @@ import { Status, type GmapLoaderProps, type UseMapLoaderProps } from "../../hook
|
|
|
5
5
|
import { type MapSupplierPayolad } from "../../hooks/useMapSupplier";
|
|
6
6
|
import type { AmapMap } from "../../types/interface";
|
|
7
7
|
import { type AmapProps } from "../Amap";
|
|
8
|
-
export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "gaodeDirectionDrivingProxyUrl" | "gaodeDirectionWalkingProxyUrl" | "googleDirectionsProxyUrl" | "googleSnapRoadProxyUrl" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
|
|
8
|
+
export type MapProviderProps = UseMapLoaderProps & Pick<MapSupplierPayolad, "gmapId" | "gmapRasterId" | "gaodeDirectionDrivingProxyUrl" | "gaodeDirectionWalkingProxyUrl" | "googleDirectionsProxyUrl" | "googleRoutesProxyUrl" | "googleSnapRoadProxyUrl" | "renderLoadFailedTitle" | "renderLoadFailedDescription">;
|
|
9
9
|
export declare const MapProvider: import("vue-demi").DefineComponent<import("vue-demi").ComponentObjectPropsOptions<MapProviderProps>, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").Empty, import("../../types/helper").EmitByProps<MapProviderProps, Required<MapProviderProps>>, "success" | "fail" | "downloadOptimizeEnd", import("vue-demi").PublicProps, MapProviderProps, MapProviderProps, import("vue-demi").SlotsType<{
|
|
10
10
|
renderLoadFailedTitle?: ((status: Status) => string | undefined) | undefined;
|
|
11
11
|
renderLoadFailedDescription?: ((status: Status) => string | undefined) | undefined;
|
|
@@ -53,7 +53,7 @@ const MapProvider = defineLagecySetup("MapProvider", function(props, {
|
|
|
53
53
|
var _a;
|
|
54
54
|
return createVNode("div", null, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
55
55
|
};
|
|
56
|
-
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "gaodeDirectionDrivingProxyUrl", "gaodeDirectionWalkingProxyUrl", "googleDirectionsProxyUrl", "googleSnapRoadProxyUrl", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
|
|
56
|
+
}).props(["amapKey", "amapSecret", "amapServiceHost", "gmapId", "gmapRasterId", "gmapKey", "supplier", "language", "gaodeDirectionDrivingProxyUrl", "gaodeDirectionWalkingProxyUrl", "googleDirectionsProxyUrl", "googleRoutesProxyUrl", "googleSnapRoadProxyUrl", "renderLoadFailedTitle", "renderLoadFailedDescription"]);
|
|
57
57
|
const HeycarMap = defineLagecySetup("HeycarMap", function(props, {
|
|
58
58
|
slots,
|
|
59
59
|
emit,
|
|
@@ -4,7 +4,7 @@ import { googleServiceApiDrivingRoute, amapJsApiDrivingRoute, gaodeServiceApiDri
|
|
|
4
4
|
import { inTaiwan, inKorean } from "./useMapInChina.js";
|
|
5
5
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
6
6
|
const useADrivingRoute = (props) => {
|
|
7
|
-
const {
|
|
7
|
+
const { googleRoutesProxyUrl } = useMapSupplier();
|
|
8
8
|
const outputRoute = reactive({
|
|
9
9
|
path: [],
|
|
10
10
|
distance: 0,
|
|
@@ -15,7 +15,7 @@ const useADrivingRoute = (props) => {
|
|
|
15
15
|
});
|
|
16
16
|
const amapDriving = new AMap.Driving({});
|
|
17
17
|
const apiMapDrivingRoute = (from, to) => {
|
|
18
|
-
return
|
|
18
|
+
return googleRoutesProxyUrl && inTaiwan(from) ? googleServiceApiDrivingRoute(from, to, googleRoutesProxyUrl) : amapJsApiDrivingRoute(from, to, amapDriving);
|
|
19
19
|
};
|
|
20
20
|
watchPostEffectForDeepOption(
|
|
21
21
|
() => {
|
|
@@ -31,11 +31,11 @@ const useADrivingRoute = (props) => {
|
|
|
31
31
|
return { route: outputRoute, apiMapDrivingRoute };
|
|
32
32
|
};
|
|
33
33
|
const useGDrivingRoute = (props) => {
|
|
34
|
-
const { gaodeDirectionDrivingProxyUrl } = useMapSupplier();
|
|
34
|
+
const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
35
35
|
const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [] });
|
|
36
36
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
37
37
|
const apiMapDrivingRoute = (from, to) => {
|
|
38
|
-
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, gaodeDirectionDrivingProxyUrl) : gmapJsApiDrivingRoute(from, to, gmapDirectionsService);
|
|
38
|
+
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, gmapDirectionsService);
|
|
39
39
|
};
|
|
40
40
|
watchPostEffectForDeepOption(
|
|
41
41
|
() => {
|
|
@@ -10,6 +10,7 @@ export interface MapSupplierPayolad extends UseMapLoaderProps {
|
|
|
10
10
|
gaodeDirectionDrivingProxyUrl?: string;
|
|
11
11
|
gaodeDirectionWalkingProxyUrl?: string;
|
|
12
12
|
googleDirectionsProxyUrl?: string;
|
|
13
|
+
googleRoutesProxyUrl?: string;
|
|
13
14
|
googleSnapRoadProxyUrl?: string;
|
|
14
15
|
renderLoadFailedTitle?: (status: Status) => string | undefined;
|
|
15
16
|
renderLoadFailedDescription?: (status: Status) => string | undefined;
|
|
@@ -4,11 +4,11 @@ import { googleServiceApiWalkingRoute, amapJsApiWalkingRoute, gaodeServiceApiWal
|
|
|
4
4
|
import { inTaiwan, inKorean } from "./useMapInChina.js";
|
|
5
5
|
import { useMapSupplier } from "./useMapSupplier.js";
|
|
6
6
|
const useAWalkingRoute = (props) => {
|
|
7
|
-
const {
|
|
7
|
+
const { googleRoutesProxyUrl } = useMapSupplier();
|
|
8
8
|
const pathRef = shallowRef([]);
|
|
9
9
|
const amapWalking = new AMap.Walking({});
|
|
10
10
|
const apiMapWalkingRoute = (from, to) => {
|
|
11
|
-
return
|
|
11
|
+
return googleRoutesProxyUrl && inTaiwan(from) ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : amapJsApiWalkingRoute(from, to, amapWalking);
|
|
12
12
|
};
|
|
13
13
|
watchPostEffectForDeepOption(
|
|
14
14
|
() => {
|
|
@@ -24,13 +24,13 @@ const useAWalkingRoute = (props) => {
|
|
|
24
24
|
return pathRef;
|
|
25
25
|
};
|
|
26
26
|
const useGWalkingRoute = (props) => {
|
|
27
|
-
const { gaodeDirectionWalkingProxyUrl } = useMapSupplier();
|
|
27
|
+
const { gaodeDirectionWalkingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
28
28
|
const pathRef = shallowRef([]);
|
|
29
29
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
30
30
|
const apiMapWalkingRoute = (from, to) => {
|
|
31
31
|
if (inKorean(from))
|
|
32
32
|
return Promise.resolve([]);
|
|
33
|
-
return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
|
|
33
|
+
return gaodeDirectionWalkingProxyUrl && inKorean(from) ? gaodeServiceApiWalkingRoute(from, to, gaodeDirectionWalkingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiWalkingRoute(from, to, googleRoutesProxyUrl) : gmapJsApiWalkingRoute(from, to, gmapDirectionsService);
|
|
34
34
|
};
|
|
35
35
|
watchPostEffectForDeepOption(
|
|
36
36
|
() => {
|
|
@@ -3,4 +3,5 @@ import type { Point, Route } from "../types/interface";
|
|
|
3
3
|
export declare function amapJsApiDrivingRoute(from: Point, to: Point, amapDriving: AMap.Driving): Promise<Route>;
|
|
4
4
|
export declare function gaodeServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
5
5
|
export declare function gmapJsApiDrivingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Route>;
|
|
6
|
+
export declare function googleServiceApiDrivingDirection(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
6
7
|
export declare function googleServiceApiDrivingRoute(from: Point, to: Point, proxyUrl: string): Promise<Route>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiGaodeDirectionDriving } from "../api/gaodeDirectionDriving.js";
|
|
2
2
|
import { apiGoogleDirections } from "../api/googleDirections.js";
|
|
3
|
+
import { apiGoogleRoutes } from "../api/googleRoutes.js";
|
|
3
4
|
import { amapTraffic2trafficStatus, stringifyPoint } from "./transform.js";
|
|
4
5
|
const amapTmcs2trafficJams = (tmcs) => {
|
|
5
6
|
const trafficJams = {};
|
|
@@ -150,7 +151,7 @@ function gmapJsApiDrivingRoute(from, to, gmapDirectionsService) {
|
|
|
150
151
|
);
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
|
-
async function
|
|
154
|
+
async function googleServiceApiDrivingDirection(from, to, proxyUrl) {
|
|
154
155
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
155
156
|
const { status, routes, error_message } = await apiGoogleDirections({
|
|
156
157
|
proxyUrl,
|
|
@@ -188,9 +189,54 @@ async function googleServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
|
188
189
|
throw Error(error_message != null ? error_message : status);
|
|
189
190
|
}
|
|
190
191
|
}
|
|
192
|
+
async function googleServiceApiDrivingRoute(from, to, proxyUrl) {
|
|
193
|
+
var _a, _b, _c, _d, _e;
|
|
194
|
+
const { routes } = await apiGoogleRoutes({
|
|
195
|
+
proxyUrl,
|
|
196
|
+
origin: {
|
|
197
|
+
location: {
|
|
198
|
+
latLng: {
|
|
199
|
+
latitude: from[1],
|
|
200
|
+
longitude: from[0]
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
destination: {
|
|
205
|
+
location: {
|
|
206
|
+
latLng: {
|
|
207
|
+
latitude: to[1],
|
|
208
|
+
longitude: to[0]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const firstRoute = routes == null ? void 0 : routes[0];
|
|
214
|
+
if (!firstRoute)
|
|
215
|
+
return { path: [], distance: 0, duration: 0, steps: [] };
|
|
216
|
+
let path = [];
|
|
217
|
+
let distance = 0;
|
|
218
|
+
let duration = 0;
|
|
219
|
+
const routeSteps = [];
|
|
220
|
+
for (const leg of firstRoute.legs) {
|
|
221
|
+
distance += (_a = leg.distanceMeters) != null ? _a : 0;
|
|
222
|
+
duration += (_b = leg.durationSeconds) != null ? _b : 0;
|
|
223
|
+
const staticRatio = leg.staticDurationSeconds ? ((_c = leg.durationSeconds) != null ? _c : 0) / leg.staticDurationSeconds : 1;
|
|
224
|
+
for (const step of leg.steps) {
|
|
225
|
+
const stepPath = step.path.map(({ lng, lat }) => [lng(), lat()]);
|
|
226
|
+
path = path.concat(stepPath);
|
|
227
|
+
routeSteps.push({
|
|
228
|
+
path: stepPath,
|
|
229
|
+
distance: (_d = step.distanceMeters) != null ? _d : 0,
|
|
230
|
+
duration: ((_e = step.staticDurationSeconds) != null ? _e : 0) * staticRatio
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return { path, distance, duration, steps: routeSteps };
|
|
235
|
+
}
|
|
191
236
|
export {
|
|
192
237
|
amapJsApiDrivingRoute,
|
|
193
238
|
gaodeServiceApiDrivingRoute,
|
|
194
239
|
gmapJsApiDrivingRoute,
|
|
240
|
+
googleServiceApiDrivingDirection,
|
|
195
241
|
googleServiceApiDrivingRoute
|
|
196
242
|
};
|
|
@@ -3,4 +3,5 @@ import type { Point } from "../types/interface";
|
|
|
3
3
|
export declare function amapJsApiWalkingRoute(from: Point, to: Point, amapWalking: AMap.Walking): Promise<Point[]>;
|
|
4
4
|
export declare function gaodeServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
5
5
|
export declare function gmapJsApiWalkingRoute(from: Point, to: Point, gmapDirectionsService: google.maps.DirectionsService): Promise<Point[]>;
|
|
6
|
+
export declare function googleServiceApiWalkingDirection(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
6
7
|
export declare function googleServiceApiWalkingRoute(from: Point, to: Point, proxyUrl: string): Promise<Point[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { apiGaodeDirectionWalking } from "../api/gaodeDirectionWalking.js";
|
|
2
2
|
import { apiGoogleDirections } from "../api/googleDirections.js";
|
|
3
|
+
import { apiGoogleRoutes } from "../api/googleRoutes.js";
|
|
3
4
|
const isIgnoredAmapTimeoutError = (err) => err === "RETURN_TIMEOUT";
|
|
4
5
|
function amapJsApiWalkingRoute(from, to, amapWalking) {
|
|
5
6
|
return new Promise((resolve, reject) => {
|
|
@@ -79,7 +80,7 @@ function gmapJsApiWalkingRoute(from, to, gmapDirectionsService) {
|
|
|
79
80
|
);
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
async function
|
|
83
|
+
async function googleServiceApiWalkingDirection(from, to, proxyUrl) {
|
|
83
84
|
const { status, routes, error_message } = await apiGoogleDirections({
|
|
84
85
|
proxyUrl,
|
|
85
86
|
mode: "WALKING",
|
|
@@ -99,9 +100,37 @@ async function googleServiceApiWalkingRoute(from, to, proxyUrl) {
|
|
|
99
100
|
throw Error(error_message != null ? error_message : status);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
103
|
+
async function googleServiceApiWalkingRoute(from, to, proxyUrl) {
|
|
104
|
+
const { routes } = await apiGoogleRoutes({
|
|
105
|
+
proxyUrl,
|
|
106
|
+
travelMode: "WALK",
|
|
107
|
+
origin: {
|
|
108
|
+
location: {
|
|
109
|
+
latLng: {
|
|
110
|
+
latitude: from[1],
|
|
111
|
+
longitude: from[0]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
destination: {
|
|
116
|
+
location: {
|
|
117
|
+
latLng: {
|
|
118
|
+
latitude: to[1],
|
|
119
|
+
longitude: to[0]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const firstRoute = routes == null ? void 0 : routes[0];
|
|
125
|
+
if (!firstRoute)
|
|
126
|
+
return [];
|
|
127
|
+
const path = firstRoute.path.map(({ lng, lat }) => [lng(), lat()]);
|
|
128
|
+
return path;
|
|
129
|
+
}
|
|
102
130
|
export {
|
|
103
131
|
amapJsApiWalkingRoute,
|
|
104
132
|
gaodeServiceApiWalkingRoute,
|
|
105
133
|
gmapJsApiWalkingRoute,
|
|
134
|
+
googleServiceApiWalkingDirection,
|
|
106
135
|
googleServiceApiWalkingRoute
|
|
107
136
|
};
|
package/dist/v3/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.
|
|
3
|
+
const pkgVersion = "2.11.1-APlus";
|
|
4
4
|
const isEnableLog = (name) => {
|
|
5
5
|
const searchParam = new URLSearchParams(location.search);
|
|
6
6
|
return searchParam.has(`log-${name}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heycar/heycars-map",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1-APlus",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"checkVersion": "./bin/checkVersion.js",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
+
"@googlemaps/routing": "^2.0.1",
|
|
65
66
|
"@types/semver": "^7.5.1",
|
|
66
67
|
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
|
67
68
|
"@typescript-eslint/parser": "^6.17.0",
|