@pisell/pisellos 2.3.62 → 2.3.63

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 (34) hide show
  1. package/dist/core/index.d.ts +0 -7
  2. package/dist/core/index.js +66 -109
  3. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  4. package/dist/modules/Quotation/index.d.ts +0 -6
  5. package/dist/modules/Quotation/index.js +19 -75
  6. package/dist/plugins/request.d.ts +0 -1
  7. package/dist/server/index.d.ts +2 -6
  8. package/dist/server/index.js +91 -132
  9. package/dist/server/modules/floor-plan/index.d.ts +0 -4
  10. package/dist/server/modules/floor-plan/index.js +98 -240
  11. package/dist/server/modules/menu/index.js +23 -48
  12. package/dist/server/modules/order/index.d.ts +7 -12
  13. package/dist/server/modules/order/index.js +96 -248
  14. package/dist/server/modules/products/index.d.ts +2 -8
  15. package/dist/server/modules/products/index.js +75 -167
  16. package/dist/server/modules/resource/index.js +13 -21
  17. package/dist/solution/BookingByStep/index.d.ts +1 -1
  18. package/lib/core/index.d.ts +0 -7
  19. package/lib/core/index.js +3 -20
  20. package/lib/modules/Quotation/index.d.ts +0 -6
  21. package/lib/modules/Quotation/index.js +5 -49
  22. package/lib/plugins/request.d.ts +0 -1
  23. package/lib/server/index.d.ts +2 -6
  24. package/lib/server/index.js +11 -33
  25. package/lib/server/modules/floor-plan/index.d.ts +0 -4
  26. package/lib/server/modules/floor-plan/index.js +6 -54
  27. package/lib/server/modules/menu/index.js +5 -31
  28. package/lib/server/modules/order/index.d.ts +7 -12
  29. package/lib/server/modules/order/index.js +28 -143
  30. package/lib/server/modules/products/index.d.ts +2 -8
  31. package/lib/server/modules/products/index.js +24 -97
  32. package/lib/server/modules/resource/index.js +2 -7
  33. package/lib/solution/BookingByStep/index.d.ts +1 -1
  34. package/package.json +1 -1
@@ -78,7 +78,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
78
78
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeLoadedKey", '');
79
79
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshPromise", void 0);
80
80
  _defineProperty(_assertThisInitialized(_this), "quotationBridgeRefreshKey", void 0);
81
- _defineProperty(_assertThisInitialized(_this), "quotationBridgeUpdatedCallback", void 0);
82
81
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCache", new Map());
83
82
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheSource", null);
84
83
  _defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheLoaded", false);
@@ -291,9 +290,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
291
290
  value: (function () {
292
291
  var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
293
292
  var _this$otherParams,
294
- _this3 = this,
295
- _this$quotationPriceB,
296
- _this$quotationPriceB2;
293
+ _this3 = this;
297
294
  var channel, quotation;
298
295
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
299
296
  while (1) switch (_context3.prev = _context3.next) {
@@ -354,20 +351,11 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
354
351
  return schedules[0];
355
352
  });
356
353
  }
357
- if (params.onQuotationUpdated) {
358
- this.quotationBridgeUpdatedCallback = params.onQuotationUpdated;
359
- }
360
- (_this$quotationPriceB = (_this$quotationPriceB2 = this.quotationPriceBridge).setQuotationListUpdatedListener) === null || _this$quotationPriceB === void 0 || _this$quotationPriceB.call(_this$quotationPriceB2, function () {
361
- var _this3$quotationBridg;
362
- _this3.quotationBridgeLoadedKey = _this3.getQuotationBridgeScopeKey();
363
- _this3.clearPriceCache();
364
- (_this3$quotationBridg = _this3.quotationBridgeUpdatedCallback) === null || _this3$quotationBridg === void 0 || _this3$quotationBridg.call(_this3);
365
- });
366
- _context3.next = 15;
354
+ _context3.next = 13;
367
355
  return this.refreshQuotationPriceBridge({
368
356
  customer_id: params.customer_id
369
357
  });
