@heycar/heycars-map 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +9 -4
  2. package/dist/v2/App.js +5 -3
  3. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +4 -1
  4. package/dist/v2/Demo/DemoBusinessReselectPlace.js +4 -1
  5. package/dist/v2/api/googleRoutes.d.ts +27 -0
  6. package/dist/v2/api/googleRoutes.js +135 -0
  7. package/dist/v2/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.d.ts +3 -0
  8. package/dist/v2/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +6 -1
  9. package/dist/v2/business-components/AbsoluteAddressBox/AbsoluteAddressBox.js +24 -14
  10. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +4 -1
  11. package/dist/v2/components/MapProvider/MapProvider.d.ts +1 -1
  12. package/dist/v2/components/MapProvider/MapProvider.js +1 -1
  13. package/dist/v2/css/{AbsoluteAddressBox-ea4f4761.css → AbsoluteAddressBox-7502ed45.css} +31 -6
  14. package/dist/v2/hooks/useDrivingRoute.js +4 -4
  15. package/dist/v2/hooks/useMapSupplier.d.ts +1 -0
  16. package/dist/v2/hooks/useWalkingRoute.js +4 -4
  17. package/dist/v2/utils/compatibleDrivingRoute.d.ts +1 -0
  18. package/dist/v2/utils/compatibleDrivingRoute.js +47 -1
  19. package/dist/v2/utils/compatibleWalkingRoute.d.ts +1 -0
  20. package/dist/v2/utils/compatibleWalkingRoute.js +29 -1
  21. package/dist/v2/utils/log.js +1 -1
  22. package/dist/v3/App.js +5 -3
  23. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +4 -1
  24. package/dist/v3/Demo/DemoBusinessReselectPlace.js +4 -1
  25. package/dist/v3/api/googleRoutes.d.ts +27 -0
  26. package/dist/v3/api/googleRoutes.js +135 -0
  27. package/dist/v3/business-components/AbsoluteAddressBox/AbsoluteAddressBox.css.d.ts +3 -0
  28. package/dist/v3/business-components/AbsoluteAddressBox/AbsoluteAddressBox.d.ts +6 -1
  29. package/dist/v3/business-components/AbsoluteAddressBox/AbsoluteAddressBox.js +22 -14
  30. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +4 -3
  31. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +0 -2
  32. package/dist/v3/components/MapProvider/MapProvider.d.ts +1 -1
  33. package/dist/v3/components/MapProvider/MapProvider.js +1 -1
  34. package/dist/v3/css/{AbsoluteAddressBox-ea4f4761.css → AbsoluteAddressBox-7502ed45.css} +31 -6
  35. package/dist/v3/hooks/useDrivingRoute.js +4 -4
  36. package/dist/v3/hooks/useMapSupplier.d.ts +1 -0
  37. package/dist/v3/hooks/useWalkingRoute.js +4 -4
  38. package/dist/v3/utils/compatibleDrivingRoute.d.ts +1 -0
  39. package/dist/v3/utils/compatibleDrivingRoute.js +47 -1
  40. package/dist/v3/utils/compatibleWalkingRoute.d.ts +1 -0
  41. package/dist/v3/utils/compatibleWalkingRoute.js +29 -1
  42. package/dist/v3/utils/log.js +1 -1
  43. 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
  // 地图加载失败时显示的描述
@@ -263,11 +265,14 @@ export default defineComponent({
263
265
  getRecomendPlace={getRecomendPlace}
264
266
  getDefaultCenterPlace={getDefaultCenterPlace}
265
267
  renderPlacePhoto={(place) => {
266
- place;
267
- return "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg";
268
+ // or return;
269
+ return {
270
+ title: "图文引导",
271
+ src: "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg",
272
+ };
268
273
  }}
269
274
  renderPlaceTag={(place) => {
270
- place;
275
+ // or return;
271
276
  return "最近使用";
272
277
  }}
273
278
  mapContext={mapContext}
package/dist/v2/App.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { h } from "vue";
2
2
  import { defineComponent, ref } from "vue-demi";
3
- import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
3
+ import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCCOe8MAeS3EYvSraKsBX6ztVyLxj69z94";
6
6
  const gmapId = "d0af0c05331af64a";
@@ -8,7 +8,7 @@ const amapApiKey = "fcb7b14c930354a248e21f4031dfa179";
8
8
  const amapApiSecret = "11ad0e3d585b80d18b1ada5b0d947c4a";
9
9
  const App = defineComponent({
10
10
  setup() {
11
- const supplierRef = ref("amap");
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(DemoBusinessRecomendPlace)]);
31
+ }, [h(DemoBusinessQuoting)]);
30
32
  }
