@heycar/heycars-map 2.18.0-apiLocalization → 2.19.0-drivingRouteFail2

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/App.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h } from "vue";
2
2
  import { defineComponent, ref } from "vue-demi";
3
3
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
4
- import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
4
+ import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
5
5
  const gmapApiKey = {}.VITE_GMAP_API_KEY;
6
6
  const gmapId = {}.VITE_GMAP_MAP_ID;
7
7
  const amapApiKey = {}.VITE_AMAP_API_KEY;
@@ -51,7 +51,7 @@ const App = defineComponent({
51
51
  "fail": () => console.log(`${supplierRef.value} load failed`),
52
52
  "downloadOptimizeEnd": () => console.log(`${supplierRef.value} load download optimize end`)
53
53
  }
54
- }, [h(DemoBusinessRecomendPlace)]);
54
+ }, [h(DemoBusinessQuoting)]);
55
55
  }
56
56
  });
57
57
  export {
@@ -47,7 +47,6 @@ const DemoBusinessQuoting = defineComponent({
47
47
  "class": demo,
48
48
  "attrs": {
49
49
  "from": from,
50
- "isBezierCurve": true,
51
50
  "to": {
52
51
  displayName: "CDG Engie Charging Station",
53
52
  name: "21 Kent Ridge Rd, Singapore 119220",
@@ -65,7 +64,8 @@ const DemoBusinessQuoting = defineComponent({
65
64
  },
66
65
  "on": {
67
66
  "clickStartPoint": (place) => console.log("点击起点时触发 palce = ", place),
68
- "clickEndPoint": (place) => console.log("点击终点时触发 palce = ", place)
67
+ "clickEndPoint": (place) => console.log("点击终点时触发 palce = ", place),
68
+ "drivingRouteDone": (hasRoute) => console.log("导航路线规划完成时触发 hasRoute = ", hasRoute)
69
69
  }
70
70
  }), h("div", ["经度 103.841974, 纬度 1.311295 在高德地图上的坐标类型是:", toAmapCoordinateType([103.841974, 1.311295])])]);
71
71
  }
@@ -18,6 +18,7 @@ export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "ce
18
18
  }) => string | undefined;
19
19
  onClickStartPoint?: (value: CoordinatePlace) => void;
20
20
  onClickEndPoint?: (value: CoordinatePlace) => void;
21
+ onDrivingRouteDone?: (hasRoute: boolean) => void;
21
22
  };
22
- export declare const BusinessQuotingMapInner: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint", BusinessQuotingMapProps>;
23
- export declare const BusinessQuotingMap: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint", BusinessQuotingMapProps>;
23
+ export declare const BusinessQuotingMapInner: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint" | "drivingRouteDone", BusinessQuotingMapProps>;
24
+ export declare const BusinessQuotingMap: import("vue/types/v3-define-component").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint" | "drivingRouteDone", BusinessQuotingMapProps>;
@@ -120,30 +120,35 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
120
120
  distance: distance2,
121
121
  duration,
122
122
  tolls,
123
- trafficJams
124
- }) => [h(TrafficDrivingLine, {
125
- "attrs": {
126
- "path": path,
127
- "trafficJams": trafficJams
128
- }
129
- }), h(StartEndPoint, {
130
- "attrs": {
131
- "type": "end",
132
- "registerOverlay": fittableRegistryOverlay,
133
- "position": to,
134
- "title": toPlace.displayName,
135
- "description": renderDescription({
136
- distance: distance2,
137
- duration,
138
- tolls
139
- }),
140
- "withArrow": !disableEndPoint,
141
- "language": language
142
- },
143
- "on": {
144
- "click": () => !disableEndPoint && emit("clickEndPoint", coordinatifyPlace(toPlace))
145
- }
146
- })]
123
+ trafficJams,
124
+ init
125
+ }) => {
126
+ if (!init)
127
+ emit("drivingRouteDone", path.length !== 0);
128
+ return [h(TrafficDrivingLine, {
129
+ "attrs": {
130
+ "path": path,
131
+ "trafficJams": trafficJams
132
+ }
133
+ }), h(StartEndPoint, {
134
+ "attrs": {
135
+ "type": "end",
136
+ "registerOverlay": fittableRegistryOverlay,
137
+ "position": to,
138
+ "title": toPlace.displayName,
139
+ "description": renderDescription({
140
+ distance: distance2,
141
+ duration,
142
+ tolls
143
+ }),
144
+ "withArrow": !disableEndPoint,
145
+ "language": language
146
+ },
147
+ "on": {
148
+ "click": () => !disableEndPoint && emit("clickEndPoint", coordinatifyPlace(toPlace))
149
+ }
150
+ })];
151
+ }
147
152
  }