370
- case 15:
358
+ case 13:
371
359
  case "end":
372
360
  return _context3.stop();
373
361
  }
@@ -1214,8 +1202,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1214
1202
  key: "clearPriceCache",
1215
1203
  value: function clearPriceCache() {
1216
1204
  this.productsPriceCache.clear();
1217
- this.quotationScheduleCache.clear();
1218
- this.quotationScheduleCacheLoaded = false;
1219
1205
  console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
1220
1206
  }
1221
1207
 
@@ -1226,76 +1212,62 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1226
1212
  key: "loadProductsByServer",
1227
1213
  value: (function () {
1228
1214
  var _loadProductsByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1229
- var options,
1230
- trigger,
1231
- t0,
1232
- tSSE,
1233
- productList,
1234
- list,
1235
- duration,
1236
- errorMessage,
1237
- _args9 = arguments;
1215
+ var t0, tSSE, productList, list, duration, errorMessage;
1238
1216
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1239
1217
  while (1) switch (_context9.prev = _context9.next) {
1240
1218
  case 0:
1241
- options = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
1242
1219
  if (this.productDataSource) {
1243
- _context9.next = 4;
1220
+ _context9.next = 3;
1244
1221
  break;
1245
1222
  }
1246
1223
  this.logWarning('loadProductsByServer: ProductDataSource 不可用');
1247
1224
  return _context9.abrupt("return", []);
1248
- case 4:
1249
- trigger = options.trigger || 'unknown';
1250
- this.logInfo('开始通过 DataSource SSE 加载商品列表', {
1251
- trigger: trigger
1252
- });
1225
+ case 3:
1226
+ this.logInfo('开始通过 DataSource SSE 加载商品列表');
1253
1227
  t0 = performance.now();
1254
- _context9.prev = 7;
1228
+ _context9.prev = 5;
1255
1229
  tSSE = performance.now();
1256
- _context9.next = 11;
1230
+ _context9.next = 9;
1257
1231
  return this.productDataSource.run({
1258
1232
  sse: {}
1259
1233
  });
1260
- case 11:
1234
+ case 9:
1261
1235
  productList = _context9.sent;
1262
1236
  list = productList || [];
1263
1237
  perfMark('loadProductsByServer.SSE', performance.now() - tSSE, {
1264
1238
  count: list.length
1265
1239
  });
1266
1240
  this.logInfo('通过 DataSource SSE 加载商品列表成功', {
1267
- trigger: trigger,
1268
1241
  productCount: list.length,
1269
1242
  duration: "".concat(Math.round(performance.now() - t0), "ms")
1270
1243
  });
1271
- _context9.next = 17;
1244
+ _context9.next = 15;
1272
1245
  return this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer');
1273
- case 17:
1246
+ case 15:
1274
1247
  this.lastServerFullFetchAtMs = Date.now();
1275
- _context9.next = 20;
1248
+ _context9.next = 18;
1276
1249
  return this.core.effects.emit(ProductsHooks.onProductsLoaded, list);
1277
- case 20:
1250
+ case 18:
1278
1251
  perfMark('loadProductsByServer', performance.now() - t0, {
1279
1252
  count: list.length
1280
1253
  });
1281
1254
  return _context9.abrupt("return", list);
1282
- case 24:
1283
- _context9.prev = 24;
1284
- _context9.t0 = _context9["catch"](7);
1255
+ case 22:
1256
+ _context9.prev = 22;
1257
+ _context9.t0 = _context9["catch"](5);
1285
1258
  duration = Math.round(performance.now() - t0);
1286
1259
  errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
1287
1260
  console.error('[Products] 加载商品数据失败:', _context9.t0);
1288
1261
  this.logError('通过 DataSource SSE 加载商品列表失败', {
1289
- trigger: trigger,
1290
1262
  duration: "".concat(duration, "ms"),
1291
1263
  error: errorMessage
1292
1264
  });
1293
1265
  return _context9.abrupt("return", []);
1294
- case 31:
1266
+ case 29:
1295
1267
  case "end":
1296
1268
  return _context9.stop();
1297
1269
  }
1298
- }, _callee9, this, [[7, 24]]);
1270
+ }, _callee9, this, [[5, 22]]);
1299
1271
  }));
