@pisell/pisellos 2.3.139 → 2.3.140

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -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
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -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
  }
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
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.140",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",