@heycar/heycars-map 1.0.0-coordinate7 → 2.0.0-switchMap10

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 (192) hide show
  1. package/README.md +45 -52
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/v2/App.js +8 -4
  5. package/dist/v2/Demo/DemoBusinessQuoting.js +6 -12
  6. package/dist/v2/Demo/DemoBusinessRecomendPlace.js +3 -8
  7. package/dist/v2/Demo/DemoBusinessReselectPlace.js +2 -7
  8. package/dist/v2/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
  9. package/dist/v2/Demo/DemoBusinessTaxiEnd.js +2 -18
  10. package/dist/v2/Demo/DemoBusinessTaxiService.d.ts +1 -2392
  11. package/dist/v2/Demo/DemoBusinessTaxiService.js +6 -19
  12. package/dist/v2/api/cdn.d.ts +1 -0
  13. package/dist/v2/api/cdn.js +2 -0
  14. package/dist/v2/api/googleSnapRoad.js +7 -2
  15. package/dist/v2/api/pingConnection.d.ts +9 -0
  16. package/dist/v2/api/pingConnection.js +111 -0
  17. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +5 -5
  18. package/dist/v2/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
  19. package/dist/v2/business-components/BusinessQuotingMap/index.js +3 -2
  20. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +2 -3
  21. package/dist/v2/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
  22. package/dist/v2/business-components/BusinessRecomendPlaceMap/index.js +4 -3
  23. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +3 -2
  24. package/dist/v2/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
  25. package/dist/v2/business-components/BusinessReselectPlaceMap/index.js +3 -2
  26. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +2 -3
  27. package/dist/v2/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
  28. package/dist/v2/business-components/BusinessTaxiEndMap/index.js +3 -2
  29. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +5 -5
  30. package/dist/v2/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
  31. package/dist/v2/business-components/BusinessTaxiServiceMap/index.js +3 -2
  32. package/dist/v2/chunks/{BusinessRecomendPlaceMap.87ea3b2f.js → BusinessRecomendPlaceMap.b4d45108.js} +65 -30
  33. package/dist/v2/chunks/{Loading.fc6e75d0.js → Loading.492acbc2.js} +30 -2
  34. package/dist/v2/components/AmapMarker/AmapMarker.js +2 -1
  35. package/dist/v2/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
  36. package/dist/v2/components/Loading/Loading.css.d.ts +5 -0
  37. package/dist/v2/components/Loading/Loading.d.ts +6 -0
  38. package/dist/v2/components/Loading/Loading.js +4 -2
  39. package/dist/v2/components/Loading/index.js +3 -2
  40. package/dist/v2/components/MapProvider/MapProvider.d.ts +2 -2
  41. package/dist/v2/components/MapProvider/MapProvider.js +24 -13
  42. package/dist/v2/css/Loading-49e58ced.css +46 -0
  43. package/dist/v2/demi-polyfill/demi-polyfill.d.ts +1 -0
  44. package/dist/v2/hooks/useDrivingRoute.js +4 -0
  45. package/dist/v2/hooks/useMapGCJ02.js +4 -37
  46. package/dist/v2/hooks/useMapGeometry.d.ts +1 -3
  47. package/dist/v2/hooks/useMapGeometry.js +4 -4
  48. package/dist/v2/hooks/useMapGraspRoad.js +1 -2
  49. package/dist/v2/hooks/useMapInChina.d.ts +3 -15
  50. package/dist/v2/hooks/useMapInChina.js +11 -16
  51. package/dist/v2/hooks/useMapLoader.d.ts +18 -10
  52. package/dist/v2/hooks/useMapLoader.js +159 -82
  53. package/dist/v2/hooks/useMapPlace.d.ts +1 -0
  54. package/dist/v2/hooks/useMapPlace.js +52 -44
  55. package/dist/v2/hooks/useMapRecomendPlace.d.ts +1 -0
  56. package/dist/v2/hooks/useMapRecomendPlace.js +75 -67
  57. package/dist/v2/hooks/useMapSupplier.d.ts +8 -0
  58. package/dist/v2/hooks/useMapSupplier.js +17 -0
  59. package/dist/v2/hooks/usePingConnection.d.ts +10 -0
  60. package/dist/v2/hooks/usePingConnection.js +26 -0
  61. package/dist/v2/hooks-business/useBusinessAlarm.d.ts +3 -0
  62. package/dist/v2/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
  63. package/dist/v2/hooks-business/useBusinessQuotingMap.js +10 -10
  64. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
  65. package/dist/v2/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
  66. package/dist/v2/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
  67. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
  68. package/dist/v2/hooks-business/useBusinessTaxiServiceMap.js +5 -10
  69. package/dist/v2/index.js +1 -1
  70. package/dist/v2/types/global.d.ts +3 -0
  71. package/dist/v2/types/interface.d.ts +1 -1
  72. package/dist/v2/utils/ManualAbortError.d.ts +3 -0
  73. package/dist/v2/utils/ManualAbortError.js +14 -0
  74. package/dist/v2/utils/compare.d.ts +4 -0
  75. package/dist/v2/utils/compare.js +6 -0
  76. package/dist/v2/utils/helper.d.ts +6 -0
  77. package/dist/v2/utils/helper.js +43 -0
  78. package/dist/v2/utils/log.js +1 -1
  79. package/dist/v2/utils/patchGoogleMapLoader.d.ts +2 -0
  80. package/dist/v2/utils/patchGoogleMapLoader.js +64 -0
  81. package/dist/v3/App.js +8 -4
  82. package/dist/v3/Demo/DemoBusinessQuoting.js +7 -13
  83. package/dist/v3/Demo/DemoBusinessRecomendPlace.js +3 -8
  84. package/dist/v3/Demo/DemoBusinessReselectPlace.js +2 -7
  85. package/dist/v3/Demo/DemoBusinessTaxiEnd.d.ts +1 -3
  86. package/dist/v3/Demo/DemoBusinessTaxiEnd.js +3 -17
  87. package/dist/v3/Demo/DemoBusinessTaxiService.d.ts +1 -2392
  88. package/dist/v3/Demo/DemoBusinessTaxiService.js +6 -17
  89. package/dist/v3/api/cdn.d.ts +1 -0
  90. package/dist/v3/api/cdn.js +2 -0
  91. package/dist/v3/api/googleSnapRoad.js +7 -2
  92. package/dist/v3/api/pingConnection.d.ts +9 -0
  93. package/dist/v3/api/pingConnection.js +111 -0
  94. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.d.ts +16 -7
  95. package/dist/v3/business-components/BusinessQuotingMap/BusinessQuotingMap.js +46 -12
  96. package/dist/v3/business-components/BusinessQuotingMap/index.js +3 -2
  97. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.d.ts +10 -3
  98. package/dist/v3/business-components/BusinessRecomendPlaceMap/BusinessRecomendPlaceMap.js +7 -4
  99. package/dist/v3/business-components/BusinessRecomendPlaceMap/index.js +4 -3
  100. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.d.ts +10 -2
  101. package/dist/v3/business-components/BusinessReselectPlaceMap/BusinessReselectPlaceMap.js +60 -24
  102. package/dist/v3/business-components/BusinessReselectPlaceMap/index.js +3 -2
  103. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.d.ts +4 -3
  104. package/dist/v3/business-components/BusinessTaxiEndMap/BusinessTaxiEndMap.js +22 -8
  105. package/dist/v3/business-components/BusinessTaxiEndMap/index.js +3 -2
  106. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.d.ts +19 -7
  107. package/dist/v3/business-components/BusinessTaxiServiceMap/BusinessTaxiServiceMap.js +52 -21
  108. package/dist/v3/business-components/BusinessTaxiServiceMap/index.js +3 -2
  109. package/dist/v3/chunks/{BusinessRecomendPlaceMap.57b15c64.js → BusinessRecomendPlaceMap.6ba5dbb1.js} +65 -30
  110. package/dist/v3/chunks/{Loading.a8e2f26a.js → Loading.21d8e759.js} +26 -2
  111. package/dist/v3/components/AmapMarker/AmapMarker.js +2 -1
  112. package/dist/v3/components/GmapAdvancedMarkerElement/GmapAdvancedMarkerElement.js +1 -1
  113. package/dist/v3/components/Loading/Loading.css.d.ts +5 -0
  114. package/dist/v3/components/Loading/Loading.d.ts +8 -0
  115. package/dist/v3/components/Loading/Loading.js +4 -2
  116. package/dist/v3/components/Loading/index.js +3 -2
  117. package/dist/v3/components/MapProvider/MapProvider.d.ts +6 -3
  118. package/dist/v3/components/MapProvider/MapProvider.js +22 -13
  119. package/dist/v3/css/Loading-49e58ced.css +46 -0
  120. package/dist/v3/demi-polyfill/demi-polyfill.d.ts +1 -0
  121. package/dist/v3/hooks/useDrivingRoute.js +4 -0
  122. package/dist/v3/hooks/useMapGCJ02.js +4 -37
  123. package/dist/v3/hooks/useMapGeometry.d.ts +1 -3
  124. package/dist/v3/hooks/useMapGeometry.js +4 -4
  125. package/dist/v3/hooks/useMapGraspRoad.js +1 -2
  126. package/dist/v3/hooks/useMapInChina.d.ts +3 -15
  127. package/dist/v3/hooks/useMapInChina.js +11 -16
  128. package/dist/v3/hooks/useMapLoader.d.ts +18 -10
  129. package/dist/v3/hooks/useMapLoader.js +159 -82
  130. package/dist/v3/hooks/useMapPlace.d.ts +1 -0
  131. package/dist/v3/hooks/useMapPlace.js +52 -44
  132. package/dist/v3/hooks/useMapRecomendPlace.d.ts +1 -0
  133. package/dist/v3/hooks/useMapRecomendPlace.js +75 -67
  134. package/dist/v3/hooks/useMapSupplier.d.ts +8 -0
  135. package/dist/v3/hooks/useMapSupplier.js +17 -0
  136. package/dist/v3/hooks/usePingConnection.d.ts +10 -0
  137. package/dist/v3/hooks/usePingConnection.js +26 -0
  138. package/dist/v3/hooks-business/useBusinessAlarm.d.ts +3 -0
  139. package/dist/v3/hooks-business/useBusinessQuotingMap.d.ts +7 -2393
  140. package/dist/v3/hooks-business/useBusinessQuotingMap.js +10 -10
  141. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.d.ts +8 -17
  142. package/dist/v3/hooks-business/useBusinessRecomendPlaceMap.js +8 -34
  143. package/dist/v3/hooks-business/useBusinessReselectPlaceMap.d.ts +4 -13
  144. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.d.ts +5 -2393
  145. package/dist/v3/hooks-business/useBusinessTaxiServiceMap.js +5 -10
  146. package/dist/v3/index.js +1 -1
  147. package/dist/v3/types/global.d.ts +3 -0
  148. package/dist/v3/types/interface.d.ts +1 -1
  149. package/dist/v3/utils/ManualAbortError.d.ts +3 -0
  150. package/dist/v3/utils/ManualAbortError.js +14 -0
  151. package/dist/v3/utils/compare.d.ts +4 -0
  152. package/dist/v3/utils/compare.js +6 -0
  153. package/dist/v3/utils/helper.d.ts +6 -0
  154. package/dist/v3/utils/helper.js +43 -0
  155. package/dist/v3/utils/log.js +1 -1
  156. package/dist/v3/utils/patchGoogleMapLoader.d.ts +2 -0
  157. package/dist/v3/utils/patchGoogleMapLoader.js +64 -0
  158. package/package.json +2 -2
  159. package/dist/v2/Demo/Demo.d.ts +0 -3
  160. package/dist/v2/Demo/Demo.js +0 -1634
  161. package/dist/v2/api/googleConnection.d.ts +0 -5
  162. package/dist/v2/api/googleConnection.js +0 -51
  163. package/dist/v2/components/AmapLoader/AmapLoader.d.ts +0 -5
  164. package/dist/v2/components/AmapLoader/AmapLoader.js +0 -21
  165. package/dist/v2/components/AmapLoader/index.d.ts +0 -1
  166. package/dist/v2/components/AmapLoader/index.js +0 -4
  167. package/dist/v2/components/GmapLoader/GmapLoader.d.ts +0 -5
  168. package/dist/v2/components/GmapLoader/GmapLoader.js +0 -21
  169. package/dist/v2/components/GmapLoader/index.d.ts +0 -1
  170. package/dist/v2/components/GmapLoader/index.js +0 -4
  171. package/dist/v2/css/Loading-523061b9.css +0 -9
  172. package/dist/v2/hooks/useGoogleConnection.d.ts +0 -7
  173. package/dist/v2/hooks/useGoogleConnection.js +0 -15
  174. package/dist/v2/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
  175. package/dist/v2/hooks-business/useBusinessTaxiEndMap.js +0 -7
  176. package/dist/v3/Demo/Demo.d.ts +0 -9
  177. package/dist/v3/Demo/Demo.js +0 -1612
  178. package/dist/v3/api/googleConnection.d.ts +0 -5
  179. package/dist/v3/api/googleConnection.js +0 -51
  180. package/dist/v3/components/AmapLoader/AmapLoader.d.ts +0 -10
  181. package/dist/v3/components/AmapLoader/AmapLoader.js +0 -21
  182. package/dist/v3/components/AmapLoader/index.d.ts +0 -1
  183. package/dist/v3/components/AmapLoader/index.js +0 -4
  184. package/dist/v3/components/GmapLoader/GmapLoader.d.ts +0 -10
  185. package/dist/v3/components/GmapLoader/GmapLoader.js +0 -21
  186. package/dist/v3/components/GmapLoader/index.d.ts +0 -1
  187. package/dist/v3/components/GmapLoader/index.js +0 -4
  188. package/dist/v3/css/Loading-523061b9.css +0 -9
  189. package/dist/v3/hooks/useGoogleConnection.d.ts +0 -7
  190. package/dist/v3/hooks/useGoogleConnection.js +0 -15
  191. package/dist/v3/hooks-business/useBusinessTaxiEndMap.d.ts +0 -3
  192. package/dist/v3/hooks-business/useBusinessTaxiEndMap.js +0 -7