148
153
  }), h(FitViewOnce, {
149
154
  "attrs": {
@@ -168,7 +173,7 @@ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(prop
168
173
  } : {},
169
174
  attrs: props,
170
175
  key: `${payload.supplier}${instanceNo}`,
171
- on: generateCreateElementV2PropsOn(props, emit, ["clickStartPoint", "clickEndPoint"])
176
+ on: generateCreateElementV2PropsOn(props, emit, ["clickStartPoint", "clickEndPoint", "drivingRouteDone"])
172
177
  });
173
178
  }).props(["fallback", "from", "loading", "disableStartPoint", "disableEndPoint", "mapContext", "renderDescription", "to", "fromDescription", "log", "isBezierCurve"]);
174
179
  export {
@@ -8,6 +8,7 @@ export type DrivingRouteRenderProps = {
8
8
  duration: number;
9
9
  tolls?: number;
10
10
  trafficJams?: TrafficJams;
11
+ init: boolean;
11
12
  };
12
13
  export interface DrivingRouteProps extends UseDrivingRouteProps {
13
14
  render?: (props: DrivingRouteRenderProps) => VNodeChild;
@@ -15,7 +15,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
15
15
  distance,
16
16
  duration,
17
17
  tolls,
18
- trafficJams
18
+ trafficJams,
19
+ init
19
20
  } = toRefs(useADrivingRoute(props).route);
20
21
  const {
21
22
  angleRef
@@ -31,7 +32,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
31
32
  distance,
32
33
  duration,
33
34
  tolls,
34
- trafficJams
35
+ trafficJams,
36
+ init
35
37
  }))]);
36
38
  };
37
39
  });
@@ -42,7 +44,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
42
44
  const {
43
45
  path,
44
46
  distance,
45
- duration
47
+ duration,
48
+ init
46
49
  } = toRefs(useGDrivingRoute(props).route);
47
50
  const {
48
51
  angleRef
@@ -56,7 +59,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
56
59
  path,
57
60
  angle: angleRef,
58
61
  distance,
59
- duration
62
+ duration,
63
+ init
60
64
  }))]);
61
65
  };
62
66
  });
@@ -16,6 +16,7 @@ export declare const useADrivingRoute: (props?: UseDrivingRouteProps) => {
16
16
  distance: number;
17
17
  }[];
18
18
  trafficJams?: import("../types/interface").TrafficJams | undefined;
19
+ init: boolean;
19
20
  };
20
21
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
21
22
  };
@@ -31,6 +32,7 @@ export declare const useGDrivingRoute: (props?: UseDrivingRouteProps) => {
31
32
  distance: number;
32
33
  }[];
33
34
  trafficJams?: import("../types/interface").TrafficJams | undefined;
35
+ init: boolean;
34
36
  };
35
37
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
36
38
  };
@@ -46,6 +48,7 @@ export declare const useDrivingRoute: (props?: UseDrivingRouteProps) => {
46
48
  distance: number;
47
49
  }[];
48
50
  trafficJams?: import("../types/interface").TrafficJams | undefined;
