@heycar/heycars-map 2.4.6 → 2.5.1

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 (60) hide show
  1. package/README.md +26 -8
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/v2/App.js +2 -4
  5. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +11 -6
  6. package/dist/v2/Demo/DemoBusinessReselectPlace.js +10 -5
  7. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  8. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  9. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  10. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +1 -1
  11. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +19 -10
  12. package/dist/v2/business-components/GreenZone/GreenZone.d.ts +1 -0
  13. package/dist/v2/business-components/GreenZone/GreenZone.js +7 -5
  14. package/dist/v2/chunks/{BusinessRecomendPlaceMap.81a4b640.js → BusinessRecomendPlaceMap.d8f5b904.js} +18 -9
  15. package/dist/v2/components/MapProvider/MapProvider.js +13 -14
  16. package/dist/v2/hooks/useMapCoordinatify.js +6 -4
  17. package/dist/v2/hooks/useMapRecomendPlace.d.ts +3 -3
  18. package/dist/v2/hooks/useMapRecomendPlace.js +55 -43
  19. package/dist/v2/hooks/useMapSupplier.d.ts +1 -1
  20. package/dist/v2/hooks/useMapSupplier.js +0 -1
  21. package/dist/v2/hooks/useWalkingRoute.js +6 -0
  22. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  23. package/dist/v2/index.js +1 -1
  24. package/dist/v2/types/gmap.d.ts +10 -0
  25. package/dist/v2/types/interface.d.ts +6 -3
  26. package/dist/v2/utils/ManualAbortError.d.ts +3 -0
  27. package/dist/v2/utils/ManualAbortError.js +22 -0
  28. package/dist/v2/utils/log.js +1 -1
  29. package/dist/v2/utils/transform.js +1 -1
  30. package/dist/v2/utils/typeChecking.d.ts +5 -2
  31. package/dist/v2/utils/typeChecking.js +32 -4
  32. package/dist/v3/App.js +2 -4
  33. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +11 -6
  34. package/dist/v3/Demo/DemoBusinessReselectPlace.js +10 -5
  35. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +1 -0
  36. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +1 -1
  37. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +1 -1
  38. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +1 -1
  39. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +19 -10
  40. package/dist/v3/business-components/GreenZone/GreenZone.d.ts +1 -0
  41. package/dist/v3/business-components/GreenZone/GreenZone.js +7 -5
  42. package/dist/v3/chunks/{BusinessRecomendPlaceMap.7133beea.js → BusinessRecomendPlaceMap.4c38b1fb.js} +18 -9
  43. package/dist/v3/components/MapProvider/MapProvider.js +13 -14
  44. package/dist/v3/hooks/useMapCoordinatify.js +6 -4
  45. package/dist/v3/hooks/useMapRecomendPlace.d.ts +3 -3
  46. package/dist/v3/hooks/useMapRecomendPlace.js +55 -43
  47. package/dist/v3/hooks/useMapSupplier.d.ts +1 -1
  48. package/dist/v3/hooks/useMapSupplier.js +0 -1
  49. package/dist/v3/hooks/useWalkingRoute.js +6 -0
  50. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +1 -1
  51. package/dist/v3/index.js +1 -1
  52. package/dist/v3/types/gmap.d.ts +10 -0
  53. package/dist/v3/types/interface.d.ts +6 -3
  54. package/dist/v3/utils/ManualAbortError.d.ts +3 -0
  55. package/dist/v3/utils/ManualAbortError.js +22 -0
  56. package/dist/v3/utils/log.js +1 -1
  57. package/dist/v3/utils/transform.js +1 -1
  58. package/dist/v3/utils/typeChecking.d.ts +5 -2
  59. package/dist/v3/utils/typeChecking.js +32 -4
  60. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { Place, Point, RecommendZonePlaces, ValueOfOnChangeRecommendPlace, Zone } from "../types/interface";
1
+ import type { Place, Point, RecommendType, RecommendZonePlaces, ValueOfOnChangeRecommendPlace, Zone } from "../types/interface";
2
2
  import { type AbortSignalOption } from "../utils/helper";
3
3
  import { type UseMapPlaceProps } from "./useMapPlace";
4
4
  export interface UseMapRecomendPlaceProps<C = Record<string, any>> {
@@ -29,12 +29,12 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
29
29
  displayName: string;
30
30
  }[]>;
31
31
  availableRef: import("vue-demi").Ref<boolean>;
