@heycar/heycars-map 2.19.0-drivingRouteFail2 → 2.19.0-drivingRouteFail4

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 (27) hide show
  1. package/dist/v2/api/googleRoutes.d.ts +1 -0
  2. package/dist/v2/api/googleRoutes.js +6 -2
  3. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +6 -1
  4. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +8 -2
  5. package/dist/v2/business-components/DrivingRoute/DrivingRoute.d.ts +1 -0
  6. package/dist/v2/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
  7. package/dist/v2/hooks/useDrivingRoute.d.ts +3 -0
  8. package/dist/v2/hooks/useDrivingRoute.js +2 -1
  9. package/dist/v2/hooks/useDrivingTrackCorrection.d.ts +1 -0
  10. package/dist/v2/types/interface.d.ts +1 -0
  11. package/dist/v2/utils/compatibleDrivingRoute.js +2 -2
  12. package/dist/v2/utils/log.js +1 -1
  13. package/dist/v2/utils/transform.js +1 -1
  14. package/dist/v3/api/googleRoutes.d.ts +1 -0
  15. package/dist/v3/api/googleRoutes.js +6 -2
  16. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +6 -1
  17. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +8 -2
  18. package/dist/v3/business-components/DrivingRoute/DrivingRoute.d.ts +1 -0
  19. package/dist/v3/hooks/useDeviationCorrectionDrivingRoute.d.ts +2 -0
  20. package/dist/v3/hooks/useDrivingRoute.d.ts +3 -0
  21. package/dist/v3/hooks/useDrivingRoute.js +2 -1
  22. package/dist/v3/hooks/useDrivingTrackCorrection.d.ts +1 -0
  23. package/dist/v3/types/interface.d.ts +1 -0
  24. package/dist/v3/utils/compatibleDrivingRoute.js +2 -2
  25. package/dist/v3/utils/log.js +1 -1
  26. package/dist/v3/utils/transform.js +1 -1
  27. package/package.json +1 -1
@@ -19,6 +19,7 @@ type GoogleRoutesRoute = Omit<protos.google.maps.routing.v2.IRoute, "legs" | "st
19
19
  };
20
20
  export interface GoogleRoutesResponse {
21
21
  routes: GoogleRoutesRoute[];
22
+ isCrossBorder?: boolean;
22
23
  }
23
24
  interface ApiGoogleRoutesProps extends protos.google.maps.routing.v2.IComputeRoutesRequest {
24
25
  proxyUrl?: string;
@@ -85,7 +85,11 @@ function assertGoogleRoutesRoute(value) {
85
85
  }
86
86
  }