51
+ init: boolean;
49
52
  };
50
53
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
51
54
  };
@@ -11,7 +11,8 @@ const useADrivingRoute = (props) => {
11
11
  duration: 0,
12
12
  tolls: void 0,
13
13
  steps: [],
14
- trafficJams: void 0
14
+ trafficJams: void 0,
15
+ init: true
15
16
  });
16
17
  const amapDriving = new AMap.Driving({ ferry: 1 });
17
18
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
@@ -25,14 +26,18 @@ const useADrivingRoute = (props) => {
25
26
  async ({ from, to, waypoints }) => {
26
27
  if (!from || !to)
27
28
  return;
28
- Object.assign(outputRoute, await apiMapDrivingRoute(from, to, waypoints));
29
+ try {
30
+ Object.assign(outputRoute, { init: false }, await apiMapDrivingRoute(from, to, waypoints));
31
+ } catch {
32
+ Object.assign(outputRoute, { init: false });
33
+ }
29
34
  }
30
35
  );
31
36
  return { route: outputRoute, apiMapDrivingRoute };
32
37
  };
33
38
  const useGDrivingRoute = (props) => {
34
39
  const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
35
- const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [] });
40
+ const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [], init: true });
36
41
  const gmapDirectionsService = new google.maps.DirectionsService();
37
42
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
38
43
  return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, waypoints, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, waypoints, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, waypoints, gmapDirectionsService);
@@ -45,7 +50,11 @@ const useGDrivingRoute = (props) => {
45
50
  async ({ from, to, waypoints }) => {
46
51
  if (!from || !to)
47
52
  return;
48
- Object.assign(outputRoute, await apiMapDrivingRoute(from, to, waypoints));
53
+ try {
54
+ Object.assign(outputRoute, { init: false }, await apiMapDrivingRoute(from, to, waypoints));
55
+ } catch {
56
+ Object.assign(outputRoute, { init: false });
57
+ }
49
58
  }
50
59
  );
51
60
  return { route: outputRoute, apiMapDrivingRoute };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.18.0-apiLocalization";
3
+ const pkgVersion = "2.19.0-drivingRouteFail2";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -160,7 +160,8 @@ function amapPlaceName2DisplayNameOutChinese(name, options) {
160
160
  if (streetNumberStreet === "Unnamed Road")
161
161
  return name;
162
162
  const streetNumberItem = typeof number === "string" ? number : "";
163
- if (streetNumberStreet || streetNumberItem)
163
+ const _streetNumberStreet = typeof streetNumberStreet === "string" ? streetNumberStreet : "";
164
+ if (_streetNumberStreet || streetNumberItem)
164
165
  return `${streetNumberStreet} ${streetNumberItem}`;
165
166
  }
166
167
  const idxs = [];
package/dist/v3/App.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createVNode } from "vue";
2
2
  import { defineComponent, ref } from "vue-demi";
3
3
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
4
- import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
4
+ import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
5
5
  const gmapApiKey = {}.VITE_GMAP_API_KEY;
6
6
  const gmapId = {}.VITE_GMAP_MAP_ID;
7
7
  const amapApiKey = {}.VITE_AMAP_API_KEY;
@@ -48,7 +48,7 @@ const App = /* @__PURE__ */ defineComponent({
48
48
  "onDownloadOptimizeEnd": () => console.log(`${supplierRef.value} load download optimize end`),
49
49
  "reportLog": () => console.log("reportLog function is called")
50
50
  }, {
51
- default: () => [createVNode(DemoBusinessRecomendPlace, null, null)]
51
+ default: () => [createVNode(DemoBusinessQuoting, null, null)]
52
52
  });
53
53
  }
54
54
  });