32
- forceRef: import("vue-demi").Ref<boolean>;
32
+ recommendTypeRef: import("vue-demi").Ref<RecommendType>;
33
33
  isQueryingRef: import("vue-demi").Ref<boolean>;
34
34
  updateRecommendPlace: (place: Place, opt?: AbortSignalOption) => Promise<void>;
35
35
  updateRecommendPlaceOnlyInZone: (place: Place, opt?: AbortSignalOption) => Promise<void>;
36
36
  updatePlaceCandidates: (place: Place, opt?: AbortSignalOption) => Promise<ValueOfOnChangeRecommendPlace>;
37
37
  updatePlace: (point: Point) => Promise<void>;
38
38
  abortUpdatePlace: () => void;
39
- setPlaceCandidatesAndZone: ({ zone, places: placeCandidates }: RecommendZonePlaces) => void;
39
+ setPlaceCandidatesAndZone: ({ type, zone, places: placeCandidates, }: RecommendZonePlaces) => void;
40
40
  };
@@ -1,10 +1,12 @@
1
1
  import { ref, reactive } from "vue-demi";
2
2
  import { GET_RECOMMEND_PLACE_TIMEOUT } from "../api/contants.js";
3
- import { logNoneManualAbortError } from "../utils/ManualAbortError.js";
3
+ import { recoverablyIgnoreManualAbortReject, logNoneManualAbortError } from "../utils/ManualAbortError.js";
4
4
  import { createAbortableOneConcurrent, AbortSignalAny, equalAssign, isPlacesInclude, createAbortable } from "../utils/helper.js";
5
5
  import { isZoneEqual, place2point, isPlaceEqual, businessCandidatesToAdsorptionPlace } from "../utils/transform.js";
6
+ import { assertNoConflictTypeAndZone } from "../utils/typeChecking.js";
6
7
  import { useMapGeometry, apiLocalIsPointInRing } from "./useMapGeometry.js";
7
8
  import { useMapPlace } from "./useMapPlace.js";
