@heycar/heycars-map 2.19.0-drivingRouteFail6 → 2.20.0-pointSource

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 (35) hide show
  1. package/dist/v2/App.js +2 -2
  2. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +35 -38
  3. package/dist/v2/business-components/BusinessRecomendPlaceMap/useCacheCenterPlace.d.ts +2 -0
  4. package/dist/v2/hooks/useMapPlace.d.ts +4 -1
  5. package/dist/v2/hooks/useMapPlace.js +9 -19
  6. package/dist/v2/hooks/useMapRecomendPlace.d.ts +3 -1
  7. package/dist/v2/hooks/useMapRecomendPlace.js +5 -4
  8. package/dist/v2/hooks/usePlacesLabelDirection.d.ts +1 -0
  9. package/dist/v2/hooks-business/useBusinessAlarm.d.ts +1 -0
  10. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +1 -0
  11. package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +1 -0
  12. package/dist/v2/index.js +2 -1
  13. package/dist/v2/types/interface.d.ts +8 -0
  14. package/dist/v2/types/interface.js +10 -1
  15. package/dist/v2/utils/log.js +1 -1
  16. package/dist/v2/utils/transform.d.ts +8 -2
  17. package/dist/v2/utils/transform.js +2 -1
  18. package/dist/v3/App.js +2 -2
  19. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +35 -38
  20. package/dist/v3/business-components/BusinessRecomendPlaceMap/useCacheCenterPlace.d.ts +2 -0
  21. package/dist/v3/hooks/useMapPlace.d.ts +4 -1
  22. package/dist/v3/hooks/useMapPlace.js +9 -19
  23. package/dist/v3/hooks/useMapRecomendPlace.d.ts +3 -1
  24. package/dist/v3/hooks/useMapRecomendPlace.js +5 -4
  25. package/dist/v3/hooks/usePlacesLabelDirection.d.ts +1 -0
  26. package/dist/v3/hooks-business/useBusinessAlarm.d.ts +1 -0
  27. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +1 -0
  28. package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +1 -0
  29. package/dist/v3/index.js +2 -1
  30. package/dist/v3/types/interface.d.ts +8 -0
  31. package/dist/v3/types/interface.js +10 -1
  32. package/dist/v3/utils/log.js +1 -1
  33. package/dist/v3/utils/transform.d.ts +8 -2
  34. package/dist/v3/utils/transform.js +2 -1
  35. package/package.json +1 -1
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 { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
4
+ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.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(DemoBusinessQuoting)]);
54
+ }, [h(DemoBusinessRecomendPlace)]);
55
55
  }
56
56
  });
57
57
  export {
@@ -12,44 +12,41 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
12
12
  await new Promise((r) => setTimeout(r, 3e3));
13
13
  return {
14
14
  available: true,
15
- type: "Restricted",
16
- zone: Object.assign({
17
- name: "",
18
- path: [{
19
- lng: lng - 1e-3,
20
- lat: lat + 1e-3,
21
- type
22
- }, {
23
- lng,
24
- lat: lat - 1e-3,
25
- type
26
- }, {
27
- lng: lng + 1e-3,
28
- lat: lat + 5e-4,
29
- type
30
- }]
31
- }, {
32
- extra: "extra information 1"
33
- }),
34
- places: [{
35
- lat: lat - 1e-5,
36
- lng: lng + 1e-4,
37
- type,
38
- name: "place 1",
39
- displayName: "place 1"
40
- }, {
41
- lat: lat - 3e-4,
42
- lng: lng + 2e-4,
43
- type,
44
- name: "place 2",
45
- displayName: "place 2"
46
- }, {
47
- lat: lat - 2e-4,
48
- lng: lng - 1e-4,
49
- type,
50
- name: "place 3",
51
- displayName: "place 3"
52
- }]
15
+ type: "Recommend"
16
+ // zone: Object.assign(
17
+ // {
18
+ // name: "",
19
+ // path: [
20
+ // { lng: lng - 0.001, lat: lat + 0.001, type },
21
+ // { lng: lng, lat: lat - 0.001, type },
22
+ // { lng: lng + 0.001, lat: lat + 0.0005, type },
23
+ // ],
24
+ // } satisfies CoordinateZone,
25
+ // { extra: "extra information 1" },
26
+ // ),
27
+ // places: [
28
+ // {
29
+ // lat: lat - 0.00001,
30
+ // lng: lng + 0.0001,
31
+ // type,
32
+ // name: "place 1",
33
+ // displayName: "place 1",
34
+ // },
35
+ // {
36
+ // lat: lat - 0.0003,
37
+ // lng: lng + 0.0002,
38
+ // type,
39
+ // name: "place 2",
40
+ // displayName: "place 2",
41
+ // },
42
+ // {
43
+ // lat: lat - 0.0002,
44
+ // lng: lng - 0.0001,
45
+ // type,
46
+ // name: "place 3",
47
+ // displayName: "place 3",
48
+ // },
49
+ // ],
53
50
  };
54
51
  };
55
52
  const {
@@ -12,6 +12,7 @@ export declare const useCacheCenterPlace: (props: UseDefaultCenterPlaceProps) =>
12
12
  lat: number;
13
13
  name: string;
14
14
  displayName: string;
15
+ pointSource?: import("../../types/interface").PointSource | undefined;
15
16
  };
16
17
  geoDefaultPosition: Point;
17
18
  defaultCenterPlace: {
@@ -19,6 +20,7 @@ export declare const useCacheCenterPlace: (props: UseDefaultCenterPlaceProps) =>
19
20
  lat: number;
20
21
  name: string;
21
22
  displayName: string;
23
+ pointSource?: import("../../types/interface").PointSource | undefined;
22
24
  };
