@pisell/pisellos 2.3.139 → 2.3.141

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.
@@ -31,6 +31,33 @@ import { FloorPlanHooks } from "./types";
31
31
  var FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3000;
32
32
  var FLOOR_PLAN_STORE_NAME = 'floor_plans';
33
33
 
34
+ /**
35
+ * Request failures can be plain response objects (rather than Error instances).
36
+ * Keep diagnostics useful without allowing the UI bridge to stringify them as
37
+ * "[object Object]".
38
+ */
39
+ function getRequestErrorInfo(error) {
40
+ var _ref, _ref2, _value$resData$res, _value$resData, _value$response, _response$code, _response$status, _value$response2;
41
+ if (error instanceof Error && error.message) return {
42
+ message: error.message
43
+ };
44
+ if (typeof error === 'string' && error) return {
45
+ message: error
46
+ };
47
+ var value = error;
48
+ var response = (_ref = (_ref2 = (_value$resData$res = value === null || value === void 0 || (_value$resData = value.resData) === null || _value$resData === void 0 ? void 0 : _value$resData.res) !== null && _value$resData$res !== void 0 ? _value$resData$res : value === null || value === void 0 || (_value$response = value.response) === null || _value$response === void 0 ? void 0 : _value$response.data) !== null && _ref2 !== void 0 ? _ref2 : value === null || value === void 0 ? void 0 : value.data) !== null && _ref !== void 0 ? _ref : value;
49
+ var candidates = [value === null || value === void 0 ? void 0 : value.message, value === null || value === void 0 ? void 0 : value.error, response === null || response === void 0 ? void 0 : response.message, response === null || response === void 0 ? void 0 : response.error];
50
+ var message = candidates.find(function (candidate) {
51
+ return typeof candidate === 'string' && candidate.trim() !== '';
52
+ });
53
+ return {
54
+ message: message || '平面图加载失败(未提供错误详情)',
55
+ code: (_response$code = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code !== void 0 ? _response$code : value === null || value === void 0 ? void 0 : value.code,
56
+ status: (_response$status = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status !== void 0 ? _response$status : value === null || value === void 0 ? void 0 : value.status,
57
+ httpStatus: value === null || value === void 0 || (_value$response2 = value.response) === null || _value$response2 === void 0 ? void 0 : _value$response2.status
58
+ };
59
+ }
60
+
34
61
  /**
35
62
  * 平面图模块:预加载列表、pubsub 同步、供 OS Server 路由读本地 store
36
63
  */
@@ -230,7 +257,7 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
230
257
  key: "loadListFromServer",
231
258
  value: function () {
232
259
  var _loadListFromServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
233
- var res, body, raw, list;
260
+ var res, body, raw, list, errorInfo;
234
261
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
235
262
  while (1) switch (_context2.prev = _context2.next) {
236
263
  case 0:
@@ -248,11 +275,15 @@ export var FloorPlanModule = /*#__PURE__*/function (_BaseModule) {
248
275
  case 10:
249
276
  _context2.prev = 10;
250
277
  _context2.t0 = _context2["catch"](0);
278
+ errorInfo = getRequestErrorInfo(_context2.t0);
251
279
  this.logWarning('loadListFromServer 失败', {
252
- error: _context2.t0 instanceof Error ? _context2.t0.message : String(_context2.t0)
280
+ error: errorInfo.message,
281
+ code: errorInfo.code,
282
+ status: errorInfo.status,
283
+ httpStatus: errorInfo.httpStatus
253
284
  });
254
285
  return _context2.abrupt("return", []);
255
- case 14:
286
+ case 15:
256
287
  case "end":
257
288
  return _context2.stop();
258
289
  }
@@ -1369,7 +1369,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1369
1369
  throw new Error('Store settings changed. Please try again.');
1370
1370
  case 12:
1371
1371
  this.captureAvailabilityScheduleCatalog();
1372
- case 13:
1372
+ _context.next = 15;
1373
+ return this.ensureAllergyItemRuleConfigsLoaded();
1374
+ case 15:
1373
1375
  case "end":
1374
1376
  return _context.stop();
1375
1377
  }
@@ -2648,7 +2650,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
2648
2650
  return _context18.stop();
2649
2651
  }
2650
2652
  }, _callee18);
2651
- }))();
2653
+ }))().catch(function () {
2654
+ return [];
2655
+ });
2652
2656
  return _context19.abrupt("return", this.allergyItemRuleConfigsPromise);
2653
2657
  case 6:
2654
2658
  case "end":
@@ -9,6 +9,30 @@ var _types = require("./types");
9
9
  const FLOOR_PLAN_SYNC_DEBOUNCE_MS = 3000;
10
10
  const FLOOR_PLAN_STORE_NAME = 'floor_plans';
11
11
 
12
+ /**
13
+ * Request failures can be plain response objects (rather than Error instances).
14
+ * Keep diagnostics useful without allowing the UI bridge to stringify them as
15
+ * "[object Object]".
16
+ */
17
+ function getRequestErrorInfo(error) {
18
+ if (error instanceof Error && error.message) return {
19
+ message: error.message
20
+ };
21
+ if (typeof error === 'string' && error) return {
22
+ message: error
23
+ };
24
+ const value = error;
25
+ const response = value?.resData?.res ?? value?.response?.data ?? value?.data ?? value;
26
+ const candidates = [value?.message, value?.error, response?.message, response?.error];
27
+ const message = candidates.find(candidate => typeof candidate === 'string' && candidate.trim() !== '');
28
+ return {
29
+ message: message || '平面图加载失败(未提供错误详情)',
30
+ code: response?.code ?? value?.code,
31
+ status: response?.status ?? value?.status,
32
+ httpStatus: value?.response?.status
33
+ };
34
+ }
35
+
12
36
  /**
13
37
  * 平面图模块:预加载列表、pubsub 同步、供 OS Server 路由读本地 store
14
38
  */
@@ -144,8 +168,12 @@ class FloorPlanModule extends _BaseModule.BaseModule {
144
168
  const list = Array.isArray(raw) ? raw : [];
145
169
  return list;
146
170
  } catch (e) {
171
+ const errorInfo = getRequestErrorInfo(e);
147
172
  this.logWarning('loadListFromServer 失败', {
148
- error: e instanceof Error ? e.message : String(e)
173
+ error: errorInfo.message,
174
+ code: errorInfo.code,
175
+ status: errorInfo.status,
176
+ httpStatus: errorInfo.httpStatus
149
177
  });
150
178
  return [];
151
179
  }
@@ -1237,6 +1237,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
1237
1237
  throw new Error('Store settings changed. Please try again.');
1238
1238
  }
1239
1239
  this.captureAvailabilityScheduleCatalog();
1240
+ await this.ensureAllergyItemRuleConfigsLoaded();
1240
1241
  }
1241
1242
  getSubmitOrderSalesChannel() {
1242
1243
  const channel = String(this.otherParams?.channel ?? '').trim();
@@ -1937,7 +1938,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
1937
1938
  this.allergyItemRuleConfigs = loaded;
1938
1939
  this.allergyItemRuleEvaluator.setStrategyConfigs(loaded);
1939
1940
  return loaded;
1940
- })();
1941
+ })().catch(() => []);
1941
1942
  return this.allergyItemRuleConfigsPromise;
1942
1943
  }
1943
1944
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.139",
4
+ "version": "2.3.141",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",