@heycar/heycars-map 0.9.23-alpha1 → 0.9.23-alpha2
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.
- package/dist/index.cjs +89 -93
- package/dist/index.js +89 -93
- package/dist/src/hooks/useMapRecomendPlace.d.ts +0 -1
- package/dist/src/utils/helper.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -19,7 +19,7 @@ if (typeof GeolocationPositionError === "undefined") {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
const name = "@heycar/heycars-map";
|
|
22
|
-
const version = "0.9.23-
|
|
22
|
+
const version = "0.9.23-alpha2";
|
|
23
23
|
const type = "module";
|
|
24
24
|
const bin = {
|
|
25
25
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1406,86 +1406,6 @@ createComparator(function() {
|
|
|
1406
1406
|
});
|
|
1407
1407
|
createComparator(createCircularEqualCreator());
|
|
1408
1408
|
createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
|
1409
|
-
const isPlace = (place) => {
|
|
1410
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
1411
|
-
};
|
|
1412
|
-
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
1413
|
-
function assertNotEmptyArray(value, name2) {
|
|
1414
|
-
if (Array.isArray(value) && value.length > 0)
|
|
1415
|
-
return;
|
|
1416
|
-
throw new Error(
|
|
1417
|
-
`Assertion Error: expect ${name2} to be not empty array, actual is ${JSON.stringify(value)}`
|
|
1418
|
-
);
|
|
1419
|
-
}
|
|
1420
|
-
const isLatLngLiteral = (value) => {
|
|
1421
|
-
return value != null && typeof value === "object" && Number.isFinite(value.lat) && Number.isFinite(value.lng);
|
|
1422
|
-
};
|
|
1423
|
-
function defered() {
|
|
1424
|
-
const defer = {};
|
|
1425
|
-
const promise = new Promise((resolve, reject) => {
|
|
1426
|
-
defer.state = "pending";
|
|
1427
|
-
defer.resolve = async (value) => {
|
|
1428
|
-
try {
|
|
1429
|
-
const result = await value;
|
|
1430
|
-
defer.state = "fulfilled";
|
|
1431
|
-
return resolve(result);
|
|
1432
|
-
} catch (err) {
|
|
1433
|
-
defer.state = "rejected";
|
|
1434
|
-
reject(err);
|
|
1435
|
-
}
|
|
1436
|
-
};
|
|
1437
|
-
defer.reject = (reason) => {
|
|
1438
|
-
defer.state = "rejected";
|
|
1439
|
-
return reject(reason);
|
|
1440
|
-
};
|
|
1441
|
-
});
|
|
1442
|
-
return Object.assign(promise, defer);
|
|
1443
|
-
}
|
|
1444
|
-
const pausableSleep = (milliSeconds) => {
|
|
1445
|
-
const sleepDefered = defered();
|
|
1446
|
-
let id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1447
|
-
let isPaused = false;
|
|
1448
|
-
const pause = () => {
|
|
1449
|
-
if (isPaused || sleepDefered.state === "fulfilled")
|
|
1450
|
-
return;
|
|
1451
|
-
console.log("pause");
|
|
1452
|
-
isPaused = true;
|
|
1453
|
-
clearTimeout(id);
|
|
1454
|
-
};
|
|
1455
|
-
const restart = () => {
|
|
1456
|
-
if (sleepDefered.state === "fulfilled")
|
|
1457
|
-
return;
|
|
1458
|
-
console.log("restart");
|
|
1459
|
-
isPaused = false;
|
|
1460
|
-
clearTimeout(id);
|
|
1461
|
-
id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1462
|
-
};
|
|
1463
|
-
return { sleepPromise: sleepDefered, pause, restart };
|
|
1464
|
-
};
|
|
1465
|
-
const createRunOnce = (fn) => {
|
|
1466
|
-
let isExcuted = false;
|
|
1467
|
-
let result;
|
|
1468
|
-
return function runOnce(...args) {
|
|
1469
|
-
if (isExcuted)
|
|
1470
|
-
return result;
|
|
1471
|
-
isExcuted = true;
|
|
1472
|
-
result = fn(...args);
|
|
1473
|
-
return result;
|
|
1474
|
-
};
|
|
1475
|
-
};
|
|
1476
|
-
const createAsyncNoFailNonNullable = (fn, defaultValue) => {
|
|
1477
|
-
return function noFailNoNullable(...args) {
|
|
1478
|
-
return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
|
|
1479
|
-
};
|
|
1480
|
-
};
|
|
1481
|
-
const pipeTimeout = (fn, defaultValue, timeout) => {
|
|
1482
|
-
return function pipedTimeoutedFunction(...args) {
|
|
1483
|
-
return new Promise((resolve, reject) => {
|
|
1484
|
-
setTimeout(() => resolve(defaultValue), timeout);
|
|
1485
|
-
fn(...args).then(resolve).catch(reject);
|
|
1486
|
-
});
|
|
1487
|
-
};
|
|
1488
|
-
};
|
|
1489
1409
|
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
1490
1410
|
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
1491
1411
|
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
@@ -1794,6 +1714,89 @@ const geoPositionError2businessTimeout = (error, platform) => {
|
|
|
1794
1714
|
return platform !== BRWOSER_PLATFORM.WECHAT && platform !== BRWOSER_PLATFORM.WECHAT_MINIPROGRAM && error.code === GeolocationPositionError.TIMEOUT;
|
|
1795
1715
|
};
|
|
1796
1716
|
const businessCandidatesToAdsorptionPlace = (places) => places[0];
|
|
1717
|
+
const isPlace = (place) => {
|
|
1718
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
1719
|
+
};
|
|
1720
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
1721
|
+
function assertNotEmptyArray(value, name2) {
|
|
1722
|
+
if (Array.isArray(value) && value.length > 0)
|
|
1723
|
+
return;
|
|
1724
|
+
throw new Error(
|
|
1725
|
+
`Assertion Error: expect ${name2} to be not empty array, actual is ${JSON.stringify(value)}`
|
|
1726
|
+
);
|
|
1727
|
+
}
|
|
1728
|
+
const isLatLngLiteral = (value) => {
|
|
1729
|
+
return value != null && typeof value === "object" && Number.isFinite(value.lat) && Number.isFinite(value.lng);
|
|
1730
|
+
};
|
|
1731
|
+
const isPlacesInclude = (places, place) => {
|
|
1732
|
+
return places.some((p) => isPlaceEqual(p, place));
|
|
1733
|
+
};
|
|
1734
|
+
function defered() {
|
|
1735
|
+
const defer = {};
|
|
1736
|
+
const promise = new Promise((resolve, reject) => {
|
|
1737
|
+
defer.state = "pending";
|
|
1738
|
+
defer.resolve = async (value) => {
|
|
1739
|
+
try {
|
|
1740
|
+
const result = await value;
|
|
1741
|
+
defer.state = "fulfilled";
|
|
1742
|
+
return resolve(result);
|
|
1743
|
+
} catch (err) {
|
|
1744
|
+
defer.state = "rejected";
|
|
1745
|
+
reject(err);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
defer.reject = (reason) => {
|
|
1749
|
+
defer.state = "rejected";
|
|
1750
|
+
return reject(reason);
|
|
1751
|
+
};
|
|
1752
|
+
});
|
|
1753
|
+
return Object.assign(promise, defer);
|
|
1754
|
+
}
|
|
1755
|
+
const pausableSleep = (milliSeconds) => {
|
|
1756
|
+
const sleepDefered = defered();
|
|
1757
|
+
let id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1758
|
+
let isPaused = false;
|
|
1759
|
+
const pause = () => {
|
|
1760
|
+
if (isPaused || sleepDefered.state === "fulfilled")
|
|
1761
|
+
return;
|
|
1762
|
+
console.log("pause");
|
|
1763
|
+
isPaused = true;
|
|
1764
|
+
clearTimeout(id);
|
|
1765
|
+
};
|
|
1766
|
+
const restart = () => {
|
|
1767
|
+
if (sleepDefered.state === "fulfilled")
|
|
1768
|
+
return;
|
|
1769
|
+
console.log("restart");
|
|
1770
|
+
isPaused = false;
|
|
1771
|
+
clearTimeout(id);
|
|
1772
|
+
id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1773
|
+
};
|
|
1774
|
+
return { sleepPromise: sleepDefered, pause, restart };
|
|
1775
|
+
};
|
|
1776
|
+
const createRunOnce = (fn) => {
|
|
1777
|
+
let isExcuted = false;
|
|
1778
|
+
let result;
|
|
1779
|
+
return function runOnce(...args) {
|
|
1780
|
+
if (isExcuted)
|
|
1781
|
+
return result;
|
|
1782
|
+
isExcuted = true;
|
|
1783
|
+
result = fn(...args);
|
|
1784
|
+
return result;
|
|
1785
|
+
};
|
|
1786
|
+
};
|
|
1787
|
+
const createAsyncNoFailNonNullable = (fn, defaultValue) => {
|
|
1788
|
+
return function noFailNoNullable(...args) {
|
|
1789
|
+
return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
|
|
1790
|
+
};
|
|
1791
|
+
};
|
|
1792
|
+
const pipeTimeout = (fn, defaultValue, timeout) => {
|
|
1793
|
+
return function pipedTimeoutedFunction(...args) {
|
|
1794
|
+
return new Promise((resolve, reject) => {
|
|
1795
|
+
setTimeout(() => resolve(defaultValue), timeout);
|
|
1796
|
+
fn(...args).then(resolve).catch(reject);
|
|
1797
|
+
});
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1797
1800
|
const deepCompareEqualsForMaps = createComparator((deepEqual) => (a2, b) => {
|
|
1798
1801
|
if (isLatLngLiteral(a2) && isLatLngLiteral(b)) {
|
|
1799
1802
|
const result = isPlaceEqual(a2, b);
|
|
@@ -7262,12 +7265,6 @@ const useMapRecomendPlace = (props) => {
|
|
|
7262
7265
|
name: "",
|
|
7263
7266
|
displayName: ""
|
|
7264
7267
|
});
|
|
7265
|
-
const isElectedRef = Vue.computed(() => {
|
|
7266
|
-
const recomendPoint = place2point(recomendPlace);
|
|
7267
|
-
return placeCandidatesRef.value.some(
|
|
7268
|
-
(candidate) => isPointEqual(place2point(candidate), recomendPoint)
|
|
7269
|
-
);
|
|
7270
|
-
});
|
|
7271
7268
|
const isQueryingRef = Vue.ref(false);
|
|
7272
7269
|
const getRecomendPlaceNoFail = pipeTimeout(
|
|
7273
7270
|
createAsyncNoFailNonNullable(getRecomendPlace, {}),
|
|
@@ -7453,7 +7450,7 @@ const useMapRecomendPlace = (props) => {
|
|
|
7453
7450
|
}) => {
|
|
7454
7451
|
const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
|
|
7455
7452
|
availableRef.value = true;
|
|
7456
|
-
forceRef.value =
|
|
7453
|
+
forceRef.value = !!zone;
|
|
7457
7454
|
zoneRef.value = zone ? zone : void 0;
|
|
7458
7455
|
placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
|
|
7459
7456
|
};
|
|
@@ -7463,7 +7460,6 @@ const useMapRecomendPlace = (props) => {
|
|
|
7463
7460
|
placeCandidates: placeCandidatesRef,
|
|
7464
7461
|
availableRef,
|
|
7465
7462
|
forceRef,
|
|
7466
|
-
isElectedRef,
|
|
7467
7463
|
isQueryingRef,
|
|
7468
7464
|
updateRecommendPlace,
|
|
7469
7465
|
updateRecommendPlaceOnlyInZone,
|
|
@@ -8514,7 +8510,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
8514
8510
|
placeCandidates,
|
|
8515
8511
|
zoneRef,
|
|
8516
8512
|
availableRef,
|
|
8517
|
-
isElectedRef,
|
|
8518
8513
|
isQueryingRef
|
|
8519
8514
|
} = useMapRecomendPlace({
|
|
8520
8515
|
defaultPoint: place2point(centerPlace),
|
|
@@ -8583,8 +8578,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
8583
8578
|
disableLocator,
|
|
8584
8579
|
disableLocatorPhoto
|
|
8585
8580
|
} = props;
|
|
8581
|
+
const isElected = isPlacesInclude(placeCandidates.value, centerPlace);
|
|
8586
8582
|
const title = geoLoading.value ? geoLoadingTitle2 : !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
8587
|
-
const description = !availableRef.value ? void 0 :
|
|
8583
|
+
const description = !availableRef.value ? void 0 : isElected ? recomendDescription : void 0;
|
|
8588
8584
|
return Vue.h(HeycarMap, {
|
|
8589
8585
|
"attrs": {
|
|
8590
8586
|
"center": place2point(centerPlace),
|
|
@@ -8769,7 +8765,6 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8769
8765
|
placeCandidates,
|
|
8770
8766
|
zoneRef,
|
|
8771
8767
|
availableRef,
|
|
8772
|
-
isElectedRef,
|
|
8773
8768
|
isQueryingRef
|
|
8774
8769
|
} = useMapRecomendPlace({
|
|
8775
8770
|
defaultPoint: place2point(centerPlace),
|
|
@@ -8835,8 +8830,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8835
8830
|
unavailableTitle,
|
|
8836
8831
|
disableLocatorPhoto
|
|
8837
8832
|
} = props;
|
|
8833
|
+
const isElected = isPlacesInclude(placeCandidates.value, centerPlace);
|
|
8838
8834
|
const title = !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
8839
|
-
const description = !availableRef.value ? void 0 :
|
|
8835
|
+
const description = !availableRef.value ? void 0 : isElected ? recomendDescription : void 0;
|
|
8840
8836
|
return Vue.h(HeycarMap, {
|
|
8841
8837
|
"attrs": {
|
|
8842
8838
|
"center": place2point(centerPlace),
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ if (typeof GeolocationPositionError === "undefined") {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
const name = "@heycar/heycars-map";
|
|
20
|
-
const version = "0.9.23-
|
|
20
|
+
const version = "0.9.23-alpha2";
|
|
21
21
|
const type = "module";
|
|
22
22
|
const bin = {
|
|
23
23
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1404,86 +1404,6 @@ createComparator(function() {
|
|
|
1404
1404
|
});
|
|
1405
1405
|
createComparator(createCircularEqualCreator());
|
|
1406
1406
|
createComparator(createCircularEqualCreator(sameValueZeroEqual));
|
|
1407
|
-
const isPlace = (place) => {
|
|
1408
|
-
return place.lng !== void 0 && place.lat !== void 0;
|
|
1409
|
-
};
|
|
1410
|
-
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
1411
|
-
function assertNotEmptyArray(value, name2) {
|
|
1412
|
-
if (Array.isArray(value) && value.length > 0)
|
|
1413
|
-
return;
|
|
1414
|
-
throw new Error(
|
|
1415
|
-
`Assertion Error: expect ${name2} to be not empty array, actual is ${JSON.stringify(value)}`
|
|
1416
|
-
);
|
|
1417
|
-
}
|
|
1418
|
-
const isLatLngLiteral = (value) => {
|
|
1419
|
-
return value != null && typeof value === "object" && Number.isFinite(value.lat) && Number.isFinite(value.lng);
|
|
1420
|
-
};
|
|
1421
|
-
function defered() {
|
|
1422
|
-
const defer = {};
|
|
1423
|
-
const promise = new Promise((resolve, reject) => {
|
|
1424
|
-
defer.state = "pending";
|
|
1425
|
-
defer.resolve = async (value) => {
|
|
1426
|
-
try {
|
|
1427
|
-
const result = await value;
|
|
1428
|
-
defer.state = "fulfilled";
|
|
1429
|
-
return resolve(result);
|
|
1430
|
-
} catch (err) {
|
|
1431
|
-
defer.state = "rejected";
|
|
1432
|
-
reject(err);
|
|
1433
|
-
}
|
|
1434
|
-
};
|
|
1435
|
-
defer.reject = (reason) => {
|
|
1436
|
-
defer.state = "rejected";
|
|
1437
|
-
return reject(reason);
|
|
1438
|
-
};
|
|
1439
|
-
});
|
|
1440
|
-
return Object.assign(promise, defer);
|
|
1441
|
-
}
|
|
1442
|
-
const pausableSleep = (milliSeconds) => {
|
|
1443
|
-
const sleepDefered = defered();
|
|
1444
|
-
let id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1445
|
-
let isPaused = false;
|
|
1446
|
-
const pause = () => {
|
|
1447
|
-
if (isPaused || sleepDefered.state === "fulfilled")
|
|
1448
|
-
return;
|
|
1449
|
-
console.log("pause");
|
|
1450
|
-
isPaused = true;
|
|
1451
|
-
clearTimeout(id);
|
|
1452
|
-
};
|
|
1453
|
-
const restart = () => {
|
|
1454
|
-
if (sleepDefered.state === "fulfilled")
|
|
1455
|
-
return;
|
|
1456
|
-
console.log("restart");
|
|
1457
|
-
isPaused = false;
|
|
1458
|
-
clearTimeout(id);
|
|
1459
|
-
id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1460
|
-
};
|
|
1461
|
-
return { sleepPromise: sleepDefered, pause, restart };
|
|
1462
|
-
};
|
|
1463
|
-
const createRunOnce = (fn) => {
|
|
1464
|
-
let isExcuted = false;
|
|
1465
|
-
let result;
|
|
1466
|
-
return function runOnce(...args) {
|
|
1467
|
-
if (isExcuted)
|
|
1468
|
-
return result;
|
|
1469
|
-
isExcuted = true;
|
|
1470
|
-
result = fn(...args);
|
|
1471
|
-
return result;
|
|
1472
|
-
};
|
|
1473
|
-
};
|
|
1474
|
-
const createAsyncNoFailNonNullable = (fn, defaultValue) => {
|
|
1475
|
-
return function noFailNoNullable(...args) {
|
|
1476
|
-
return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
|
|
1477
|
-
};
|
|
1478
|
-
};
|
|
1479
|
-
const pipeTimeout = (fn, defaultValue, timeout) => {
|
|
1480
|
-
return function pipedTimeoutedFunction(...args) {
|
|
1481
|
-
return new Promise((resolve, reject) => {
|
|
1482
|
-
setTimeout(() => resolve(defaultValue), timeout);
|
|
1483
|
-
fn(...args).then(resolve).catch(reject);
|
|
1484
|
-
});
|
|
1485
|
-
};
|
|
1486
|
-
};
|
|
1487
1407
|
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
1488
1408
|
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
1489
1409
|
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
@@ -1792,6 +1712,89 @@ const geoPositionError2businessTimeout = (error, platform) => {
|
|
|
1792
1712
|
return platform !== BRWOSER_PLATFORM.WECHAT && platform !== BRWOSER_PLATFORM.WECHAT_MINIPROGRAM && error.code === GeolocationPositionError.TIMEOUT;
|
|
1793
1713
|
};
|
|
1794
1714
|
const businessCandidatesToAdsorptionPlace = (places) => places[0];
|
|
1715
|
+
const isPlace = (place) => {
|
|
1716
|
+
return place.lng !== void 0 && place.lat !== void 0;
|
|
1717
|
+
};
|
|
1718
|
+
const sleep = (milliSeconds) => new Promise((resolve) => setTimeout(resolve, milliSeconds));
|
|
1719
|
+
function assertNotEmptyArray(value, name2) {
|
|
1720
|
+
if (Array.isArray(value) && value.length > 0)
|
|
1721
|
+
return;
|
|
1722
|
+
throw new Error(
|
|
1723
|
+
`Assertion Error: expect ${name2} to be not empty array, actual is ${JSON.stringify(value)}`
|
|
1724
|
+
);
|
|
1725
|
+
}
|
|
1726
|
+
const isLatLngLiteral = (value) => {
|
|
1727
|
+
return value != null && typeof value === "object" && Number.isFinite(value.lat) && Number.isFinite(value.lng);
|
|
1728
|
+
};
|
|
1729
|
+
const isPlacesInclude = (places, place) => {
|
|
1730
|
+
return places.some((p) => isPlaceEqual(p, place));
|
|
1731
|
+
};
|
|
1732
|
+
function defered() {
|
|
1733
|
+
const defer = {};
|
|
1734
|
+
const promise = new Promise((resolve, reject) => {
|
|
1735
|
+
defer.state = "pending";
|
|
1736
|
+
defer.resolve = async (value) => {
|
|
1737
|
+
try {
|
|
1738
|
+
const result = await value;
|
|
1739
|
+
defer.state = "fulfilled";
|
|
1740
|
+
return resolve(result);
|
|
1741
|
+
} catch (err) {
|
|
1742
|
+
defer.state = "rejected";
|
|
1743
|
+
reject(err);
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
defer.reject = (reason) => {
|
|
1747
|
+
defer.state = "rejected";
|
|
1748
|
+
return reject(reason);
|
|
1749
|
+
};
|
|
1750
|
+
});
|
|
1751
|
+
return Object.assign(promise, defer);
|
|
1752
|
+
}
|
|
1753
|
+
const pausableSleep = (milliSeconds) => {
|
|
1754
|
+
const sleepDefered = defered();
|
|
1755
|
+
let id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1756
|
+
let isPaused = false;
|
|
1757
|
+
const pause = () => {
|
|
1758
|
+
if (isPaused || sleepDefered.state === "fulfilled")
|
|
1759
|
+
return;
|
|
1760
|
+
console.log("pause");
|
|
1761
|
+
isPaused = true;
|
|
1762
|
+
clearTimeout(id);
|
|
1763
|
+
};
|
|
1764
|
+
const restart = () => {
|
|
1765
|
+
if (sleepDefered.state === "fulfilled")
|
|
1766
|
+
return;
|
|
1767
|
+
console.log("restart");
|
|
1768
|
+
isPaused = false;
|
|
1769
|
+
clearTimeout(id);
|
|
1770
|
+
id = setTimeout(sleepDefered.resolve, milliSeconds);
|
|
1771
|
+
};
|
|
1772
|
+
return { sleepPromise: sleepDefered, pause, restart };
|
|
1773
|
+
};
|
|
1774
|
+
const createRunOnce = (fn) => {
|
|
1775
|
+
let isExcuted = false;
|
|
1776
|
+
let result;
|
|
1777
|
+
return function runOnce(...args) {
|
|
1778
|
+
if (isExcuted)
|
|
1779
|
+
return result;
|
|
1780
|
+
isExcuted = true;
|
|
1781
|
+
result = fn(...args);
|
|
1782
|
+
return result;
|
|
1783
|
+
};
|
|
1784
|
+
};
|
|
1785
|
+
const createAsyncNoFailNonNullable = (fn, defaultValue) => {
|
|
1786
|
+
return function noFailNoNullable(...args) {
|
|
1787
|
+
return fn(...args).then((result) => result != null ? result : defaultValue).catch(() => defaultValue);
|
|
1788
|
+
};
|
|
1789
|
+
};
|
|
1790
|
+
const pipeTimeout = (fn, defaultValue, timeout) => {
|
|
1791
|
+
return function pipedTimeoutedFunction(...args) {
|
|
1792
|
+
return new Promise((resolve, reject) => {
|
|
1793
|
+
setTimeout(() => resolve(defaultValue), timeout);
|
|
1794
|
+
fn(...args).then(resolve).catch(reject);
|
|
1795
|
+
});
|
|
1796
|
+
};
|
|
1797
|
+
};
|
|
1795
1798
|
const deepCompareEqualsForMaps = createComparator((deepEqual) => (a2, b) => {
|
|
1796
1799
|
if (isLatLngLiteral(a2) && isLatLngLiteral(b)) {
|
|
1797
1800
|
const result = isPlaceEqual(a2, b);
|
|
@@ -7260,12 +7263,6 @@ const useMapRecomendPlace = (props) => {
|
|
|
7260
7263
|
name: "",
|
|
7261
7264
|
displayName: ""
|
|
7262
7265
|
});
|
|
7263
|
-
const isElectedRef = computed(() => {
|
|
7264
|
-
const recomendPoint = place2point(recomendPlace);
|
|
7265
|
-
return placeCandidatesRef.value.some(
|
|
7266
|
-
(candidate) => isPointEqual(place2point(candidate), recomendPoint)
|
|
7267
|
-
);
|
|
7268
|
-
});
|
|
7269
7266
|
const isQueryingRef = ref(false);
|
|
7270
7267
|
const getRecomendPlaceNoFail = pipeTimeout(
|
|
7271
7268
|
createAsyncNoFailNonNullable(getRecomendPlace, {}),
|
|
@@ -7451,7 +7448,7 @@ const useMapRecomendPlace = (props) => {
|
|
|
7451
7448
|
}) => {
|
|
7452
7449
|
const placeCandidates = inputPlaceCandidates == null ? void 0 : inputPlaceCandidates.map(toPlaceType);
|
|
7453
7450
|
availableRef.value = true;
|
|
7454
|
-
forceRef.value =
|
|
7451
|
+
forceRef.value = !!zone;
|
|
7455
7452
|
zoneRef.value = zone ? zone : void 0;
|
|
7456
7453
|
placeCandidatesRef.value = placeCandidates != null ? placeCandidates : [];
|
|
7457
7454
|
};
|
|
@@ -7461,7 +7458,6 @@ const useMapRecomendPlace = (props) => {
|
|
|
7461
7458
|
placeCandidates: placeCandidatesRef,
|
|
7462
7459
|
availableRef,
|
|
7463
7460
|
forceRef,
|
|
7464
|
-
isElectedRef,
|
|
7465
7461
|
isQueryingRef,
|
|
7466
7462
|
updateRecommendPlace,
|
|
7467
7463
|
updateRecommendPlaceOnlyInZone,
|
|
@@ -8512,7 +8508,6 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
8512
8508
|
placeCandidates,
|
|
8513
8509
|
zoneRef,
|
|
8514
8510
|
availableRef,
|
|
8515
|
-
isElectedRef,
|
|
8516
8511
|
isQueryingRef
|
|
8517
8512
|
} = useMapRecomendPlace({
|
|
8518
8513
|
defaultPoint: place2point(centerPlace),
|
|
@@ -8581,8 +8576,9 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
|
|
|
8581
8576
|
disableLocator,
|
|
8582
8577
|
disableLocatorPhoto
|
|
8583
8578
|
} = props;
|
|
8579
|
+
const isElected = isPlacesInclude(placeCandidates.value, centerPlace);
|
|
8584
8580
|
const title = geoLoading.value ? geoLoadingTitle2 : !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
8585
|
-
const description = !availableRef.value ? void 0 :
|
|
8581
|
+
const description = !availableRef.value ? void 0 : isElected ? recomendDescription : void 0;
|
|
8586
8582
|
return h(HeycarMap, {
|
|
8587
8583
|
"attrs": {
|
|
8588
8584
|
"center": place2point(centerPlace),
|
|
@@ -8767,7 +8763,6 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8767
8763
|
placeCandidates,
|
|
8768
8764
|
zoneRef,
|
|
8769
8765
|
availableRef,
|
|
8770
|
-
isElectedRef,
|
|
8771
8766
|
isQueryingRef
|
|
8772
8767
|
} = useMapRecomendPlace({
|
|
8773
8768
|
defaultPoint: place2point(centerPlace),
|
|
@@ -8833,8 +8828,9 @@ const BusinessReselectPlaceMap = defineLagecySetup(function BusinessReselectPlac
|
|
|
8833
8828
|
unavailableTitle,
|
|
8834
8829
|
disableLocatorPhoto
|
|
8835
8830
|
} = props;
|
|
8831
|
+
const isElected = isPlacesInclude(placeCandidates.value, centerPlace);
|
|
8836
8832
|
const title = !availableRef.value ? unavailableTitle : centerPlace.displayName;
|
|
8837
|
-
const description = !availableRef.value ? void 0 :
|
|
8833
|
+
const description = !availableRef.value ? void 0 : isElected ? recomendDescription : void 0;
|
|
8838
8834
|
return h(HeycarMap, {
|
|
8839
8835
|
"attrs": {
|
|
8840
8836
|
"center": place2point(centerPlace),
|
|
@@ -35,7 +35,6 @@ export declare const useMapRecomendPlace: <C>(props: UseMapRecomendPlaceProps<C>
|
|
|
35
35
|
}[]>;
|
|
36
36
|
availableRef: import("vue-demi").Ref<boolean>;
|
|
37
37
|
forceRef: import("vue-demi").Ref<boolean>;
|
|
38
|
-
isElectedRef: import("vue-demi").ComputedRef<boolean>;
|
|
39
38
|
isQueryingRef: import("vue-demi").Ref<boolean>;
|
|
40
39
|
updateRecommendPlace: (place: Place) => Promise<void>;
|
|
41
40
|
updateRecommendPlaceOnlyInZone: (place: Place) => Promise<void>;
|
|
@@ -6,6 +6,7 @@ export declare function assertAngle(angle: unknown): asserts angle is number | u
|
|
|
6
6
|
export declare function assertZone(zone: any): asserts zone is Zone;
|
|
7
7
|
export declare function assertNotEmptyArray(value: unknown, name: string): void;
|
|
8
8
|
export declare const isLatLngLiteral: (value: any) => boolean;
|
|
9
|
+
export declare const isPlacesInclude: (places: Place[], place: Place) => boolean;
|
|
9
10
|
interface Defered<T> extends Promise<T> {
|
|
10
11
|
state: "pending" | "fulfilled" | "rejected";
|
|
11
12
|
resolve: (value: T | PromiseLike<T>) => void;
|