@heycar/heycars-map 2.21.0-gmapCost → 2.21.0-gmapCost2
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.
|
@@ -34,9 +34,9 @@ const useAmapPlace = (props) => {
|
|
|
34
34
|
place.name = value.name;
|
|
35
35
|
place.displayName = value.displayName;
|
|
36
36
|
};
|
|
37
|
+
const { getPlaceByRegeo: getPlaceByGmapRegeo } = useGmapPlace(props);
|
|
37
38
|
const getPlaceByRegeo = ([lng, lat], opt) => {
|
|
38
39
|
const signal = AbortSignalAny([opt == null ? void 0 : opt.signal, inputSignal]);
|
|
39
|
-
const { getPlaceByRegeo: getPlaceByGmapRegeo } = useGmapPlace(props);
|
|
40
40
|
const regeoPromise = new Promise((resolve) => {
|
|
41
41
|
const handleFailed = () => {
|
|
42
42
|
const name = emptyPlaceName;
|
|
@@ -187,9 +187,10 @@ const useGmapPlace = (props) => {
|
|
|
187
187
|
lng,
|
|
188
188
|
lat,
|
|
189
189
|
language
|
|
190
|
-
}).then((results) => {
|
|
191
|
-
|
|
192
|
-
const
|
|
190
|
+
}).then(({ results }) => {
|
|
191
|
+
var _a2, _b;
|
|
192
|
+
const name = ((_a2 = results[0]) == null ? void 0 : _a2.formatted_address) || emptyPlaceName;
|
|
193
|
+
const displayName = gmapPlaceName2DisplayName(name, (_b = results[0]) == null ? void 0 : _b.address_components);
|
|
193
194
|
if (hkReturned)
|
|
194
195
|
return;
|
|
195
196
|
mapReturned = true;
|
|
@@ -206,8 +207,9 @@ const useGmapPlace = (props) => {
|
|
|
206
207
|
} else {
|
|
207
208
|
const geocoder = new google.maps.Geocoder();
|
|
208
209
|
geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
|
|
209
|
-
|
|
210
|
-
const
|
|
210
|
+
var _a2, _b;
|
|
211
|
+
const name = ((_a2 = results[0]) == null ? void 0 : _a2.formatted_address) || emptyPlaceName;
|
|
212
|
+
const displayName = gmapPlaceName2DisplayName(name, (_b = results[0]) == null ? void 0 : _b.address_components);
|
|
211
213
|
if (hkReturned)
|
|
212
214
|
return;
|
|
213
215
|
mapReturned = true;
|
package/dist/v2/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.21.0-
|
|
3
|
+
const pkgVersion = "2.21.0-gmapCost2";
|
|
4
4
|
const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
|
|
5
5
|
const enableSessionLogKey = (key) => {
|
|
6
6
|
const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
|
|
@@ -191,6 +191,8 @@ const EMPTY_REGEX = /^$/;
|
|
|
191
191
|
const POSTAL_CODE_ZH_DESC = "邮政编码:";
|
|
192
192
|
function gmapPlaceName2DisplayName(name, addressComponents) {
|
|
193
193
|
var _a, _b;
|
|
194
|
+
if (!addressComponents)
|
|
195
|
+
return name;
|
|
194
196
|
const addressComponentMap = gmapAddressComponentList2AddressComponentMap(addressComponents);
|
|
195
197
|
const streetNumberComponent = addressComponentMap["street_number"];
|
|
196
198
|
const routeComponent = addressComponentMap["route"];
|
|
@@ -34,9 +34,9 @@ const useAmapPlace = (props) => {
|
|
|
34
34
|
place.name = value.name;
|
|
35
35
|
place.displayName = value.displayName;
|
|
36
36
|
};
|
|
37
|
+
const { getPlaceByRegeo: getPlaceByGmapRegeo } = useGmapPlace(props);
|
|
37
38
|
const getPlaceByRegeo = ([lng, lat], opt) => {
|
|
38
39
|
const signal = AbortSignalAny([opt == null ? void 0 : opt.signal, inputSignal]);
|
|
39
|
-
const { getPlaceByRegeo: getPlaceByGmapRegeo } = useGmapPlace(props);
|
|
40
40
|
const regeoPromise = new Promise((resolve) => {
|
|
41
41
|
const handleFailed = () => {
|
|
42
42
|
const name = emptyPlaceName;
|
|
@@ -187,9 +187,10 @@ const useGmapPlace = (props) => {
|
|
|
187
187
|
lng,
|
|
188
188
|
lat,
|
|
189
189
|
language
|
|
190
|
-
}).then((results) => {
|
|
191
|
-
|
|
192
|
-
const
|
|
190
|
+
}).then(({ results }) => {
|
|
191
|
+
var _a2, _b;
|
|
192
|
+
const name = ((_a2 = results[0]) == null ? void 0 : _a2.formatted_address) || emptyPlaceName;
|
|
193
|
+
const displayName = gmapPlaceName2DisplayName(name, (_b = results[0]) == null ? void 0 : _b.address_components);
|
|
193
194
|
if (hkReturned)
|
|
194
195
|
return;
|
|
195
196
|
mapReturned = true;
|
|
@@ -206,8 +207,9 @@ const useGmapPlace = (props) => {
|
|
|
206
207
|
} else {
|
|
207
208
|
const geocoder = new google.maps.Geocoder();
|
|
208
209
|
geocoder.geocode({ language, location: { lng, lat } }).finally(() => clearTimeout(timer)).then(({ results }) => {
|
|
209
|
-
|
|
210
|
-
const
|
|
210
|
+
var _a2, _b;
|
|
211
|
+
const name = ((_a2 = results[0]) == null ? void 0 : _a2.formatted_address) || emptyPlaceName;
|
|
212
|
+
const displayName = gmapPlaceName2DisplayName(name, (_b = results[0]) == null ? void 0 : _b.address_components);
|
|
211
213
|
if (hkReturned)
|
|
212
214
|
return;
|
|
213
215
|
mapReturned = true;
|
package/dist/v3/utils/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const availableLogKeys = /* @__PURE__ */ new Set();
|
|
2
2
|
const pkgName = "@heycar/heycars-map";
|
|
3
|
-
const pkgVersion = "2.21.0-
|
|
3
|
+
const pkgVersion = "2.21.0-gmapCost2";
|
|
4
4
|
const spaceLogSessionKey = "wiajlf;jwiatitruiq3jrlw";
|
|
5
5
|
const enableSessionLogKey = (key) => {
|
|
6
6
|
const sessionParam = new URLSearchParams(sessionStorage.getItem(spaceLogSessionKey) || void 0);
|
|
@@ -191,6 +191,8 @@ const EMPTY_REGEX = /^$/;
|
|
|
191
191
|
const POSTAL_CODE_ZH_DESC = "邮政编码:";
|
|
192
192
|
function gmapPlaceName2DisplayName(name, addressComponents) {
|
|
193
193
|
var _a, _b;
|
|
194
|
+
if (!addressComponents)
|
|
195
|
+
return name;
|
|
194
196
|
const addressComponentMap = gmapAddressComponentList2AddressComponentMap(addressComponents);
|
|
195
197
|
const streetNumberComponent = addressComponentMap["street_number"];
|
|
196
198
|
const routeComponent = addressComponentMap["route"];
|