@pisell/pisellos 2.3.69 → 2.3.71

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.
Files changed (44) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +65 -109
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/types.d.ts +2 -0
  5. package/dist/modules/Order/types.js +1 -0
  6. package/dist/modules/Quotation/index.d.ts +0 -6
  7. package/dist/modules/Quotation/index.js +19 -75
  8. package/dist/plugins/request.d.ts +0 -1
  9. package/dist/server/index.d.ts +2 -8
  10. package/dist/server/index.js +140 -206
  11. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  12. package/dist/server/modules/floor-plan/index.js +98 -240
  13. package/dist/server/modules/menu/index.js +23 -48
  14. package/dist/server/modules/order/index.d.ts +7 -17
  15. package/dist/server/modules/order/index.js +207 -419
  16. package/dist/server/modules/products/index.d.ts +2 -8
  17. package/dist/server/modules/products/index.js +75 -167
  18. package/dist/server/modules/resource/index.js +13 -21
  19. package/dist/solution/BaseSales/index.js +15 -4
  20. package/dist/solution/BookingByStep/index.d.ts +1 -1
  21. package/dist/solution/BookingTicket/index.d.ts +5 -15
  22. package/dist/solution/BookingTicket/index.js +21 -6
  23. package/lib/core/index.d.ts +0 -7
  24. package/lib/core/index.js +2 -20
  25. package/lib/modules/Order/index.d.ts +1 -1
  26. package/lib/modules/Order/types.d.ts +2 -0
  27. package/lib/modules/Quotation/index.d.ts +0 -6
  28. package/lib/modules/Quotation/index.js +5 -49
  29. package/lib/plugins/request.d.ts +0 -1
  30. package/lib/server/index.d.ts +2 -8
  31. package/lib/server/index.js +17 -52
  32. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  33. package/lib/server/modules/floor-plan/index.js +6 -54
  34. package/lib/server/modules/menu/index.js +5 -31
  35. package/lib/server/modules/order/index.d.ts +7 -17
  36. package/lib/server/modules/order/index.js +40 -197
  37. package/lib/server/modules/products/index.d.ts +2 -8
  38. package/lib/server/modules/products/index.js +24 -97
  39. package/lib/server/modules/resource/index.js +2 -7
  40. package/lib/solution/BaseSales/index.js +4 -4
  41. package/lib/solution/BookingByStep/index.d.ts +1 -1
  42. package/lib/solution/BookingTicket/index.d.ts +5 -15
  43. package/lib/solution/BookingTicket/index.js +15 -5
  44. package/package.json +1 -1