1300
1272
  function loadProductsByServer() {
1301
1273
  return _loadProductsByServer.apply(this, arguments);
@@ -1692,9 +1664,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1692
1664
  tTotal = performance.now();
1693
1665
  this.logInfo('refreshProducts 开始');
1694
1666
  _context16.next = 4;
1695
- return this.loadProductsByServer({
1696
- trigger: 'product_sync'
1697
- });
1667
+ return this.loadProductsByServer();
1698
1668
  case 4:
1699
1669
  products = _context16.sent;
1700
1670
  if (products && products.length > 0) {
@@ -1786,7 +1756,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1786
1756
  key: "loadProductsFromIndexDB",
1787
1757
  value: (function () {
1788
1758
  var _loadProductsFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1789
- var startedAt, _products$length, _products$length2, products, durationMs, errorMessage;
1759
+ var _products$length, _products$length2, t0, products, errorMessage;
1790
1760
  return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1791
1761
  while (1) switch (_context18.prev = _context18.next) {
1792
1762
  case 0:
@@ -1797,36 +1767,33 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1797
1767
  this.logWarning('loadProductsFromIndexDB: dbManager 不可用');
1798
1768
  return _context18.abrupt("return", []);
1799
1769
  case 3:
1800
- startedAt = performance.now();
1801
- _context18.prev = 4;
1770
+ _context18.prev = 3;
1771
+ t0 = performance.now();
1802
1772
  _context18.next = 7;
1803
1773
  return this.dbManager.getAll(INDEXDB_STORE_NAME);
1804
1774
  case 7:
1805
1775
  products = _context18.sent;
1806
- durationMs = +(performance.now() - startedAt).toFixed(2);
1807
- perfMark('loadProductsFromIndexDB', durationMs, {
1776
+ perfMark('loadProductsFromIndexDB', performance.now() - t0, {
1808
1777
  count: (_products$length = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length !== void 0 ? _products$length : 0
1809
1778
  });
1810
1779
  this.logInfo('从 IndexDB 加载商品数据', {
1811
- productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0,
1812
- durationMs: durationMs
1780
+ productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0
1813
1781
  });
1814
1782
  return _context18.abrupt("return", products || []);
1815
- case 14:
1816
- _context18.prev = 14;
1817
- _context18.t0 = _context18["catch"](4);
1783
+ case 13:
1784
+ _context18.prev = 13;
1785
+ _context18.t0 = _context18["catch"](3);
1818
1786
  errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
1819
1787
  console.error('[Products] 从 IndexDB 读取数据失败:', _context18.t0);
1820
1788
  this.logError('从 IndexDB 读取数据失败', {
1821
- durationMs: +(performance.now() - startedAt).toFixed(2),
1822
1789
  error: errorMessage
1823
1790
  });
1824
1791
  return _context18.abrupt("return", []);
1825
- case 20:
1792
+ case 19:
1826
1793
  case "end":
1827
1794
  return _context18.stop();
1828
1795
  }
1829
- }, _callee18, this, [[4, 14]]);
1796
+ }, _callee18, this, [[3, 13]]);
1830
1797
  }));