9
+ const DEFAULT_RECOMMEND_TYPE = "Recommend";
8
10
  function mergeGetRecommendPlaceAndGetAvailable(getRecomendPlace, getAvailable, timeout) {
9
11
  return function mergedGetRecommendPlace(place, context) {
10
12
  const available = true;
@@ -49,7 +51,7 @@ const useMapRecomendPlace = (props) => {
49
51
  onChangePlace
50
52
  } = props;
51
53
  const availableRef = ref(true);
52
- const forceRef = ref(false);
54
+ const recommendTypeRef = ref(DEFAULT_RECOMMEND_TYPE);
53
55
  const placeCandidatesRef = ref([]);
54
56
  const zoneRef = ref();
55
57
  const abortable = createAbortable(inputSignal);
@@ -77,16 +79,16 @@ const useMapRecomendPlace = (props) => {
77
79
  places: placeCandidates,
78
80
  zone,
79
81
  available = false,
80
- force = false,
82
+ type = DEFAULT_RECOMMEND_TYPE,
81
83
  adsorption = false
82
84
  } = await getRecomendPlaceNoFail({ ...place }, context);
83
85
  (_a = opt == null ? void 0 : opt.signal) == null ? void 0 : _a.throwIfAborted();
84
- if (!available || !placeCandidates) {
85
- return { place: { ...place }, zone, candidates: [], available, force };
86
+ if (!available || !placeCandidates || placeCandidates.length === 0) {
87
+ return { place: { ...place }, zone, candidates: [], available, type };
86
88
  }
87
89
  if (!zone) {
88
90
  const resultPlace2 = adsorption ? businessCandidatesToAdsorptionPlace(placeCandidates) : place;
89
- return { place: { ...resultPlace2 }, zone, candidates: placeCandidates, available, force };
91
+ return { place: { ...resultPlace2 }, zone, candidates: placeCandidates, available, type };
90
92
  }
91
93
  const { shortestPlace, shortestDistance } = findNearestPlace(
92
94
  place,
@@ -95,42 +97,43 @@ const useMapRecomendPlace = (props) => {
95
97
  );
96
98
  const limit = getLimit(context);
97
99
  const resultPlace = zone || shortestDistance <= limit ? shortestPlace : place;
98
- return { place: { ...resultPlace }, zone, candidates: placeCandidates, available, force };
100
+ return { place: { ...resultPlace }, zone, candidates: placeCandidates, available, type };
99
101
  };
100
102
  const getRecommendPlaceZoneState = async (point, prevState, opt) => {
101
103
  const [lng, lat] = point;
102
- const zone = zoneRef.value;
104
+ const { type, zone, available, candidates } = prevState;
103
105
  if (!zone || !apiLocalIsPointInRing(point, zone.path)) {
104
- const reGeoPlacePromise = getPlaceByRegeo(point, opt);
106
+ const reGeoPlacePromiseIgnored = recoverablyIgnoreManualAbortReject(
107
+ getPlaceByRegeo(point, opt)
108
+ );
105
109
  const {
106
110
  place: closestPlace,
107
- candidates,
108
- available,
109
- force,
111
+ candidates: candidates2,
112
+ available: available2,
113
+ type: type2,
110
114
  zone: zone2
111
115
  } = await findAttachedPlace({ lng, lat, name: "", displayName: "" }, opt);
112
- if (isPlacesInclude(candidates, closestPlace)) {
113
- return { place: { ...closestPlace }, zone: zone2, available, candidates, force };
116
+ if (isPlacesInclude(candidates2, closestPlace)) {
117
+ return { place: { ...closestPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
114
118
  }
115
- const regeoPlace = await reGeoPlacePromise;
116
- return { place: { ...regeoPlace }, zone: zone2, available, candidates, force };
119
+ const regeoPlace = await reGeoPlacePromiseIgnored.recover();
120
+ return { place: { ...regeoPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
121
+ }
122
+ if (type === "Forbidden") {
123
+ const regeoPlace = await getPlaceByRegeo(point, opt);
124
+ return { place: { ...regeoPlace }, zone, available, candidates, type };
117
125
  }
118
126
  const { shortestPlace: resultPlace } = findNearestPlace(
119
127
  { lng, lat, name: "", displayName: "" },
120
- prevState.candidates,
128
+ candidates,
121
129
  apiMapDistance
122
130
  );
123
- return {
124
- place: { ...resultPlace },
125
- zone,
126
- available: prevState.available,
127
- force: prevState.force,
128
- candidates: prevState.candidates
129
- };
131
+ return { place: { ...resultPlace }, zone, type, available, candidates };
130
132
  };
131
133
  const updateIntermediateQueryingState = (point) => {
134
+ const type = recommendTypeRef.value;
132
135
  const zone = zoneRef.value;
133
- if (zone && apiLocalIsPointInRing(point, zone.path))
136
+ if (type === "Restricted" && zone && apiLocalIsPointInRing(point, zone.path))
134
137
  return;
135
138
  const [lng, lat] = point;
136
139
  const intermediateQueryingPlace = {
@@ -141,8 +144,10 @@ const useMapRecomendPlace = (props) => {
141
144
  };
142
145
  isQueryingRef.value = true;
143
146
  availableRef.value = true;
144
- if (zone)
147
+ if (type === "Restricted" || type === "Forbidden" && (!zone || !apiLocalIsPointInRing(point, zone.path))) {
145
148
  zoneRef.value = void 0;
149
+ recommendTypeRef.value = "Recommend";
150
+ }
146
151
  placeCandidatesRef.value = [];
147
152
  equalAssign(recomendPlace, { ...intermediateQueryingPlace });
148
153
  onQueryingPlace == null ? void 0 : onQueryingPlace({ ...intermediateQueryingPlace });
@@ -156,13 +161,13 @@ const useMapRecomendPlace = (props) => {
156
161
  candidates,
157
162
  zone,
158
163
  available,
159
- force
164
+ type
160
165
  } = await getRecommendPlaceZoneState(
161
166
  point,
162
167
  {
163
168
  place: recomendPlace,
164
169
  available: availableRef.value,
165
- force: forceRef.value,
170
+ type: recommendTypeRef.value,
166
171
  candidates: placeCandidatesRef.value,
167
172
  zone: zoneRef.value
168
173
  },
@@ -171,13 +176,13 @@ const useMapRecomendPlace = (props) => {
171
176
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
172
177
  isQueryingRef.value = false;
173
178
  availableRef.value = available;
174
- forceRef.value = force;
179
+ recommendTypeRef.value = type;
175
180
  zoneRef.value = zone;
176
181
  placeCandidatesRef.value = candidates;
177
182
  equalAssign(recomendPlace, { ...resultPlace });
178
183
  onChangePlace == null ? void 0 : onChangePlace({ ...resultPlace });
179
184
  const inputPlace = { name: "", displayName: "", lng: point[0], lat: point[1] };
180
- onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace, isInZone: !!zone, isSameZone });
185
+ onChange == null ? void 0 : onChange({ place: { ...resultPlace }, inputPlace, type, zone, isSameZone });
181
186
  },
182
187
  { silent: true }
183
188
  );
@@ -188,19 +193,19 @@ const useMapRecomendPlace = (props) => {
188
193
  places: placeCandidates,
189
194
  zone,
190
195
  available = false,
191
- force = false
196
+ type = DEFAULT_RECOMMEND_TYPE
192
197
  } = await getRecomendPlaceNoFail({ ...place }, context);
193
198
  signal.throwIfAborted();
194
199
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
195
200
  isQueryingRef.value = false;
196
201
  availableRef.value = !!available;
197
- forceRef.value = !!force;
202
+ recommendTypeRef.value = type;
198
203
  zoneRef.value = zone;
199
204
  placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
200
205
  return {
201
206
  inputPlace: { ...place },
202
- isInZone: !!zone,
203
207
  place: { ...place },
208
+ type,
204
209
  isSameZone
205
210
  };
206
211
  };
@@ -210,13 +215,13 @@ const useMapRecomendPlace = (props) => {
210
215
  place: resultPlace,
211
216
  candidates,
212
217
  available,
213
- force,
218
+ type,
214
219
  zone
215
220
  } = await findAttachedPlace(place, opt);
216
221
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
217
222
  isQueryingRef.value = false;
218
223
  availableRef.value = available;
219
- forceRef.value = force;
224
+ recommendTypeRef.value = type;
220
225
  zoneRef.value = zone;
221
226
  placeCandidatesRef.value = candidates;
222
227
  equalAssign(recomendPlace, { ...resultPlace });
@@ -224,7 +229,8 @@ const useMapRecomendPlace = (props) => {
224
229
  onChange == null ? void 0 : onChange({
225
230
  place: { ...resultPlace },
226
231
  inputPlace: { ...place },
227
- isInZone: !!zone,
232
+ type,
233
+ zone,
228
234
  isSameZone
229
235
  });
230
236
  };
@@ -235,14 +241,14 @@ const useMapRecomendPlace = (props) => {
235
241
  place: foundPlace,
236
242
  candidates,
237
243
  available,
238
- force,
244
+ type,
239
245
  zone
240
246
  } = await findAttachedPlace(place, opt);
241
- const resultPlace = zone ? foundPlace : (_a = candidates.find((p) => isPlaceEqual(p, place))) != null ? _a : place;
247
+ const resultPlace = type === "Restricted" ? foundPlace : (_a = candidates.find((p) => isPlaceEqual(p, place))) != null ? _a : place;
242
248
  const isSameZone = !!zone && isZoneEqual(zone, zoneRef.value);
243
249
  isQueryingRef.value = false;
244
250
  availableRef.value = available;
245
- forceRef.value = force;
251
+ recommendTypeRef.value = type;
246
252
  zoneRef.value = zone;
247
253
  placeCandidatesRef.value = candidates;
248
254
  equalAssign(recomendPlace, { ...resultPlace });
@@ -250,13 +256,19 @@ const useMapRecomendPlace = (props) => {
250
256
  onChange == null ? void 0 : onChange({
251
257
  place: { ...resultPlace },
252
258
  inputPlace: { ...place },
253
- isInZone: !!zone,
259
+ type,
260
+ zone,
254
261
  isSameZone
255
262
  });
256
263
  };
257
- const setPlaceCandidatesAndZone = ({ zone, places: placeCandidates }) => {
264
+ const setPlaceCandidatesAndZone = ({
265
+ type = DEFAULT_RECOMMEND_TYPE,
266
+ zone,
267
+ places: placeCandidates
268
+ }) => {
269
+ assertNoConflictTypeAndZone(type, zone);
258
270
  availableRef.value = true;
259
- forceRef.value = !!zone;
271
+ recommendTypeRef.value = type;
260
272
  zoneRef.value = zone ? zone : void 0;
261
273
  placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
262
274
  };
@@ -265,7 +277,7 @@ const useMapRecomendPlace = (props) => {
265
277
  recomendPlace,
266
278
  placeCandidates: placeCandidatesRef,
267
279
  availableRef,
268
- forceRef,
280
+ recommendTypeRef,
269
281
  isQueryingRef,
270
282
  updateRecommendPlace,
271
283
  updateRecommendPlaceOnlyInZone,
@@ -2,7 +2,7 @@ import type { AnyFn } from "@vueuse/core";
2
2
  import type { ConnectionStatus } from "../types/interface";
3
3
  import type { Status, UseMapLoaderOutput, UseMapLoaderProps } from "./useMapLoader";
4
4
  export interface MapSupplierPayolad extends UseMapLoaderProps {
5
- gmapRasterId: string;
5
+ gmapRasterId?: string;
6
6
  gmapId: string;
7
7
  readyPromise: UseMapLoaderOutput["readyPromise"];
8
8
  status: Status;
@@ -12,7 +12,6 @@ const useMapAssertSupplier = () => {
12
12
  const instanceSupplier = payload.supplier;
13
13
  function assertSupplier(fn) {
14
14
  return function fnWithAssertSupplier(...args) {
15
- console.log("instanceSupplier, payload.supplier = ", instanceSupplier, payload.supplier);
16
15
  if (instanceSupplier === payload.supplier)
17
16
  return fn(...args);
18
17
  throw Error(
@@ -1,6 +1,7 @@
1
1
  import { shallowRef } from "vue-demi";
2
2
  import { watchPostEffectForDeepOption } from "../utils/compare.js";
3
3
  import { useMapSupplier } from "./useMapSupplier.js";
4
+ const isIgnoredAmapWalkingRouteError = (err) => err === "RETURN_TIMEOUT";
4
5
  const useAWalkingRoute = (props) => {
5
6
  const pathRef = shallowRef([]);
6
7
  const amapWalking = new AMap.Walking({});
@@ -30,6 +31,11 @@ const useAWalkingRoute = (props) => {
30
31
  pathRef.value = [];
31
32
  return;
32
33
  default:
34
+ if (isIgnoredAmapWalkingRouteError(result)) {
35
+ console.warn(result);
36
+ pathRef.value = [];
37
+ return;
38
+ }
33
39
  throw result;
34
40
  }
35
41
  });
@@ -1,5 +1,5 @@
1
1
  import { reactive, ref, readonly } from "vue-demi";
2
- import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.81a4b640.js";
2
+ import { E as EMPTY_PLACE } from "../chunks/BusinessRecomendPlaceMap.d8f5b904.js";
3
3
  import { CenterPlaceStatus } from "../types/interface.js";
4
4
  import { proxyFunctionalProperty, assertAssingedBeforeUsed } from "../utils/helper.js";
5
5
  const useBusinessRecomendPlaceMap = () => {
package/dist/v2/index.js CHANGED
@@ -3,7 +3,7 @@ import { isCoordinatePointEqual } from "./api/geometry.js";
3
3
  import { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox/AbsoluteAddressBox.js";
4
4
  import { AddressBox } from "./business-components/AddressBox/AddressBox.js";
5
5
  import { BusinessQuotingMap } from "./business-components/BusinessQuotingMap/BusinessQuotingMap.js";
6
- import { B } from "./chunks/BusinessRecomendPlaceMap.81a4b640.js";
6
+ import { B } from "./chunks/BusinessRecomendPlaceMap.d8f5b904.js";
7
7
  import { BusinessReselectPlaceMap } from "./business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js";
8
8
  import { BusinessTaxiEndMap } from "./business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js";
9
9
  import { BusinessTaxiServiceMap } from "./business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js";
@@ -1 +1,11 @@
1
+ /// <reference types="google.maps" />
2
+ declare global {
3
+ namespace google.maps {
4
+ interface MapOptions {
5
+ headingInteractionEnabled?: boolean;
6
+ tiltInteractionEnabled?: boolean;
7
+ renderingType?: RenderingType;
8
+ }
9
+ }
10
+ }
1
11
  export type GmapGeocoderAddressComponentType = "street_number" | "street_address" | "route" | "intersection" | "political" | "country" | "administrative_area_level_1" | "administrative_area_level_2" | "administrative_area_level_3" | "administrative_area_level_4" | "administrative_area_level_5" | "administrative_area_level_6" | "administrative_area_level_7" | "colloquial_area" | "locality" | "sublocality" | "neighborhood" | "premise" | "subpremise" | "plus_code" | "postal_code" | "natural_feature" | "airport" | "park" | "point_of_interest";
@@ -33,7 +33,7 @@ export interface CoordinateZone extends Omit<Zone, "path"> {
33
33
  }
34
34
  export interface RecommendZonePlaces {
35
35
  adsorption?: boolean;
36
- force?: boolean;
36
+ type?: RecommendType;
37
37
  available?: boolean;
38
38
  zone?: Zone;
39
39
  places?: Place[];
@@ -43,14 +43,16 @@ export interface CoordinateRecommendZonePlaces extends Omit<RecommendZonePlaces,
43
43
  places?: CoordinatePlace[];
44
44
  }
45
45
  export interface ValueOfOnChangeRecommendPlace {
46
+ type: RecommendType;
46
47
  place: Place;
47
48
  inputPlace: Place;
48
- isInZone: boolean;
49
+ zone?: Zone;
49
50
  isSameZone: boolean;
50
51
  }
51
- export interface CoordinateValueOfOnChangeRecommendPlace extends Omit<ValueOfOnChangeRecommendPlace, "place" | "inputPlace"> {
52
+ export interface CoordinateValueOfOnChangeRecommendPlace extends Omit<ValueOfOnChangeRecommendPlace, "place" | "inputPlace" | "zone"> {
52
53
  place: CoordinatePlace;
53
54
  inputPlace: CoordinatePlace;
55
+ zone?: CoordinateZone;
54
56
  }
55
57
  export interface GeoPosition {
56
58
  position: Point;
@@ -86,6 +88,7 @@ export interface TrackPoint {
86
88
  export interface CoordinateTrackPoint extends TrackPoint {
87
89
  type: CoordinateType;
88
90
  }
91
+ export type RecommendType = "Restricted" | "Forbidden" | "Recommend";
89
92
  export type DriverStatus = "dispatching" | "book-dispatching" | "dispatched" | "driverStartService" | "book-driverStartService" | "book-dispatched" | "driverArrived" | "inService" | "canceled" | "endService" | "completed" | "canceling" | "banlanceRefund" | "waitBanlanceRefund" | "rechargePayed" | "waitRechargePay" | "payed" | "waitpay" | "refund" | "confirmed" | "assign" | "orderReassigned";
90
93
  export declare enum CenterPlaceStatus {
91
94
  GEO_LOADING = "GEO_LOADING",
@@ -1,3 +1,6 @@
1
1
  export declare const MANUAL_ABORT_MESSAGE = "MANUAL_ABORT_MESSAGE";
2
2
  export declare const throwNoneManualAbortError: (e: unknown) => void;
3
3
  export declare const logNoneManualAbortError: (e: unknown) => void;
4
+ export declare const recoverablyIgnoreManualAbortReject: <T>(promise: Promise<T>) => {
5
+ recover: () => Promise<T>;
6
+ };
@@ -7,8 +7,30 @@ const logNoneManualAbortError = (e) => {
7
7
  if (e !== MANUAL_ABORT_MESSAGE)
8
8
  console.error(e);
9
9
  };
10
+ function recoverablyIgnoreReject(promise, ignoreFilter) {
11
+ let isValid = true;
12
+ let error;
13
+ const ignoredPromise = promise.catch((err) => {
14
+ if (!isValid || !ignoreFilter(err))
15
+ throw err;
16
+ isValid = false;
17
+ error = err;
18
+ return void 0;
19
+ });
20
+ const recover = () => {
21
+ if (!isValid)
22
+ return Promise.reject(error);
23
+ isValid = false;
24
+ return ignoredPromise;
25
+ };
26
+ return { recover };
27
+ }
28
+ const recoverablyIgnoreManualAbortReject = (promise) => {
29
+ return recoverablyIgnoreReject(promise, (e) => e === MANUAL_ABORT_MESSAGE);
30
+ };
10
31
  export {
11
32
  MANUAL_ABORT_MESSAGE,
12
33
  logNoneManualAbortError,
34
+ recoverablyIgnoreManualAbortReject,
13
35
  throwNoneManualAbortError
14
36
  };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.4.6";
3
+ const pkgVersion = "2.5.1";
4
4
  const isEnableLog = (name) => {
5
5
  const searchParam = new URLSearchParams(location.search);
6
6
  return searchParam.has(`log-${name}`);
@@ -74,7 +74,7 @@ const isGeoPositionEqual = (p1, p2) => {
74
74
  return p1.coords.longitude === p2.coords.longitude && p1.coords.latitude === p2.coords.latitude;
75
75
  };
76
76
  const isZoneEqual = (z1, z2) => {
77
- return z1.path.every((point, idx) => isPointEqual(point, z2 == null ? void 0 : z2.path[idx]));
77
+ return z1.name === (z2 == null ? void 0 : z2.name) && z1.path.every((point, idx) => isPointEqual(point, z2 == null ? void 0 : z2.path[idx]));
78
78
  };
79
79
  const amapPlaceName2DisplayName = (name, options) => {
80
80
  const { isChina } = options;
@@ -1,5 +1,7 @@
1
- import type { CoordinatePlace, CoordinatePoint, CoordinateRecommendZonePlaces, CoordinateTrackPoint, CoordinateType, CoordinateZone } from "../types/interface";
1
+ import type { CoordinatePlace, CoordinatePoint, CoordinateRecommendZonePlaces, CoordinateTrackPoint, CoordinateType, CoordinateZone, RecommendType } from "../types/interface";
2
2
  export declare function isCoordinateType(type: unknown): type is CoordinateType;
3
+ export declare function isRecommendType(type: unknown): type is RecommendType;
4
+ export declare function toRecommendType(type: unknown): RecommendType;
3
5
  interface MaybeCoordinatePlace {
4
6
  displayName?: string;
5
7
  name: string;
@@ -20,9 +22,10 @@ interface MaybeCoordinateZone {
20
22
  path: MaybeCoordinatePoint[];
21
23
  }
22
24
  export declare const toCoordinateZoneType: (value?: MaybeCoordinateZone) => CoordinateZone;
25
+ export declare const assertNoConflictTypeAndZone: (type: unknown, zone: unknown) => void;
23
26
  interface MaybeCoordinateRecomendZonePlaces {
24
27
  adsorption?: boolean;
25
- force?: boolean;
28
+ type?: string;
26
29
  available?: boolean;
27
30
  zone?: MaybeCoordinateZone;
28
31
  places?: MaybeCoordinatePlace[];
@@ -11,6 +11,16 @@ const createTypeError = (typeName, value, detail) => {
11
11
  function isCoordinateType(type) {
12
12
  return type === "wgs84" || type === "gcj02" || type === "bd09";
13
13
  }
14
+ function isRecommendType(type) {
15
+ return type === "Recommend" || type === "Restricted" || type === "Forbidden";
16
+ }
17
+ function toRecommendType(type) {
18
+ if (type === void 0)
19
+ return "Recommend";
20
+ if (isRecommendType(type))
21
+ return type;
22
+ throw createTypeError("RecommendType", type);
23
+ }
14
24
  const toCoordinatePlaceType = (value) => {
15
25
  var _a;
16
26
  try {
@@ -48,16 +58,31 @@ const toCoordinateZoneType = (value) => {
48
58
  const { name = "", path } = value;
49
59
  if (!Array.isArray(path))
50
60
  throw Error();
51
- return { name, path: path.map(toCoordinatePointType) };
61
+ return { ...value, name, path: path.map(toCoordinatePointType) };
52
62
  } catch (err) {
53
63
  throw createTypeError("CoordinateZone", value, err == null ? void 0 : err.message);
54
64
  }
55
65
  };
66
+ const assertNoConflictTypeAndZone = (type, zone) => {
67
+ if (!!zone && type !== "Restricted" && type !== "Forbidden") {
68
+ throw Error(
69
+ `MyTypeError: zone exist, so expected type: Restricted | Forbidden, but received: ${JSON.stringify(
70
+ type
71
+ )}`
72
+ );
73
+ }
74
+ if (!zone && (type === "Restricted" || type === "Forbidden")) {
75
+ throw Error(
76
+ `MyTypeError: zone not exist, so expected type: Recommend | undefined, but received: ${type}`
77
+ );
78
+ }
79
+ };
56
80
  const toCoordinateRecommendZonePlacesType = (value) => {
57
81
  try {
58
- const { force, available, zone, places, adsorption } = value;
82
+ const { type, available, zone, places, adsorption } = value;
83
+ assertNoConflictTypeAndZone(type, zone);
59
84
  return {
60
- force: !!force,
85
+ type: toRecommendType(type),
61
86
  available: !!available,
62
87
  zone: zone === void 0 ? void 0 : toCoordinateZoneType(zone),
63
88
  places: places === void 0 ? void 0 : places.map(toCoordinatePlaceType),
@@ -81,11 +106,14 @@ const toCoordinateTrackPoint = (value) => {
81
106
  return { lng, lat, type, angle, speed, timestamp };
82
107
  };
83
108
  export {
109
+ assertNoConflictTypeAndZone,
84
110
  isCoordinatePoint,
85
111
  isCoordinateType,
112
+ isRecommendType,
86
113
  toCoordinatePlaceType,
87
114
  toCoordinatePointType,
88
115
  toCoordinateRecommendZonePlacesType,
89
116
  toCoordinateTrackPoint,
90
- toCoordinateZoneType
117
+ toCoordinateZoneType,
118
+ toRecommendType
91
119
  };
package/dist/v3/App.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { createVNode } from "vue";
2
2
  import { defineComponent, ref } from "vue-demi";
3
- import { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
3
+ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.js";
4
4
  import { MapProvider } from "./components/MapProvider/MapProvider.js";
5
5
  const gmapApiKey = "AIzaSyCCOe8MAeS3EYvSraKsBX6ztVyLxj69z94";
6
6
  const gmapId = "d0af0c05331af64a";
7
- const gmapRasterId = "e02db3cb62a7b46";
8
7
  const amapApiKey = "81ed1d2b5b77187683717a5f2f19591a";
9
8
  const amapApiSecret = "1dfe626553258a9f91d7c4552c0816d2";
10
9
  const App = /* @__PURE__ */ defineComponent({
@@ -15,7 +14,6 @@ const App = /* @__PURE__ */ defineComponent({
15
14
  "amapKey": amapApiKey,
16
15
  "amapSecret": amapApiSecret,
17
16
  "gmapId": gmapId,
18
- "gmapRasterId": gmapRasterId,
19
17
  "gmapKey": gmapApiKey,
20
18
  "language": "en",
21
19
  "supplier": supplierRef.value,
@@ -25,7 +23,7 @@ const App = /* @__PURE__ */ defineComponent({
25
23
  "onFail": () => console.log(`${supplierRef.value} load failed`),
26
24
  "onDownloadOptimizeEnd": () => console.log(`${supplierRef.value} load download optimize end`)
27
25
  }, {
28
- default: () => [createVNode(DemoBusinessQuoting, null, null)]
26
+ default: () => [createVNode(DemoBusinessRecomendPlace, null, null)]
29
27
  });
30
28
  }
31
29
  });
@@ -1,5 +1,5 @@
1
1
  import { createVNode } from "vue";
2
- import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.7133beea.js";
2
+ import { B as BusinessRecomendPlaceMap } from "../chunks/BusinessRecomendPlaceMap.4c38b1fb.js";
3
3
  import { useBusinessRecomendPlaceMap } from "../hooks-business/useBusinessRecomendPlaceMap.js";
4
4
  import { defineSetup } from "../types/helper.js";
5
5
  import { d as demo } from "../chunks/Demo.css.e921a2f6.js";
@@ -12,7 +12,8 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
12
12
  await new Promise((r) => setTimeout(r, 3e3));
13
13
  return {
14
14
  available: true,
15
- zone: {
15
+ type: "Restricted",
16
+ zone: Object.assign({
16
17
  name: "",
17
18
  path: [{
18
19
  lng: lng - 1e-3,
@@ -27,7 +28,9 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
27
28
  lat: lat + 5e-4,
28
29
  type
29
30
  }]
30
- },
31
+ }, {
32
+ extra: "extra information 1"
33
+ }),
31
34
  places: [{
32
35
  lat: lat - 1e-5,
33
36
  lng: lng + 1e-4,
@@ -108,6 +111,7 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
108
111
  "class": demo,
109
112
  "geoLoadingTitle": "正在获取您当前的位置",
110
113
  "unavailableTitle": "当前区域暂未开通服务",
114
+ "forbiddenTitle": "当前区域不可叫车",
111
115
  "emptyTitle": "当前位置",
112
116
  "queryingTitle": "正在获取地址信息",
113
117
  "recomendDescription": "您将在此处上车",
@@ -115,7 +119,7 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
115
119
  "defaultCenterPlace": (place) => place != null ? place : {
116
120
  lng: 139.777777,
117
121
  lat: 35.777777,
118
- type: "gcj02",
122
+ type: "wgs84",
119
123
  name: "default place name",
120
124
  displayName: "default place displayName"
121
125
  },
@@ -134,10 +138,11 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
134
138
  "onChangeRecomandPlace": ({
135
139
  place,
136
140
  inputPlace,
137
- isInZone
141
+ type,
142
+ zone
138
143
  }) => {
139
144
  console.log("用户操作地图,计算推荐点后得出的最终位置时触发,此时可以向后端查询城市信息");
140
- console.log("计算推荐点之前的地址是: ", inputPlace, " 最终的地址是: ", place, " 是否在绿区内: ", isInZone);
145
+ console.log("计算推荐点之前的地址是: ", inputPlace, " 最终的地址是: ", place, " 推荐类型: ", type, "绿区(或红区):", zone);
141
146
  },
142
147
  "onClickLocatorText": () => console.log("用户点击了蓝色光标文字触发,此时可以执行用户点击起点输入框相同的逻辑"),
143
148
  "onClickLocatorPhoto": () => console.log("用户点击了蓝色光标图片触发,此时可以执行用户点击起点输入框相同的逻辑"),