@@ -12,15 +12,8 @@ declare class PisellOSCore implements PisellCore {
12
12
  context: BusinessContext;
13
13
  server: any;
14
14
  serverOptions?: ServerOptions;
15
- private serverModulePromise?;
16
15
  constructor(options?: PisellOSOptions);
17
16
  private initialize;
18
- /**
19
- * 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
20
- * 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
21
- */
22
- preloadServerModule(): Promise<void>;
23
- private loadServerModule;
24
17
  /**
25
18
  * 初始化 Server(公开方法,需要外部显式调用并等待)
26
19
  * Server 配置从构造函数传入的 options.server 中获取
@@ -24,6 +24,8 @@ import { EffectsManager } from "../effects";
24
24
  * pisell OS 核心实现
25
25
  */
26
26
  var PisellOSCore = /*#__PURE__*/function () {
27
+ // 保存 Server 配置
28
+
27
29
  function PisellOSCore(options) {
28
30
  _classCallCheck(this, PisellOSCore);
29
31
  _defineProperty(this, "plugins", new Map());
@@ -35,8 +37,6 @@ var PisellOSCore = /*#__PURE__*/function () {
35
37
  _defineProperty(this, "server", void 0);
36
38
  // Server 实例
37
39
  _defineProperty(this, "serverOptions", void 0);
38
- // 保存 Server 配置
39
- _defineProperty(this, "serverModulePromise", void 0);
40
40
  this.debug = (options === null || options === void 0 ? void 0 : options.debug) || false;
41
41
  this.context = (options === null || options === void 0 ? void 0 : options.context) || {};
42
42
 
@@ -45,7 +45,6 @@ var PisellOSCore = /*#__PURE__*/function () {
45
45
  this.serverOptions = options.server;
46
46
  }
47
47
  this.initialize(options);
48
- console.log('constructor123456');
49
48
  }
50
49
  _createClass(PisellOSCore, [{
51
50
  key: "initialize",
@@ -64,49 +63,6 @@ var PisellOSCore = /*#__PURE__*/function () {
64
63
  this.log('[PisellOS] 核心初始化完成');
65
64
  }
66
65
 
67
- /**
68
- * 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
69
- * 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
70
- */
71
- }, {
72
- key: "preloadServerModule",
73
- value: (function () {
74
- var _preloadServerModule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
75
- return _regeneratorRuntime().wrap(function _callee$(_context) {
76
- while (1) switch (_context.prev = _context.next) {
77
- case 0:
78
- if (!(this.server || !this.serverOptions)) {
79
- _context.next = 2;
80
- break;
81
- }
82
- return _context.abrupt("return");
83
- case 2:
84
- _context.next = 4;
85
- return this.loadServerModule();
86
- case 4:
87
- case "end":
88
- return _context.stop();
89
- }
90
- }, _callee, this);
91
- }));
92
- function preloadServerModule() {
93
- return _preloadServerModule.apply(this, arguments);
94
- }
95
- return preloadServerModule;
96
- }())
97
- }, {
98
- key: "loadServerModule",
99
- value: function loadServerModule() {
100
- var _this2 = this;
101
- if (!this.serverModulePromise) {
102
- this.serverModulePromise = import("../server").catch(function (error) {
103
- _this2.serverModulePromise = undefined;
104
- throw error;
105
- });
106
- }
107
- return this.serverModulePromise;
108
- }
109
-
110
66
  /**
111
67
  * 初始化 Server(公开方法,需要外部显式调用并等待)
112
68
  * Server 配置从构造函数传入的 options.server 中获取
@@ -114,57 +70,57 @@ var PisellOSCore = /*#__PURE__*/function () {
114
70
  }, {
115
71
  key: "initializeServer",
116
72
  value: (function () {
117
- var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
73
+ var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
118
74
  var ServerModule, Server;
119
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
120
- while (1) switch (_context2.prev = _context2.next) {
75
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
121
77
  case 0:
122
78
  if (!this.server) {
123
- _context2.next = 3;
79
+ _context.next = 3;
124
80
  break;
125
81
  }
126
82
  this.log('Server 已经初始化,跳过重复初始化', 'warn');
127
- return _context2.abrupt("return");
83
+ return _context.abrupt("return");
128
84
  case 3:
129
85
  if (this.serverOptions) {
130
- _context2.next = 6;
86
+ _context.next = 6;
131
87
  break;
132
88
  }
133
89
  this.log('未提供 Server 配置,无法初始化', 'warn');
134
- return _context2.abrupt("return");
90
+ return _context.abrupt("return");
135
91
  case 6:
136
- _context2.prev = 6;
137
- _context2.next = 9;
138
- return this.loadServerModule();
92
+ _context.prev = 6;
93
+ _context.next = 9;
94
+ return import("../server");
139
95
  case 9:
140
- ServerModule = _context2.sent;
96
+ ServerModule = _context.sent;
141
97
  Server = ServerModule.default; // 创建 Server 实例
142
98
  this.server = new Server(this);
143
99
  this.log('Server 实例已创建');
144
100
 
145
101
  // 初始化模块并预加载数据
146
102
  if (!this.serverOptions.modules) {
147
- _context2.next = 16;
103
+ _context.next = 16;
148
104
  break;
149
105
  }
150
- _context2.next = 16;
106
+ _context.next = 16;
151
107
  return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
152
108
  case 16:
153
109
  console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
154
110
  this.log('[PisellOS] Server 初始化完成');
155
- _context2.next = 25;
111
+ _context.next = 25;
156
112
  break;
157
113
  case 20:
158
- _context2.prev = 20;
159
- _context2.t0 = _context2["catch"](6);
160
- console.error('[PisellOS] ❌ Server 初始化失败:', _context2.t0);
161
- this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context2.t0), 'error');
162
- throw _context2.t0;
114
+ _context.prev = 20;
115
+ _context.t0 = _context["catch"](6);
116
+ console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
117
+ this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
118
+ throw _context.t0;
163
119
  case 25:
164
120
  case "end":
165
- return _context2.stop();
121
+ return _context.stop();
166
122
  }
167
- }, _callee2, this, [[6, 20]]);
123
+ }, _callee, this, [[6, 20]]);
168
124
  }));
