@heycar/heycars-map 0.9.20-timeout → 0.9.20-timeout1
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 +99 -148
- package/dist/index.js +99 -148
- package/dist/src/api/contants.d.ts +2 -2
- package/dist/src/index.d.ts +0 -1
- package/dist/src/utils/mockWx.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18,152 +18,8 @@ if (typeof GeolocationPositionError === "undefined") {
|
|
|
18
18
|
TIMEOUT: 3
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
22
|
-
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
23
|
-
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
24
|
-
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
25
|
-
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
26
|
-
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
27
|
-
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
28
|
-
return BRWOSER_PLATFORM2;
|
|
29
|
-
})(BRWOSER_PLATFORM || {});
|
|
30
|
-
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
31
|
-
OS_PLATFORM2["IOS"] = "IOS";
|
|
32
|
-
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
33
|
-
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
34
|
-
return OS_PLATFORM2;
|
|
35
|
-
})(OS_PLATFORM || {});
|
|
36
|
-
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
37
|
-
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
38
|
-
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
39
|
-
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
40
|
-
return WEBGL_STATUS2;
|
|
41
|
-
})(WEBGL_STATUS || {});
|
|
42
|
-
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
43
|
-
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
44
|
-
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
45
|
-
return ALIPAY_WALLET2;
|
|
46
|
-
})(ALIPAY_WALLET || {});
|
|
47
|
-
const detectAlipayWallet = () => {
|
|
48
|
-
if (!navigator)
|
|
49
|
-
return void 0;
|
|
50
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
51
|
-
if (!useragent.includes("alipay"))
|
|
52
|
-
return void 0;
|
|
53
|
-
if (useragent.includes("tngkit"))
|
|
54
|
-
return "TNGD";
|
|
55
|
-
if (useragent.includes("truemoney"))
|
|
56
|
-
return "TMN";
|
|
57
|
-
};
|
|
58
|
-
const detectBrowserPlatform = () => {
|
|
59
|
-
if (typeof navigator === "undefined")
|
|
60
|
-
return "NODE_JS";
|
|
61
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
62
|
-
if (useragent.includes("micromessenger")) {
|
|
63
|
-
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
64
|
-
}
|
|
65
|
-
if (useragent.includes("alipay")) {
|
|
66
|
-
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
67
|
-
}
|
|
68
|
-
return "H5";
|
|
69
|
-
};
|
|
70
|
-
const detectOSPlatform = () => {
|
|
71
|
-
if (typeof navigator === "undefined")
|
|
72
|
-
return "OTHER";
|
|
73
|
-
const userAgent = navigator.userAgent || navigator.vendor;
|
|
74
|
-
if (/android/i.test(userAgent)) {
|
|
75
|
-
return "ANDROID";
|
|
76
|
-
}
|
|
77
|
-
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
78
|
-
return "IOS";
|
|
79
|
-
}
|
|
80
|
-
return "OTHER";
|
|
81
|
-
};
|
|
82
|
-
function detectWebGL() {
|
|
83
|
-
if (typeof window === "undefined")
|
|
84
|
-
return "NOT_SUPPORTED";
|
|
85
|
-
if (window.WebGLRenderingContext) {
|
|
86
|
-
const canvas = document.createElement("canvas");
|
|
87
|
-
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
88
|
-
let context2 = null;
|
|
89
|
-
for (const name2 of names) {
|
|
90
|
-
try {
|
|
91
|
-
context2 = canvas.getContext(name2);
|
|
92
|
-
if (context2 && typeof context2.getParameter === "function") {
|
|
93
|
-
return "ENABLED";
|
|
94
|
-
}
|
|
95
|
-
} catch (e) {
|
|
96
|
-
console.error("MyError: detectWebGL catch e = ", e);
|
|
97
|
-
return "NOT_SUPPORTED";
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return "DISABLED";
|
|
101
|
-
}
|
|
102
|
-
return "NOT_SUPPORTED";
|
|
103
|
-
}
|
|
104
|
-
const createMockWx = (opt) => {
|
|
105
|
-
const { timeout, lng, lat, status } = opt.getLocation;
|
|
106
|
-
const mockWx = {
|
|
107
|
-
ready(callback) {
|
|
108
|
-
callback();
|
|
109
|
-
},
|
|
110
|
-
error(callback) {
|
|
111
|
-
callback({ errCode: "mock error code", errMsg: "mock error message" });
|
|
112
|
-
},
|
|
113
|
-
getLocation(props) {
|
|
114
|
-
const { success, fail } = props;
|
|
115
|
-
if (status === "success") {
|
|
116
|
-
setTimeout(() => {
|
|
117
|
-
success({
|
|
118
|
-
longitude: String(lng),
|
|
119
|
-
latitude: String(lat),
|
|
120
|
-
accuracy: "30",
|
|
121
|
-
speed: "0",
|
|
122
|
-
errCode: "",
|
|
123
|
-
errMsg: ""
|
|
124
|
-
});
|
|
125
|
-
}, timeout);
|
|
126
|
-
}
|
|
127
|
-
if (status === "fail") {
|
|
128
|
-
setTimeout(() => {
|
|
129
|
-
fail == null ? void 0 : fail({ errCode: "mock error code", errMsg: "mock error message" });
|
|
130
|
-
}, timeout);
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
config() {
|
|
134
|
-
return;
|
|
135
|
-
},
|
|
136
|
-
miniProgram: {
|
|
137
|
-
redirectTo() {
|
|
138
|
-
return;
|
|
139
|
-
},
|
|
140
|
-
getEnv() {
|
|
141
|
-
const miniprogram = detectBrowserPlatform() === BRWOSER_PLATFORM.WECHAT_MINIPROGRAM;
|
|
142
|
-
return { miniprogram };
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
return mockWx;
|
|
147
|
-
};
|
|
148
|
-
const mockWxByUrl = () => {
|
|
149
|
-
const searchParams = new URLSearchParams(location.search);
|
|
150
|
-
const enable = searchParams.has("enableMockWx");
|
|
151
|
-
if (!enable)
|
|
152
|
-
return;
|
|
153
|
-
const lng = Number(searchParams.get("lng"));
|
|
154
|
-
const lat = Number(searchParams.get("lat"));
|
|
155
|
-
const timeout = Number(searchParams.get("timeout")) * 1e3;
|
|
156
|
-
const status = searchParams.get("status");
|
|
157
|
-
if (status !== "success" && status !== "fail" || isNaN(timeout)) {
|
|
158
|
-
console.error("MyError: createMockWxByUrl: wrong parameter from url");
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const mockWx = createMockWx({ getLocation: { lng, lat, timeout, status } });
|
|
162
|
-
window.wx = mockWx;
|
|
163
|
-
};
|
|
164
|
-
mockWxByUrl();
|
|
165
21
|
const name = "@heycar/heycars-map";
|
|
166
|
-
const version = "0.9.20-
|
|
22
|
+
const version = "0.9.20-timeout1";
|
|
167
23
|
const type = "module";
|
|
168
24
|
const bin = {
|
|
169
25
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1583,10 +1439,93 @@ const ZINDEX_AUXILIARY_GRASP = 14;
|
|
|
1583
1439
|
const ZINDEX_LINE_LAYER = 12;
|
|
1584
1440
|
const ZINDEX_GREEN_ZONE = 10;
|
|
1585
1441
|
const TRACKS_MATCH_MAX_LENGTH = 3;
|
|
1586
|
-
const REGEO_TIMEOUT =
|
|
1587
|
-
const GET_RECOMMEND_PLACE_TIMEOUT =
|
|
1442
|
+
const REGEO_TIMEOUT = 5e3;
|
|
1443
|
+
const GET_RECOMMEND_PLACE_TIMEOUT = 5e3;
|
|
1588
1444
|
const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
|
|
1589
1445
|
const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
1446
|
+
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
1447
|
+
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
1448
|
+
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
1449
|
+
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
1450
|
+
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
1451
|
+
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
1452
|
+
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
1453
|
+
return BRWOSER_PLATFORM2;
|
|
1454
|
+
})(BRWOSER_PLATFORM || {});
|
|
1455
|
+
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
1456
|
+
OS_PLATFORM2["IOS"] = "IOS";
|
|
1457
|
+
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
1458
|
+
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
1459
|
+
return OS_PLATFORM2;
|
|
1460
|
+
})(OS_PLATFORM || {});
|
|
1461
|
+
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
1462
|
+
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
1463
|
+
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
1464
|
+
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
1465
|
+
return WEBGL_STATUS2;
|
|
1466
|
+
})(WEBGL_STATUS || {});
|
|
1467
|
+
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
1468
|
+
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
1469
|
+
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
1470
|
+
return ALIPAY_WALLET2;
|
|
1471
|
+
})(ALIPAY_WALLET || {});
|
|
1472
|
+
const detectAlipayWallet = () => {
|
|
1473
|
+
if (!navigator)
|
|
1474
|
+
return void 0;
|
|
1475
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
1476
|
+
if (!useragent.includes("alipay"))
|
|
1477
|
+
return void 0;
|
|
1478
|
+
if (useragent.includes("tngkit"))
|
|
1479
|
+
return "TNGD";
|
|
1480
|
+
if (useragent.includes("truemoney"))
|
|
1481
|
+
return "TMN";
|
|
1482
|
+
};
|
|
1483
|
+
const detectBrowserPlatform = () => {
|
|
1484
|
+
if (typeof navigator === "undefined")
|
|
1485
|
+
return "NODE_JS";
|
|
1486
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
1487
|
+
if (useragent.includes("micromessenger")) {
|
|
1488
|
+
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
1489
|
+
}
|
|
1490
|
+
if (useragent.includes("alipay")) {
|
|
1491
|
+
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
1492
|
+
}
|
|
1493
|
+
return "H5";
|
|
1494
|
+
};
|
|
1495
|
+
const detectOSPlatform = () => {
|
|
1496
|
+
if (typeof navigator === "undefined")
|
|
1497
|
+
return "OTHER";
|
|
1498
|
+
const userAgent = navigator.userAgent || navigator.vendor;
|
|
1499
|
+
if (/android/i.test(userAgent)) {
|
|
1500
|
+
return "ANDROID";
|
|
1501
|
+
}
|
|
1502
|
+
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
1503
|
+
return "IOS";
|
|
1504
|
+
}
|
|
1505
|
+
return "OTHER";
|
|
1506
|
+
};
|
|
1507
|
+
function detectWebGL() {
|
|
1508
|
+
if (typeof window === "undefined")
|
|
1509
|
+
return "NOT_SUPPORTED";
|
|
1510
|
+
if (window.WebGLRenderingContext) {
|
|
1511
|
+
const canvas = document.createElement("canvas");
|
|
1512
|
+
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
1513
|
+
let context2 = null;
|
|
1514
|
+
for (const name2 of names) {
|
|
1515
|
+
try {
|
|
1516
|
+
context2 = canvas.getContext(name2);
|
|
1517
|
+
if (context2 && typeof context2.getParameter === "function") {
|
|
1518
|
+
return "ENABLED";
|
|
1519
|
+
}
|
|
1520
|
+
} catch (e) {
|
|
1521
|
+
console.error("MyError: detectWebGL catch e = ", e);
|
|
1522
|
+
return "NOT_SUPPORTED";
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return "DISABLED";
|
|
1526
|
+
}
|
|
1527
|
+
return "NOT_SUPPORTED";
|
|
1528
|
+
}
|
|
1590
1529
|
const vec2lnglat = ([lng, lat]) => ({
|
|
1591
1530
|
lng: Number(lng),
|
|
1592
1531
|
lat: Number(lat)
|
|
@@ -4615,7 +4554,19 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
4615
4554
|
const isGeoWorkingRef = Vue.ref(true);
|
|
4616
4555
|
const { visibilityStateRef, unwatchVisibilityState } = watchVisibilityState();
|
|
4617
4556
|
const startWatch = async () => {
|
|
4618
|
-
|
|
4557
|
+
try {
|
|
4558
|
+
await wxReady();
|
|
4559
|
+
} catch (err) {
|
|
4560
|
+
console.error(err);
|
|
4561
|
+
onError == null ? void 0 : onError(
|
|
4562
|
+
createCustomGeolocationPositionError(
|
|
4563
|
+
err.errMsg,
|
|
4564
|
+
// 签名失败,也算无权限的一种
|
|
4565
|
+
GeolocationPositionError.PERMISSION_DENIED
|
|
4566
|
+
)
|
|
4567
|
+
);
|
|
4568
|
+
return;
|
|
4569
|
+
}
|
|
4619
4570
|
do {
|
|
4620
4571
|
if (visibilityStateRef.value === "hidden") {
|
|
4621
4572
|
await sleep(WX_GET_LOCATION_INTERVAL);
|
package/dist/index.js
CHANGED
|
@@ -16,152 +16,8 @@ if (typeof GeolocationPositionError === "undefined") {
|
|
|
16
16
|
TIMEOUT: 3
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
20
|
-
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
21
|
-
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
22
|
-
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
23
|
-
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
24
|
-
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
25
|
-
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
26
|
-
return BRWOSER_PLATFORM2;
|
|
27
|
-
})(BRWOSER_PLATFORM || {});
|
|
28
|
-
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
29
|
-
OS_PLATFORM2["IOS"] = "IOS";
|
|
30
|
-
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
31
|
-
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
32
|
-
return OS_PLATFORM2;
|
|
33
|
-
})(OS_PLATFORM || {});
|
|
34
|
-
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
35
|
-
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
36
|
-
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
37
|
-
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
38
|
-
return WEBGL_STATUS2;
|
|
39
|
-
})(WEBGL_STATUS || {});
|
|
40
|
-
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
41
|
-
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
42
|
-
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
43
|
-
return ALIPAY_WALLET2;
|
|
44
|
-
})(ALIPAY_WALLET || {});
|
|
45
|
-
const detectAlipayWallet = () => {
|
|
46
|
-
if (!navigator)
|
|
47
|
-
return void 0;
|
|
48
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
49
|
-
if (!useragent.includes("alipay"))
|
|
50
|
-
return void 0;
|
|
51
|
-
if (useragent.includes("tngkit"))
|
|
52
|
-
return "TNGD";
|
|
53
|
-
if (useragent.includes("truemoney"))
|
|
54
|
-
return "TMN";
|
|
55
|
-
};
|
|
56
|
-
const detectBrowserPlatform = () => {
|
|
57
|
-
if (typeof navigator === "undefined")
|
|
58
|
-
return "NODE_JS";
|
|
59
|
-
const useragent = navigator.userAgent.toLowerCase();
|
|
60
|
-
if (useragent.includes("micromessenger")) {
|
|
61
|
-
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
62
|
-
}
|
|
63
|
-
if (useragent.includes("alipay")) {
|
|
64
|
-
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
65
|
-
}
|
|
66
|
-
return "H5";
|
|
67
|
-
};
|
|
68
|
-
const detectOSPlatform = () => {
|
|
69
|
-
if (typeof navigator === "undefined")
|
|
70
|
-
return "OTHER";
|
|
71
|
-
const userAgent = navigator.userAgent || navigator.vendor;
|
|
72
|
-
if (/android/i.test(userAgent)) {
|
|
73
|
-
return "ANDROID";
|
|
74
|
-
}
|
|
75
|
-
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
76
|
-
return "IOS";
|
|
77
|
-
}
|
|
78
|
-
return "OTHER";
|
|
79
|
-
};
|
|
80
|
-
function detectWebGL() {
|
|
81
|
-
if (typeof window === "undefined")
|
|
82
|
-
return "NOT_SUPPORTED";
|
|
83
|
-
if (window.WebGLRenderingContext) {
|
|
84
|
-
const canvas = document.createElement("canvas");
|
|
85
|
-
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
86
|
-
let context2 = null;
|
|
87
|
-
for (const name2 of names) {
|
|
88
|
-
try {
|
|
89
|
-
context2 = canvas.getContext(name2);
|
|
90
|
-
if (context2 && typeof context2.getParameter === "function") {
|
|
91
|
-
return "ENABLED";
|
|
92
|
-
}
|
|
93
|
-
} catch (e) {
|
|
94
|
-
console.error("MyError: detectWebGL catch e = ", e);
|
|
95
|
-
return "NOT_SUPPORTED";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return "DISABLED";
|
|
99
|
-
}
|
|
100
|
-
return "NOT_SUPPORTED";
|
|
101
|
-
}
|
|
102
|
-
const createMockWx = (opt) => {
|
|
103
|
-
const { timeout, lng, lat, status } = opt.getLocation;
|
|
104
|
-
const mockWx = {
|
|
105
|
-
ready(callback) {
|
|
106
|
-
callback();
|
|
107
|
-
},
|
|
108
|
-
error(callback) {
|
|
109
|
-
callback({ errCode: "mock error code", errMsg: "mock error message" });
|
|
110
|
-
},
|
|
111
|
-
getLocation(props) {
|
|
112
|
-
const { success, fail } = props;
|
|
113
|
-
if (status === "success") {
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
success({
|
|
116
|
-
longitude: String(lng),
|
|
117
|
-
latitude: String(lat),
|
|
118
|
-
accuracy: "30",
|
|
119
|
-
speed: "0",
|
|
120
|
-
errCode: "",
|
|
121
|
-
errMsg: ""
|
|
122
|
-
});
|
|
123
|
-
}, timeout);
|
|
124
|
-
}
|
|
125
|
-
if (status === "fail") {
|
|
126
|
-
setTimeout(() => {
|
|
127
|
-
fail == null ? void 0 : fail({ errCode: "mock error code", errMsg: "mock error message" });
|
|
128
|
-
}, timeout);
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
config() {
|
|
132
|
-
return;
|
|
133
|
-
},
|
|
134
|
-
miniProgram: {
|
|
135
|
-
redirectTo() {
|
|
136
|
-
return;
|
|
137
|
-
},
|
|
138
|
-
getEnv() {
|
|
139
|
-
const miniprogram = detectBrowserPlatform() === BRWOSER_PLATFORM.WECHAT_MINIPROGRAM;
|
|
140
|
-
return { miniprogram };
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
return mockWx;
|
|
145
|
-
};
|
|
146
|
-
const mockWxByUrl = () => {
|
|
147
|
-
const searchParams = new URLSearchParams(location.search);
|
|
148
|
-
const enable = searchParams.has("enableMockWx");
|
|
149
|
-
if (!enable)
|
|
150
|
-
return;
|
|
151
|
-
const lng = Number(searchParams.get("lng"));
|
|
152
|
-
const lat = Number(searchParams.get("lat"));
|
|
153
|
-
const timeout = Number(searchParams.get("timeout")) * 1e3;
|
|
154
|
-
const status = searchParams.get("status");
|
|
155
|
-
if (status !== "success" && status !== "fail" || isNaN(timeout)) {
|
|
156
|
-
console.error("MyError: createMockWxByUrl: wrong parameter from url");
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
const mockWx = createMockWx({ getLocation: { lng, lat, timeout, status } });
|
|
160
|
-
window.wx = mockWx;
|
|
161
|
-
};
|
|
162
|
-
mockWxByUrl();
|
|
163
19
|
const name = "@heycar/heycars-map";
|
|
164
|
-
const version = "0.9.20-
|
|
20
|
+
const version = "0.9.20-timeout1";
|
|
165
21
|
const type = "module";
|
|
166
22
|
const bin = {
|
|
167
23
|
checkVersion: "./bin/checkVersion.js"
|
|
@@ -1581,10 +1437,93 @@ const ZINDEX_AUXILIARY_GRASP = 14;
|
|
|
1581
1437
|
const ZINDEX_LINE_LAYER = 12;
|
|
1582
1438
|
const ZINDEX_GREEN_ZONE = 10;
|
|
1583
1439
|
const TRACKS_MATCH_MAX_LENGTH = 3;
|
|
1584
|
-
const REGEO_TIMEOUT =
|
|
1585
|
-
const GET_RECOMMEND_PLACE_TIMEOUT =
|
|
1440
|
+
const REGEO_TIMEOUT = 5e3;
|
|
1441
|
+
const GET_RECOMMEND_PLACE_TIMEOUT = 5e3;
|
|
1586
1442
|
const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
|
|
1587
1443
|
const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
|
1444
|
+
var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
|
|
1445
|
+
BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
|
|
1446
|
+
BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
|
|
1447
|
+
BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
|
|
1448
|
+
BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
|
|
1449
|
+
BRWOSER_PLATFORM2["H5"] = "H5";
|
|
1450
|
+
BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
|
|
1451
|
+
return BRWOSER_PLATFORM2;
|
|
1452
|
+
})(BRWOSER_PLATFORM || {});
|
|
1453
|
+
var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
|
|
1454
|
+
OS_PLATFORM2["IOS"] = "IOS";
|
|
1455
|
+
OS_PLATFORM2["ANDROID"] = "ANDROID";
|
|
1456
|
+
OS_PLATFORM2["OTHER"] = "OTHER";
|
|
1457
|
+
return OS_PLATFORM2;
|
|
1458
|
+
})(OS_PLATFORM || {});
|
|
1459
|
+
var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
|
|
1460
|
+
WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
|
|
1461
|
+
WEBGL_STATUS2["DISABLED"] = "DISABLED";
|
|
1462
|
+
WEBGL_STATUS2["ENABLED"] = "ENABLED";
|
|
1463
|
+
return WEBGL_STATUS2;
|
|
1464
|
+
})(WEBGL_STATUS || {});
|
|
1465
|
+
var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
|
|
1466
|
+
ALIPAY_WALLET2["TNGD"] = "TNGD";
|
|
1467
|
+
ALIPAY_WALLET2["TMN"] = "TMN";
|
|
1468
|
+
return ALIPAY_WALLET2;
|
|
1469
|
+
})(ALIPAY_WALLET || {});
|
|
1470
|
+
const detectAlipayWallet = () => {
|
|
1471
|
+
if (!navigator)
|
|
1472
|
+
return void 0;
|
|
1473
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
1474
|
+
if (!useragent.includes("alipay"))
|
|
1475
|
+
return void 0;
|
|
1476
|
+
if (useragent.includes("tngkit"))
|
|
1477
|
+
return "TNGD";
|
|
1478
|
+
if (useragent.includes("truemoney"))
|
|
1479
|
+
return "TMN";
|
|
1480
|
+
};
|
|
1481
|
+
const detectBrowserPlatform = () => {
|
|
1482
|
+
if (typeof navigator === "undefined")
|
|
1483
|
+
return "NODE_JS";
|
|
1484
|
+
const useragent = navigator.userAgent.toLowerCase();
|
|
1485
|
+
if (useragent.includes("micromessenger")) {
|
|
1486
|
+
return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
|
|
1487
|
+
}
|
|
1488
|
+
if (useragent.includes("alipay")) {
|
|
1489
|
+
return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
|
|
1490
|
+
}
|
|
1491
|
+
return "H5";
|
|
1492
|
+
};
|
|
1493
|
+
const detectOSPlatform = () => {
|
|
1494
|
+
if (typeof navigator === "undefined")
|
|
1495
|
+
return "OTHER";
|
|
1496
|
+
const userAgent = navigator.userAgent || navigator.vendor;
|
|
1497
|
+
if (/android/i.test(userAgent)) {
|
|
1498
|
+
return "ANDROID";
|
|
1499
|
+
}
|
|
1500
|
+
if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
|
|
1501
|
+
return "IOS";
|
|
1502
|
+
}
|
|
1503
|
+
return "OTHER";
|
|
1504
|
+
};
|
|
1505
|
+
function detectWebGL() {
|
|
1506
|
+
if (typeof window === "undefined")
|
|
1507
|
+
return "NOT_SUPPORTED";
|
|
1508
|
+
if (window.WebGLRenderingContext) {
|
|
1509
|
+
const canvas = document.createElement("canvas");
|
|
1510
|
+
const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
|
|
1511
|
+
let context2 = null;
|
|
1512
|
+
for (const name2 of names) {
|
|
1513
|
+
try {
|
|
1514
|
+
context2 = canvas.getContext(name2);
|
|
1515
|
+
if (context2 && typeof context2.getParameter === "function") {
|
|
1516
|
+
return "ENABLED";
|
|
1517
|
+
}
|
|
1518
|
+
} catch (e) {
|
|
1519
|
+
console.error("MyError: detectWebGL catch e = ", e);
|
|
1520
|
+
return "NOT_SUPPORTED";
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
return "DISABLED";
|
|
1524
|
+
}
|
|
1525
|
+
return "NOT_SUPPORTED";
|
|
1526
|
+
}
|
|
1588
1527
|
const vec2lnglat = ([lng, lat]) => ({
|
|
1589
1528
|
lng: Number(lng),
|
|
1590
1529
|
lat: Number(lat)
|
|
@@ -4613,7 +4552,19 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
4613
4552
|
const isGeoWorkingRef = ref(true);
|
|
4614
4553
|
const { visibilityStateRef, unwatchVisibilityState } = watchVisibilityState();
|
|
4615
4554
|
const startWatch = async () => {
|
|
4616
|
-
|
|
4555
|
+
try {
|
|
4556
|
+
await wxReady();
|
|
4557
|
+
} catch (err) {
|
|
4558
|
+
console.error(err);
|
|
4559
|
+
onError == null ? void 0 : onError(
|
|
4560
|
+
createCustomGeolocationPositionError(
|
|
4561
|
+
err.errMsg,
|
|
4562
|
+
// 签名失败,也算无权限的一种
|
|
4563
|
+
GeolocationPositionError.PERMISSION_DENIED
|
|
4564
|
+
)
|
|
4565
|
+
);
|
|
4566
|
+
return;
|
|
4567
|
+
}
|
|
4617
4568
|
do {
|
|
4618
4569
|
if (visibilityStateRef.value === "hidden") {
|
|
4619
4570
|
await sleep(WX_GET_LOCATION_INTERVAL);
|
|
@@ -15,7 +15,7 @@ export declare const ZINDEX_AUXILIARY_GRASP = 14;
|
|
|
15
15
|
export declare const ZINDEX_LINE_LAYER = 12;
|
|
16
16
|
export declare const ZINDEX_GREEN_ZONE = 10;
|
|
17
17
|
export declare const TRACKS_MATCH_MAX_LENGTH = 3;
|
|
18
|
-
export declare const REGEO_TIMEOUT =
|
|
19
|
-
export declare const GET_RECOMMEND_PLACE_TIMEOUT =
|
|
18
|
+
export declare const REGEO_TIMEOUT = 5000;
|
|
19
|
+
export declare const GET_RECOMMEND_PLACE_TIMEOUT = 5000;
|
|
20
20
|
export declare const IS_ENABLE_AUXILIARY_GRASP_ROAD: boolean;
|
|
21
21
|
export declare const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
2
|
import "./utils/alipayPolyfill";
|
|
3
|
-
import "./utils/mockWx";
|
|
4
3
|
export { AbsoluteAddressBox } from "./business-components/AbsoluteAddressBox";
|
|
5
4
|
export { AddressBox } from "./business-components/AddressBox";
|
|
6
5
|
export { BusinessQuotingMap } from "./business-components/BusinessQuotingMap";
|