@heycar/heycars-map 0.9.20-timeout → 0.9.20-timeout2

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 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-timeout";
22
+ const version = "0.9.20-timeout2";
167
23
  const type = "module";
168
24
  const bin = {
169
25
  checkVersion: "./bin/checkVersion.js"
@@ -1583,10 +1439,94 @@ 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 = 2e3;
1587
- const GET_RECOMMEND_PLACE_TIMEOUT = 2e3;
1442
+ const REGEO_TIMEOUT = 5e3;
1443
+ const GET_RECOMMEND_PLACE_TIMEOUT = 5e3;
1444
+ const GET_DEFAULT_CENTER_PLACE_TIMEOUT = 5e3;
1588
1445
  const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
1589
1446
  const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
1447
+ var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
1448
+ BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
1449
+ BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
1450
+ BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
1451
+ BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
1452
+ BRWOSER_PLATFORM2["H5"] = "H5";
1453
+ BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
1454
+ return BRWOSER_PLATFORM2;
1455
+ })(BRWOSER_PLATFORM || {});
1456
+ var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1457
+ OS_PLATFORM2["IOS"] = "IOS";
1458
+ OS_PLATFORM2["ANDROID"] = "ANDROID";
1459
+ OS_PLATFORM2["OTHER"] = "OTHER";
1460
+ return OS_PLATFORM2;
1461
+ })(OS_PLATFORM || {});
1462
+ var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1463
+ WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
1464
+ WEBGL_STATUS2["DISABLED"] = "DISABLED";
1465
+ WEBGL_STATUS2["ENABLED"] = "ENABLED";
1466
+ return WEBGL_STATUS2;
1467
+ })(WEBGL_STATUS || {});
1468
+ var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
1469
+ ALIPAY_WALLET2["TNGD"] = "TNGD";
1470
+ ALIPAY_WALLET2["TMN"] = "TMN";
1471
+ return ALIPAY_WALLET2;
1472
+ })(ALIPAY_WALLET || {});
1473
+ const detectAlipayWallet = () => {
1474
+ if (!navigator)
1475
+ return void 0;
1476
+ const useragent = navigator.userAgent.toLowerCase();
1477
+ if (!useragent.includes("alipay"))
1478
+ return void 0;
1479
+ if (useragent.includes("tngkit"))
1480
+ return "TNGD";
1481
+ if (useragent.includes("truemoney"))
1482
+ return "TMN";
1483
+ };
1484
+ const detectBrowserPlatform = () => {
1485
+ if (typeof navigator === "undefined")
1486
+ return "NODE_JS";
1487
+ const useragent = navigator.userAgent.toLowerCase();
1488
+ if (useragent.includes("micromessenger")) {
1489
+ return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
1490
+ }
1491
+ if (useragent.includes("alipay")) {
1492
+ return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
1493
+ }
1494
+ return "H5";
1495
+ };
1496
+ const detectOSPlatform = () => {
1497
+ if (typeof navigator === "undefined")
1498
+ return "OTHER";
1499
+ const userAgent = navigator.userAgent || navigator.vendor;
1500
+ if (/android/i.test(userAgent)) {
1501
+ return "ANDROID";
1502
+ }
1503
+ if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
1504
+ return "IOS";
1505
+ }
1506
+ return "OTHER";
1507
+ };
1508
+ function detectWebGL() {
1509
+ if (typeof window === "undefined")
1510
+ return "NOT_SUPPORTED";
1511
+ if (window.WebGLRenderingContext) {
1512
+ const canvas = document.createElement("canvas");
1513
+ const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
1514
+ let context2 = null;
1515
+ for (const name2 of names) {
1516
+ try {
1517
+ context2 = canvas.getContext(name2);
1518
+ if (context2 && typeof context2.getParameter === "function") {
1519
+ return "ENABLED";
1520
+ }
1521
+ } catch (e) {
1522
+ console.error("MyError: detectWebGL catch e = ", e);
1523
+ return "NOT_SUPPORTED";
1524
+ }
1525
+ }
1526
+ return "DISABLED";
1527
+ }
1528
+ return "NOT_SUPPORTED";
1529
+ }
1590
1530
  const vec2lnglat = ([lng, lat]) => ({
1591
1531
  lng: Number(lng),
1592
1532
  lat: Number(lat)
@@ -4615,7 +4555,19 @@ function wechatWatchPosition(onSuccess, onError, option) {
4615
4555
  const isGeoWorkingRef = Vue.ref(true);
4616
4556
  const { visibilityStateRef, unwatchVisibilityState } = watchVisibilityState();
4617
4557
  const startWatch = async () => {
4618
- await wxReady();
4558
+ try {
4559
+ await wxReady();
4560
+ } catch (err) {
4561
+ console.error(err);
4562
+ onError == null ? void 0 : onError(
4563
+ createCustomGeolocationPositionError(
4564
+ err.errMsg,
4565
+ // 签名失败,也算无权限的一种
4566
+ GeolocationPositionError.PERMISSION_DENIED
4567
+ )
4568
+ );
4569
+ return;
4570
+ }
4619
4571
  do {
4620
4572
  if (visibilityStateRef.value === "hidden") {
4621
4573
  await sleep(WX_GET_LOCATION_INTERVAL);
@@ -7817,7 +7769,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7817
7769
  });
7818
7770
  };
7819
7771
  const defaultCenterPlacePromise = new Promise((resolve) => {
7820
- getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
7772
+ pipeTimeout(getDefaultCenterPlace, void 0, GET_DEFAULT_CENTER_PLACE_TIMEOUT)().then(resolve).catch(() => resolve(void 0));
7821
7773
  });
7822
7774
  const {
7823
7775
  orientation
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-timeout";
20
+ const version = "0.9.20-timeout2";
165
21
  const type = "module";
166
22
  const bin = {
167
23
  checkVersion: "./bin/checkVersion.js"
@@ -1581,10 +1437,94 @@ 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 = 2e3;
1585
- const GET_RECOMMEND_PLACE_TIMEOUT = 2e3;
1440
+ const REGEO_TIMEOUT = 5e3;
1441
+ const GET_RECOMMEND_PLACE_TIMEOUT = 5e3;
1442
+ const GET_DEFAULT_CENTER_PLACE_TIMEOUT = 5e3;
1586
1443
  const IS_ENABLE_AUXILIARY_GRASP_ROAD = location.search.includes("enableAuxiliaryGraspRoad");
1587
1444
  const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
1445
+ var BRWOSER_PLATFORM = /* @__PURE__ */ ((BRWOSER_PLATFORM2) => {
1446
+ BRWOSER_PLATFORM2["WECHAT"] = "WECHAT";
1447
+ BRWOSER_PLATFORM2["WECHAT_MINIPROGRAM"] = "WECHAT_MINIPROGRAM";
1448
+ BRWOSER_PLATFORM2["ALIPAY"] = "ALIPAY";
1449
+ BRWOSER_PLATFORM2["ALIPAY_MINIPROGRAM"] = "ALIPAY_MINIPROGRAM";
1450
+ BRWOSER_PLATFORM2["H5"] = "H5";
1451
+ BRWOSER_PLATFORM2["NODE_JS"] = "NODE_JS";
1452
+ return BRWOSER_PLATFORM2;
1453
+ })(BRWOSER_PLATFORM || {});
1454
+ var OS_PLATFORM = /* @__PURE__ */ ((OS_PLATFORM2) => {
1455
+ OS_PLATFORM2["IOS"] = "IOS";
1456
+ OS_PLATFORM2["ANDROID"] = "ANDROID";
1457
+ OS_PLATFORM2["OTHER"] = "OTHER";
1458
+ return OS_PLATFORM2;
1459
+ })(OS_PLATFORM || {});
1460
+ var WEBGL_STATUS = /* @__PURE__ */ ((WEBGL_STATUS2) => {
1461
+ WEBGL_STATUS2["NOT_SUPPORTED"] = "NOT_SUPPORTED";
1462
+ WEBGL_STATUS2["DISABLED"] = "DISABLED";
1463
+ WEBGL_STATUS2["ENABLED"] = "ENABLED";
1464
+ return WEBGL_STATUS2;
1465
+ })(WEBGL_STATUS || {});
1466
+ var ALIPAY_WALLET = /* @__PURE__ */ ((ALIPAY_WALLET2) => {
1467
+ ALIPAY_WALLET2["TNGD"] = "TNGD";
1468
+ ALIPAY_WALLET2["TMN"] = "TMN";
1469
+ return ALIPAY_WALLET2;
1470
+ })(ALIPAY_WALLET || {});
1471
+ const detectAlipayWallet = () => {
1472
+ if (!navigator)
1473
+ return void 0;
1474
+ const useragent = navigator.userAgent.toLowerCase();
1475
+ if (!useragent.includes("alipay"))
1476
+ return void 0;
1477
+ if (useragent.includes("tngkit"))
1478
+ return "TNGD";
1479
+ if (useragent.includes("truemoney"))
1480
+ return "TMN";
1481
+ };
1482
+ const detectBrowserPlatform = () => {
1483
+ if (typeof navigator === "undefined")
1484
+ return "NODE_JS";
1485
+ const useragent = navigator.userAgent.toLowerCase();
1486
+ if (useragent.includes("micromessenger")) {
1487
+ return useragent.includes("miniprogram") ? "WECHAT_MINIPROGRAM" : "WECHAT";
1488
+ }
1489
+ if (useragent.includes("alipay")) {
1490
+ return useragent.includes("miniprogram") ? "ALIPAY_MINIPROGRAM" : "ALIPAY";
1491
+ }
1492
+ return "H5";
1493
+ };
1494
+ const detectOSPlatform = () => {
1495
+ if (typeof navigator === "undefined")
1496
+ return "OTHER";
1497
+ const userAgent = navigator.userAgent || navigator.vendor;
1498
+ if (/android/i.test(userAgent)) {
1499
+ return "ANDROID";
1500
+ }
1501
+ if (/iPad|iPhone|iPod/.test(userAgent) && !globalThis.MSStream) {
1502
+ return "IOS";
1503
+ }
1504
+ return "OTHER";
1505
+ };
1506
+ function detectWebGL() {
1507
+ if (typeof window === "undefined")
1508
+ return "NOT_SUPPORTED";
1509
+ if (window.WebGLRenderingContext) {
1510
+ const canvas = document.createElement("canvas");
1511
+ const names = ["webgl", "experimental-webgl", "moz-webgl", "webkit-3d"];
1512
+ let context2 = null;
1513
+ for (const name2 of names) {
1514
+ try {
1515
+ context2 = canvas.getContext(name2);
1516
+ if (context2 && typeof context2.getParameter === "function") {
1517
+ return "ENABLED";
1518
+ }
1519
+ } catch (e) {
1520
+ console.error("MyError: detectWebGL catch e = ", e);
1521
+ return "NOT_SUPPORTED";
1522
+ }
1523
+ }
1524
+ return "DISABLED";
1525
+ }
1526
+ return "NOT_SUPPORTED";
1527
+ }
1588
1528
  const vec2lnglat = ([lng, lat]) => ({
1589
1529
  lng: Number(lng),
1590
1530
  lat: Number(lat)
@@ -4613,7 +4553,19 @@ function wechatWatchPosition(onSuccess, onError, option) {
4613
4553
  const isGeoWorkingRef = ref(true);
4614
4554
  const { visibilityStateRef, unwatchVisibilityState } = watchVisibilityState();
4615
4555
  const startWatch = async () => {
4616
- await wxReady();
4556
+ try {
4557
+ await wxReady();
4558
+ } catch (err) {
4559
+ console.error(err);
4560
+ onError == null ? void 0 : onError(
4561
+ createCustomGeolocationPositionError(
4562
+ err.errMsg,
4563
+ // 签名失败,也算无权限的一种
4564
+ GeolocationPositionError.PERMISSION_DENIED
4565
+ )
4566
+ );
4567
+ return;
4568
+ }
4617
4569
  do {
4618
4570
  if (visibilityStateRef.value === "hidden") {
4619
4571
  await sleep(WX_GET_LOCATION_INTERVAL);
@@ -7815,7 +7767,7 @@ const BusinessRecomendPlaceMap = defineLagecySetup(function BusinessRecomendPlac
7815
7767
  });
7816
7768
  };
7817
7769
  const defaultCenterPlacePromise = new Promise((resolve) => {
7818
- getDefaultCenterPlace().then(resolve).catch(() => resolve(void 0));
7770
+ pipeTimeout(getDefaultCenterPlace, void 0, GET_DEFAULT_CENTER_PLACE_TIMEOUT)().then(resolve).catch(() => resolve(void 0));
7819
7771
  });
7820
7772
  const {
7821
7773
  orientation
@@ -15,7 +15,8 @@ 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 = 2000;
19
- export declare const GET_RECOMMEND_PLACE_TIMEOUT = 2000;
18
+ export declare const REGEO_TIMEOUT = 5000;
19
+ export declare const GET_RECOMMEND_PLACE_TIMEOUT = 5000;
20
+ export declare const GET_DEFAULT_CENTER_PLACE_TIMEOUT = 5000;
20
21
  export declare const IS_ENABLE_AUXILIARY_GRASP_ROAD: boolean;
21
22
  export declare const AMAP_DEFAULT_MARKER_ICON_URL = "https://webapi.amap.com/theme/v1.3/markers/b/mark_bs.png";
@@ -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";
@@ -1,5 +1,6 @@
1
1
  import type { Wx } from "../types/wx";
2
2
  interface CreateMockWxProps {
3
+ configOk: boolean;
3
4
  getLocation: {
4
5
  timeout: number;
5
6
  lng?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycar/heycars-map",
3
- "version": "0.9.20-timeout",
3
+ "version": "0.9.20-timeout2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "checkVersion": "./bin/checkVersion.js"