@@ -46,7 +46,6 @@ const DemoBusinessQuoting = /* @__PURE__ */ defineComponent({
46
46
  return createVNode("div", null, [createVNode(BusinessQuotingMap, {
47
47
  "class": demo,
48
48
  "from": from,
49
- "isBezierCurve": true,
50
49
  "to": {
51
50
  displayName: "CDG Engie Charging Station",
52
51
  name: "21 Kent Ridge Rd, Singapore 119220",
@@ -62,7 +61,8 @@ const DemoBusinessQuoting = /* @__PURE__ */ defineComponent({
62
61
  }) => `全程 *${distance / 1e3}公里* 约行驶 *${duration}* 高速费用 *${tolls != null ? tolls : 0}*元`,
63
62
  "mapContext": mapContext,
64
63
  "onClickStartPoint": (place) => console.log("点击起点时触发 palce = ", place),
65
- "onClickEndPoint": (place) => console.log("点击终点时触发 palce = ", place)
64
+ "onClickEndPoint": (place) => console.log("点击终点时触发 palce = ", place),
65
+ "onDrivingRouteDone": (hasRoute) => console.log("导航路线规划完成时触发 hasRoute = ", hasRoute)
66
66
  }, null), createVNode("div", null, [createTextVNode("经度 103.841974, 纬度 1.311295 在高德地图上的坐标类型是:"), toAmapCoordinateType([103.841974, 1.311295])])]);
67
67
  }
68
68
  });
@@ -18,8 +18,9 @@ export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "ce
18
18
  }) => string | undefined;
19
19
  onClickStartPoint?: (value: CoordinatePlace) => void;
20
20
  onClickEndPoint?: (value: CoordinatePlace) => void;
21
+ onDrivingRouteDone?: (hasRoute: boolean) => void;
21
22
  };
22
- export declare const BusinessQuotingMapInner: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint", import("@vue/runtime-core").PublicProps, BusinessQuotingMapProps, BusinessQuotingMapProps, import("@vue/runtime-core").SlotsType<{
23
+ export declare const BusinessQuotingMapInner: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint" | "drivingRouteDone", import("@vue/runtime-core").PublicProps, BusinessQuotingMapProps, BusinessQuotingMapProps, import("@vue/runtime-core").SlotsType<{
23
24
  fallback?: (() => import("vue").VNodeChild) | undefined;
24
25
  loading?: (() => import("vue").VNodeChild) | undefined;
25
26
  outerArea?: (() => import("vue").VNodeChild) | undefined;
@@ -31,7 +32,7 @@ export declare const BusinessQuotingMapInner: import("@vue/runtime-core").Define
31
32
  } & {
32
33
  default?: import("../../demi-polyfill").Slot | undefined;
33
34
  }>>;