@@ -9,14 +9,10 @@ const DemoBusinessTaxiService = defineComponent({
9
9
  name: "DemoBusinessTaxiService",
10
10
  setup() {
11
11
  const {
12
- googleConnectionStatus,
13
- setMap,
14
- registerFitVeiw
12
+ mapContext
15
13
  } = useBusinessTaxiServiceMap();
16
14
  return {
17
- googleConnectionStatus,
18
- setMap,
19
- registerFitVeiw
15
+ mapContext
20
16
  };
21
17
  },
22
18
  data() {
@@ -79,13 +75,11 @@ const DemoBusinessTaxiService = defineComponent({
79
75
  },
80
76
  render() {
81
77
  const {
82
- setMap,
78
+ mapContext,
83
79
  getDriverPositionTrack,
84
- registerFitVeiw,
85
80
  from,
86
81
  to,
87
- status,
88
- googleConnectionStatus
82
+ status
89
83
  } = this;
90
84
  const isReady = isCoordinatePoint(from) && isCoordinatePoint(to);
91
85
  if (!isReady)
@@ -95,7 +89,7 @@ const DemoBusinessTaxiService = defineComponent({
95
89
  } = this;
96
90
  return h("div", {
97
91
  "class": layout
98
- }, [h("div", [googleConnectionStatus]), h(BusinessTaxiServiceMap, {
92
+ }, [h(BusinessTaxiServiceMap, {
99
93
  "class": adjustedDemo,
100
94
  "attrs": {
101
95
  "from": from,
@@ -114,14 +108,7 @@ const DemoBusinessTaxiService = defineComponent({
114
108
  }) => `距离终点*${distance / 1e3}*公里, 预计*${duration}*分钟`,
115
109
  "getDriverPositionTrack": getDriverPositionTrack,
116
110
  "interval": 5e3,
117
- "mapRef": setMap,
118
- "registerOverlay": registerFitVeiw
119
- },
120
- "on": {
121
- "changeGoogleConnection": (status2) => (
122
- // 根据目前的产品需求,连通性检测只会被检测一次。
123
- console.log("谷歌连通性发生变化时触发,连通性状态是:", status2)
124
- )
111
+ "mapContext": mapContext
125
112
  }
126
113
  }), h("div", {
127
114
  "style": {
@@ -5,3 +5,4 @@ export declare const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/he
5
5
  export declare const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
6
6
  export declare const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
7
7
  export declare const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
8
+ export declare const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
@@ -5,12 +5,14 @@ const ICON_END_POINT_EN_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/en
5
5
  const ICON_END_POINT_ZH_TW_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/end-point-zh-TW.svg";
6
6
  const ICON_TAXI_CAR_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/taxi-car.svg";
7
7
  const ICON_DOT_LOADING_URL = "https://overseas-oss.heycars.cn/heycar-map/gif/dot-loading.gif";
8
+ const ICON_LOAD_FAILED_URL = "https://overseas-oss.heycars.cn/heycar-map/svg/load-failed.svg";
8
9
  export {
9
10
  AMAP_DEFAULT_MARKER_ICON_URL,
10
11
  ICON_DOT_LOADING_URL,
11
12
  ICON_END_POINT_EN_URL,
12
13
  ICON_END_POINT_ZH_TW_URL,
13
14
  ICON_FULL_SCREEN_URL,
15
+ ICON_LOAD_FAILED_URL,
14
16
  ICON_START_POINT_EN_URL,
15
17
  ICON_TAXI_CAR_URL
16
18
  };
@@ -13,9 +13,14 @@ function assertLatitudeLongitudeLiteral(value) {
13
13
  throw Error(`MyError: expect type LatitudeLongitudeLiteral, actual is: ${JSON.stringify(value)}`);
14
14
  }
15
15
  function assertSnappedPoint(value) {
16
- if (value)
16
+ const error = Error(`MyError: expect type SnappedPoint, actual is: ${JSON.stringify(value)}`);
17
+ if (!value)
18
+ throw error;
19
+ try {
17
20
  assertLatitudeLongitudeLiteral(value.location);
18
- throw Error(`MyError: expect type SnappedPoint, actual is: ${JSON.stringify(value)}`);
21
+ } catch {
22
+ throw error;
23
+ }
19
24
  }
20
25
  function assertSnapToRoadsResponse(value) {
21
26
  const error = Error(
@@ -0,0 +1,9 @@
1
+ import type { ConnectionStatus } from "../types/interface";
2
+ export type PingConnectionOnChangeHandler = (status: ConnectionStatus) => void;
3
+ export type PingConnectionOnChangeCleanup = () => void;
4
+ export declare const apiGetPingAmapStatus: () => ConnectionStatus;
5
+ export declare const apiGetPingGmapStatus: () => ConnectionStatus;
6
+ export declare const apiPingAmap: () => Promise<ConnectionStatus>;
7
+ export declare const apiPingGmap: () => Promise<ConnectionStatus>;
8
+ export declare const apiSubscribePingAmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
9
+ export declare const apiSubscribePingGmapChange: (handler: PingConnectionOnChangeHandler) => PingConnectionOnChangeCleanup;
@@ -0,0 +1,111 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { sleep } from "../utils/helper.js";
8
+ const PING_AMAP_URL = "https://webapi.amap.com/maps";
9
+ const PING_AMAP_TIMEOUT = 5e3;
10
+ const PING_AMAP_INTERVAL = 5e3;
11
+ const PING_GMAP_URL = "https://maps.googleapis.com/maps/api/mapsjs/gen_204";
12
+ const PING_GMAP_TIMEOUT = 5e3;
13
+ const PING_GMAP_INTERVAL = 5e3;
14
+ const noop = () => {
15
+ };
16
+ const toUncachableUrl = (url, label = "") => {
17
+ const parsedUrl = new URL(url);
18
+ const randomKey = `ping${Date.now()}`;
19
+ parsedUrl.searchParams.set(randomKey, label);
20
+ return parsedUrl.toString();
21
+ };
22
+ class PingConnection {
23
+ constructor({ timeout, url, fetchOption }) {
24
+ __publicField(this, "timeout");
25
+ __publicField(this, "url");
26
+ __publicField(this, "fetchOption");
27
+ __publicField(this, "status", "pending");
28
+ __publicField(this, "listeners", /* @__PURE__ */ new Set());
29
+ __publicField(this, "updatingPromise");
30
+ this.timeout = timeout;
31
+ this.url = url;
32
+ this.fetchOption = fetchOption;
33
+ }
34
+ // 只有订阅了 onChange 事件,listen 才会更新状态
35
+ async listen(interval) {
36
+ while (true) {
37
+ if (this.listeners.size > 0)
38
+ await this.updateStatus();
39
+ await sleep(interval);
40
+ }
41
+ }
42
+ async updateStatus() {
43
+ const { url, timeout, fetchOption } = this;
44
+ if (this.updatingPromise)
45
+ return this.updatingPromise;
46
+ return this.updatingPromise = this.check(url, timeout, fetchOption).then((status) => {
47
+ this.status = status;
48
+ this.updatingPromise = void 0;
49
+ for (const handler of this.listeners) {
50
+ try {
51
+ handler(status);
52
+ } catch (err) {
53
+ console.error(err);
54
+ }
55
+ }
56
+ return status;
57
+ });
58
+ }
59
+ check(url, timeout, fetchOption) {
60
+ const controller = new AbortController();
61
+ const timer = setTimeout(() => controller.abort(), timeout);
62
+ return fetch(toUncachableUrl(url, timeout.toString()), {
63
+ signal: controller.signal,
64
+ ...fetchOption
65
+ }).then(() => "connected").catch(() => "unconnected").finally(() => clearTimeout(timer));
66
+ }
67
+ onChange(handler) {
68
+ if (typeof handler !== "function")
69
+ return noop;
70
+ this.listeners.add(handler);
71
+ const clear = () => {
72
+ this.listeners.delete(handler);
73
+ };
74
+ return clear;
75
+ }
76
+ }
77
+ const pingAmapConnection = new PingConnection({
78
+ timeout: PING_AMAP_TIMEOUT,
79
+ url: PING_AMAP_URL,
80
+ fetchOption: {
81
+ method: "HEAD"
82
+ }
83
+ });
84
+ const pingGmapConnection = new PingConnection({
85
+ timeout: PING_GMAP_TIMEOUT,
86
+ url: PING_GMAP_URL
87
+ });
88
+ pingAmapConnection.listen(PING_AMAP_INTERVAL);
89
+ pingGmapConnection.listen(PING_GMAP_INTERVAL);
90
+ const apiGetPingAmapStatus = () => {
91
+ return pingAmapConnection.status;
92
+ };
93
+ const apiGetPingGmapStatus = () => {
94
+ return pingGmapConnection.status;
95
+ };
96
+ const apiPingAmap = () => {
97
+ return pingAmapConnection.updateStatus();
98
+ };
99
+ const apiPingGmap = () => {
100
+ return pingGmapConnection.updateStatus();
101
+ };
102
+ const apiSubscribePingAmapChange = (handler) => pingAmapConnection.onChange(handler);
103
+ const apiSubscribePingGmapChange = (handler) => pingGmapConnection.onChange(handler);
104
+ export {
105
+ apiGetPingAmapStatus,
106
+ apiGetPingGmapStatus,
107
+ apiPingAmap,
108
+ apiPingGmap,
109
+ apiSubscribePingAmapChange,
110
+ apiSubscribePingGmapChange
111
+ };
@@ -1,13 +1,13 @@
1
- import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
2
1
  import { type HeycarMapProps } from "../../components/MapProvider";
3
- import type { MROP } from "../../hooks/useOverlay";
2
+ import type { BusinessQuotingContext } from "../../hooks-business/useBusinessQuotingMap";
4
3
  import type { CoordinatifyProps } from "../../types/coordinatify";
5
4
  import type { CoordinatePlace } from "../../types/interface";
6
- export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "center" | "zoom">> & Required<MROP> & {
5
+ export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "center" | "zoom" | "mapRef">> & {
7
6
  from: CoordinatePlace;
8
7
  to: CoordinatePlace;
9
8
  fromDescription: string;
10
9
  log?: boolean;
10
+ mapContext: CoordinatifyProps<BusinessQuotingContext>;
11
11
  renderDescription: (titleProps: {
12
12
  distance: number;
13
13
  duration: number;
@@ -15,6 +15,6 @@ export type BusinessQuotingMapProps = CoordinatifyProps<Omit<HeycarMapProps, "ce
15
15
  }) => string;
16
16
  onClickStartPoint?: (value: CoordinatePlace) => void;
17
17
  onClickEndPoint?: (value: CoordinatePlace) => void;
18
- onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
19
18
  };
20
- export declare const BusinessQuotingMap: import("vue").DefineComponent<import("vue3").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" | "changeGoogleConnection" | "clickStartPoint" | "clickEndPoint", BusinessQuotingMapProps>;
19
+ 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>;
20
+ 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>;
@@ -1,39 +1,54 @@
1
1
  import { h } from "vue";
2
2
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
3
- import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
3
+ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
4
+ import { useHeycarMap } from "../../hooks/useHeycarMap.js";
4
5
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
5
- import { useMapSupplier } from "../../hooks/useMapSupplier.js";
6
- import { defineLagecySetup } from "../../types/helper.js";
6
+ import { useMapFitView } from "../../hooks/useMapFitView.js";
7
+ import { useMapSupplier, useMapAssertSupplier } from "../../hooks/useMapSupplier.js";
8
+ import { defineSetup, defineLagecySetup } from "../../types/helper.js";
9
+ import { generateCreateElementV2PropsOn } from "../../utils/compare.js";
7
10
  import { place2point, pipeDefer } from "../../utils/transform.js";
8
11
  import { toCoordinatePlaceType } from "../../utils/typeChecking.js";
9
12
  import { DrivingLine } from "../DrivingLine/DrivingLine.js";
10
13
  import { DrivingRoute } from "../DrivingRoute/DrivingRoute.js";
11
14
  import { FitViewOnce, createFittableRegisterOverlay } from "../FitView/FitView.js";
12
15
  import { StartEndPoint } from "../StartEndPoint/StartEndPoint.js";
13
- const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(props, {
16
+ const BUSINESS_QUOTING_FITVIEW_PANDING = [26, 26, 19, 26];
17
+ const BusinessQuotingMapInner = defineSetup("BusinessQuotingMapInner", function(props, {
14
18
  emit,
15
19
  attrs
16
20
  }) {
17
21
  const {
18
- registerOverlay,
19
- mapRef,
22
+ mapContext,
20
23
  renderDescription
21
24
  } = props;
22
25
  const {
23
26
  language
24
27
  } = useMapSupplier();
28
+ const {
29
+ assertSupplier
30
+ } = useMapAssertSupplier();
31
+ const {
32
+ mapRef,
33
+ setMap
34
+ } = useHeycarMap();
25
35
  const {
26
36
  coordinatifyPlace,
27
37
  unCoordinatifyPlace
28
38
  } = useMapCoordinatify();
39
+ const {
40
+ registerFitVeiw: registerOverlay,
41
+ setFitView
42
+ } = useMapFitView({
43
+ mapRef,
44
+ padding: BUSINESS_QUOTING_FITVIEW_PANDING
45
+ });
46
+ mapContext.setFitView = assertSupplier(() => setFitView(false));
29
47
  const fittableRegistryOverlay = createFittableRegisterOverlay({
30
48
  registerOverlay,
31
49
  immediate: true
32
50
  });
33
51
  const deferedSetFitView = pipeDefer(() => registerOverlay.setFitView(true));
34
- useGoogleConnection({
35
- onChange: (status) => emit("changeGoogleConnection", status)
36
- });
37
52
  return () => {
38
53
  const {
39
54
  from: inputFromPlace,
@@ -48,7 +63,7 @@ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(prop
48
63
  "class": attrs.class,
49
64
  "style": attrs.style,
50
65
  "attrs": {
51
- "mapRef": mapRef,
66
+ "mapRef": setMap,
52
67
  "center": from,
53
68
  "zoom": 13
54
69
  },
@@ -106,7 +121,26 @@ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(prop
106
121
  }
107
122
  })]);
108
123
  };
109
- }).props(["fallback", "from", "loading", "mapRef", "registerOverlay", "renderDescription", "to", "fromDescription", "log"]);
124
+ });
125
+ const BusinessQuotingMap = defineLagecySetup("BusinessQuotingMap", function(props, {
126
+ attrs,
127
+ emit
128
+ }) {
129
+ const payload = useMapSupplier();
130
+ const instanceNo = Date.now();
131
+ return () => createElement(BusinessQuotingMapInner, {
132
+ ...attrs.class ? {
133
+ class: attrs.class
134
+ } : {},
135
+ ...attrs.style ? {
136
+ style: attrs.style
137
+ } : {},
138
+ attrs: props,
139
+ key: `${payload.supplier}${instanceNo}`,
140
+ on: generateCreateElementV2PropsOn(props, emit, ["clickStartPoint", "clickEndPoint"])
141
+ });
142
+ }).props(["fallback", "from", "loading", "mapContext", "renderDescription", "to", "fromDescription", "log"]);
110
143
  export {
111
- BusinessQuotingMap
144
+ BusinessQuotingMap,
145
+ BusinessQuotingMapInner
112
146
  };
@@ -1,4 +1,5 @@
1
- import { BusinessQuotingMap } from "./BusinessQuotingMap.js";
1
+ import { BusinessQuotingMap, BusinessQuotingMapInner } from "./BusinessQuotingMap.js";
2
2
  export {
3
- BusinessQuotingMap
3
+ BusinessQuotingMap,
4
+ BusinessQuotingMapInner
4
5
  };
@@ -1,4 +1,3 @@
1
- import type { GoogleConnectionOnChangeHandler } from "../../api/googleConnection";
2
1
  import { type HeycarMapProps } from "../../components/MapProvider";
3
2
  import type { BusinessRecomendPlaceContext } from "../../hooks-business/useBusinessRecomendPlaceMap";
4
3
  import { type UseGeoLocationProps } from "../../hooks/useGeoLocation";
@@ -45,6 +44,6 @@ export interface BusinessRecomendPlaceMapProps extends CoordinatifyProps<Omit<He
45
44
  onGeoErrorOnce?: (isBusinessTimeout: boolean) => void;
46
45
  onClickLocatorText?: AbsoluteAddressBoxProps["onClickText"];
47
46
  onClickLocatorPhoto?: AbsoluteAddressBoxProps["onClickPhoto"];
48
- onChangeGoogleConnection?: GoogleConnectionOnChangeHandler;
49
47
  }
50
- export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changeGoogleConnection" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;
48
+ export declare const BusinessRecomendPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;
49
+ export declare const BusinessRecomendPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessRecomendPlaceMapProps>, 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<BusinessRecomendPlaceMapProps, Required<BusinessRecomendPlaceMapProps>>, "resize" | "dragEnd" | "zoomEnd" | "changePlace" | "loadGeoLocation" | "loadDefaultGeoLocation" | "changeByDrag" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessRecomendPlaceMapProps>;
@@ -3,16 +3,18 @@ import "vue-demi";
3
3
  import "../../api/browser.js";
4
4
  import "../../api/memory.js";
5
5
  import "../../components/MapProvider/MapProvider.js";
6
+ import "../../demi-polyfill/demi-polyfill.js";
6
7
  import "../../hooks/useGeoLocation.js";
7
- import "../../hooks/useGoogleConnection.js";
8
8
  import "../../hooks/useHeycarMap.js";
9
9
  import "../../hooks/useMapCoordinatify.js";
10
10
  import "../../hooks/useMapDrag.js";
11
+ import "../../hooks/useMapGeometry.js";
11
12
  import "../../hooks/useMapRecomendPlace.js";
12
13
  import "../../hooks/useMapSupplier.js";
13
14
  import "../../hooks/useMapZoom.js";
14
15
  import "../../types/helper.js";
15
16
  import "../../types/interface.js";
17
+ import "../../utils/ManualAbortError.js";
16
18
  import "../../utils/compare.js";
17
19
  import "../../utils/helper.js";
18
20
  import "../../utils/platform.js";
@@ -24,14 +26,15 @@ import "../GreenZone/GreenZone.js";
24
26
  import "../PassengerCircle/PassengerCircle.js";
25
27
  import "../PickupPoints/PickupPoints.js";
26
28
  import "./useCacheCenterPlace.js";
27
- import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
29
+ import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
28
30
  export {
29
31
  B as BusinessRecomendPlaceMap,
32
+ f as BusinessRecomendPlaceMapInner,
30
33
  D as DEFAULT_ZOOM,
31
34
  E as EMPTY_PLACE,
32
- a as RECOMMEND_PLACE_DRAG_LIMIT,
35
+ R as RECOMMEND_PLACE_DRAG_LIMIT,
33
36
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
34
- R as RECOMMEND_PLACE_LARGE_LIMIT,
37
+ a as RECOMMEND_PLACE_LARGE_LIMIT,
35
38
  e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
36
39
  b as RECOMMEND_PLACE_ZONE_ICON_MIN,
37
40
  d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
@@ -1,11 +1,12 @@
1
- import { B, D, E, a, c, R, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
1
+ import { B, f, D, E, R, c, a, e, b, d, Z } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
2
2
  export {
3
3
  B as BusinessRecomendPlaceMap,
4
+ f as BusinessRecomendPlaceMapInner,
4
5
  D as DEFAULT_ZOOM,
5
6
  E as EMPTY_PLACE,
6
- a as RECOMMEND_PLACE_DRAG_LIMIT,
7
+ R as RECOMMEND_PLACE_DRAG_LIMIT,
7
8
  c as RECOMMEND_PLACE_ICON_ZOOM_MIN,
8
- R as RECOMMEND_PLACE_LARGE_LIMIT,
9
+ a as RECOMMEND_PLACE_LARGE_LIMIT,
9
10
  e as RECOMMEND_PLACE_TEXT_ZOOM_MIN,
10
11
  b as RECOMMEND_PLACE_ZONE_ICON_MIN,
11
12
  d as RECOMMEND_PLACE_ZONE_TEXT_MIN,
@@ -1,6 +1,7 @@
1
1
  import { type CoordinatePlace } from "../../types/interface";
2
2
  import { type BusinessRecomendPlaceMapProps } from "../BusinessRecomendPlaceMap";
3
- export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "loading" | "fallback" | "log" | "getAvailable" | "getRecomendPlace" | "unavailableTitle" | "emptyTitle" | "queryingTitle" | "recomendDescription" | "disableLocator" | "disableLocatorPhoto" | "mapContext" | "renderPlacePhoto" | "renderPlaceTag" | "onChangeGeoLocation" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocatorText" | "onClickLocatorPhoto" | "onChangeGoogleConnection"> {
3
+ export interface BusinessReselectPlaceMapProps extends Pick<BusinessRecomendPlaceMapProps, "geoErrorOnceNotificationKey" | "loading" | "fallback" | "log" | "getAvailable" | "getRecomendPlace" | "unavailableTitle" | "emptyTitle" | "queryingTitle" | "recomendDescription" | "disableLocator" | "disableLocatorPhoto" | "mapContext" | "renderPlacePhoto" | "renderPlaceTag" | "onChangeGeoLocation" | "onChangePlace" | "onChangeRecomandPlace" | "onGeoError" | "onGeoErrorOnce" | "onClickLocatorText" | "onClickLocatorPhoto"> {
4
4
  defaultPlace?: CoordinatePlace;
5
5
  }
6
- export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("vue3").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changeGoogleConnection" | "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessReselectPlaceMapProps>;
6
+ export declare const BusinessReselectPlaceMapInner: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessReselectPlaceMapProps>;
7
+ export declare const BusinessReselectPlaceMap: import("vue-demi").DefineComponent<import("@vue/runtime-core").ComponentObjectPropsOptions<BusinessReselectPlaceMapProps>, 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<BusinessReselectPlaceMapProps, Required<BusinessReselectPlaceMapProps>>, "changePlace" | "changeGeoLocation" | "changeRecomandPlace" | "geoError" | "geoErrorOnce" | "clickLocatorText" | "clickLocatorPhoto", BusinessReselectPlaceMapProps>;
@@ -1,28 +1,31 @@
1
1
  import { h } from "vue";
2
- import { reactive, watchEffect } from "vue-demi";
2
+ import { reactive, watch, watchEffect, onUnmounted } from "vue-demi";
3
3
  import { apiMemoryShouldSkipByKey } from "../../api/memory.js";
4
4
  import { HeycarMap } from "../../components/MapProvider/MapProvider.js";
5
+ import { createElement } from "../../demi-polyfill/demi-polyfill.js";
5
6
  import { useGeoLocation } from "../../hooks/useGeoLocation.js";
6
- import { useGoogleConnection } from "../../hooks/useGoogleConnection.js";
7
7
  import { useHeycarMap } from "../../hooks/useHeycarMap.js";
8
8
  import { useMapCoordinatify } from "../../hooks/useMapCoordinatify.js";
9
9
  import { useMapDrag } from "../../hooks/useMapDrag.js";
10
+ import { useMapGeometry } from "../../hooks/useMapGeometry.js";
10
11
  import { useMapRecomendPlace } from "../../hooks/useMapRecomendPlace.js";
12
+ import { useMapAssertSupplier, useMapSupplier } from "../../hooks/useMapSupplier.js";
11
13
  import { useMapZoom } from "../../hooks/useMapZoom.js";
12
- import { defineLagecySetup } from "../../types/helper.js";
14
+ import { defineSetup, defineLagecySetup } from "../../types/helper.js";
13
15
  import { CenterPlaceStatus } from "../../types/interface.js";
14
- import { watchPostEffectOnce } from "../../utils/compare.js";
16
+ import { throwNoneManualAbortError, MANUAL_ABORT_MESSAGE } from "../../utils/ManualAbortError.js";
17
+ import { watchPostEffectOnce, generateCreateElementV2PropsOn } from "../../utils/compare.js";
15
18
  import { equalAssign, isPlacesInclude } from "../../utils/helper.js";
16
19
  import { detectBrowserPlatform } from "../../utils/platform.js";
17
20
  import { place2point, isPlaceEqual, pipeOnlyLastEffect, isZoneEqual, geoPositionError2businessTimeout } from "../../utils/transform.js";
18
- import { toCoordinatePlaceType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
21
+ import { toCoordinatePlaceType, toCoordinatePointType, toCoordinateRecommendZonePlacesType } from "../../utils/typeChecking.js";
19
22
  import { AbsoluteAddressBox } from "../AbsoluteAddressBox/AbsoluteAddressBox.js";
20
- import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_LARGE_LIMIT, a as RECOMMEND_PLACE_DRAG_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.87ea3b2f.js";
23
+ import { E as EMPTY_PLACE, m as memoize, R as RECOMMEND_PLACE_DRAG_LIMIT, a as RECOMMEND_PLACE_LARGE_LIMIT, Z as ZONE_ZOOM, b as RECOMMEND_PLACE_ZONE_ICON_MIN, c as RECOMMEND_PLACE_ICON_ZOOM_MIN, d as RECOMMEND_PLACE_ZONE_TEXT_MIN, e as RECOMMEND_PLACE_TEXT_ZOOM_MIN, D as DEFAULT_ZOOM } from "../../chunks/BusinessRecomendPlaceMap.b4d45108.js";
21
24
  import { DeviceOrientation } from "../DeviceOrientation/DeviceOrientation.js";
22
25
  import { GreenZone } from "../GreenZone/GreenZone.js";
23
26
  import { PassengerCircle } from "../PassengerCircle/PassengerCircle.js";
24
27
  import { PickupPoints } from "../PickupPoints/PickupPoints.js";
25
- const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
28
+ const BusinessReselectPlaceMapInner = defineSetup("BusinessReselectPlaceMapInner", function(props, {
26
29
  emit,
27
30
  slots,
28
31
  attrs
@@ -39,8 +42,10 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
39
42
  ...EMPTY_PLACE
40
43
  }
41
44
  } = props;
45
+ const abortController = new AbortController();
42
46
  const {
43
47
  coordinatifyPoint,
48
+ unCoordinatifyPoint,
44
49
  coordinatifyPlace,
45
50
  unCoordinatifyPlace,
46
51
  unCoordinatifyRecommendZonePlaces,
@@ -48,7 +53,10 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
48
53
  coordinatifyGeoPosition
49
54
  } = useMapCoordinatify();
50
55
  const pipedGetAvailable = getAvailable && pipeOnlyLastEffect((p) => getAvailable(coordinatifyPlace(p)));
51
- const pipedGetRecomendPlace = pipeOnlyLastEffect((p) => getRecomendPlace(coordinatifyPlace(p)).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
56
+ const pipedGetRecomendPlace = pipeOnlyLastEffect((p, context) => getRecomendPlace(coordinatifyPlace(p), context).then((r) => r && unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(r))));
57
+ const {
58
+ apiMapDistance
59
+ } = useMapGeometry();
52
60
  const {
53
61
  mapRef,
54
62
  mapElementRef,
@@ -62,6 +70,9 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
62
70
  mapRef,
63
71
  defaultValue: DEFAULT_ZOOM
64
72
  });
73
+ const {
74
+ assertSupplier
75
+ } = useMapAssertSupplier();
65
76
  const defaultPlace = unCoordinatifyPlace(toCoordinatePlaceType(inputDefaultPlace));
66
77
  const centerPlace = reactive({
67
78
  lng: defaultPlace.lng,
@@ -88,6 +99,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
88
99
  place: inputPlace,
89
100
  recommends: inputRecommends
90
101
  }) => {
102
+ centerSource.source = "api";
91
103
  const place = unCoordinatifyPlace(toCoordinatePlaceType(inputPlace));
92
104
  const recommends = unCoordinatifyRecommendZonePlaces(toCoordinateRecommendZonePlacesType(inputRecommends));
93
105
  const isSameZone = recommends.zone && isZoneEqual(recommends.zone, zoneRef.value);
@@ -142,19 +154,19 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
142
154
  emitGeoErrorOnce(error);
143
155
  }
144
156
  });
145
- useGoogleConnection({
146
- onChange: (status) => emit("changeGoogleConnection", status)
157
+ mapContext.apiMapDistance = assertSupplier((from, to) => {
158
+ return apiMapDistance(unCoordinatifyPoint(toCoordinatePointType(from)), unCoordinatifyPoint(toCoordinatePointType(to)));
147
159
  });
148
- mapContext.setCenterPlaceByUserSpecified = setCenterPlaceByUserSpecified;
149
- mapContext.setCenterPlaceByUserSpecifiedInZone = setCenterPlaceByUserSpecifiedInZone;
150
- mapContext.panToGeoPositionByRecomend = () => {
160
+ mapContext.setCenterPlaceByUserSpecified = assertSupplier(setCenterPlaceByUserSpecified);
161
+ mapContext.setCenterPlaceByUserSpecifiedInZone = assertSupplier(setCenterPlaceByUserSpecifiedInZone);
162
+ mapContext.panToGeoPositionByRecomend = assertSupplier(() => {
151
163
  if (geoError.value)
152
164
  return false;
153
165
  updateCenterPlaceByPoint(geoPosition.value, {
154
166
  source: "geo"
155
167
  });
156
168
  return true;
157
- };
169
+ });
158
170
  const {
159
171
  isDragging
160
172
  } = useMapDrag({
@@ -177,6 +189,7 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
177
189
  emptyPlaceName: emptyTitle,
178
190
  queryingPlaceName: queryingTitle,
179
191
  context: centerSource,
192
+ signal: abortController.signal,
180
193
  getAvailable: pipedGetAvailable,
181
194
  getRecomendPlace: pipedGetRecomendPlace,
182
195
  getLimit: (context) => {
@@ -189,14 +202,15 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
189
202
  case "default":
190
203
  return RECOMMEND_PLACE_LARGE_LIMIT;
191
204
  default:
192
- throw new Error(`MyError: should not call getLimit on source: ${source}`);
205
+ console.error(new Error(`MyError: should not call getLimit on source: ${source}`));
206
+ return RECOMMEND_PLACE_DRAG_LIMIT;
193
207
  }
194
208
  },
195
209
  onQueryingPlace: (place) => equalAssign(centerPlace, {
196
210
  ...place
197
211
  }),
198
212
  onChangePlace: (place) => emit("changePlace", coordinatifyPlace(place)),
199
- onChange: async ({
213
+ onChange: ({
200
214
  place,
201
215
  inputPlace,
202
216
  isInZone,
@@ -218,18 +232,19 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
218
232
  }));
219
233
  }
220
234
  });
221
- watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace));
222
- watchEffect(() => {
223
- mapContext.onChangeCenterPlace(coordinatifyPlace({
224
- ...centerPlace
235
+ watchPostEffectOnce(() => updateRecommendPlaceOnlyInZone(defaultPlace).catch(throwNoneManualAbortError));
236
+ watch(centerPlace, (place) => {
237
+ equalAssign(mapContext.centerPlace, coordinatifyPlace({
238
+ ...place
225
239
  }));
226
- });
227
- watchEffect(() => {
228
- mapContext.onChangeRecomendPlaces(placeCandidates.value.map(coordinatifyPlace));
240
+ }, {
241
+ deep: true,
242
+ flush: "post"
229
243
  });
230
244
  watchEffect(() => {
231
245
  mapContext.centerPlaceStatusRef.value = isQueryingRef.value ? CenterPlaceStatus.QUERYING_INFO : !availableRef.value ? CenterPlaceStatus.SERVICE_UNAVAILABLE : CenterPlaceStatus.OK;
232
246
  });
247
+ onUnmounted(() => abortController.abort(MANUAL_ABORT_MESSAGE));
233
248
  return () => {
234
249
  var _a, _b, _c;
235
250
  const {
@@ -292,7 +307,28 @@ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", f
292
307
  }
293
308
  })]);
294
309
  };
310
+ });
311
+ const BusinessReselectPlaceMap = defineLagecySetup("BusinessReselectPlaceMap", function(props, {
312
+ slots,
313
+ attrs,
314
+ emit
315
+ }) {
316
+ const payload = useMapSupplier();
317
+ const instanceNo = Date.now();
318
+ return () => createElement(BusinessReselectPlaceMapInner, {
319
+ ...attrs.class ? {
320
+ class: attrs.class
321
+ } : {},
322
+ ...attrs.style ? {
323
+ style: attrs.style
324
+ } : {},
325
+ attrs: props,
326
+ scopedSlots: slots,
327
+ key: `${payload.supplier}${instanceNo}`,
328
+ on: generateCreateElementV2PropsOn(props, emit, ["changeGeoLocation", "changePlace", "changeRecomandPlace", "geoError", "geoErrorOnce", "clickLocatorText", "clickLocatorPhoto"])
329
+ });
295
330
  }).props(["loading", "fallback", "log", "defaultPlace", "unavailableTitle", "emptyTitle", "queryingTitle", "recomendDescription", "geoErrorOnceNotificationKey", "disableLocator", "getAvailable", "getRecomendPlace", "renderPlacePhoto", "renderPlaceTag", "mapContext"]);
296
331
  export {
297
- BusinessReselectPlaceMap
332
+ BusinessReselectPlaceMap,
333
+ BusinessReselectPlaceMapInner
298
334
  };
@@ -1,4 +1,5 @@
1
- import { BusinessReselectPlaceMap } from "./BusinessReselectPlaceMap.js";
1
+ import { BusinessReselectPlaceMap, BusinessReselectPlaceMapInner } from "./BusinessReselectPlaceMap.js";
2
2
  export {
3
- BusinessReselectPlaceMap
3
+ BusinessReselectPlaceMap,
4
+ BusinessReselectPlaceMapInner
4
5
  };