@pisell/pisellos 2.3.72 → 2.3.74
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/core/index.d.ts +7 -0
- package/dist/core/index.js +109 -65
- package/dist/modules/OpenData/types.d.ts +1 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.js +6 -1
- package/dist/modules/Quotation/index.d.ts +6 -0
- package/dist/modules/Quotation/index.js +75 -19
- package/dist/modules/ResourcePlanner/index.d.ts +0 -22
- package/dist/modules/ResourcePlanner/index.js +1 -180
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/ResourcePlanner/localClock.js +183 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
- package/dist/modules/ResourcePlanner/planner.js +2019 -936
- package/dist/modules/ResourcePlanner/types.d.ts +346 -187
- package/dist/modules/ResourcePlanner/types.js +33 -1
- package/dist/plugins/request.d.ts +1 -0
- package/dist/server/index.d.ts +8 -2
- package/dist/server/index.js +206 -140
- package/dist/server/modules/floor-plan/index.d.ts +4 -0
- package/dist/server/modules/floor-plan/index.js +240 -98
- package/dist/server/modules/menu/index.js +48 -23
- package/dist/server/modules/order/index.d.ts +17 -7
- package/dist/server/modules/order/index.js +419 -207
- package/dist/server/modules/products/index.d.ts +8 -2
- package/dist/server/modules/products/index.js +167 -75
- package/dist/server/modules/resource/index.js +21 -13
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +4 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +3 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/dist/solution/UnifiedBookingSales/index.js +3349 -971
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/dist/solution/UnifiedBookingSales/types.js +4 -9
- package/lib/core/index.d.ts +7 -0
- package/lib/core/index.js +20 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/OpenData/types.d.ts +1 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.js +5 -1
- package/lib/modules/Quotation/index.d.ts +6 -0
- package/lib/modules/Quotation/index.js +49 -5
- package/lib/modules/ResourcePlanner/index.d.ts +0 -22
- package/lib/modules/ResourcePlanner/index.js +0 -123
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/ResourcePlanner/localClock.js +270 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
- package/lib/modules/ResourcePlanner/planner.js +1903 -798
- package/lib/modules/ResourcePlanner/types.d.ts +346 -187
- package/lib/modules/ResourcePlanner/types.js +19 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +8 -2
- package/lib/server/index.js +52 -17
- package/lib/server/modules/floor-plan/index.d.ts +4 -0
- package/lib/server/modules/floor-plan/index.js +54 -6
- package/lib/server/modules/menu/index.js +31 -5
- package/lib/server/modules/order/index.d.ts +17 -7
- package/lib/server/modules/order/index.js +197 -40
- package/lib/server/modules/products/index.d.ts +8 -2
- package/lib/server/modules/products/index.js +97 -24
- package/lib/server/modules/resource/index.js +7 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +110 -73
- package/lib/solution/UnifiedBookingSales/index.js +2289 -374
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +376 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +133 -76
- package/lib/solution/UnifiedBookingSales/types.js +3 -2
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
25
25
|
private quotationBridgeLoadedKey?;
|
|
26
26
|
private quotationBridgeRefreshPromise?;
|
|
27
27
|
private quotationBridgeRefreshKey?;
|
|
28
|
+
private quotationBridgeUpdatedCallback?;
|
|
28
29
|
private quotationScheduleCache;
|
|
29
30
|
private quotationScheduleCacheSource;
|
|
30
31
|
private quotationScheduleCacheLoaded;
|
|
@@ -72,6 +73,7 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
72
73
|
scheduleModule?: any;
|
|
73
74
|
channel?: string;
|
|
74
75
|
customer_id?: number | string;
|
|
76
|
+
onQuotationUpdated?: () => void;
|
|
75
77
|
}): Promise<void>;
|
|
76
78
|
/**
|
|
77
79
|
* 刷新桥接器内的报价单列表。
|
|
@@ -181,7 +183,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
181
183
|
/**
|
|
182
184
|
* 通过 ProductDataSource SSE 加载完整商品列表
|
|
183
185
|
*/
|
|
184
|
-
loadProductsByServer(
|
|
186
|
+
loadProductsByServer(options?: {
|
|
187
|
+
trigger?: string;
|
|
188
|
+
}): Promise<any>;
|
|
185
189
|
/**
|
|
186
190
|
* 纯请求方法:通过 HTTP 接口获取商品列表(无副作用,不触发事件、不写 IndexDB)
|
|
187
191
|
* @param params 查询参数
|
|
@@ -331,7 +335,9 @@ export declare class ProductsModule extends BaseModule implements Module {
|
|
|
331
335
|
* 拿到完整数据后一次性替换 store,清除价格缓存,触发 onProductsSyncCompleted
|
|
332
336
|
* @returns 刷新后的商品列表
|
|
333
337
|
*/
|
|
334
|
-
silentRefresh(
|
|
338
|
+
silentRefresh(options?: {
|
|
339
|
+
trigger?: string;
|
|
340
|
+
}): Promise<ProductData[]>;
|
|
335
341
|
/**
|
|
336
342
|
* 销毁同步资源(取消 pubsub 订阅、清除定时器)
|
|
337
343
|
*/
|
|
@@ -78,6 +78,7 @@ 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);
|
|
81
82
|
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCache", new Map());
|
|
82
83
|
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheSource", null);
|
|
83
84
|
_defineProperty(_assertThisInitialized(_this), "quotationScheduleCacheLoaded", false);
|
|
@@ -290,7 +291,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
290
291
|
value: (function () {
|
|
291
292
|
var _setupQuotationPriceBridge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
292
293
|
var _this$otherParams,
|
|
293
|
-
_this3 = this
|
|
294
|
+
_this3 = this,
|
|
295
|
+
_this$quotationPriceB,
|
|
296
|
+
_this$quotationPriceB2;
|
|
294
297
|
var channel, quotation;
|
|
295
298
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
296
299
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -351,11 +354,20 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
351
354
|
return schedules[0];
|
|
352
355
|
});
|
|
353
356
|
}
|
|
354
|
-
|
|
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;
|
|
355
367
|
return this.refreshQuotationPriceBridge({
|
|
356
368
|
customer_id: params.customer_id
|
|
357
369
|
});
|
|
358
|
-
case
|
|
370
|
+
case 15:
|
|
359
371
|
case "end":
|
|
360
372
|
return _context3.stop();
|
|
361
373
|
}
|
|
@@ -1202,6 +1214,8 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1202
1214
|
key: "clearPriceCache",
|
|
1203
1215
|
value: function clearPriceCache() {
|
|
1204
1216
|
this.productsPriceCache.clear();
|
|
1217
|
+
this.quotationScheduleCache.clear();
|
|
1218
|
+
this.quotationScheduleCacheLoaded = false;
|
|
1205
1219
|
console.log('[ProductsModule] 🗑️ 商品价格缓存已清空');
|
|
1206
1220
|
}
|
|
1207
1221
|
|
|
@@ -1212,62 +1226,76 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1212
1226
|
key: "loadProductsByServer",
|
|
1213
1227
|
value: (function () {
|
|
1214
1228
|
var _loadProductsByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
1215
|
-
var
|
|
1229
|
+
var options,
|
|
1230
|
+
trigger,
|
|
1231
|
+
t0,
|
|
1232
|
+
tSSE,
|
|
1233
|
+
productList,
|
|
1234
|
+
list,
|
|
1235
|
+
duration,
|
|
1236
|
+
errorMessage,
|
|
1237
|
+
_args9 = arguments;
|
|
1216
1238
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1217
1239
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1218
1240
|
case 0:
|
|
1241
|
+
options = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
|
|
1219
1242
|
if (this.productDataSource) {
|
|
1220
|
-
_context9.next =
|
|
1243
|
+
_context9.next = 4;
|
|
1221
1244
|
break;
|
|
1222
1245
|
}
|
|
1223
1246
|
this.logWarning('loadProductsByServer: ProductDataSource 不可用');
|
|
1224
1247
|
return _context9.abrupt("return", []);
|
|
1225
|
-
case
|
|
1226
|
-
|
|
1248
|
+
case 4:
|
|
1249
|
+
trigger = options.trigger || 'unknown';
|
|
1250
|
+
this.logInfo('开始通过 DataSource SSE 加载商品列表', {
|
|
1251
|
+
trigger: trigger
|
|
1252
|
+
});
|
|
1227
1253
|
t0 = performance.now();
|
|
1228
|
-
_context9.prev =
|
|
1254
|
+
_context9.prev = 7;
|
|
1229
1255
|
tSSE = performance.now();
|
|
1230
|
-
_context9.next =
|
|
1256
|
+
_context9.next = 11;
|
|
1231
1257
|
return this.productDataSource.run({
|
|
1232
1258
|
sse: {}
|
|
1233
1259
|
});
|
|
1234
|
-
case
|
|
1260
|
+
case 11:
|
|
1235
1261
|
productList = _context9.sent;
|
|
1236
1262
|
list = productList || [];
|
|
1237
1263
|
perfMark('loadProductsByServer.SSE', performance.now() - tSSE, {
|
|
1238
1264
|
count: list.length
|
|
1239
1265
|
});
|
|
1240
1266
|
this.logInfo('通过 DataSource SSE 加载商品列表成功', {
|
|
1267
|
+
trigger: trigger,
|
|
1241
1268
|
productCount: list.length,
|
|
1242
1269
|
duration: "".concat(Math.round(performance.now() - t0), "ms")
|
|
1243
1270
|
});
|
|
1244
|
-
_context9.next =
|
|
1271
|
+
_context9.next = 17;
|
|
1245
1272
|
return this.replaceProductsSnapshotInIndexDB(list, 'loadProductsByServer');
|
|
1246
|
-
case
|
|
1273
|
+
case 17:
|
|
1247
1274
|
this.lastServerFullFetchAtMs = Date.now();
|
|
1248
|
-
_context9.next =
|
|
1275
|
+
_context9.next = 20;
|
|
1249
1276
|
return this.core.effects.emit(ProductsHooks.onProductsLoaded, list);
|
|
1250
|
-
case
|
|
1277
|
+
case 20:
|
|
1251
1278
|
perfMark('loadProductsByServer', performance.now() - t0, {
|
|
1252
1279
|
count: list.length
|
|
1253
1280
|
});
|
|
1254
1281
|
return _context9.abrupt("return", list);
|
|
1255
|
-
case
|
|
1256
|
-
_context9.prev =
|
|
1257
|
-
_context9.t0 = _context9["catch"](
|
|
1282
|
+
case 24:
|
|
1283
|
+
_context9.prev = 24;
|
|
1284
|
+
_context9.t0 = _context9["catch"](7);
|
|
1258
1285
|
duration = Math.round(performance.now() - t0);
|
|
1259
1286
|
errorMessage = _context9.t0 instanceof Error ? _context9.t0.message : String(_context9.t0);
|
|
1260
1287
|
console.error('[Products] 加载商品数据失败:', _context9.t0);
|
|
1261
1288
|
this.logError('通过 DataSource SSE 加载商品列表失败', {
|
|
1289
|
+
trigger: trigger,
|
|
1262
1290
|
duration: "".concat(duration, "ms"),
|
|
1263
1291
|
error: errorMessage
|
|
1264
1292
|
});
|
|
1265
1293
|
return _context9.abrupt("return", []);
|
|
1266
|
-
case
|
|
1294
|
+
case 31:
|
|
1267
1295
|
case "end":
|
|
1268
1296
|
return _context9.stop();
|
|
1269
1297
|
}
|
|
1270
|
-
}, _callee9, this, [[
|
|
1298
|
+
}, _callee9, this, [[7, 24]]);
|
|
1271
1299
|
}));
|
|
1272
1300
|
function loadProductsByServer() {
|
|
1273
1301
|
return _loadProductsByServer.apply(this, arguments);
|
|
@@ -1664,7 +1692,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1664
1692
|
tTotal = performance.now();
|
|
1665
1693
|
this.logInfo('refreshProducts 开始');
|
|
1666
1694
|
_context16.next = 4;
|
|
1667
|
-
return this.loadProductsByServer(
|
|
1695
|
+
return this.loadProductsByServer({
|
|
1696
|
+
trigger: 'product_sync'
|
|
1697
|
+
});
|
|
1668
1698
|
case 4:
|
|
1669
1699
|
products = _context16.sent;
|
|
1670
1700
|
if (products && products.length > 0) {
|
|
@@ -1756,7 +1786,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1756
1786
|
key: "loadProductsFromIndexDB",
|
|
1757
1787
|
value: (function () {
|
|
1758
1788
|
var _loadProductsFromIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1759
|
-
var _products$length, _products$length2,
|
|
1789
|
+
var startedAt, _products$length, _products$length2, products, durationMs, errorMessage;
|
|
1760
1790
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1761
1791
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1762
1792
|
case 0:
|
|
@@ -1767,33 +1797,36 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1767
1797
|
this.logWarning('loadProductsFromIndexDB: dbManager 不可用');
|
|
1768
1798
|
return _context18.abrupt("return", []);
|
|
1769
1799
|
case 3:
|
|
1770
|
-
|
|
1771
|
-
|
|
1800
|
+
startedAt = performance.now();
|
|
1801
|
+
_context18.prev = 4;
|
|
1772
1802
|
_context18.next = 7;
|
|
1773
1803
|
return this.dbManager.getAll(INDEXDB_STORE_NAME);
|
|
1774
1804
|
case 7:
|
|
1775
1805
|
products = _context18.sent;
|
|
1776
|
-
|
|
1806
|
+
durationMs = +(performance.now() - startedAt).toFixed(2);
|
|
1807
|
+
perfMark('loadProductsFromIndexDB', durationMs, {
|
|
1777
1808
|
count: (_products$length = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length !== void 0 ? _products$length : 0
|
|
1778
1809
|
});
|
|
1779
1810
|
this.logInfo('从 IndexDB 加载商品数据', {
|
|
1780
|
-
productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0
|
|
1811
|
+
productCount: (_products$length2 = products === null || products === void 0 ? void 0 : products.length) !== null && _products$length2 !== void 0 ? _products$length2 : 0,
|
|
1812
|
+
durationMs: durationMs
|
|
1781
1813
|
});
|
|
1782
1814
|
return _context18.abrupt("return", products || []);
|
|
1783
|
-
case
|
|
1784
|
-
_context18.prev =
|
|
1785
|
-
_context18.t0 = _context18["catch"](
|
|
1815
|
+
case 14:
|
|
1816
|
+
_context18.prev = 14;
|
|
1817
|
+
_context18.t0 = _context18["catch"](4);
|
|
1786
1818
|
errorMessage = _context18.t0 instanceof Error ? _context18.t0.message : String(_context18.t0);
|
|
1787
1819
|
console.error('[Products] 从 IndexDB 读取数据失败:', _context18.t0);
|
|
1788
1820
|
this.logError('从 IndexDB 读取数据失败', {
|
|
1821
|
+
durationMs: +(performance.now() - startedAt).toFixed(2),
|
|
1789
1822
|
error: errorMessage
|
|
1790
1823
|
});
|
|
1791
1824
|
return _context18.abrupt("return", []);
|
|
1792
|
-
case
|
|
1825
|
+
case 20:
|
|
1793
1826
|
case "end":
|
|
1794
1827
|
return _context18.stop();
|
|
1795
1828
|
}
|
|
1796
|
-
}, _callee18, this, [[
|
|
1829
|
+
}, _callee18, this, [[4, 14]]);
|
|
1797
1830
|
}));
|
|
1798
1831
|
function loadProductsFromIndexDB() {
|
|
1799
1832
|
return _loadProductsFromIndexDB.apply(this, arguments);
|
|
@@ -1847,7 +1880,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1847
1880
|
value: (function () {
|
|
1848
1881
|
var _replaceProductsSnapshotInIndexDB = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(products, source) {
|
|
1849
1882
|
var _this9 = this;
|
|
1850
|
-
var errorMessage;
|
|
1883
|
+
var enqueuedAt, queueWaitMs, clearDurationMs, writeDurationMs, errorMessage;
|
|
1851
1884
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
1852
1885
|
while (1) switch (_context21.prev = _context21.next) {
|
|
1853
1886
|
case 0:
|
|
@@ -1858,58 +1891,86 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
1858
1891
|
this.logWarning('replaceProductsSnapshotInIndexDB: dbManager 不可用');
|
|
1859
1892
|
return _context21.abrupt("return");
|
|
1860
1893
|
case 3:
|
|
1861
|
-
|
|
1862
|
-
|
|
1894
|
+
enqueuedAt = performance.now();
|
|
1895
|
+
queueWaitMs = 0;
|
|
1896
|
+
clearDurationMs = 0;
|
|
1897
|
+
writeDurationMs = 0;
|
|
1898
|
+
_context21.prev = 7;
|
|
1899
|
+
_context21.next = 10;
|
|
1863
1900
|
return this.runInProductIndexDBSaveQueue( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1864
|
-
var
|
|
1901
|
+
var operationStartedAt, clearStartedAt, writeStartedAt, executeDurationMs;
|
|
1865
1902
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1866
1903
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1867
1904
|
case 0:
|
|
1905
|
+
operationStartedAt = performance.now();
|
|
1906
|
+
queueWaitMs = +(operationStartedAt - enqueuedAt).toFixed(2);
|
|
1868
1907
|
_this9.logInfo('replaceProductsSnapshotInIndexDB 开始', {
|
|
1869
1908
|
source: source,
|
|
1870
|
-
productCount: products.length
|
|
1909
|
+
productCount: products.length,
|
|
1910
|
+
queueWaitMs: queueWaitMs
|
|
1871
1911
|
});
|
|
1872
|
-
|
|
1873
|
-
_context20.
|
|
1912
|
+
clearStartedAt = performance.now();
|
|
1913
|
+
_context20.prev = 4;
|
|
1914
|
+
_context20.next = 7;
|
|
1874
1915
|
return _this9.dbManager.clear(INDEXDB_STORE_NAME);
|
|
1875
|
-
case
|
|
1916
|
+
case 7:
|
|
1917
|
+
_context20.prev = 7;
|
|
1918
|
+
clearDurationMs = +(performance.now() - clearStartedAt).toFixed(2);
|
|
1919
|
+
return _context20.finish(7);
|
|
1920
|
+
case 10:
|
|
1876
1921
|
if (!(products.length > 0)) {
|
|
1877
|
-
_context20.next =
|
|
1922
|
+
_context20.next = 18;
|
|
1878
1923
|
break;
|
|
1879
1924
|
}
|
|
1880
|
-
|
|
1925
|
+
writeStartedAt = performance.now();
|
|
1926
|
+
_context20.prev = 12;
|
|
1927
|
+
_context20.next = 15;
|
|
1881
1928
|
return _this9.dbManager.bulkUpdate(INDEXDB_STORE_NAME, products);
|
|
1882
|
-
case
|
|
1883
|
-
|
|
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, {
|
|
1884
1936
|
count: products.length
|
|
1885
1937
|
});
|
|
1886
1938
|
_this9.logInfo('replaceProductsSnapshotInIndexDB 完成', {
|
|
1887
1939
|
source: source,
|
|
1888
|
-
productCount: products.length
|
|
1940
|
+
productCount: products.length,
|
|
1941
|
+
queueWaitMs: queueWaitMs,
|
|
1942
|
+
clearDurationMs: clearDurationMs,
|
|
1943
|
+
writeDurationMs: writeDurationMs,
|
|
1944
|
+
executeDurationMs: executeDurationMs,
|
|
1945
|
+
totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2)
|
|
1889
1946
|
});
|
|
1890
|
-
case
|
|
1947
|
+
case 21:
|
|
1891
1948
|
case "end":
|
|
1892
1949
|
return _context20.stop();
|
|
1893
1950
|
}
|
|
1894
|
-
}, _callee20);
|
|
1951
|
+
}, _callee20, null, [[4,, 7, 10], [12,, 15, 18]]);
|
|
1895
1952
|
})));
|
|
1896
|
-
case
|
|
1897
|
-
_context21.next =
|
|
1953
|
+
case 10:
|
|
1954
|
+
_context21.next = 16;
|
|
1898
1955
|
break;
|
|
1899
|
-
case
|
|
1900
|
-
_context21.prev =
|
|
1901
|
-
_context21.t0 = _context21["catch"](
|
|
1956
|
+
case 12:
|
|
1957
|
+
_context21.prev = 12;
|
|
1958
|
+
_context21.t0 = _context21["catch"](7);
|
|
1902
1959
|
errorMessage = _context21.t0 instanceof Error ? _context21.t0.message : String(_context21.t0);
|
|
1903
1960
|
this.logError('全量保存商品到 IndexDB 失败', {
|
|
1904
1961
|
source: source,
|
|
1905
1962
|
productCount: products.length,
|
|
1963
|
+
queueWaitMs: queueWaitMs,
|
|
1964
|
+
clearDurationMs: clearDurationMs,
|
|
1965
|
+
writeDurationMs: writeDurationMs,
|
|
1966
|
+
totalDurationMs: +(performance.now() - enqueuedAt).toFixed(2),
|
|
1906
1967
|
error: errorMessage
|
|
1907
1968
|
});
|
|
1908
|
-
case
|
|
1969
|
+
case 16:
|
|
1909
1970
|
case "end":
|
|
1910
1971
|
return _context21.stop();
|
|
1911
1972
|
}
|
|
1912
|
-
}, _callee21, this, [[
|
|
1973
|
+
}, _callee21, this, [[7, 12]]);
|
|
1913
1974
|
}));
|
|
1914
1975
|
function replaceProductsSnapshotInIndexDB(_x21, _x22) {
|
|
1915
1976
|
return _replaceProductsSnapshotInIndexDB.apply(this, arguments);
|
|
@@ -2110,6 +2171,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2110
2171
|
source: 'IndexDB'
|
|
2111
2172
|
});
|
|
2112
2173
|
this.logInfo('预加载完成(从 IndexDB)', {
|
|
2174
|
+
trigger: 'preload',
|
|
2113
2175
|
productCount: cachedData.length,
|
|
2114
2176
|
duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
|
|
2115
2177
|
source: 'IndexDB'
|
|
@@ -2132,7 +2194,9 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2132
2194
|
case 29:
|
|
2133
2195
|
tServer = performance.now();
|
|
2134
2196
|
_context24.next = 32;
|
|
2135
|
-
return this.loadProductsByServer(
|
|
2197
|
+
return this.loadProductsByServer({
|
|
2198
|
+
trigger: 'preload'
|
|
2199
|
+
});
|
|
2136
2200
|
case 32:
|
|
2137
2201
|
products = _context24.sent;
|
|
2138
2202
|
perfMark('preload.loadFromServer', performance.now() - tServer, {
|
|
@@ -2152,6 +2216,7 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2152
2216
|
source: 'Server'
|
|
2153
2217
|
});
|
|
2154
2218
|
this.logInfo('预加载完成(从服务器)', {
|
|
2219
|
+
trigger: 'preload',
|
|
2155
2220
|
productCount: products.length,
|
|
2156
2221
|
duration: "".concat(Math.round(performance.now() - tTotal), "ms"),
|
|
2157
2222
|
source: 'Server'
|
|
@@ -2776,64 +2841,91 @@ export var ProductsModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
2776
2841
|
key: "silentRefresh",
|
|
2777
2842
|
value: (function () {
|
|
2778
2843
|
var _silentRefresh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2779
|
-
var
|
|
2844
|
+
var options,
|
|
2845
|
+
t0,
|
|
2846
|
+
now,
|
|
2847
|
+
trigger,
|
|
2848
|
+
elapsedSincePreloadMs,
|
|
2849
|
+
elapsedSinceFullFetchMs,
|
|
2850
|
+
products,
|
|
2851
|
+
errorMessage,
|
|
2852
|
+
_args29 = arguments;
|
|
2780
2853
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2781
2854
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2782
2855
|
case 0:
|
|
2856
|
+
options = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
|
|
2783
2857
|
t0 = performance.now();
|
|
2784
2858
|
now = Date.now();
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
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;
|
|
2789
2864
|
break;
|
|
2790
2865
|
}
|
|
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
|
+
});
|
|
2791
2874
|
return _context29.abrupt("return", this.store.list);
|
|
2792
|
-
case
|
|
2793
|
-
this.logInfo('silentRefresh 开始'
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
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:
|
|
2798
2888
|
products = _context29.sent;
|
|
2799
2889
|
if (!(products && products.length > 0)) {
|
|
2800
|
-
_context29.next =
|
|
2890
|
+
_context29.next = 24;
|
|
2801
2891
|
break;
|
|
2802
2892
|
}
|
|
2803
2893
|
this.store.list = products;
|
|
2804
2894
|
this.syncProductsMap();
|
|
2805
2895
|
this.clearPriceCache();
|
|
2806
2896
|
this.core.effects.emit(ProductsHooks.onProductsChanged, this.store.list);
|
|
2807
|
-
_context29.next =
|
|
2897
|
+
_context29.next = 21;
|
|
2808
2898
|
return this.core.effects.emit(ProductsHooks.onProductsSyncCompleted, null);
|
|
2809
|
-
case
|
|
2899
|
+
case 21:
|
|
2810
2900
|
this.logInfo('silentRefresh 完成', {
|
|
2901
|
+
trigger: trigger,
|
|
2811
2902
|
productCount: products.length,
|
|
2812
2903
|
duration: "".concat(Math.round(performance.now() - t0), "ms")
|
|
2813
2904
|
});
|
|
2814
|
-
_context29.next =
|
|
2905
|
+
_context29.next = 25;
|
|
2815
2906
|
break;
|
|
2816
|
-
case
|
|
2907
|
+
case 24:
|
|
2817
2908
|
this.logWarning('silentRefresh: 服务器未返回数据');
|
|
2818
|
-
case
|
|
2909
|
+
case 25:
|
|
2819
2910
|
perfMark('silentRefresh', performance.now() - t0, {
|
|
2820
2911
|
count: this.store.list.length
|
|
2821
2912
|
});
|
|
2822
2913
|
return _context29.abrupt("return", this.store.list);
|
|
2823
|
-
case
|
|
2824
|
-
_context29.prev =
|
|
2825
|
-
_context29.t0 = _context29["catch"](
|
|
2914
|
+
case 29:
|
|
2915
|
+
_context29.prev = 29;
|
|
2916
|
+
_context29.t0 = _context29["catch"](10);
|
|
2826
2917
|
errorMessage = _context29.t0 instanceof Error ? _context29.t0.message : String(_context29.t0);
|
|
2827
2918
|
this.logError('silentRefresh 失败', {
|
|
2919
|
+
trigger: trigger,
|
|
2828
2920
|
duration: "".concat(Math.round(performance.now() - t0), "ms"),
|
|
2829
2921
|
error: errorMessage
|
|
2830
2922
|
});
|
|
2831
2923
|
return _context29.abrupt("return", this.store.list);
|
|
2832
|
-
case
|
|
2924
|
+
case 34:
|
|
2833
2925
|
case "end":
|
|
2834
2926
|
return _context29.stop();
|
|
2835
2927
|
}
|
|
2836
|
-
}, _callee29, this, [[
|
|
2928
|
+
}, _callee29, this, [[10, 29]]);
|
|
2837
2929
|
}));
|
|
2838
2930
|
function silentRefresh() {
|
|
2839
2931
|
return _silentRefresh.apply(this, arguments);
|
|
@@ -149,41 +149,49 @@ 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.setupResourceSync();
|
|
153
|
-
case 2:
|
|
154
|
-
_context2.next = 4;
|
|
155
152
|
return this.loadResourcesFromSQLite();
|
|
156
|
-
case
|
|
153
|
+
case 2:
|
|
157
154
|
cachedResources = _context2.sent;
|
|
158
155
|
if (!(cachedResources.length > 0)) {
|
|
159
|
-
_context2.next =
|
|
156
|
+
_context2.next = 10;
|
|
160
157
|
break;
|
|
161
158
|
}
|
|
162
159
|
this.store.list = cloneDeep(cachedResources).map(function (item) {
|
|
163
160
|
return _this3.normalizeResource(item);
|
|
164
161
|
});
|
|
165
162
|
this.syncResourcesMap();
|
|
166
|
-
_context2.next =
|
|
163
|
+
_context2.next = 8;
|
|
167
164
|
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");
|
|
168
172
|
case 10:
|
|
169
|
-
_context2.next =
|
|
170
|
-
|
|
173
|
+
_context2.next = 12;
|
|
174
|
+
return this.setupResourceSync();
|
|
171
175
|
case 12:
|
|
172
|
-
|
|
176
|
+
if (!(this.store.list.length === 0)) {
|
|
177
|
+
_context2.next = 21;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
_context2.next = 15;
|
|
173
181
|
return this.loadResourcesByServer();
|
|
174
|
-
case
|
|
182
|
+
case 15:
|
|
175
183
|
resources = _context2.sent;
|
|
176
184
|
if (!(resources.length > 0)) {
|
|
177
|
-
_context2.next =
|
|
185
|
+
_context2.next = 21;
|
|
178
186
|
break;
|
|
179
187
|
}
|
|
180
188
|
this.store.list = cloneDeep(resources).map(function (item) {
|
|
181
189
|
return _this3.normalizeResource(item);
|
|
182
190
|
});
|
|
183
191
|
this.syncResourcesMap();
|
|
184
|
-
_context2.next =
|
|
192
|
+
_context2.next = 21;
|
|
185
193
|
return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
|
|
186
|
-
case
|
|
194
|
+
case 21:
|
|
187
195
|
case "end":
|
|
188
196
|
return _context2.stop();
|
|
189
197
|
}
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -2337,14 +2337,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2337
2337
|
var bookingContextState = this.store.bookingContext.getState();
|
|
2338
2338
|
var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
|
|
2339
2339
|
var orderCustomerId = (_ref12 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get4 = this.store.order.getTempOrder()) === null || _this$store$order$get4 === void 0 ? void 0 : _this$store$order$get4.customer_id) !== null && _ref12 !== void 0 ? _ref12 : undefined;
|
|
2340
|
-
return _objectSpread({
|
|
2340
|
+
return _objectSpread(_objectSpread({
|
|
2341
2341
|
bookingConfig: bookingContextState.bookingConfig,
|
|
2342
2342
|
resourcesOrigin: bookingContextState.resourcesOrigin,
|
|
2343
2343
|
resourcesOriginMap: bookingContextState.resourcesOriginMap,
|
|
2344
2344
|
date: date,
|
|
2345
2345
|
presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
|
|
2346
2346
|
customerId: orderCustomerId
|
|
2347
|
-
}, extra || {})
|
|
2347
|
+
}, extra || {}), {}, {
|
|
2348
|
+
channel: this.getSubmitOrderSalesChannel()
|
|
2349
|
+
});
|
|
2348
2350
|
}
|
|
2349
2351
|
|
|
2350
2352
|
/**
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -65,6 +65,7 @@ export interface AddProductDecideContext extends BookingCalcContext {
|
|
|
65
65
|
type?: 'select' | 'detail';
|
|
66
66
|
quantity?: number;
|
|
67
67
|
customerId?: number | string;
|
|
68
|
+
channel?: string;
|
|
68
69
|
}
|
|
69
70
|
/**
|
|
70
71
|
* 统一补齐预约商品的运行态字段。
|
|
@@ -13,7 +13,7 @@ import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
|
13
13
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
14
14
|
*
|
|
15
15
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
16
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
16
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(kiosk 强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
17
17
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -30,10 +30,11 @@ function needsSpecDetailModal(item) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
33
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(kiosk 强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
34
34
|
*/
|
|
35
35
|
function needsBookingEdit(cacheItem, ctx) {
|
|
36
36
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
37
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel) === 'kiosk') return true;
|
|
37
38
|
var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
|
|
38
39
|
return true;
|
|
39
40
|
};
|