1831
1798
  function loadProductsFromIndexDB() {
1832
1799
  return _loadProductsFromIndexDB.apply(this, arguments);
@@ -1880,7 +1847,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1880
1847
  value: (function () {
1881
1848
  var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(products, source) {
1882
1849
  var _this9 = this;
1883
- var enqueuedAt, queueWaitMs, clearDurationMs, writeDurationMs, errorMessage;
1850
+ var errorMessage;
1884
1851
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1885
1852
  while (1) switch (_context21.prev = _context21.next) {
1886
1853
  case 0:
@@ -1891,86 +1858,58 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
1891
1858
  this.logWarning('replaceProductsSnapshotInIndexDB: dbManager 不可用');
1892
1859
  return _context21.abrupt("return");
1893
1860
  case 3:
1894
- enqueuedAt = performance.now();
1895
- queueWaitMs = 0;
1896
- clearDurationMs = 0;
1897
- writeDurationMs = 0;
1898
- _context21.prev = 7;
1899
- _context21.next = 10;
1861
+ _context21.prev = 3;
1862
+ _context21.next = 6;
1900
1863
  return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1901
- var operationStartedAt, clearStartedAt, writeStartedAt, executeDurationMs;
1864
+ var t0;
1902
1865
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1903
1866
  while (1) switch (_context20.prev = _context20.next) {
1904
1867
  case 0:
1905
- operationStartedAt = performance.now();
1906
- queueWaitMs = +(operationStartedAt - enqueuedAt).toFixed(2);
1907
1868
  _this9.logInfo('replaceProductsSnapshotInIndexDB 开始', {
1908
1869
  source: source,
1909
- productCount: products.length,
1910
- queueWaitMs: queueWaitMs
1870
+ productCount: products.length
1911
1871
  });
1912
- clearStartedAt = performance.now();
1913
- _context20.prev = 4;
1914
- _context20.next = 7;
1872
+ t0 = performance.now();
1873
+ _context20.next = 4;
1915
1874
  return _this9.dbManager.clear(INDEXDB_STORE_NAME);
1916
- case 7:
1917
- _context20.prev = 7;
1918
- clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
1919
- return _context20.finish(7);
1920
- case 10:
1875
+ case 4:
1921
1876
  if (!(products.length > 0)) {
1922
- _context20.next = 18;
1877
+ _context20.next = 7;
1923
1878
  break;
1924
1879
  }
1925
- writeStartedAt = performance.now();
1926
- _context20.prev = 12;
1927
- _context20.next = 15;
1880
+ _context20.next = 7;
1928
1881
  return _this9.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
1929
- case 15:
1930
- _context20.prev = 15;
1931
- writeDurationMs = +(performance.now() - writeStartedAt).toFixed(2);
1932
- return _context20.finish(15);
1933
- case 18:
1934
- executeDurationMs = +(performance.now() - operationStartedAt).toFixed(2);
1935
- perfMark('replaceProductsSnapshotInIndexDB', executeDurationMs, {
1882
+ case 7:
1883
+ perfMark('replaceProductsSnapshotInIndexDB', performance.now() - t0, {
1936
1884
  count: products.length
1937
1885
  });
1938
1886
  _this9.logInfo('replaceProductsSnapshotInIndexDB 完成', {
1939
1887
  source: source,
1940
- productCount: products.length,
1941
- queueWaitMs: queueWaitMs,
1942
- clearDurationMs: clearDurationMs,
1943
- writeDurationMs: writeDurationMs,
1944
- executeDurationMs: executeDurationMs,
1945
- totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2)
1888
+ productCount: products.length
1946
1889
  });
1947
- case 21:
1890
+ case 9:
1948
1891
  case "end":
1949
1892
  return _context20.stop();
1950
1893
  }
1951
- }, _callee20, null, [[4,, 7, 10], [12,, 15, 18]]);
1894
+ }, _callee20);
1952
1895
  })));
1953
- case 10:
1954
- _context21.next = 16;
1896
+ case 6:
1897
+ _context21.next = 12;
1955
1898
  break;
1956
- case 12:
1957
- _context21.prev = 12;
1958
- _context21.t0 = _context21["catch"](7);
1899
+ case 8:
1900
+ _context21.prev = 8;
1901
+ _context21.t0 = _context21["catch"](3);
1959
1902
  errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