34
- export declare const BusinessQuotingMap: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint", import("@vue/runtime-core").PublicProps, BusinessQuotingMapProps, BusinessQuotingMapProps, import("@vue/runtime-core").SlotsType<{
35
+ export declare const BusinessQuotingMap: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessQuotingMapProps>, 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<BusinessQuotingMapProps, Required<BusinessQuotingMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "clickStartPoint" | "clickEndPoint" | "drivingRouteDone", import("@vue/runtime-core").PublicProps, BusinessQuotingMapProps, BusinessQuotingMapProps, import("@vue/runtime-core").SlotsType<{
35
36
  fallback?: (() => import("vue").VNodeChild) | undefined;
36
37
  loading?: (() => import("vue").VNodeChild) | undefined;
37
38
  outerArea?: (() => import("vue").VNodeChild) | undefined;
@@ -106,24 +106,29 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
106
106
  distance: distance2,
107
107
  duration,
108
108
  tolls,
109
- trafficJams
110
- }) => [createVNode(TrafficDrivingLine, {
111
- "path": path,
112
- "trafficJams": trafficJams
113
- }, null), createVNode(StartEndPoint, {
114
- "type": "end",
115
- "registerOverlay": fittableRegistryOverlay,
116
- "position": to,
117
- "title": toPlace.displayName,
118
- "description": renderDescription({
119
- distance: distance2,
120
- duration,
121
- tolls
122
- }),
123
- "withArrow": !disableEndPoint,
124
- "language": language,
125
- "onClick": () => !disableEndPoint && emit("clickEndPoint", coordinatifyPlace(toPlace))
126
- }, null)]
109
+ trafficJams,
110
+ init
111
+ }) => {
112
+ if (!init)
113
+ emit("drivingRouteDone", path.length !== 0);
114
+ return [createVNode(TrafficDrivingLine, {
115
+ "path": path,
116
+ "trafficJams": trafficJams
117
+ }, null), createVNode(StartEndPoint, {
118
+ "type": "end",
119
+ "registerOverlay": fittableRegistryOverlay,
120
+ "position": to,
121
+ "title": toPlace.displayName,
122
+ "description": renderDescription({
123
+ distance: distance2,
124
+ duration,
125
+ tolls
126
+ }),
127
+ "withArrow": !disableEndPoint,
128
+ "language": language,
129
+ "onClick": () => !disableEndPoint && emit("clickEndPoint", coordinatifyPlace(toPlace))
130
+ }, null)];
131
+ }
127
132
  }, null), createVNode(FitViewOnce, {
128
133
  "registerOverlay": registerOverlay,
129
134
  "immediate": true
@@ -146,7 +151,7 @@ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(prop
146
151
  } : {},
147
152
  attrs: props,
148
153
  key: `${payload.supplier}${instanceNo}`,
149
- on: generateCreateElementV2PropsOn(props, emit, ["clickStartPoint", "clickEndPoint"])
154
+ on: generateCreateElementV2PropsOn(props, emit, ["clickStartPoint", "clickEndPoint", "drivingRouteDone"])
150
155
  });
151
156
  }).props(["fallback", "from", "loading", "disableStartPoint", "disableEndPoint", "mapContext", "renderDescription", "to", "fromDescription", "log", "isBezierCurve"]);
152
157
  export {
@@ -8,6 +8,7 @@ export type DrivingRouteRenderProps = {
8
8
  duration: number;
9
9
  tolls?: number;
10
10
  trafficJams?: TrafficJams;
11
+ init: boolean;
11
12
  };
12
13
  export interface DrivingRouteProps extends UseDrivingRouteProps {
13
14
  render?: (props: DrivingRouteRenderProps) => VNodeChild;
@@ -15,7 +15,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
15
15
  distance,
16
16
  duration,
17
17
  tolls,
18
- trafficJams
18
+ trafficJams,
19
+ init
19
20
  } = toRefs(useADrivingRoute(props).route);
20
21
  const {
21
22
  angleRef
@@ -31,7 +32,8 @@ const ADrivingRoute = defineSetup("ADrivingRoute", function(props, {
31
32
  distance,
32
33
  duration,
33
34
  tolls,
34
- trafficJams
35
+ trafficJams,
36
+ init
35
37
  }))]);
36
38
  };
37
39
  });
@@ -42,7 +44,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
42
44
  const {
43
45
  path,
44
46
  distance,
45
- duration
47
+ duration,
48
+ init
46
49
  } = toRefs(useGDrivingRoute(props).route);
47
50
  const {
48
51
  angleRef
@@ -56,7 +59,8 @@ const GDrivingRoute = defineSetup("GDrivingRoute", function(props, {
56
59
  path,
57
60
  angle: angleRef,
58
61
  distance,
59
- duration
62
+ duration,
63
+ init
60
64
  }))]);
61
65
  };
62
66
  });
@@ -16,6 +16,7 @@ export declare const useADrivingRoute: (props?: UseDrivingRouteProps) => {
16
16
  distance: number;
17
17
  }[];
18
18
  trafficJams?: import("../types/interface").TrafficJams | undefined;
19
+ init: boolean;
19
20
  };
20
21
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
21
22
  };