31
33
  });
32
34
  export {
@@ -127,7 +127,10 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
127
127
  "getAvailable": () => Promise.resolve(true),
128
128
  "getRecomendPlace": getRecomendPlace,
129
129
  "renderPlacePhoto": (place) => {
130
- return "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg";
130
+ return {
131
+ title: "图文引导",
132
+ src: "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg"
133
+ };
131
134
  },
132
135
  "renderPlaceTag": (place) => {
133
136
  return "最近使用";
@@ -131,7 +131,10 @@ const DemoBusinessReselectPlace = defineSetup("DemoBusinessReselectPlace", funct
131
131
  "getAvailable": () => Promise.resolve(true),
132
132
  "getRecomendPlace": getRecomendPlace,
133
133
  "renderPlacePhoto": (place) => {
134
- return "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg";
134
+ return {
135
+ title: "图文引导",
136
+ src: "https://oss-now.heycars.cn/image/graphicGuidance/file/hmlh38_xs6_DdksNX0_TbgF0lKXp.jpg"
137
+ };
135
138
  },
136
139
  "renderPlaceTag": (place) => {
137
140
  return "最近使用";
@@ -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
+ };
@@ -15,6 +15,9 @@ export declare const boxTextLayout: import("@vanilla-extract/recipes").RuntimeFn
15
15
  }>;
16
16
  export declare const boxPhotoLayout: string;
17
17
  export declare const boxPhoto: string;
18
+ export declare const boxPhotoDescriptionLayout: string;
19
+ export declare const boxPhotoArrow: string;
20
+ export declare const boxPhotoDescription: string;
18
21
  export declare const boxPhotoIcon: string;
19
22
  export declare const boxTitle: string;
20
23
  export declare const boxDescription: string;
@@ -1,10 +1,15 @@
1
+ interface AddressBoxPhoto {
2
+ src: string;
3
+ title?: string;
4
+ }
1
5
  export interface AbsoluteAddressBoxProps {
2
6
  type: "box" | "locator" | "loading";
3
7
  title: string;
4
8
  description?: string;
5
- photo?: string;
9
+ photo?: AddressBoxPhoto;
6
10
  withArrow?: boolean;
7
11
  onClickText?: () => any;
8
12
  onClickPhoto?: () => any;
9
13
  }
10
14
  export declare const AbsoluteAddressBox: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<AbsoluteAddressBoxProps>, 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<AbsoluteAddressBoxProps, Required<AbsoluteAddressBoxProps>>, "clickText" | "clickPhoto", AbsoluteAddressBoxProps>;
15
+ export {};
@@ -1,29 +1,32 @@
1
- import "../../css/AbsoluteAddressBox-ea4f4761.css";
1
+ import "../../css/AbsoluteAddressBox-7502ed45.css";
2
2
  import { h } from "vue";
3
3
  import { computed } from "vue-demi";
4
- import { ICON_DOT_LOADING_URL, ICON_FULL_SCREEN_URL } from "../../api/cdn.js";
4
+ import { ICON_DOT_LOADING_URL } from "../../api/cdn.js";
5
5
  import { i as imgAddressLocator } from "../../chunks/address-locator.98305e58.js";
6
6
  import { i as imgArrowRight } from "../../chunks/arrow-right.eedc7433.js";
7
7
  import { defineSetup } from "../../types/helper.js";
8
8
  import { c as createRuntimeFn } from "../../chunks/vanilla-extract-recipes-createRuntimeFn.esm.bd6fc290.js";
9
9
  const imgBubbleRightArc = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTgiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTAgMGgyLjEzMWExMCAxMCAwIDAxOS42OTYgNy41NTJMMTggMzJILjA0MkwwIDB6IiBmaWxsPSIjMjUzRTdBIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=";
10
+ const imgGuideArrow = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHdpZHRoPSIyIiBoZWlnaHQ9IjYiPgogIDxwYXRoIGQ9Ik0uNTE2IDEuMTAzQS4zLjMgMCAwMDAgMS4zMXYyLjY2OGEuMy4zIDAgMDAuNTE2LjIwOEwxLjggMi44NTNhLjMuMyAwIDAwMC0uNDE2TC41MTYgMS4xMDN6IiBmaWxsPSIjRkZGIiAvPgo8L3N2Zz4=";
10
11
  const AbsoluteAddressBox_css_ts_vanilla = "";
11
12
  var absoluteAddressBox = "n8tgem1";
12
13
  var absoluteAddressBoxLayout = "n8tgem0";
13
- var arrowRight = "n8tgemg";
14
+ var arrowRight = "n8tgemj";
14
15
  var boxBody = "n8tgem2";
15
16
  var boxHeader = "n8tgem3";
16
17
  var boxHeaderIcon = "n8tgem4";
17
18
  var boxHeaderText = "n8tgem5";
18
19
  var boxPhoto = "n8tgemb";
19
- var boxPhotoIcon = "n8tgemc";
20
+ var boxPhotoArrow = "n8tgemd";
21
+ var boxPhotoDescription = "n8tgeme";
22
+ var boxPhotoDescriptionLayout = "n8tgemc";
20
23
  var boxPhotoLayout = "n8tgema";
21
24
  var boxTextClickableArea = "n8tgem6";
22
25
  var boxTextLayout = createRuntimeFn({ defaultClassName: "n8tgem7", variantClassNames: { withArrow: { true: "n8tgem8", false: "n8tgem9" } }, defaultVariants: {}, compoundVariants: [] });
23
- var boxTitle = "n8tgemd";
24
- var imgDotLoading = "n8tgemf";
25
- var locatorIcon = "n8tgemi";
26
- var straightLine = "n8tgemh";
26
+ var boxTitle = "n8tgemg";
27
+ var imgDotLoading = "n8tgemi";
28
+ var locatorIcon = "n8tgeml";
29
+ var straightLine = "n8tgemk";
27
30
  const MultilineTitle = defineSetup("MultilineTitle", function(props, {
28
31
  attrs
29
32
  }) {
@@ -88,22 +91,29 @@ const AbsoluteAddressBox = defineSetup("AbsoluteAddressBox", function(props, {
88
91
  }
89
92
  })]), h("div", {
90
93
  "class": boxBody
91
- }, [!!photo && h("div", {
94
+ }, [!!(photo == null ? void 0 : photo.src) && h("div", {
92
95
  "class": boxPhotoLayout
93
96
  }, [h("img", {
94
97
  "class": boxPhoto,
95
98
  "attrs": {
96
- "src": photo
99
+ "src": photo.src
97
100
  },
98
101
  "on": {
99
102
  "click": handleClickPhoto
100
103
  }
101
- }), h("img", {
102
- "class": boxPhotoIcon,
104
+ }), !!photo.title && h("div", {
105
+ "class": boxPhotoDescriptionLayout,
106
+ "on": {
107
+ "click": handleClickPhoto
108
+ }
109
+ }, [h("div", {
110
+ "class": boxPhotoDescription
111
+ }, [photo.title]), h("img", {
112
+ "class": boxPhotoArrow,
103
113
  "attrs": {
104
- "src": ICON_FULL_SCREEN_URL
114
+ "src": imgGuideArrow
105
115
  }
106
- })]), h("div", {
116
+ })])]), h("div", {
107
117
  "class": boxTextClickableArea,
108
118
  "on": {
109
119
  "click": handleClickText
@@ -33,7 +33,10 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
33
33
  geoErrorOnceNotificationKey?: string;
34
34
  mapContext: CoordinatifyProps<BusinessRecomendPlaceContext>;
35
35
  defaultCenterPlace?: CoordinatePlace | ((place?: CoordinatePlace) => CoordinatePlace | undefined);
36
- renderPlacePhoto?: (place: CoordinatePlace) => string | undefined;
36
+ renderPlacePhoto?: (place: CoordinatePlace) => undefined | {
37
+ src: string;
38
+ title?: string;
39
+ };
37
40
  renderPlaceTag?: PickupPointsProps["renderPlaceTag"];
38
41
  onLoadGeoLocation?: Coordinatify<UseGeoLocationProps["onLoad"]>;
39
42
  onLoadDefaultGeoLocation?: Coordinatify<UseGeoLocationProps["onLoadDefault"]>;
@@ -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,
@@ -69,6 +69,31 @@
69
69
  height: 100%;
70
70
  }
71
71
  .n8tgemc {
72
+ position: absolute;
73
+ bottom: 0;
74
+ left: 0;
75
+ right: 0;
76
+ height: 3.6vw;
77
+ box-sizing: border-box;
78
+ display: flex;
79
+ justify-content: center;
80
+ align-items: center;
81
+ background-color: rgba(0, 0, 0, 0.6);
82
+ }
83
+ .n8tgemd {
84
+ margin-left: 0.6vw;
85
+ margin-top: 0.2vw;
86
+ width: 0.6vw;
87
+ height: 1.8vw;
88
+ }
89
+ .n8tgeme {
90
+ font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
91
+ font-weight: 500;
92
+ font-size: 2.1vw;
93
+ color: #FFFFFF;
94
+ line-height: 1;
95
+ }
96
+ .n8tgemf {
72
97
  pointer-events: none;
73
98
  position: absolute;
74
99
  right: 0.045vw;
@@ -76,7 +101,7 @@
76
101
  width: 3.74vw;
77
102
  height: 3.74vw;
78
103
  }
79
- .n8tgemd {
104
+ .n8tgemg {
80
105
  display: -webkit-box;
81
106
  font-size: 3.47vw;
82
107
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_SEMI_BOLD);
@@ -87,7 +112,7 @@
87
112
  -webkit-box-orient: vertical;
88
113
  overflow: hidden;
89
114
  }
90
- .n8tgeme {
115
+ .n8tgemh {
91
116
  margin-top: 0.53vw;
92
117
  font-size: 2.93vw;
93
118
  font-family: var(--HEYCAR_MAP_CSS_VAR_FONT_REGULAR);
@@ -96,22 +121,22 @@
96
121
  line-height: 4.27vw;
97
122
  opacity: 0.8;
98
123
  }
99
- .n8tgemf {
124
+ .n8tgemi {
100
125
  margin: 1.865vw 0;
101
126
  width: 7.467vw;
102
127
  height: 1.6vw;
103
128
  }
104
- .n8tgemg {
129
+ .n8tgemj {
105
130
  width: 1.758vw;
106
131
  height: 2.93vw;
107
132
  }
108
- .n8tgemh {
133
+ .n8tgemk {
109
134
  width: 0.8vw;
110
135
  height: 4vw;
111
136
  background: #4C80FF;
112
137
  border-radius: 0vw 0vw 26.67vw 26.67vw;
113
138
  }
114
- .n8tgemi {
139
+ .n8tgeml {
115
140
  width: 6.9355vw;
116
141
  height: 10.67vw;
117
142
  }
@@ -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 { googleDirectionsProxyUrl } = useMapSupplier();
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 googleDirectionsProxyUrl && inTaiwan(from) ? googleServiceApiDrivingRoute(from, to, googleDirectionsProxyUrl) : amapJsApiDrivingRoute(from, to, amapDriving);
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 { googleDirectionsProxyUrl } = useMapSupplier();
7
+ const { googleRoutesProxyUrl } = useMapSupplier();
8
8
  const pathRef = shallowRef([]);
9
9
  const amapWalking = new AMap.Walking({});
10
10
  const apiMapWalkingRoute = (from, to) => {
11
- return googleDirectionsProxyUrl && inTaiwan(from) ? googleServiceApiWalkingRoute(from, to, googleDirectionsProxyUrl) : amapJsApiWalkingRoute(from, to, amapWalking);
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 googleServiceApiDrivingRoute(from, to, proxyUrl) {
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[]>;