1960
1903
  this.logError('全量保存商品到 IndexDB 失败', {
1961
1904
  source: source,
1962
1905
  productCount: products.length,
1963
- queueWaitMs: queueWaitMs,
1964
- clearDurationMs: clearDurationMs,
1965
- writeDurationMs: writeDurationMs,
1966
- totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2),
1967
1906
  error: errorMessage
1968
1907
  });
1969
- case 16:
1908
+ case 12:
1970
1909
  case "end":
1971
1910
  return _context21.stop();
1972
1911
  }
1973
- }, _callee21, this, [[7, 12]]);
1912
+ }, _callee21, this, [[3, 8]]);
1974
1913
  }));
1975
1914
  function replaceProductsSnapshotInIndexDB(_x21, _x22) {
1976
1915
  return _replaceProductsSnapshotInIndexDB.apply(this, arguments);
@@ -2171,7 +2110,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2171
2110
  source: 'IndexDB'
2172
2111
  });
2173
2112
  this.logInfo('预加载完成(从 IndexDB)', {
2174
- trigger: 'preload',
2175
2113
  productCount: cachedData.length,
2176
2114
  duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
2177
2115
  source: 'IndexDB'
@@ -2194,9 +2132,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2194
2132
  case 29:
2195
2133
  tServer = performance.now();
2196
2134
  _context24.next = 32;
2197
- return this.loadProductsByServer({
2198
- trigger: 'preload'
2199
- });
2135
+ return this.loadProductsByServer();
2200
2136
  case 32:
2201
2137
  products = _context24.sent;
2202
2138
  perfMark('preload.loadFromServer', performance.now() - tServer, {
@@ -2216,7 +2152,6 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2216
2152
  source: 'Server'
2217
2153
  });
2218
2154
  this.logInfo('预加载完成(从服务器)', {
2219
- trigger: 'preload',
2220
2155
  productCount: products.length,
2221
2156
  duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
2222
2157
  source: 'Server'
@@ -2841,91 +2776,64 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
2841
2776
  key: "silentRefresh",
2842
2777
  value: (function () {
2843
2778
  var _silentRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2844
- var options,
2845
- t0,
2846
- now,
2847
- trigger,
2848
- elapsedSincePreloadMs,
2849
- elapsedSinceFullFetchMs,
2850
- products,
2851
- errorMessage,
2852
- _args29 = arguments;
2779
+ var t0, now, elapsedSincePreload, elapsedSinceFullFetch, products, errorMessage;
2853
2780
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2854
2781
  while (1) switch (_context29.prev = _context29.next) {
2855
2782
  case 0:
2856
- options = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
2857
2783
  t0 = performance.now();
2858
2784
  now = Date.now();
2859
- trigger = options.trigger || 'background';
2860
- elapsedSincePreloadMs = now - this.lastPreloadCompletedAtMs;
2861
- elapsedSinceFullFetchMs = now - this.lastServerFullFetchAtMs;
2862
- if (!(this.lastPreloadCompletedAtMs > 0 && elapsedSincePreloadMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetchMs < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS)) {
2863
- _context29.next = 9;
2785
+ elapsedSincePreload = now - this.lastPreloadCompletedAtMs;
2786
+ elapsedSinceFullFetch = now - this.lastServerFullFetchAtMs;
2787
+ if (!(this.lastPreloadCompletedAtMs > 0 && elapsedSincePreload < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS || this.lastServerFullFetchAtMs > 0 && elapsedSinceFullFetch < PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS)) {
2788
+ _context29.next = 6;
2864
2789
  break;
2865
2790
  }
2866
- this.logInfo('silentRefresh 跳过全量 SSE', {
2867
- trigger: trigger,
2868
- reason: 'within_min_interval',
2869
- minIntervalMs: PRODUCT_SILENT_REFRESH_MIN_INTERVAL_MS,
2870
- elapsedSincePreloadMs: elapsedSincePreloadMs,
2871
- elapsedSinceFullFetchMs: elapsedSinceFullFetchMs,
2872
- productCount: this.store.list.length
2873
- });
2874
2791
  return _context29.abrupt("return", this.store.list);
2875
- case 9:
2876
- this.logInfo('silentRefresh 开始', {
2877
- trigger: trigger,
2878
- elapsedSincePreloadMs: elapsedSincePreloadMs,
2879
- elapsedSinceFullFetchMs: elapsedSinceFullFetchMs,
2880
- productCount: this.store.list.length
2881
- });
2882
- _context29.prev = 10;
2883
- _context29.next = 13;
2884
- return this.loadProductsByServer({
2885
- trigger: trigger
2886
- });
2887
- case 13:
2792
+ case 6:
2793
+ this.logInfo('silentRefresh 开始');
2794
+ _context29.prev = 7;
2795
+ _context29.next = 10;
2796
+ return this.loadProductsByServer();
2797
+ case 10:
2888
2798
  products = _context29.sent;
2889
2799
  if (!(products && products.length > 0)) {
2890
- _context29.next = 24;
2800
+ _context29.next = 21;
2891
2801
  break;
2892
2802
  }
2893
2803
  this.store.list = products;
2894
2804
  this.syncProductsMap();
2895
2805
  this.clearPriceCache();
2896
2806
  this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
2897
- _context29.next = 21;
2807
+ _context29.next = 18;
2898
2808
  return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
2899
- case 21:
2809
+ case 18:
2900
2810
  this.logInfo('silentRefresh 完成', {
2901
- trigger: trigger,
2902
2811
  productCount: products.length,
2903
2812
  duration: "".concat(Math.round(performance.now() - t0), "ms")
2904
2813
  });
2905
- _context29.next = 25;
2814
+ _context29.next = 22;
2906
2815
  break;
2907
- case 24:
2816
+ case 21:
2908
2817
  this.logWarning('silentRefresh: 服务器未返回数据');
2909
- case 25:
2818
+ case 22:
2910
2819
  perfMark('silentRefresh', performance.now() - t0, {
2911
2820
  count: this.store.list.length
2912
2821
  });
2913
2822
  return _context29.abrupt("return", this.store.list);
2914
- case 29:
2915
- _context29.prev = 29;
2916
- _context29.t0 = _context29["catch"](10);
2823
+ case 26:
2824
+ _context29.prev = 26;
2825
+ _context29.t0 = _context29["catch"](7);
2917
2826
  errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
2918
2827
  this.logError('silentRefresh 失败', {
2919
- trigger: trigger,
2920
2828
  duration: "".concat(Math.round(performance.now() - t0), "ms"),
2921
2829
  error: errorMessage
2922
2830
  });
2923
2831
  return _context29.abrupt("return", this.store.list);
2924
- case 34:
2832
+ case 31:
2925
2833
  case "end":
2926
2834
  return _context29.stop();
2927
2835
  }
2928
- }, _callee29, this, [[10, 29]]);
2836
+ }, _callee29, this, [[7, 26]]);
2929
2837
  }));