169
125
  function initializeServer(_x) {
170
126
  return _initializeServer.apply(this, arguments);
@@ -197,7 +153,7 @@ var PisellOSCore = /*#__PURE__*/function () {
197
153
  }, {
198
154
  key: "registerPlugin",
199
155
  value: function registerPlugin(plugin, options) {
200
- var _this3 = this;
156
+ var _this2 = this;
201
157
  if (this.plugins.has(plugin.name)) {
202
158
  this.log("\u63D2\u4EF6 ".concat(plugin.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
203
159
  }
@@ -225,7 +181,7 @@ var PisellOSCore = /*#__PURE__*/function () {
225
181
  var result = plugin.initialize();
226
182
  if (result instanceof Promise) {
227
183
  result.catch(function (err) {
228
- _this3.log("\u63D2\u4EF6 ".concat(plugin.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
184
+ _this2.log("\u63D2\u4EF6 ".concat(plugin.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
229
185
  throw err;
230
186
  });
231
187
  }
@@ -251,7 +207,7 @@ var PisellOSCore = /*#__PURE__*/function () {
251
207
  }, {
252
208
  key: "registerModule",
253
209
  value: function registerModule(module, options) {
254
- var _this4 = this;
210
+ var _this3 = this;
255
211
  if (this.modules.has(module.name)) {
256
212
  this.log("\u6A21\u5757 ".concat(module.name, " \u5DF2\u7ECF\u6CE8\u518C\u8FC7\uFF0C\u5C06\u88AB\u8986\u76D6"), 'warn');
257
213
  }
@@ -294,7 +250,7 @@ var PisellOSCore = /*#__PURE__*/function () {
294
250
  // 预先给模块初始化值系统
295
251
  var _createStore = createStore((options === null || options === void 0 ? void 0 : options.initialState) || {}, module.name, function (path, value) {
296
252
  console.log('core 检测到模块值更新', module.name, path, value);
297
- _this4.effects.emit("".concat(module.name, ":changed"), {
253
+ _this3.effects.emit("".concat(module.name, ":changed"), {
298
254
  path: path,
299
255
  value: value
300
256
  });
@@ -309,7 +265,7 @@ var PisellOSCore = /*#__PURE__*/function () {
309
265
  }, options));
310
266
  if (result instanceof Promise) {
311
267
  result.catch(function (err) {
312
- _this4.log("\u6A21\u5757 ".concat(module.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
268
+ _this3.log("\u6A21\u5757 ".concat(module.name, " \u521D\u59CB\u5316\u5931\u8D25: ").concat(err.message), 'error');
313
269
  throw err;
314
270
  });
315
271
  }
@@ -354,100 +310,100 @@ var PisellOSCore = /*#__PURE__*/function () {
354
310
  }, {
355
311
  key: "destroy",
356
312
  value: function () {
357
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
313
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
358
314
  var _iterator4, _step4, _step4$value, name, module, _iterator5, _step5, _step5$value, _name, plugin;
359
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
360
- while (1) switch (_context3.prev = _context3.next) {
315
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
316
+ while (1) switch (_context2.prev = _context2.next) {
361
317
  case 0:
362
318
  // 先销毁模块
363
319
  _iterator4 = _createForOfIteratorHelper(this.modules.entries());
364
- _context3.prev = 1;
320
+ _context2.prev = 1;
365
321
  _iterator4.s();
366
322
  case 3:
367
323
  if ((_step4 = _iterator4.n()).done) {
368
- _context3.next = 17;
324
+ _context2.next = 17;
369
325
  break;
370
326
  }
371
327
  _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], module = _step4$value[1];
372
328
  if (!module.destroy) {
373
- _context3.next = 15;
329
+ _context2.next = 15;
374
330
  break;
375
331
  }
376
- _context3.prev = 6;
377
- _context3.next = 9;
332
+ _context2.prev = 6;
333
+ _context2.next = 9;
378
334
  return Promise.resolve(module.destroy());
379
335
  case 9:
380
336
  this.log("\u6A21\u5757 ".concat(name, " \u5DF2\u9500\u6BC1"));
381
- _context3.next = 15;
337
+ _context2.next = 15;
382
338
  break;
383
339
  case 12:
384
- _context3.prev = 12;
385
- _context3.t0 = _context3["catch"](6);
386
- this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context3.t0), 'error');
340
+ _context2.prev = 12;
341
+ _context2.t0 = _context2["catch"](6);
342
+ this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context2.t0), 'error');
387
343
  case 15:
388
- _context3.next = 3;
344
+ _context2.next = 3;
389
345
  break;
390
346
  case 17:
391
- _context3.next = 22;
347
+ _context2.next = 22;
392
348
  break;
393
349
  case 19:
394
- _context3.prev = 19;
395
- _context3.t1 = _context3["catch"](1);
396
- _iterator4.e(_context3.t1);
350
+ _context2.prev = 19;
351
+ _context2.t1 = _context2["catch"](1);
352
+ _iterator4.e(_context2.t1);
397
353
  case 22:
398
- _context3.prev = 22;
354
+ _context2.prev = 22;
399
355
  _iterator4.f();
400
- return _context3.finish(22);
356
+ return _context2.finish(22);
401
357
  case 25:
402
358
  this.modules.clear();
403
359
 
404
360
  // 再销毁插件
405
361
  _iterator5 = _createForOfIteratorHelper(this.plugins.entries());
406
- _context3.prev = 27;
362
+ _context2.prev = 27;
407
363
  _iterator5.s();
408
364
  case 29:
409
365
  if ((_step5 = _iterator5.n()).done) {
410
- _context3.next = 43;
366
+ _context2.next = 43;
411
367
  break;
412
368
  }
413
369
  _step5$value = _slicedToArray(_step5.value, 2), _name = _step5$value[0], plugin = _step5$value[1];
414
370
  if (!plugin.destroy) {
415
- _context3.next = 41;
371
+ _context2.next = 41;
416
372
  break;
417
373
  }
418
- _context3.prev = 32;
419
- _context3.next = 35;
374
+ _context2.prev = 32;
375
+ _context2.next = 35;
420
376
  return Promise.resolve(plugin.destroy());
421
377
  case 35:
422
378
  this.log("\u63D2\u4EF6 ".concat(_name, " \u5DF2\u9500\u6BC1"));
423
- _context3.next = 41;
379
+ _context2.next = 41;
424
380
  break;
425
381
  case 38:
426
- _context3.prev = 38;
427
- _context3.t2 = _context3["catch"](32);
428
- this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context3.t2), 'error');
382
+ _context2.prev = 38;
383
+ _context2.t2 = _context2["catch"](32);
384
+ this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context2.t2), 'error');
429
385
  case 41:
430
- _context3.next = 29;
386
+ _context2.next = 29;
431
387
  break;
432
388
  case 43:
433
- _context3.next = 48;
389
+ _context2.next = 48;
434
390
  break;
435
391
  case 45:
436
- _context3.prev = 45;
437
- _context3.t3 = _context3["catch"](27);
438
- _iterator5.e(_context3.t3);
392
+ _context2.prev = 45;
393
+ _context2.t3 = _context2["catch"](27);
394
+ _iterator5.e(_context2.t3);
439
395
  case 48:
440
- _context3.prev = 48;
396
+ _context2.prev = 48;
441
397
  _iterator5.f();
442
- return _context3.finish(48);
398
+ return _context2.finish(48);
443
399
  case 51:
444
400
  this.plugins.clear();
445
401
  this.log('PisellOS 核心已销毁');
446
402
  case 53:
447
403
  case "end":
448
- return _context3.stop();
404
+ return _context2.stop();
449
405
  }
450
- }, _callee3, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
406
+ }, _callee2, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
451
407
  }));
452
408
  function destroy() {
453
409
  return _destroy.apply(this, arguments);
@@ -512,7 +512,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
512
512
  generateIdempotencyToken(): string;
513
513
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
514
514
  createOrder(params: CommitOrderParams['query']): {
515
- type: "appointment_booking" | "virtual";
515
+ type: "virtual" | "appointment_booking";
516
516
  platform: string;
517
517
  sales_channel: string;
518
518
  order_sales_channel: string;
@@ -157,11 +157,13 @@ export interface OrderCustomerPatch {
157
157
  * 下单客户变更事件 payload。
158
158
  * - `patch`:tempOrder 上的协议字段视图(会随订单提交)
159
159
  * - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
160
+ * - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
160
161
  * 清空时整个 payload 为 null。
161
162
  */
162
163
  export interface OrderCustomerChangePayload {
163
164
  patch: OrderCustomerView;
164
165
  snapshot: ICustomer | null;
166
+ source?: 'detailHydrate';
165
167
  }
166
168
  export interface OrderScanCodeResult {
167
169
  isAvailable: boolean;
@@ -60,6 +60,7 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
60
60
  * 下单客户变更事件 payload。
61
61
  * - `patch`:tempOrder 上的协议字段视图(会随订单提交)
62
62
  * - `snapshot`:UI 富字段快照(仅本地,不随订单提交)
63
+ * - `source`:缺省表示真实业务变更;`detailHydrate` 仅表示打开详情时快照已就绪
63
64
  * 清空时整个 payload 为 null。
64
65
  */
65
66
 
@@ -9,8 +9,6 @@ export declare class QuotationModule extends BaseModule implements Module {
9
9
  private request;
10
10
  private store;
11
11
  private scheduleResolver?;
12
- private app;
13
- private quotationListUpdatedListener?;
14
12
  constructor(name?: string, version?: string);
15
13
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
16
14
  loadQuotations(params?: {
@@ -18,7 +16,6 @@ export declare class QuotationModule extends BaseModule implements Module {
18
16
  customer_id?: number | string;
19
17
  }): Promise<void>;
20
18
  getQuotationList(): QuotationItem[];
21
- setQuotationListUpdatedListener(listener?: () => void): void;
22
19
  getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
23
20
  /**
24
21
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
@@ -63,9 +60,6 @@ export declare class QuotationModule extends BaseModule implements Module {
63
60
  customer_id?: number | string;
64
61
  }): Map<string, string | null>;
65
62
  setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
66
- private applyQuotationResponse;
67
- private notifyQuotationListUpdated;
68
- private getQuotationCacheKeyData;
69
63
  private isQuotationVisibleForCustomer;
70
64
  private hasValidCustomerId;
71
65
  private normalizeCustomerId;
@@ -1,10 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
4
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
9
5
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
@@ -40,15 +36,12 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
40
36
  list: []
41
37
  });
42
38
  _defineProperty(_assertThisInitialized(_this), "scheduleResolver", void 0);
43
- _defineProperty(_assertThisInitialized(_this), "app", void 0);
44
- _defineProperty(_assertThisInitialized(_this), "quotationListUpdatedListener", void 0);
45
39
  return _this;
46
40
  }
47
41
  _createClass(QuotationModule, [{
48
42
  key: "initialize",
49
43
  value: function () {
50
44
  var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
51
- var _core$getPlugin, _core$getPlugin$getAp;
52
45
  return _regeneratorRuntime().wrap(function _callee$(_context) {
53
46
  while (1) switch (_context.prev = _context.next) {
54
47
  case 0:
@@ -60,11 +53,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
60
53
  }
61
54
  throw new Error('QuotationModule 需要 request 插件支持');
62
55
  case 4:
63
- this.app = (_core$getPlugin = core.getPlugin('app')) === null || _core$getPlugin === void 0 || (_core$getPlugin$getAp = _core$getPlugin.getApp) === null || _core$getPlugin$getAp === void 0 ? void 0 : _core$getPlugin$getAp.call(_core$getPlugin);
64
56
  this.store = {
65
57
  list: []
66
58
  };
67
- case 6:
59
+ case 5:
68
60
  case "end":
69
61
  return _context.stop();
70
62
  }
@@ -79,8 +71,8 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
79
71
  key: "loadQuotations",
80
72
  value: function () {
81
73
  var _loadQuotations = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
82
- var _this2 = this;
83
- var query, initialResultApplied, applyRemoteUpdate, res;
74
+ var _data;
75
+ var query, res, list;
84
76
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
85
77
  while (1) switch (_context2.prev = _context2.next) {
86
78
  case 0:
@@ -89,27 +81,19 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
89
81
  if ((params === null || params === void 0 ? void 0 : params.channel) === 'online_store') {
90
82
  query.channel = 'online-store';
91
83
  }
92
- initialResultApplied = false;
93
- applyRemoteUpdate = function applyRemoteUpdate(response) {
94
- _this2.applyQuotationResponse(response);
95
- if (initialResultApplied) {
96
- _this2.notifyQuotationListUpdated();
97
- }
98
- };
99
- _context2.next = 7;
84
+ _context2.next = 5;
100
85
  return this.request.get('/quotation/available', query, {
101
- cache: {
102
- type: 'indexDB',
103
- updateCache: true,
104
- cacheKeyData: this.getQuotationCacheKeyData(query)
105
- },
106
- cacheUpdateChange: applyRemoteUpdate
86
+ useCache: false,
87
+ osServer: true
107
88
  });
108
- case 7:
89
+ case 5:
109
90
  res = _context2.sent;
110
- this.applyQuotationResponse(res);
111
- initialResultApplied = true;
112
- case 10:
91
+ list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
92
+ list.sort(function (a, b) {
93
+ return b.sort - a.sort;
94
+ });
95
+ this.store.list = list;
96
+ case 9:
113
97
  case "end":
114
98
  return _context2.stop();
115
99
  }
@@ -125,15 +109,10 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
125
109
  value: function getQuotationList() {
126
110
  return this.store.list;
127
111
  }
128
- }, {
129
- key: "setQuotationListUpdatedListener",
130
- value: function setQuotationListUpdatedListener(listener) {
131
- this.quotationListUpdatedListener = listener;
132
- }
133
112
  }, {
134
113
  key: "getQuotationCustomerScopeInfo",
135
114
  value: function getQuotationCustomerScopeInfo() {
136
- var _this3 = this;
115
+ var _this2 = this;
137
116
  var customerById = new Map();
138
117
  var quotationScopes = this.store.list.filter(function (quotation) {
139
118
  return Array.isArray(quotation.customer) && quotation.customer.length > 0;
@@ -143,7 +122,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
143
122
  var localSeen = new Set();
144
123
  var quotationCustomers = quotation.customer || [];
145
124
  quotationCustomers.forEach(function (customer) {
146
- var customerId = _this3.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
125
+ var customerId = _this2.normalizeCustomerId(customer === null || customer === void 0 ? void 0 : customer.id);
147
126
  if (!customerId || localSeen.has(customerId)) return;
148
127
  localSeen.add(customerId);
149
128
  customerIds.push(customerId);
@@ -268,41 +247,6 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
268
247
  value: function setScheduleResolver(resolver) {
269
248
  this.scheduleResolver = resolver;
270
249
  }
271
- }, {
272
- key: "applyQuotationResponse",
273
- value: function applyQuotationResponse(response) {
274
- var _data;
275
- var source = (response === null || response === void 0 || (_data = response.data) === null || _data === void 0 ? void 0 : _data.list) || (response === null || response === void 0 ? void 0 : response.list) || [];
276
- this.store.list = _toConsumableArray(source).sort(function (a, b) {
277
- return Number(b.sort || 0) - Number(a.sort || 0);
278
- });
279
- }
280
- }, {
281
- key: "notifyQuotationListUpdated",
282
- value: function notifyQuotationListUpdated() {
283
- try {
284
- var _this$quotationListUp;
285
- (_this$quotationListUp = this.quotationListUpdatedListener) === null || _this$quotationListUp === void 0 || _this$quotationListUp.call(this);
286
- } catch (error) {
287
- console.warn('[QuotationModule] 报价单后台更新回调失败', error);
288
- }
289
- }
290
- }, {
291
- key: "getQuotationCacheKeyData",
292
- value: function getQuotationCacheKeyData(query) {
293
- var shopId = '';
294
- try {
295
- var _this$app, _this$app$getStorage;
296
- var storedCore = (_this$app = this.app) === null || _this$app === void 0 || (_this$app = _this$app.storage) === null || _this$app === void 0 || (_this$app$getStorage = _this$app.getStorage) === null || _this$app$getStorage === void 0 ? void 0 : _this$app$getStorage.call(_this$app, 'core');
297
- var coreInfo = typeof storedCore === 'string' ? JSON.parse(storedCore || '{}') : storedCore || {};
298
- shopId = String((coreInfo === null || coreInfo === void 0 ? void 0 : coreInfo.id) || '');
299
- } catch (_unused) {
300
- // 缓存隔离信息读取失败时仍按请求参数缓存。
301
- }
302
- return _objectSpread(_objectSpread({}, query), {}, {
303
- shop_id: shopId
304
- });
305
- }
306
250
  }, {
307
251
  key: "isQuotationVisibleForCustomer",
308
252
  value: function isQuotationVisibleForCustomer(quotation, customerId) {
@@ -329,17 +273,17 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
329
273
  key: "isQuotationActiveAt",
330
274
  value: function isQuotationActiveAt(quotation, datetime) {
331
275
  var _quotation$schedule,
332
- _this4 = this;
276
+ _this3 = this;
333
277
  if (!((_quotation$schedule = quotation.schedule) !== null && _quotation$schedule !== void 0 && _quotation$schedule.length)) return false;
334
278
  var scheduleItems = [];
335
279
  quotation.schedule.forEach(function (s) {
336
- var _this4$scheduleResolv;
337
- var full = (_this4$scheduleResolv = _this4.scheduleResolver) === null || _this4$scheduleResolv === void 0 ? void 0 : _this4$scheduleResolv.call(_this4, s.id);
280
+ var _this3$scheduleResolv;
281
+ var full = (_this3$scheduleResolv = _this3.scheduleResolver) === null || _this3$scheduleResolv === void 0 ? void 0 : _this3$scheduleResolv.call(_this3, s.id);
338
282
  if (full) {
339
283
  scheduleItems.push(full);
340
284
  return;
341
285
  }
342
- if (_this4.scheduleResolver) {
286
+ if (_this3.scheduleResolver) {
343
287
  return;
344
288
  }
345
289
  var fallbackSchedule = _objectSpread(_objectSpread({}, s), {}, {
@@ -68,7 +68,6 @@ export interface RequestOptions {
68
68
  useCache?: boolean;
69
69
  customToast?: () => void;
70
70
  cache?: CacheProps;
71
- cacheUpdateChange?: (data: any) => void;
72
71
  osServer?: boolean;
73
72
  prefix?: boolean;
74
73
  callback?: (res: any) => void;
@@ -51,8 +51,6 @@ declare class Server {
51
51
  private productQueryScheduleTimers;
52
52
  /** 餐牌筛选为空时才触发的菜单/日程缓存自愈,避免每次商品查询都请求远端。 */
53
53
  private menuScheduleRefreshInFlight;
54
- /** 启动阶段模块预加载任务;预渲染商品查询复用该任务,避免缓存尚未 ready 时误触发远端自愈。 */
55
- private startupModulePreloadInFlight;
56
54
  private lastMenuScheduleRefreshAt;
57
55
  private readonly MENU_SCHEDULE_REFRESH_COOLDOWN_MS;
58
56
  private orderQuerySubscribers;
@@ -159,17 +157,13 @@ declare class Server {
159
157
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onProductsSyncCompleted
160
158
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
161
159
  */
162
- refreshProductsInBackground(options?: {
163
- trigger?: string;
164
- }): Promise<void>;
160
+ refreshProductsInBackground(): Promise<void>;
165
161
  /**
166
162
  * 后台静默刷新订单数据
167
163
  * 重新拉取全量 SSE 接口,更新本地数据后触发 onOrdersSyncCompleted
168
164
  * 不影响当前界面展示,适用于切回前台、定时刷新等场景
169
165
  */
170
- refreshOrdersInBackground(options?: {
171
- trigger?: string;
172
- }): Promise<void>;
166
+ refreshOrdersInBackground(): Promise<void>;
173
167
  /**
174
168
  * 编辑正式订单时强制查询 Server 最新快照并覆盖本地缓存。
175
169
  * 商品成员增删由 OrderModule 在 SQLite/Store 更新完成后广播,