87
87
  function assertGoogleRoutesResponse(value) {
88
- if (typeof value !== "object" || value === null || !("routes" in value) || !Array.isArray(value.routes))
88
+ if (typeof value !== "object" || value === null)
89
+ throw createTypeError("GoogleRoutesResponse", value);
90
+ if ("isCrossBorder" in value && value.isCrossBorder)
91
+ return;
92
+ if (!("routes" in value) || !Array.isArray(value.routes))
89
93
  throw createTypeError("GoogleRoutesResponse", value);
90
94
  try {
91
95
  for (const route of value.routes) {
@@ -100,7 +104,7 @@ async function apiGoogleRoutes(props) {
100
104
  const { proxyUrl, ...request } = props;
101
105
  if (!proxyUrl) {
102
106
  console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
103
- return { routes: [] };
107
+ return { routes: [], isCrossBorder: false };
104
108
  }
105
109
  const { protocol, host } = location;
106
110
  const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
@@ -18,7 +18,12 @@ 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
+ onDrivingRouteDone?: (drivingRouteDoneProps: {
22
+ hasRoute: boolean;
23
+ distance: number;
24
+ duration: number;
25
+ isCrossBorder: boolean;
26
+ }) => void;
22
27
  };
23
28
  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
29
  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>;
@@ -121,10 +121,16 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
121
121
  duration,
122
122
  tolls,
123
123
  trafficJams,
124
- init
124
+ init,
125
+ isCrossBorder = false
125
126
  }) => {
126
127
  if (!init)
127
- emit("drivingRouteDone", path.length !== 0);
128
+ emit("drivingRouteDone", {
129
+ hasRoute: path.length !== 0,
130
+ distance: distance2,
131
+ duration,
132
+ isCrossBorder
133
+ });
128
134
  return [h(TrafficDrivingLine, {
129
135
  "attrs": {
130
136
  "path": path,
@@ -8,6 +8,7 @@ export type DrivingRouteRenderProps = {
8
8
  duration: number;
9
9
  tolls?: number;
10
10
  trafficJams?: TrafficJams;
11
+ isCrossBorder?: boolean;
11
12
  init: boolean;
12
13
  };
13
14
  export interface DrivingRouteProps extends UseDrivingRouteProps {
@@ -29,6 +29,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
29
29
  distance: number;
30
30
  }[];
31
31
  trafficJams?: import("../types/interface").TrafficJams | undefined;
32
+ isCrossBorder?: boolean | undefined;
32
33
  };
33
34
  index: number;
34
35
  path: [number, number][];
@@ -41,6 +42,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
41
42
  distance: number;
42
43
  }[];
43
44
  trafficJams?: import("../types/interface").TrafficJams | undefined;
45
+ isCrossBorder?: boolean | undefined;
44
46
  };
45
47
  angleRef: import("vue-demi").Ref<number>;
46
48
  graspRoadPathRef: import("vue-demi").Ref<Point[] | undefined>;
@@ -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
+ isCrossBorder?: boolean | undefined;
19
20
  init: boolean;
20
21
  };
21
22
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -32,6 +33,7 @@ export declare const useGDrivingRoute: (props?: UseDrivingRouteProps) => {
32
33
  distance: number;
33
34
  }[];
34
35
  trafficJams?: import("../types/interface").TrafficJams | undefined;
36
+ isCrossBorder?: boolean | undefined;
35
37
  init: boolean;
36
38
  };
37
39
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -48,6 +50,7 @@ export declare const useDrivingRoute: (props?: UseDrivingRouteProps) => {
48
50
  distance: number;
49
51
  }[];
50
52
  trafficJams?: import("../types/interface").TrafficJams | undefined;
53
+ isCrossBorder?: boolean | undefined;
51
54
  init: boolean;
52
55
  };
53
56
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -12,7 +12,8 @@ const useADrivingRoute = (props) => {
12
12
  tolls: void 0,
13
13
  steps: [],
14
14
  trafficJams: void 0,
15
- init: true
15
+ init: true,
16
+ isCrossBorder: false
16
17
  });
17
18
  const amapDriving = new AMap.Driving({ ferry: 1 });
18
19
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
@@ -15,5 +15,6 @@ export declare const useDrivingTrackCorrection: (props: UseDrivingTrackCorrectio
15
15
  distance: number;
16
16
  }[];
17
17
  trafficJams?: import("../types/interface").TrafficJams | undefined;
18
+ isCrossBorder?: boolean | undefined;
18
19
  };
19
20
  export {};
@@ -79,6 +79,7 @@ export interface Route {
79
79
  tolls?: number;
80
80
  steps: RouteStep[];
81
81
  trafficJams?: TrafficJams;
82
+ isCrossBorder?: boolean;
82
83
  }