23
25
  };
24
26
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from "vue-demi";
2
- import type { Place, Point } from "../types/interface";
2
+ import { PointSource, type Place, type Point } from "../types/interface";
3
3
  import { type AbortSignalOption } from "../utils/helper";
4
4
  export interface UseMapPlaceProps {
5
5
  pointRef: Ref<Point>;
@@ -13,6 +13,7 @@ export declare const useAmapPlace: (props: UseMapPlaceProps) => {
13
13
  lat: number;
14
14
  name: string;
15
15
  displayName: string;
16
+ pointSource?: PointSource | undefined;
16
17
  };
17
18
  updatePlace: (value: Point) => void;
18
19
  setPlace: (value: Place) => void;
@@ -24,6 +25,7 @@ export declare const useGmapPlace: (props: UseMapPlaceProps) => {
24
25
  lat: number;
25
26
  name: string;
26
27
  displayName: string;
28
+ pointSource?: PointSource | undefined;
27
29
  };
28
30
  updatePlace: (value: Point) => void;
29
31
  setPlace: (value: Place) => void;
@@ -35,6 +37,7 @@ export declare const useMapPlace: (props: UseMapPlaceProps) => {
35
37
  lat: number;
36
38
  name: string;
37
39
  displayName: string;
40
+ pointSource?: PointSource | undefined;
38
41
  };
39
42
  updatePlace: (value: Point) => void;
40
43
  setPlace: (value: Place) => void;
@@ -1,6 +1,7 @@
1
1
  import { ref, reactive, watch } from "vue-demi";
2
2
  import { REGEO_TIMEOUT, HK_GOVERN_API_TIMEOUT } from "../api/contants.js";
3
3
  import { apiHongKongGovernDriving } from "../api/hongkongGovernDriving.js";
4
+ import { PointSource } from "../types/interface.js";
4
5
  import { createPipeTw } from "../utils/cn2tw.js";
5
6
  import { equalAssign, AbortSignalAny, sleep } from "../utils/helper.js";
6
7
  import { getHKGovernResult } from "../utils/hongkongGovernGeoCoder.js";
@@ -39,7 +40,7 @@ const useAmapPlace = (props) => {
39
40
  const handleFailed = () => {
40
41
  const name = emptyPlaceName;
41
42
  const displayName = emptyPlaceName;
42
- resolve({ lng, lat, name, displayName });
43
+ resolve({ lng, lat, name, displayName, pointSource: PointSource.OTHERS });
43
44
  };
44
45
  readyPromise.then(() => {
45
46
  const pipeTw = createPipeTw(language === "zh-TW");
@@ -60,9 +61,6 @@ const useAmapPlace = (props) => {
60
61
  }).then(({ result, origin }) => {
61
62
  var _a, _b;
62
63
  const hkGovernRes = getHKGovernResult((_b = (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.rawResponse) == null ? void 0 : _b.results, origin);
63
- const diff = Date.now() - startTime;
64
- console.log("==return value of hkGovernApi==", hkGovernRes);
65
- console.log("==time of hkGovernApi==", diff);
66
64
  if (!amapReturned && hkGovernRes) {
67
65
  const name = language === "en" ? hkGovernRes.ename : hkGovernRes.cname;
68
66
  hkReturned = true;
@@ -70,7 +68,8 @@ const useAmapPlace = (props) => {
70
68
  lng,
71
69
  lat,
72
70
  name,
73
- displayName: name
71
+ displayName: name,
72
+ pointSource: PointSource.HKGOV
74
73
  });
75
74
  }
76
75
  });
@@ -101,7 +100,7 @@ const useAmapPlace = (props) => {
101
100
  ...addressComponent
102
101
  });
103
102
  amapReturned = true;
104
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
103
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GAODE });
105
104
  }).catch(() => {
106
105
  handleFailed();
107
106
  });
@@ -128,7 +127,7 @@ const useAmapPlace = (props) => {
128
127
  ...addressComponent
129
128
  });
130
129
  amapReturned = true;
131
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
130
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GAODE });
132
131
  return;
133
132
  }
134
133
  case "no_data":
@@ -161,7 +160,7 @@ const useGmapPlace = (props) => {
161
160
  const { signal: inputSignal, onChange, emptyPlaceName } = props;
162
161
  const defaultPoint = [...props.pointRef.value];
163
162
  const pointRef = ref(defaultPoint);
164
- const { readyPromise, language, reportLog } = useMapSupplier();
163
+ const { readyPromise, language } = useMapSupplier();
165
164
  const { idx: placeKey, update } = useUpdate();
166
165
  const place = reactive({
167
166
  lng: pointRef.value[0],
@@ -187,24 +186,15 @@ const useGmapPlace = (props) => {
187
186
  console.error(err);
188
187
  const name = emptyPlaceName;
189
188
  const displayName = emptyPlaceName;
190
- resolve({ lng, lat, name, displayName });
189
+ resolve({ lng, lat, name, displayName, pointSource: PointSource.GOOGLE });
191
190
  };
192
191
  readyPromise.then(() => {
193
192
  const geocoder = new google.maps.Geocoder();
194
193
  const pipeTw = createPipeTw(language === "zh-TW");
195
- reportLog == null ? void 0 : reportLog({
196
- operation: "google_regeo",
197
- eventType: "ServiceLogic",
198
- message: {
199
- lng,
200
- lat,
201
- language
202
- }
203
- });
204
194
  geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
205
195
  const name = results[0].formatted_address || emptyPlaceName;
206
196
  const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
207
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
197
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GOOGLE });
208
198
  }).catch(handleFailed);
209
199
  }, handleFailed);