2930
2838
  function silentRefresh() {
2931
2839
  return _silentRefresh.apply(this, arguments);
@@ -149,49 +149,41 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
149
149
  while (1) switch (_context2.prev = _context2.next) {
150
150
  case 0:
151
151
  _context2.next = 2;
152
- return this.loadResourcesFromSQLite();
152
+ return this.setupResourceSync();
153
153
  case 2:
154
+ _context2.next = 4;
155
+ return this.loadResourcesFromSQLite();
156
+ case 4:
154
157
  cachedResources = _context2.sent;
155
158
  if (!(cachedResources.length > 0)) {
156
- _context2.next = 10;
159
+ _context2.next = 12;
157
160
  break;
158
161
  }
159
162
  this.store.list = cloneDeep(cachedResources).map(function (item) {
160
163
  return _this3.normalizeResource(item);
161
164
  });
162
165
  this.syncResourcesMap();
163
- _context2.next = 8;
166
+ _context2.next = 10;
164
167
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
165
- case 8:
166
- // 二次启动优先使用 SQLite。pubsub 注册及远端校准继续在后台执行,
167
- // setupResourceSync 完成后会合并最新数据并回写 SQLite。
168
- void this.setupResourceSync().catch(function (error) {
169
- _this3.logError('后台初始化资源同步失败', error);
170
- });
171
- return _context2.abrupt("return");
172
168
  case 10:
173
- _context2.next = 12;
174
- return this.setupResourceSync();
169
+ _context2.next = 20;
170
+ break;
175
171
  case 12:
176
- if (!(this.store.list.length === 0)) {
177
- _context2.next = 21;
178
- break;
179
- }
180
- _context2.next = 15;
172
+ _context2.next = 14;
181
173
  return this.loadResourcesByServer();
182
- case 15:
174
+ case 14:
183
175
  resources = _context2.sent;
184
176
  if (!(resources.length > 0)) {
185
- _context2.next = 21;
177
+ _context2.next = 20;
186
178
  break;
187
179
  }
188
180
  this.store.list = cloneDeep(resources).map(function (item) {
189
181
  return _this3.normalizeResource(item);
190
182
  });
191
183
  this.syncResourcesMap();
192
- _context2.next = 21;
184
+ _context2.next = 20;
193
185
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
194
- case 21:
186
+ case 20:
195
187
  case "end":
196
188
  return _context2.stop();
197
189
  }
@@ -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 | 3 | 4 | 5 | 6;
329
+ weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -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 中获取
package/lib/core/index.js CHANGED
@@ -36,6 +36,7 @@ module.exports = __toCommonJS(core_exports);
36
36
  var import_createStore = require("../store/createStore");
37
37
  var import_effects = require("../effects");
38
38
  var PisellOSCore = class {
39
+ // 保存 Server 配置
39
40
  constructor(options) {
40
41
  this.plugins = /* @__PURE__ */ new Map();
41
42
  this.modules = /* @__PURE__ */ new Map();
@@ -49,7 +50,7 @@ var PisellOSCore = class {
49
50
  this.serverOptions = options.server;
50
51
  }
51
52
  this.initialize(options);
52
- console.log("constructor123456");
53
+ console.log("constructor1234");
53
54
  }
54
55
  initialize(options) {
55
56
  if (options == null ? void 0 : options.plugins) {
@@ -64,24 +65,6 @@ var PisellOSCore = class {
64
65
  }
65
66
  this.log("[PisellOS] 核心初始化完成");
66
67
  }
67
- /**
68
- * 仅预加载 Server 模块代码,不创建实例、不注册模块、不请求业务数据。
69
- * 导入失败会清空 Promise,正式 initializeServer 时仍可重新尝试。
70
- */
71
- async preloadServerModule() {
72
- if (this.server || !this.serverOptions)
73
- return;
74
- await this.loadServerModule();
75
- }
76
- loadServerModule() {
77
- if (!this.serverModulePromise) {
78
- this.serverModulePromise = import("../server").catch((error) => {
79
- this.serverModulePromise = void 0;
80
- throw error;
81
- });
82
- }
83
- return this.serverModulePromise;
84
- }
85
68
  /**
86
69
  * 初始化 Server(公开方法,需要外部显式调用并等待)
87
70
  * Server 配置从构造函数传入的 options.server 中获取
@@ -96,7 +79,7 @@ var PisellOSCore = class {
96
79
  return;
97
80
  }
98
81
  try {
99
- const ServerModule = await this.loadServerModule();
82
+ const ServerModule = await import("../server");
100
83
  const Server = ServerModule.default;
101
84
  this.server = new Server(this);
102
85
  this.log("Server 实例已创建");
@@ -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;