@@ -31,6 +32,7 @@ export declare const useGDrivingRoute: (props?: UseDrivingRouteProps) => {
31
32
  distance: number;
32
33
  }[];
33
34
  trafficJams?: import("../types/interface").TrafficJams | undefined;
35
+ init: boolean;
34
36
  };
35
37
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
36
38
  };
@@ -46,6 +48,7 @@ export declare const useDrivingRoute: (props?: UseDrivingRouteProps) => {
46
48
  distance: number;
47
49
  }[];
48
50
  trafficJams?: import("../types/interface").TrafficJams | undefined;
51
+ init: boolean;
49
52
  };
50
53
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
51
54
  };
@@ -11,7 +11,8 @@ const useADrivingRoute = (props) => {
11
11
  duration: 0,
12
12
  tolls: void 0,
13
13
  steps: [],
14
- trafficJams: void 0
14
+ trafficJams: void 0,
15
+ init: true
15
16
  });
16
17
  const amapDriving = new AMap.Driving({ ferry: 1 });
17
18
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
@@ -25,14 +26,18 @@ const useADrivingRoute = (props) => {
25
26
  async ({ from, to, waypoints }) => {
26
27
  if (!from || !to)
27
28
  return;
28
- Object.assign(outputRoute, await apiMapDrivingRoute(from, to, waypoints));
29
+ try {
30
+ Object.assign(outputRoute, { init: false }, await apiMapDrivingRoute(from, to, waypoints));
31
+ } catch {
32
+ Object.assign(outputRoute, { init: false });
33
+ }
29
34
  }
30
35
  );
31
36
  return { route: outputRoute, apiMapDrivingRoute };
32
37
  };
33
38
  const useGDrivingRoute = (props) => {
34
39
  const { gaodeDirectionDrivingProxyUrl, googleRoutesProxyUrl } = useMapSupplier();
35
- const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [] });
40
+ const outputRoute = reactive({ path: [], distance: 0, duration: 0, steps: [], init: true });
36
41
  const gmapDirectionsService = new google.maps.DirectionsService();
37
42
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
38
43
  return gaodeDirectionDrivingProxyUrl && inKorean(from) ? gaodeServiceApiDrivingRoute(from, to, waypoints, gaodeDirectionDrivingProxyUrl) : googleRoutesProxyUrl ? googleServiceApiDrivingRoute(from, to, waypoints, googleRoutesProxyUrl) : gmapJsApiDrivingRoute(from, to, waypoints, gmapDirectionsService);
@@ -45,7 +50,11 @@ const useGDrivingRoute = (props) => {
45
50
  async ({ from, to, waypoints }) => {
46
51
  if (!from || !to)
47
52
  return;
48
- Object.assign(outputRoute, await apiMapDrivingRoute(from, to, waypoints));
53
+ try {
54
+ Object.assign(outputRoute, { init: false }, await apiMapDrivingRoute(from, to, waypoints));
55
+ } catch {
56
+ Object.assign(outputRoute, { init: false });
57
+ }
49
58
  }
50
59
  );
51
60
  return { route: outputRoute, apiMapDrivingRoute };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.18.0-apiLocalization";
3
+ const pkgVersion = "2.19.0-drivingRouteFail2";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -160,7 +160,8 @@ function amapPlaceName2DisplayNameOutChinese(name, options) {
160
160
  if (streetNumberStreet === "Unnamed Road")
161
161
  return name;
162
162
  const streetNumberItem = typeof number === "string" ? number : "";
163
- if (streetNumberStreet || streetNumberItem)
163
+ const _streetNumberStreet = typeof streetNumberStreet === "string" ? streetNumberStreet : "";
164
+ if (_streetNumberStreet || streetNumberItem)
164
165
  return `${streetNumberStreet} ${streetNumberItem}`;
165
166
  }
166
167
  const idxs = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.18.0-apiLocalization",
3
+ "version": "2.19.0-drivingRouteFail2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",