210
200
  const timer = setTimeout(() => {
@@ -1,4 +1,4 @@
1
- import type { Place, Point, RecommendType, RecommendZonePlaces, ValueOfOnChangeRecommendPlace, Zone } from "../types/interface";
1
+ import { PointSource, type Place, type Point, type RecommendType, type RecommendZonePlaces, type ValueOfOnChangeRecommendPlace, type 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>> {
@@ -21,12 +21,14 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
21
21
  lat: number;
22
22
  name: string;
23
23
  displayName: string;
24
+ pointSource?: PointSource | undefined;
24
25
  };
25
26
  placeCandidates: import("vue-demi").Ref<{
26
27
  lng: number;
27
28
  lat: number;
28
29
  name: string;
29
30
  displayName: string;
31
+ pointSource?: PointSource | undefined;
30
32
  }[]>;
31
33
  availableRef: import("vue-demi").Ref<boolean>;
32
34
  recommendTypeRef: import("vue-demi").Ref<RecommendType>;
@@ -1,5 +1,6 @@
1
1
  import { ref, reactive } from "vue-demi";
2
2
  import { GET_RECOMMEND_PLACE_TIMEOUT } from "../api/contants.js";
3
+ import { PointSource } from "../types/interface.js";
3
4
  import { recoverablyIgnoreManualAbortReject, logNoneManualAbortError } from "../utils/ManualAbortError.js";
4
5
  import { createAbortableOneConcurrent, AbortSignalAny, equalAssign, isPlacesInclude, createAbortable } from "../utils/helper.js";
5
6
  import { isZoneEqual, place2point, isPlaceEqual, businessCandidatesToAdsorptionPlace } from "../utils/transform.js";
@@ -84,7 +85,7 @@ const useMapRecomendPlace = (props) => {
84
85
  } = await getRecomendPlaceNoFail({ ...place }, context);
85
86
  (_a = opt == null ? void 0 : opt.signal) == null ? void 0 : _a.throwIfAborted();
86
87
  if (!available || !placeCandidates || placeCandidates.length === 0) {
87
- return { place: { ...place }, zone, candidates: [], available, type };
88
+ return { place: { ...place, pointSource: PointSource.OTHERS }, zone, candidates: [], available, type };
88
89
  }
89
90
  if (!zone) {
90
91
  const resultPlace2 = adsorption ? businessCandidatesToAdsorptionPlace(placeCandidates) : place;
@@ -97,7 +98,7 @@ const useMapRecomendPlace = (props) => {
97
98
  );
98
99
  const limit = getLimit(context);
99
100
  const resultPlace = zone || shortestDistance <= limit ? shortestPlace : place;
100
- return { place: { ...resultPlace }, zone, candidates: placeCandidates, available, type };
101
+ return { place: { ...resultPlace, pointSource: PointSource.RECOMMEND }, zone, candidates: placeCandidates, available, type };
101
102
  };
102
103
  const getRecommendPlaceZoneState = async (point, prevState, opt) => {
103
104
  const [lng, lat] = point;
@@ -117,7 +118,7 @@ const useMapRecomendPlace = (props) => {
117
118
  return { place: { ...closestPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
118
119
  }
119
120
  const regeoPlace = await reGeoPlacePromiseIgnored.recover();
120
- console.log(54566544, regeoPlace);
121
+ console.log("==RegeoPlace==", regeoPlace);
121
122
  return { place: { ...regeoPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
122
123
  }
123
124
  if (type === "Forbidden") {
@@ -129,7 +130,7 @@ const useMapRecomendPlace = (props) => {
129
130
  candidates,
130
131
  apiMapDistance
131
132
  );
132
- return { place: { ...resultPlace }, zone, type, available, candidates };
133
+ return { place: { ...resultPlace, pointSource: PointSource.RECOMMEND }, zone, type, available, candidates };
133
134
  };
134
135
  const updateIntermediateQueryingState = (point) => {
135
136
  const type = recommendTypeRef.value;
@@ -15,6 +15,7 @@ export declare const usePointsLabelDirection: (props: UsePointsLabelDirectionPro
15
15
  lat: number;
16
16
  name: string;
17
17
  displayName: string;
18
+ pointSource?: import("../types/interface").PointSource | undefined;
18
19
  }[]>;
19
20
  isContainBasePlaceRef: import("vue-demi").Ref<boolean>;
20
21
  };
@@ -11,6 +11,7 @@ export declare const useBusinessAlarm: (props?: useBusinessAlarmProps) => {
11
11
  lat: number;
12
12
  name: string;
13
13
  displayName: string;
14
+ pointSource?: import("..").PointSource | undefined;
14
15
  };
15
16
  geoError: import("vue").Ref<GeolocationPositionError | undefined>;
16
17
  };
@@ -25,6 +25,7 @@ export declare const useBusinessRecomendPlaceMap: () => {
25
25
  lat: number;
26
26
  name: string;
27
27
  displayName: string;
28
+ pointSource?: import("../types/interface").PointSource | undefined;
28
29
  };
29
30
  geoPosition: Readonly<Ref<{
30
31
  readonly lng: number;
@@ -10,6 +10,7 @@ export declare const useBusinessReselectPlaceMap: () => {
10
10
  lat: number;
11
11
  name: string;
12
12
  displayName: string;
13
+ pointSource?: import("..").PointSource | undefined;
13
14
  };
14
15
  geoPosition: Readonly<import("vue").Ref<{
15
16
  readonly lng: number;
package/dist/v2/index.js CHANGED
@@ -33,7 +33,7 @@ import { useMapPlace } from "./hooks/useMapPlace.js";
33
33
  import { useMapRecomendPlace } from "./hooks/useMapRecomendPlace.js";
34
34
  import { useWalkingRoute } from "./hooks/useWalkingRoute.js";
35
35
  import { inChina, inHongkong, inKorean, inMacau, inTaiwan } from "./hooks/useMapInChina.js";
36
- import { CenterPlaceStatus } from "./types/interface.js";
36
+ import { CenterPlaceStatus, PointSource } from "./types/interface.js";
37
37
  import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT, MINI_PROGRAM_WEB_VIEW_CLOSE_TIMEOUT, patchMiniprogramRedirectTo } from "./utils/patchMiniprogram.js";
38
38
  export {
39
39
  AbsoluteAddressBox,
@@ -52,6 +52,7 @@ export {
52
52
  PassengerCircle,
53
53
  PickupPoints,
54
54
  PlaceCircle,
55
+ PointSource,
55
56
  StartEndPoint,
56
57
  TaxiCar,
57
58
  WalkingLine,
@@ -20,6 +20,7 @@ export type Place = {
20
20
  lat: number;
21
21
  name: string;
22
22
  displayName: string;
23
+ pointSource?: PointSource;
23
24
  };
24
25
  export interface CoordinatePlace extends Place {
25
26
  type: CoordinateType;
@@ -99,6 +100,13 @@ export declare enum CenterPlaceStatus {
99
100
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
100
101
  OK = "OK"
101
102
  }
103
+ export declare enum PointSource {
104
+ GOOGLE = "google",
105
+ GAODE = "gd",
106
+ HKGOV = "gov",
107
+ RECOMMEND = "recommend",
108
+ OTHERS = "others"
109
+ }
102
110
  export type ConnectionStatus = "pending" | "connected" | "unconnected";
103
111
  export interface BusinessGeolocationPositionError extends GeolocationPositionError {
104
112
  isBusinessTimeout: boolean;
@@ -5,6 +5,15 @@ var CenterPlaceStatus = /* @__PURE__ */ ((CenterPlaceStatus2) => {
5
5
  CenterPlaceStatus2["OK"] = "OK";
6
6
  return CenterPlaceStatus2;
7
7
  })(CenterPlaceStatus || {});
8
+ var PointSource = /* @__PURE__ */ ((PointSource2) => {
9
+ PointSource2["GOOGLE"] = "google";
10
+ PointSource2["GAODE"] = "gd";
11
+ PointSource2["HKGOV"] = "gov";
12
+ PointSource2["RECOMMEND"] = "recommend";
13
+ PointSource2["OTHERS"] = "others";
14
+ return PointSource2;
15
+ })(PointSource || {});
8
16
  export {
9
- CenterPlaceStatus
17
+ CenterPlaceStatus,
18
+ PointSource
10
19
  };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.19.0-drivingRouteFail6";
3
+ const pkgVersion = "2.20.0-pointSource";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { CoordinateType, LngLatLiterial, Place, Point, TrackPoint, TrafficStatus, Zone } from "../types/interface";
2
+ import { PointSource, type CoordinateType, type LngLatLiterial, type Place, type Point, type TrackPoint, type TrafficStatus, type Zone } from "../types/interface";
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
@@ -41,7 +41,13 @@ export declare const trackPoints2amapGraspRoadPoints: (trackPoints: TrackPoint[]
41
41
  export declare const alipayMyGetLocationSuccessResponse2GeolocationPosition: (res: AlipayMyGetLocationSuccessResponse) => GeolocationPosition;
42
42
  export declare const alipayMyGetLocationError2GeolocationPositionErrorCode: (code: number) => 1 | 2 | 3;
43
43
  export declare const geoPositionError2businessTimeout: (error: GeolocationPositionError, platform: BRWOSER_PLATFORM) => boolean;
44
- export declare const businessCandidatesToAdsorptionPlace: (places: Place[]) => Place;
44
+ export declare const businessCandidatesToAdsorptionPlace: (places: Place[]) => {
45
+ pointSource: PointSource;
46
+ lng: number;
47
+ lat: number;
48
+ name: string;
49
+ displayName: string;
50
+ };
45
51
  type MaybeFunctionToFunction<T> = T extends (...args: any) => any ? T : () => T;
46
52
  export declare const maybeFunctionToFunction: <T>(value: T) => MaybeFunctionToFunction<T>;
47
53
  export declare const signal2promise: (signal?: AbortSignal) => Promise<any>;
@@ -1,5 +1,6 @@
1
1
  import { e as exported } from "../chunks/gcoord.esm-bundler.3f2f1369.js";
2
2
  import { MIN_ANIMATION_DURATION, ANIMATION_DURATION_FOR_100VW, ANIMATION_DURATION_PER_ZOOM } from "../api/contants.js";
3
+ import { PointSource } from "../types/interface.js";
3
4
  import { GoogleLatLng } from "./compatibleGoogleTypes.js";
4
5
  import { BRWOSER_PLATFORM } from "./platform.js";
5
6
  var decode = function(encodedPath, precision) {
@@ -296,7 +297,7 @@ const alipayMyGetLocationError2GeolocationPositionErrorCode = (code) => {
296
297
  const geoPositionError2businessTimeout = (error, platform) => {
297
298
  return platform !== BRWOSER_PLATFORM.WECHAT && platform !== BRWOSER_PLATFORM.WECHAT_MINIPROGRAM && error.code === GeolocationPositionError.TIMEOUT;
298
299
  };
299
- const businessCandidatesToAdsorptionPlace = (places) => places[0];
300
+ const businessCandidatesToAdsorptionPlace = (places) => ({ ...places[0], pointSource: PointSource.RECOMMEND });
300
301
  const maybeFunctionToFunction = (value) => {
301
302
  return typeof value === "function" ? value : () => value;
302
303
  };
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 { DemoBusinessQuoting } from "./Demo/DemoBusinessQuoting.js";
4
+ import { DemoBusinessRecomendPlace } from "./Demo/DemoBusinessRecomendPlace.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(DemoBusinessQuoting, null, null)]
51
+ default: () => [createVNode(DemoBusinessRecomendPlace, null, null)]
52
52
  });
53
53
  }
54
54
  });
@@ -12,44 +12,41 @@ const DemoBusinessRecomendPlace = defineSetup("DemoBusinessRecomendPlace", funct
12
12
  await new Promise((r) => setTimeout(r, 3e3));
13
13
  return {
14
14
  available: true,
15
- type: "Restricted",
16
- zone: Object.assign({
17
- name: "",
18
- path: [{
19
- lng: lng - 1e-3,
20
- lat: lat + 1e-3,
21
- type
22
- }, {
23
- lng,
24
- lat: lat - 1e-3,
25
- type
26
- }, {
27
- lng: lng + 1e-3,
28
- lat: lat + 5e-4,
29
- type
30
- }]
31
- }, {
32
- extra: "extra information 1"
33
- }),
34
- places: [{
35
- lat: lat - 1e-5,
36
- lng: lng + 1e-4,
37
- type,
38
- name: "place 1",
39
- displayName: "place 1"
40
- }, {
41
- lat: lat - 3e-4,
42
- lng: lng + 2e-4,
43
- type,
44
- name: "place 2",
45
- displayName: "place 2"
46
- }, {
47
- lat: lat - 2e-4,
48
- lng: lng - 1e-4,
49
- type,
50
- name: "place 3",
51
- displayName: "place 3"
52
- }]
15
+ type: "Recommend"
16
+ // zone: Object.assign(
17
+ // {
18
+ // name: "",
19
+ // path: [
20
+ // { lng: lng - 0.001, lat: lat + 0.001, type },
21
+ // { lng: lng, lat: lat - 0.001, type },
22
+ // { lng: lng + 0.001, lat: lat + 0.0005, type },
23
+ // ],
24
+ // } satisfies CoordinateZone,
25
+ // { extra: "extra information 1" },
26
+ // ),
27
+ // places: [
28
+ // {
29
+ // lat: lat - 0.00001,
30
+ // lng: lng + 0.0001,
31
+ // type,
32
+ // name: "place 1",
33
+ // displayName: "place 1",
34
+ // },
35
+ // {
36
+ // lat: lat - 0.0003,
37
+ // lng: lng + 0.0002,
38
+ // type,
39
+ // name: "place 2",
40
+ // displayName: "place 2",
41
+ // },
42
+ // {
43
+ // lat: lat - 0.0002,
44
+ // lng: lng - 0.0001,
45
+ // type,
46
+ // name: "place 3",
47
+ // displayName: "place 3",
48
+ // },
49
+ // ],
53
50
  };
54
51
  };
55
52
  const {
@@ -12,6 +12,7 @@ export declare const useCacheCenterPlace: (props: UseDefaultCenterPlaceProps) =>
12
12
  lat: number;
13
13
  name: string;
14
14
  displayName: string;
15
+ pointSource?: import("../../types/interface").PointSource | undefined;
15
16
  };
16
17
  geoDefaultPosition: Point;
17
18
  defaultCenterPlace: {
@@ -19,6 +20,7 @@ export declare const useCacheCenterPlace: (props: UseDefaultCenterPlaceProps) =>
19
20
  lat: number;
20
21
  name: string;
21
22
  displayName: string;
23
+ pointSource?: import("../../types/interface").PointSource | undefined;
22
24
  };
23
25
  };
24
26
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from "vue-demi";
2
- import type { Place, Point } from "../types/interface";
2
+ import { PointSource, type Place, type Point } from "../types/interface";
3
3
  import { type AbortSignalOption } from "../utils/helper";
4
4
  export interface UseMapPlaceProps {
5
5
  pointRef: Ref<Point>;
@@ -13,6 +13,7 @@ export declare const useAmapPlace: (props: UseMapPlaceProps) => {
13
13
  lat: number;
14
14
  name: string;
15
15
  displayName: string;
16
+ pointSource?: PointSource | undefined;
16
17
  };
17
18
  updatePlace: (value: Point) => void;
18
19
  setPlace: (value: Place) => void;
@@ -24,6 +25,7 @@ export declare const useGmapPlace: (props: UseMapPlaceProps) => {
24
25
  lat: number;
25
26
  name: string;
26
27
  displayName: string;
28
+ pointSource?: PointSource | undefined;
27
29
  };
28
30
  updatePlace: (value: Point) => void;
29
31
  setPlace: (value: Place) => void;
@@ -35,6 +37,7 @@ export declare const useMapPlace: (props: UseMapPlaceProps) => {
35
37
  lat: number;
36
38
  name: string;
37
39
  displayName: string;
40
+ pointSource?: PointSource | undefined;
38
41
  };
39
42
  updatePlace: (value: Point) => void;
40
43
  setPlace: (value: Place) => void;
@@ -1,6 +1,7 @@
1
1
  import { ref, reactive, watch } from "vue-demi";
2
2
  import { REGEO_TIMEOUT, HK_GOVERN_API_TIMEOUT } from "../api/contants.js";
3
3
  import { apiHongKongGovernDriving } from "../api/hongkongGovernDriving.js";
4
+ import { PointSource } from "../types/interface.js";
4
5
  import { createPipeTw } from "../utils/cn2tw.js";
5
6
  import { equalAssign, AbortSignalAny, sleep } from "../utils/helper.js";
6
7
  import { getHKGovernResult } from "../utils/hongkongGovernGeoCoder.js";
@@ -39,7 +40,7 @@ const useAmapPlace = (props) => {
39
40
  const handleFailed = () => {
40
41
  const name = emptyPlaceName;
41
42
  const displayName = emptyPlaceName;
42
- resolve({ lng, lat, name, displayName });
43
+ resolve({ lng, lat, name, displayName, pointSource: PointSource.OTHERS });
43
44
  };
44
45
  readyPromise.then(() => {
45
46
  const pipeTw = createPipeTw(language === "zh-TW");
@@ -60,9 +61,6 @@ const useAmapPlace = (props) => {
60
61
  }).then(({ result, origin }) => {
61
62
  var _a, _b;
62
63
  const hkGovernRes = getHKGovernResult((_b = (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.rawResponse) == null ? void 0 : _b.results, origin);
63
- const diff = Date.now() - startTime;
64
- console.log("==return value of hkGovernApi==", hkGovernRes);
65
- console.log("==time of hkGovernApi==", diff);
66
64
  if (!amapReturned && hkGovernRes) {
67
65
  const name = language === "en" ? hkGovernRes.ename : hkGovernRes.cname;
68
66
  hkReturned = true;
@@ -70,7 +68,8 @@ const useAmapPlace = (props) => {
70
68
  lng,
71
69
  lat,
72
70
  name,
73
- displayName: name
71
+ displayName: name,
72
+ pointSource: PointSource.HKGOV
74
73
  });
75
74
  }
76
75
  });
@@ -101,7 +100,7 @@ const useAmapPlace = (props) => {
101
100
  ...addressComponent
102
101
  });
103
102
  amapReturned = true;
104
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
103
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GAODE });
105
104
  }).catch(() => {
106
105
  handleFailed();
107
106
  });
@@ -128,7 +127,7 @@ const useAmapPlace = (props) => {
128
127
  ...addressComponent
129
128
  });
130
129
  amapReturned = true;
131
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
130
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GAODE });
132
131
  return;
133
132
  }
134
133
  case "no_data":
@@ -161,7 +160,7 @@ const useGmapPlace = (props) => {
161
160
  const { signal: inputSignal, onChange, emptyPlaceName } = props;
162
161
  const defaultPoint = [...props.pointRef.value];
163
162
  const pointRef = ref(defaultPoint);
164
- const { readyPromise, language, reportLog } = useMapSupplier();
163
+ const { readyPromise, language } = useMapSupplier();
165
164
  const { idx: placeKey, update } = useUpdate();
166
165
  const place = reactive({
167
166
  lng: pointRef.value[0],
@@ -187,24 +186,15 @@ const useGmapPlace = (props) => {
187
186
  console.error(err);
188
187
  const name = emptyPlaceName;
189
188
  const displayName = emptyPlaceName;
190
- resolve({ lng, lat, name, displayName });
189
+ resolve({ lng, lat, name, displayName, pointSource: PointSource.GOOGLE });
191
190
  };
192
191
  readyPromise.then(() => {
193
192
  const geocoder = new google.maps.Geocoder();
194
193
  const pipeTw = createPipeTw(language === "zh-TW");
195
- reportLog == null ? void 0 : reportLog({
196
- operation: "google_regeo",
197
- eventType: "ServiceLogic",
198
- message: {
199
- lng,
200
- lat,
201
- language
202
- }
203
- });
204
194
  geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
205
195
  const name = results[0].formatted_address || emptyPlaceName;
206
196
  const displayName = gmapPlaceName2DisplayName(name, results[0].address_components);
207
- resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName) });
197
+ resolve({ lng, lat, name: pipeTw(name), displayName: pipeTw(displayName), pointSource: PointSource.GOOGLE });
208
198
  }).catch(handleFailed);
209
199
  }, handleFailed);