83
84
  export interface TrackPoint {
84
85
  lng: number;
@@ -195,7 +195,7 @@ async function googleServiceApiDrivingDirection(from, to, waypoints, proxyUrl) {
195
195
  }
196
196
  async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
197
197
  var _a, _b, _c, _d, _e;
198
- const { routes } = await apiGoogleRoutes({
198
+ const { routes, isCrossBorder } = await apiGoogleRoutes({
199
199
  proxyUrl,
200
200
  origin: {
201
201
  location: {
@@ -244,7 +244,7 @@ async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
244
244
  });
245
245
  }
246
246
  }
247
- return { path, distance, duration, steps: routeSteps };
247
+ return { path, distance, duration, steps: routeSteps, isCrossBorder };
248
248
  }
249
249
  export {
250
250
  amapJsApiDrivingRoute,
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.19.0-drivingRouteFail2";
3
+ const pkgVersion = "2.19.0-drivingRouteFail4";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -166,7 +166,7 @@ function amapPlaceName2DisplayNameOutChinese(name, options) {
166
166
  }
167
167
  const idxs = [];
168
168
  for (const token of [adcode, province, city, district, township]) {
169
- if (!token)
169
+ if (!token || !token.length)
170
170
  continue;
171
171
  if (idxs.length === 2)
172
172
  break;
@@ -19,6 +19,7 @@ type GoogleRoutesRoute = Omit<protos.google.maps.routing.v2.IRoute, "legs" | "st
19
19
  };
20
20
  export interface GoogleRoutesResponse {
21
21
  routes: GoogleRoutesRoute[];
22
+ isCrossBorder?: boolean;
22
23
  }
23
24
  interface ApiGoogleRoutesProps extends protos.google.maps.routing.v2.IComputeRoutesRequest {
24
25
  proxyUrl?: string;
@@ -85,7 +85,11 @@ function assertGoogleRoutesRoute(value) {
85
85
  }
86
86
  }
87
87
  function assertGoogleRoutesResponse(value) {
88
- if (typeof value !== "object" || value === null || !("routes" in value) || !Array.isArray(value.routes))
88
+ if (typeof value !== "object" || value === null)
89
+ throw createTypeError("GoogleRoutesResponse", value);
90
+ if ("isCrossBorder" in value && value.isCrossBorder)
91
+ return;
92
+ if (!("routes" in value) || !Array.isArray(value.routes))
89
93
  throw createTypeError("GoogleRoutesResponse", value);
90
94
  try {
91
95
  for (const route of value.routes) {
@@ -100,7 +104,7 @@ async function apiGoogleRoutes(props) {
100
104
  const { proxyUrl, ...request } = props;
101
105
  if (!proxyUrl) {
102
106
  console.warn("Warning: google routes service is bypassed due to proxyUrl is not provided!");
103
- return { routes: [] };
107
+ return { routes: [], isCrossBorder: false };
104
108
  }
105
109
  const { protocol, host } = location;
106
110
  const baseUrl = proxyUrl.startsWith(protocol) ? void 0 : `${protocol}//${host}`;
@@ -18,7 +18,12 @@ 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
+ onDrivingRouteDone?: (drivingRouteDoneProps: {
22
+ hasRoute: boolean;
23
+ distance: number;
24
+ duration: number;
25
+ isCrossBorder: boolean;
26
+ }) => void;
22
27
  };
23
28
  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<{
24
29
  fallback?: (() => import("vue").VNodeChild) | undefined;
@@ -107,10 +107,16 @@ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(
107
107
  duration,
108
108
  tolls,
109
109
  trafficJams,
110
- init
110
+ init,
111
+ isCrossBorder = false
111
112
  }) => {
112
113
  if (!init)
113
- emit("drivingRouteDone", path.length !== 0);
114
+ emit("drivingRouteDone", {
115
+ hasRoute: path.length !== 0,
116
+ distance: distance2,
117
+ duration,
118
+ isCrossBorder
119
+ });
114
120
  return [createVNode(TrafficDrivingLine, {
115
121
  "path": path,
116
122
  "trafficJams": trafficJams
@@ -8,6 +8,7 @@ export type DrivingRouteRenderProps = {
8
8
  duration: number;
9
9
  tolls?: number;
10
10
  trafficJams?: TrafficJams;
11
+ isCrossBorder?: boolean;
11
12
  init: boolean;
12
13
  };
13
14
  export interface DrivingRouteProps extends UseDrivingRouteProps {
@@ -29,6 +29,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
29
29
  distance: number;
30
30
  }[];
31
31
  trafficJams?: import("../types/interface").TrafficJams | undefined;
32
+ isCrossBorder?: boolean | undefined;
32
33
  };
33
34
  index: number;
34
35
  path: [number, number][];
@@ -41,6 +42,7 @@ export declare const useDeviationCorrectionDrivingRoute: (props?: UseDeviationCo
41
42
  distance: number;
42
43
  }[];
43
44
  trafficJams?: import("../types/interface").TrafficJams | undefined;
45
+ isCrossBorder?: boolean | undefined;
44
46
  };
45
47
  angleRef: import("vue-demi").Ref<number>;
46
48
  graspRoadPathRef: import("vue-demi").Ref<Point[] | undefined>;
@@ -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
+ isCrossBorder?: boolean | undefined;
19
20
  init: boolean;
20
21
  };
21
22
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -32,6 +33,7 @@ export declare const useGDrivingRoute: (props?: UseDrivingRouteProps) => {
32
33
  distance: number;
33
34
  }[];
34
35
  trafficJams?: import("../types/interface").TrafficJams | undefined;
36
+ isCrossBorder?: boolean | undefined;
35
37
  init: boolean;
36
38
  };
37
39
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -48,6 +50,7 @@ export declare const useDrivingRoute: (props?: UseDrivingRouteProps) => {
48
50
  distance: number;
49
51
  }[];
50
52
  trafficJams?: import("../types/interface").TrafficJams | undefined;
53
+ isCrossBorder?: boolean | undefined;
51
54
  init: boolean;
52
55
  };
53
56
  apiMapDrivingRoute: (from: Point, to: Point, waypoints?: Point[]) => Promise<Route>;
@@ -12,7 +12,8 @@ const useADrivingRoute = (props) => {
12
12
  tolls: void 0,
13
13
  steps: [],
14
14
  trafficJams: void 0,
15
- init: true
15
+ init: true,
16
+ isCrossBorder: false
16
17
  });
17
18
  const amapDriving = new AMap.Driving({ ferry: 1 });
18
19
  const apiMapDrivingRoute = (from, to, waypoints = []) => {
@@ -15,5 +15,6 @@ export declare const useDrivingTrackCorrection: (props: UseDrivingTrackCorrectio
15
15
  distance: number;
16
16
  }[];
17
17
  trafficJams?: import("../types/interface").TrafficJams | undefined;
18
+ isCrossBorder?: boolean | undefined;
18
19
  };
19
20
  export {};
@@ -79,6 +79,7 @@ export interface Route {
79
79
  tolls?: number;
80
80
  steps: RouteStep[];
81
81
  trafficJams?: TrafficJams;
82
+ isCrossBorder?: boolean;
82
83
  }
83
84
  export interface TrackPoint {
84
85
  lng: number;
@@ -195,7 +195,7 @@ async function googleServiceApiDrivingDirection(from, to, waypoints, proxyUrl) {
195
195
  }
196
196
  async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
197
197
  var _a, _b, _c, _d, _e;
198
- const { routes } = await apiGoogleRoutes({
198
+ const { routes, isCrossBorder } = await apiGoogleRoutes({
199
199
  proxyUrl,
200
200
  origin: {
201
201
  location: {
@@ -244,7 +244,7 @@ async function googleServiceApiDrivingRoute(from, to, waypoints, proxyUrl) {
244
244
  });
245
245
  }
246
246
  }
247
- return { path, distance, duration, steps: routeSteps };
247
+ return { path, distance, duration, steps: routeSteps, isCrossBorder };
248
248
  }
249
249
  export {
250
250
  amapJsApiDrivingRoute,
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.19.0-drivingRouteFail2";
3
+ const pkgVersion = "2.19.0-drivingRouteFail4";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -166,7 +166,7 @@ function amapPlaceName2DisplayNameOutChinese(name, options) {
166
166
  }
167
167
  const idxs = [];
168
168
  for (const token of [adcode, province, city, district, township]) {
169
- if (!token)
169
+ if (!token || !token.length)
170
170
  continue;
171
171
  if (idxs.length === 2)
172
172
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.19.0-drivingRouteFail2",
3
+ "version": "2.19.0-drivingRouteFail4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",