@heycar/heycars-map 2.19.0-drivingRouteFail4 → 2.19.0-drivingRouteFail6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v2/api/gaodeDirectionDriving.js +2 -3
- package/dist/v2/api/gaodeDirectionWalking.js +2 -3
- package/dist/v2/api/gaodeRegeo.js +2 -3
- package/dist/v2/api/googleDirections.js +2 -3
- package/dist/v2/api/googleRoutes.js +2 -3
- package/dist/v2/api/googleSnapRoad.js +2 -3
- package/dist/v2/api/hongkongGovernDriving.js +2 -3
- package/dist/v2/business-components/DrivingRoute/DrivingRoute.js +8 -4
- package/dist/v2/hooks/useDrivingRoute.js +8 -1
- package/dist/v2/hooks/useMapPlace.js +3 -2
- package/dist/v2/utils/compatibleDrivingRoute.js +1 -1
- package/dist/v2/utils/log.js +1 -1
- package/dist/v2/utils/url.d.ts +1 -0
- package/dist/v2/utils/url.js +9 -0
- package/dist/v3/api/gaodeDirectionDriving.js +2 -3
- package/dist/v3/api/gaodeDirectionWalking.js +2 -3
- package/dist/v3/api/gaodeRegeo.js +2 -3
- package/dist/v3/api/googleDirections.js +2 -3
- package/dist/v3/api/googleRoutes.js +2 -3
- package/dist/v3/api/googleSnapRoad.js +2 -3
- package/dist/v3/api/hongkongGovernDriving.js +2 -3
- package/dist/v3/business-components/DrivingRoute/DrivingRoute.js +8 -4
- package/dist/v3/hooks/useDrivingRoute.js +8 -1
- package/dist/v3/hooks/useMapPlace.js +3 -2
- package/dist/v3/utils/compatibleDrivingRoute.js +1 -1
- package/dist/v3/utils/log.js +1 -1
- package/dist/v3/utils/url.d.ts +1 -0
- package/dist/v3/utils/url.js +9 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gaodePointsStringify, gaodePolyline2amapLngLat } from "../utils/transform.js";
|
|
2
2
|
import { createTypeError, isProxyServiceError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const GAODE_POLYLINE_REGEX = /^(?:-?\d*\.\d+,-?\d*\.\d+)?(?:;-?\d*\.\d+,-?\d*\.\d+)*$/;
|
|
4
5
|
var GaodeDirectionStatus = /* @__PURE__ */ ((GaodeDirectionStatus2) => {
|
|
5
6
|
GaodeDirectionStatus2["SUCCESS"] = "1";
|
|
@@ -104,9 +105,7 @@ async function apiGaodeDirectionDriving(props) {
|
|
|
104
105
|
console.warn(error_message);
|
|
105
106
|
return { status: "no_data", routes: [], error_message };
|
|
106
107
|
}
|
|
107
|
-
const
|
|
108
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
109
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
108
|
+
const url = createUrlObject(proxyUrl);
|
|
110
109
|
url.searchParams.set("origin", gaodePointsStringify(origin));
|
|
111
110
|
url.searchParams.set("destination", gaodePointsStringify([destination]));
|
|
112
111
|
url.searchParams.set("extensions", extensions);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gaodePointsStringify, gaodePolyline2amapLngLat } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
import { gaodeDirectionStatus2amapDirectionCallbackStatus, isGaodeDirectionResponse, isGaodeMeasurableObject, isGaodeDirectionBasicStep } from "./gaodeDirectionDriving.js";
|
|
4
5
|
function assertGaodoDirectionWalkingStep(value) {
|
|
5
6
|
if (isGaodeDirectionBasicStep(value))
|
|
@@ -58,9 +59,7 @@ async function apiGaodeDirectionWalking(props) {
|
|
|
58
59
|
error_message
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
63
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
62
|
+
const url = createUrlObject(proxyUrl);
|
|
64
63
|
url.searchParams.set("origin", gaodePointsStringify([origin]));
|
|
65
64
|
url.searchParams.set("destination", gaodePointsStringify([destination]));
|
|
66
65
|
for (const key of [
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
2
2
|
import { guid } from "../utils/helper.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const apiGaodeRegeo = async (props) => {
|
|
4
5
|
const { proxyUrl, lng, lat, language } = props;
|
|
5
|
-
const
|
|
6
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
7
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
6
|
+
const url = createUrlObject(proxyUrl);
|
|
8
7
|
url.searchParams.set("language", language);
|
|
9
8
|
url.searchParams.set("location", `${lng.toString()},${lat.toString()}`);
|
|
10
9
|
url.searchParams.set("reqSid", guid());
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googlePointsStringify, googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const ALL_DIRECTIONS_STATUS = [
|
|
4
5
|
"INVALID_REQUEST",
|
|
5
6
|
"MAX_WAYPOINTS_EXCEEDED",
|
|
@@ -92,9 +93,7 @@ async function apiGoogleDirections(props) {
|
|
|
92
93
|
error_message
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
const
|
|
96
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
97
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
96
|
+
const url = createUrlObject(proxyUrl);
|
|
98
97
|
url.searchParams.set("origin", googlePointsStringify([origin]));
|
|
99
98
|
url.searchParams.set("destination", googlePointsStringify([destination]));
|
|
100
99
|
if (waypoints && waypoints.length > 0)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const DEFAULT_GOOGLE_ROUTES_FIELDS = ["routes.polyline", "routes.legs"];
|
|
4
5
|
const ALL_ROUTES_STATUS = [
|
|
5
6
|
"OK",
|
|
@@ -106,9 +107,7 @@ async function apiGoogleRoutes(props) {
|
|
|
106
107
|
console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
|
|
107
108
|
return { routes: [], isCrossBorder: false };
|
|
108
109
|
}
|
|
109
|
-
const
|
|
110
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
111
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
110
|
+
const url = createUrlObject(proxyUrl);
|
|
112
111
|
url.searchParams.set("fields", DEFAULT_GOOGLE_ROUTES_FIELDS.join(","));
|
|
113
112
|
const response = await fetch(url, {
|
|
114
113
|
method: "POST",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googlePointsStringify } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const point2snappedPoint = (point) => {
|
|
4
5
|
const [longitude, latitude] = point;
|
|
5
6
|
return { location: { longitude, latitude }, placeId: "" };
|
|
@@ -37,9 +38,7 @@ async function apiGoogleSnapRoad(props) {
|
|
|
37
38
|
snappedPoints: path.map(point2snappedPoint),
|
|
38
39
|
warningMessage: "Warning: snapRoad service is bypassed due to proxyUrl is not provided!"
|
|
39
40
|
};
|
|
40
|
-
const
|
|
41
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
42
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
41
|
+
const url = createUrlObject(proxyUrl);
|
|
43
42
|
if (interpolate !== void 0)
|
|
44
43
|
url.searchParams.set("interpolate", String(interpolate));
|
|
45
44
|
url.searchParams.set("path", googlePointsStringify(path));
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
2
2
|
import { guid } from "../utils/helper.js";
|
|
3
3
|
import { wgs84ToHK80 } from "../utils/transform.js";
|
|
4
|
+
import { createUrlObject } from "../utils/url.js";
|
|
4
5
|
const apiHongKongGovernDriving = async (props) => {
|
|
5
6
|
const { proxyUrl, lng, lat, language } = props;
|
|
6
|
-
const
|
|
7
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
8
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
7
|
+
const url = createUrlObject(proxyUrl);
|
|
9
8
|
const hk80Coord = wgs84ToHK80(lat, lng);
|
|
10
9
|
url.searchParams.set("lang", language);
|
|
11
10
|
url.searchParams.set("x", hk80Coord.x.toString());
|
|
@@ -16,7 +16,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
16
16
|
duration,
|
|
17
17
|
tolls,
|
|
18
18
|
trafficJams,
|
|
19
|
-
init
|
|
19
|
+
init,
|
|
20
|
+
isCrossBorder
|
|
20
21
|
} = toRefs(useADrivingRoute(props).route);
|
|
21
22
|
const {
|
|
22
23
|
angleRef
|
|
@@ -33,7 +34,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
33
34
|
duration,
|
|
34
35
|
tolls,
|
|
35
36
|
trafficJams,
|
|
36
|
-
init
|
|
37
|
+
init,
|
|
38
|
+
isCrossBorder
|
|
37
39
|
}))]);
|
|
38
40
|
};
|
|
39
41
|
});
|
|
@@ -45,7 +47,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
|
|
|
45
47
|
path,
|
|
46
48
|
distance,
|
|
47
49
|
duration,
|
|
48
|
-
init
|
|
50
|
+
init,
|
|
51
|
+
isCrossBorder
|
|
49
52
|
} = toRefs(useGDrivingRoute(props).route);
|
|
50
53
|
const {
|
|
51
54
|
angleRef
|
|
@@ -60,7 +63,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
|
|
|
60
63
|
angle: angleRef,
|
|
61
64
|
distance,
|
|
62
65
|
duration,
|
|
63
|
-
init
|
|
66
|
+
init,
|
|
67
|
+
isCrossBorder
|
|
64
68
|
}))]);
|
|
65
69
|
};
|
|
66
70
|
});
|
|
@@ -38,7 +38,14 @@ const useADrivingRoute = (props) => {
|
|
|
38
38
|
};
|
|
39
39
|
const useGDrivingRoute = (props) => {
|
|
40
40
|
const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
41
|
-
const outputRoute = reactive({
|
|
41
|
+
const outputRoute = reactive({
|
|
42
|
+
path: [],
|
|
43
|
+
distance: 0,
|
|
44
|
+
duration: 0,
|
|
45
|
+
steps: [],
|
|
46
|
+
init: true,
|
|
47
|
+
isCrossBorder: false
|
|
48
|
+
});
|
|
42
49
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
43
50
|
const apiMapDrivingRoute = (from, to, waypoints = []) => {
|
|
44
51
|
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, waypoints, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, waypoints, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, waypoints, gmapDirectionsService);
|
|
@@ -94,7 +94,8 @@ const useAmapPlace = (props) => {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const { formatted_address, addressComponent } = result.regeocode;
|
|
97
|
-
const
|
|
97
|
+
const _formmatted_address = typeof formatted_address === "string" ? formatted_address : "";
|
|
98
|
+
const name = _formmatted_address || emptyPlaceName;
|
|
98
99
|
const displayName = amapPlaceName2DisplayName(name, {
|
|
99
100
|
isChinese,
|
|
100
101
|
...addressComponent
|
|
@@ -201,7 +202,7 @@ const useGmapPlace = (props) => {
|
|
|
201
202
|
}
|
|
202
203
|
});
|
|
203
204
|
geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
|
|
204
|
-
const name = results[0].formatted_address
|
|
205
|
+
const name = results[0].formatted_address || emptyPlaceName;
|
|
205
206
|
const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
|
|
206
207
|
resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
|
|
207
208
|
}).catch(handleFailed);
|
|
@@ -225,7 +225,7 @@ async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
|
|
|
225
225
|
});
|
|
226
226
|
const firstRoute = routes == null ? void 0 : routes[0];
|
|
227
227
|
if (!firstRoute)
|
|
228
|
-
return { path: [], distance: 0, duration: 0, steps: [] };
|
|
228
|
+
return { path: [], distance: 0, duration: 0, steps: [], isCrossBorder };
|
|
229
229
|
let path = [];
|
|
230
230
|
let distance = 0;
|
|
231
231
|
let duration = 0;
|
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.19.0-
|
|
3
|
+
const pkgVersion = "2.19.0-drivingRouteFail6";
|
|
4
4
|
const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
|
|
5
5
|
const enableSessionLogKey = (key) => {
|
|
6
6
|
const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createUrlObject: (proxyUrl: string) => URL;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gaodePointsStringify, gaodePolyline2amapLngLat } from "../utils/transform.js";
|
|
2
2
|
import { createTypeError, isProxyServiceError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const GAODE_POLYLINE_REGEX = /^(?:-?\d*\.\d+,-?\d*\.\d+)?(?:;-?\d*\.\d+,-?\d*\.\d+)*$/;
|
|
4
5
|
var GaodeDirectionStatus = /* @__PURE__ */ ((GaodeDirectionStatus2) => {
|
|
5
6
|
GaodeDirectionStatus2["SUCCESS"] = "1";
|
|
@@ -104,9 +105,7 @@ async function apiGaodeDirectionDriving(props) {
|
|
|
104
105
|
console.warn(error_message);
|
|
105
106
|
return { status: "no_data", routes: [], error_message };
|
|
106
107
|
}
|
|
107
|
-
const
|
|
108
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
109
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
108
|
+
const url = createUrlObject(proxyUrl);
|
|
110
109
|
url.searchParams.set("origin", gaodePointsStringify(origin));
|
|
111
110
|
url.searchParams.set("destination", gaodePointsStringify([destination]));
|
|
112
111
|
url.searchParams.set("extensions", extensions);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gaodePointsStringify, gaodePolyline2amapLngLat } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
import { gaodeDirectionStatus2amapDirectionCallbackStatus, isGaodeDirectionResponse, isGaodeMeasurableObject, isGaodeDirectionBasicStep } from "./gaodeDirectionDriving.js";
|
|
4
5
|
function assertGaodoDirectionWalkingStep(value) {
|
|
5
6
|
if (isGaodeDirectionBasicStep(value))
|
|
@@ -58,9 +59,7 @@ async function apiGaodeDirectionWalking(props) {
|
|
|
58
59
|
error_message
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
63
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
62
|
+
const url = createUrlObject(proxyUrl);
|
|
64
63
|
url.searchParams.set("origin", gaodePointsStringify([origin]));
|
|
65
64
|
url.searchParams.set("destination", gaodePointsStringify([destination]));
|
|
66
65
|
for (const key of [
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
2
2
|
import { guid } from "../utils/helper.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const apiGaodeRegeo = async (props) => {
|
|
4
5
|
const { proxyUrl, lng, lat, language } = props;
|
|
5
|
-
const
|
|
6
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
7
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
6
|
+
const url = createUrlObject(proxyUrl);
|
|
8
7
|
url.searchParams.set("language", language);
|
|
9
8
|
url.searchParams.set("location", `${lng.toString()},${lat.toString()}`);
|
|
10
9
|
url.searchParams.set("reqSid", guid());
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googlePointsStringify, googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const ALL_DIRECTIONS_STATUS = [
|
|
4
5
|
"INVALID_REQUEST",
|
|
5
6
|
"MAX_WAYPOINTS_EXCEEDED",
|
|
@@ -92,9 +93,7 @@ async function apiGoogleDirections(props) {
|
|
|
92
93
|
error_message
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
|
-
const
|
|
96
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
97
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
96
|
+
const url = createUrlObject(proxyUrl);
|
|
98
97
|
url.searchParams.set("origin", googlePointsStringify([origin]));
|
|
99
98
|
url.searchParams.set("destination", googlePointsStringify([destination]));
|
|
100
99
|
if (waypoints && waypoints.length > 0)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googleEncodedPolyline2googleLatLng } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError, createTypeError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const DEFAULT_GOOGLE_ROUTES_FIELDS = ["routes.polyline", "routes.legs"];
|
|
4
5
|
const ALL_ROUTES_STATUS = [
|
|
5
6
|
"OK",
|
|
@@ -106,9 +107,7 @@ async function apiGoogleRoutes(props) {
|
|
|
106
107
|
console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
|
|
107
108
|
return { routes: [], isCrossBorder: false };
|
|
108
109
|
}
|
|
109
|
-
const
|
|
110
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
111
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
110
|
+
const url = createUrlObject(proxyUrl);
|
|
112
111
|
url.searchParams.set("fields", DEFAULT_GOOGLE_ROUTES_FIELDS.join(","));
|
|
113
112
|
const response = await fetch(url, {
|
|
114
113
|
method: "POST",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { googlePointsStringify } from "../utils/transform.js";
|
|
2
2
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
3
|
+
import { createUrlObject } from "../utils/url.js";
|
|
3
4
|
const point2snappedPoint = (point) => {
|
|
4
5
|
const [longitude, latitude] = point;
|
|
5
6
|
return { location: { longitude, latitude }, placeId: "" };
|
|
@@ -37,9 +38,7 @@ async function apiGoogleSnapRoad(props) {
|
|
|
37
38
|
snappedPoints: path.map(point2snappedPoint),
|
|
38
39
|
warningMessage: "Warning: snapRoad service is bypassed due to proxyUrl is not provided!"
|
|
39
40
|
};
|
|
40
|
-
const
|
|
41
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
42
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
41
|
+
const url = createUrlObject(proxyUrl);
|
|
43
42
|
if (interpolate !== void 0)
|
|
44
43
|
url.searchParams.set("interpolate", String(interpolate));
|
|
45
44
|
url.searchParams.set("path", googlePointsStringify(path));
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isProxyServiceError } from "../utils/typeChecking.js";
|
|
2
2
|
import { guid } from "../utils/helper.js";
|
|
3
3
|
import { wgs84ToHK80 } from "../utils/transform.js";
|
|
4
|
+
import { createUrlObject } from "../utils/url.js";
|
|
4
5
|
const apiHongKongGovernDriving = async (props) => {
|
|
5
6
|
const { proxyUrl, lng, lat, language } = props;
|
|
6
|
-
const
|
|
7
|
-
const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
|
|
8
|
-
const url = new URL(proxyUrl, baseUrl);
|
|
7
|
+
const url = createUrlObject(proxyUrl);
|
|
9
8
|
const hk80Coord = wgs84ToHK80(lat, lng);
|
|
10
9
|
url.searchParams.set("lang", language);
|
|
11
10
|
url.searchParams.set("x", hk80Coord.x.toString());
|
|
@@ -16,7 +16,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
16
16
|
duration,
|
|
17
17
|
tolls,
|
|
18
18
|
trafficJams,
|
|
19
|
-
init
|
|
19
|
+
init,
|
|
20
|
+
isCrossBorder
|
|
20
21
|
} = toRefs(useADrivingRoute(props).route);
|
|
21
22
|
const {
|
|
22
23
|
angleRef
|
|
@@ -33,7 +34,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
|
|
|
33
34
|
duration,
|
|
34
35
|
tolls,
|
|
35
36
|
trafficJams,
|
|
36
|
-
init
|
|
37
|
+
init,
|
|
38
|
+
isCrossBorder
|
|
37
39
|
}))]);
|
|
38
40
|
};
|
|
39
41
|
});
|
|
@@ -45,7 +47,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
|
|
|
45
47
|
path,
|
|
46
48
|
distance,
|
|
47
49
|
duration,
|
|
48
|
-
init
|
|
50
|
+
init,
|
|
51
|
+
isCrossBorder
|
|
49
52
|
} = toRefs(useGDrivingRoute(props).route);
|
|
50
53
|
const {
|
|
51
54
|
angleRef
|
|
@@ -60,7 +63,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
|
|
|
60
63
|
angle: angleRef,
|
|
61
64
|
distance,
|
|
62
65
|
duration,
|
|
63
|
-
init
|
|
66
|
+
init,
|
|
67
|
+
isCrossBorder
|
|
64
68
|
}))]);
|
|
65
69
|
};
|
|
66
70
|
});
|
|
@@ -38,7 +38,14 @@ const useADrivingRoute = (props) => {
|
|
|
38
38
|
};
|
|
39
39
|
const useGDrivingRoute = (props) => {
|
|
40
40
|
const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
|
|
41
|
-
const outputRoute = reactive({
|
|
41
|
+
const outputRoute = reactive({
|
|
42
|
+
path: [],
|
|
43
|
+
distance: 0,
|
|
44
|
+
duration: 0,
|
|
45
|
+
steps: [],
|
|
46
|
+
init: true,
|
|
47
|
+
isCrossBorder: false
|
|
48
|
+
});
|
|
42
49
|
const gmapDirectionsService = new google.maps.DirectionsService();
|
|
43
50
|
const apiMapDrivingRoute = (from, to, waypoints = []) => {
|
|
44
51
|
return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, waypoints, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, waypoints, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, waypoints, gmapDirectionsService);
|
|
@@ -94,7 +94,8 @@ const useAmapPlace = (props) => {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const { formatted_address, addressComponent } = result.regeocode;
|
|
97
|
-
const
|
|
97
|
+
const _formmatted_address = typeof formatted_address === "string" ? formatted_address : "";
|
|
98
|
+
const name = _formmatted_address || emptyPlaceName;
|
|
98
99
|
const displayName = amapPlaceName2DisplayName(name, {
|
|
99
100
|
isChinese,
|
|
100
101
|
...addressComponent
|
|
@@ -201,7 +202,7 @@ const useGmapPlace = (props) => {
|
|
|
201
202
|
}
|
|
202
203
|
});
|
|
203
204
|
geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
|
|
204
|
-
const name = results[0].formatted_address
|
|
205
|
+
const name = results[0].formatted_address || emptyPlaceName;
|
|
205
206
|
const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
|
|
206
207
|
resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
|
|
207
208
|
}).catch(handleFailed);
|
|
@@ -225,7 +225,7 @@ async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
|
|
|
225
225
|
});
|
|
226
226
|
const firstRoute = routes == null ? void 0 : routes[0];
|
|
227
227
|
if (!firstRoute)
|
|
228
|
-
return { path: [], distance: 0, duration: 0, steps: [] };
|
|
228
|
+
return { path: [], distance: 0, duration: 0, steps: [], isCrossBorder };
|
|
229
229
|
let path = [];
|
|
230
230
|
let distance = 0;
|
|
231
231
|
let duration = 0;
|
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.19.0-
|
|
3
|
+
const pkgVersion = "2.19.0-drivingRouteFail6";
|
|
4
4
|
const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
|
|
5
5
|
const enableSessionLogKey = (key) => {
|
|
6
6
|
const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createUrlObject: (proxyUrl: string) => URL;
|