210
200
  const timer = setTimeout(() => {
@@ -1,4 +1,4 @@
1
- import type { Place, Point, RecommendType, RecommendZonePlaces, ValueOfOnChangeRecommendPlace, Zone } from "../types/interface";
1
+ import { PointSource, type Place, type Point, type RecommendType, type RecommendZonePlaces, type ValueOfOnChangeRecommendPlace, type 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>> {
@@ -21,12 +21,14 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
21
21
  lat: number;
22
22
  name: string;
23
23
  displayName: string;
24
+ pointSource?: PointSource | undefined;
24
25
  };
25
26
  placeCandidates: import("vue-demi").Ref<{
26
27
  lng: number;
27
28
  lat: number;
28
29
  name: string;
29
30
  displayName: string;
31
+ pointSource?: PointSource | undefined;
30
32
  }[]>;
31
33
  availableRef: import("vue-demi").Ref<boolean>;
32
34
  recommendTypeRef: import("vue-demi").Ref<RecommendType>;
@@ -1,5 +1,6 @@
1
1
  import { ref, reactive } from "vue-demi";
2
2
  import { GET_RECOMMEND_PLACE_TIMEOUT } from "../api/contants.js";
3
+ import { PointSource } from "../types/interface.js";
3
4
  import { recoverablyIgnoreManualAbortReject, logNoneManualAbortError } from "../utils/ManualAbortError.js";
4
5
  import { createAbortableOneConcurrent, AbortSignalAny, equalAssign, isPlacesInclude, createAbortable } from "../utils/helper.js";
5
6
  import { isZoneEqual, place2point, isPlaceEqual, businessCandidatesToAdsorptionPlace } from "../utils/transform.js";
@@ -84,7 +85,7 @@ const useMapRecomendPlace = (props) => {
84
85
  } = await getRecomendPlaceNoFail({ ...place }, context);
85
86
  (_a = opt == null ? void 0 : opt.signal) == null ? void 0 : _a.throwIfAborted();
86
87
  if (!available || !placeCandidates || placeCandidates.length === 0) {
87
- return { place: { ...place }, zone, candidates: [], available, type };
88
+ return { place: { ...place, pointSource: PointSource.OTHERS }, zone, candidates: [], available, type };
88
89
  }
89
90
  if (!zone) {
90
91
  const resultPlace2 = adsorption ? businessCandidatesToAdsorptionPlace(placeCandidates) : place;
@@ -97,7 +98,7 @@ const useMapRecomendPlace = (props) => {
97
98
  );
98
99
  const limit = getLimit(context);
99
100
  const resultPlace = zone || shortestDistance <= limit ? shortestPlace : place;
100
- return { place: { ...resultPlace }, zone, candidates: placeCandidates, available, type };
101
+ return { place: { ...resultPlace, pointSource: PointSource.RECOMMEND }, zone, candidates: placeCandidates, available, type };
101
102
  };
102
103
  const getRecommendPlaceZoneState = async (point, prevState, opt) => {
103
104
  const [lng, lat] = point;
@@ -117,7 +118,7 @@ const useMapRecomendPlace = (props) => {
117
118
  return { place: { ...closestPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
118
119
  }
119
120
  const regeoPlace = await reGeoPlacePromiseIgnored.recover();
120
- console.log(54566544, regeoPlace);
121
+ console.log("==RegeoPlace==", regeoPlace);
121
122
  return { place: { ...regeoPlace }, zone: zone2, available: available2, candidates: candidates2, type: type2 };
122
123
  }
123
124
  if (type === "Forbidden") {
@@ -129,7 +130,7 @@ const useMapRecomendPlace = (props) => {
129
130
  candidates,
130
131
  apiMapDistance
131
132
  );
132
- return { place: { ...resultPlace }, zone, type, available, candidates };
133
+ return { place: { ...resultPlace, pointSource: PointSource.RECOMMEND }, zone, type, available, candidates };
133
134
  };
134
135
  const updateIntermediateQueryingState = (point) => {
135
136
  const type = recommendTypeRef.value;
@@ -15,6 +15,7 @@ export declare const usePointsLabelDirection: (props: UsePointsLabelDirectionPro
15
15
  lat: number;
16
16
  name: string;
17
17
  displayName: string;
18
+ pointSource?: import("../types/interface").PointSource | undefined;
18
19
  }[]>;
19
20
  isContainBasePlaceRef: import("vue-demi").Ref<boolean>;
20
21
  };
@@ -11,6 +11,7 @@ export declare const useBusinessAlarm: (props?: useBusinessAlarmProps) => {
11
11
  lat: number;
12
12
  name: string;
13
13
  displayName: string;
14
+ pointSource?: import("..").PointSource | undefined;
14
15
  };
15
16
  geoError: import("vue").Ref<GeolocationPositionError | undefined>;
16
17
  };
@@ -25,6 +25,7 @@ export declare const useBusinessRecomendPlaceMap: () => {
25
25
  lat: number;
26
26
  name: string;
27
27
  displayName: string;
28
+ pointSource?: import("../types/interface").PointSource | undefined;
28
29
  };
29
30
  geoPosition: Readonly<Ref<{
30
31
  readonly lng: number;
@@ -10,6 +10,7 @@ export declare const useBusinessReselectPlaceMap: () => {
10
10
  lat: number;
11
11
  name: string;
12
12
  displayName: string;
13
+ pointSource?: import("..").PointSource | undefined;
13
14
  };
14
15
  geoPosition: Readonly<import("vue").Ref<{
15
16
  readonly lng: number;
package/dist/v3/index.js CHANGED
@@ -33,7 +33,7 @@ import { useMapPlace } from "./hooks/useMapPlace.js";
33
33
  import { useMapRecomendPlace } from "./hooks/useMapRecomendPlace.js";
34
34
  import { useWalkingRoute } from "./hooks/useWalkingRoute.js";
35
35
  import { inChina, inHongkong, inKorean, inMacau, inTaiwan } from "./hooks/useMapInChina.js";
36
- import { CenterPlaceStatus } from "./types/interface.js";
36
+ import { CenterPlaceStatus, PointSource } from "./types/interface.js";
37
37
  import { MINI_PROGRAM_WEB_VIEW_CLOSE_EVENT, MINI_PROGRAM_WEB_VIEW_CLOSE_TIMEOUT, patchMiniprogramRedirectTo } from "./utils/patchMiniprogram.js";
38
38
  export {
39
39
  AbsoluteAddressBox,
@@ -52,6 +52,7 @@ export {
52
52
  PassengerCircle,
53
53
  PickupPoints,
54
54
  PlaceCircle,
55
+ PointSource,
55
56
  StartEndPoint,
56
57
  TaxiCar,
57
58
  WalkingLine,
@@ -20,6 +20,7 @@ export type Place = {
20
20
  lat: number;
21
21
  name: string;
22
22
  displayName: string;
23
+ pointSource?: PointSource;
23
24
  };
24
25
  export interface CoordinatePlace extends Place {
25
26
  type: CoordinateType;
@@ -99,6 +100,13 @@ export declare enum CenterPlaceStatus {
99
100
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
100
101
  OK = "OK"
101
102
  }
103
+ export declare enum PointSource {
104
+ GOOGLE = "google",
105
+ GAODE = "gd",
106
+ HKGOV = "gov",
107
+ RECOMMEND = "recommend",
108
+ OTHERS = "others"
109
+ }
102
110
  export type ConnectionStatus = "pending" | "connected" | "unconnected";
103
111
  export interface BusinessGeolocationPositionError extends GeolocationPositionError {
104
112
  isBusinessTimeout: boolean;
@@ -5,6 +5,15 @@ var CenterPlaceStatus = /* @__PURE__ */ ((CenterPlaceStatus2) => {
5
5
  CenterPlaceStatus2["OK"] = "OK";
6
6
  return CenterPlaceStatus2;
7
7
  })(CenterPlaceStatus || {});
8
+ var PointSource = /* @__PURE__ */ ((PointSource2) => {
9
+ PointSource2["GOOGLE"] = "google";
10
+ PointSource2["GAODE"] = "gd";
11
+ PointSource2["HKGOV"] = "gov";
12
+ PointSource2["RECOMMEND"] = "recommend";
13
+ PointSource2["OTHERS"] = "others";
14
+ return PointSource2;
15
+ })(PointSource || {});
8
16
  export {
9
- CenterPlaceStatus
17
+ CenterPlaceStatus,
18
+ PointSource
10
19
  };
@@ -1,6 +1,6 @@
1
1
  const availableLogKeys = /* @__PURE__ */ new Set();
2
2
  const pkgName = "@heycar/heycars-map";
3
- const pkgVersion = "2.19.0-drivingRouteFail6";
3
+ const pkgVersion = "2.20.0-pointSource";
4
4
  const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
5
5
  const enableSessionLogKey = (key) => {
6
6
  const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
@@ -1,5 +1,5 @@
1
1
  /// <reference types="google.maps" />
2
- import type { CoordinateType, LngLatLiterial, Place, Point, TrackPoint, TrafficStatus, Zone } from "../types/interface";
2
+ import { PointSource, type CoordinateType, type LngLatLiterial, type Place, type Point, type TrackPoint, type TrafficStatus, type Zone } from "../types/interface";
3
3
  import type { AlipayMyGetLocationSuccessResponse } from "../types/my";
4
4
  import type { WxGetLocationSuccessResponse } from "../types/wx";
5
5
  import { BRWOSER_PLATFORM } from "./platform";
@@ -41,7 +41,13 @@ export declare const trackPoints2amapGraspRoadPoints: (trackPoints: TrackPoint[]
41
41
  export declare const alipayMyGetLocationSuccessResponse2GeolocationPosition: (res: AlipayMyGetLocationSuccessResponse) => GeolocationPosition;
42
42
  export declare const alipayMyGetLocationError2GeolocationPositionErrorCode: (code: number) => 1 | 2 | 3;
43
43
  export declare const geoPositionError2businessTimeout: (error: GeolocationPositionError, platform: BRWOSER_PLATFORM) => boolean;
44
- export declare const businessCandidatesToAdsorptionPlace: (places: Place[]) => Place;
44
+ export declare const businessCandidatesToAdsorptionPlace: (places: Place[]) => {
45
+ pointSource: PointSource;
46
+ lng: number;
47
+ lat: number;
48
+ name: string;
49
+ displayName: string;
50
+ };
45
51
  type MaybeFunctionToFunction<T> = T extends (...args: any) => any ? T : () => T;
46
52
  export declare const maybeFunctionToFunction: <T>(value: T) => MaybeFunctionToFunction<T>;
47
53
  export declare const signal2promise: (signal?: AbortSignal) => Promise<any>;
@@ -1,5 +1,6 @@
1
1
  import { e as exported } from "../chunks/gcoord.esm-bundler.3f2f1369.js";
2
2
  import { MIN_ANIMATION_DURATION, ANIMATION_DURATION_FOR_100VW, ANIMATION_DURATION_PER_ZOOM } from "../api/contants.js";
3
+ import { PointSource } from "../types/interface.js";
3
4
  import { GoogleLatLng } from "./compatibleGoogleTypes.js";
4
5
  import { BRWOSER_PLATFORM } from "./platform.js";
5
6
  var decode = function(encodedPath, precision) {
@@ -296,7 +297,7 @@ const alipayMyGetLocationError2GeolocationPositionErrorCode = (code) => {
296
297
  const geoPositionError2businessTimeout = (error, platform) => {
297
298
  return platform !== BRWOSER_PLATFORM.WECHAT && platform !== BRWOSER_PLATFORM.WECHAT_MINIPROGRAM && error.code === GeolocationPositionError.TIMEOUT;
298
299
  };
299
- const businessCandidatesToAdsorptionPlace = (places) => places[0];
300
+ const businessCandidatesToAdsorptionPlace = (places) => ({ ...places[0], pointSource: PointSource.RECOMMEND });
300
301
  const maybeFunctionToFunction = (value) => {
301
302
  return typeof value === "function" ? value : () => value;
302
303
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "2.19.0-drivingRouteFail6",
3
+ "version": "2.20.0-pointSource",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js",