@pisell/pisellos 2.3.214 → 2.3.216

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.
@@ -314,6 +314,12 @@ var Server = /*#__PURE__*/function () {
314
314
  while (1) switch (_context3.prev = _context3.next) {
315
315
  case 0:
316
316
  url = _ref5.url, method = _ref5.method, data = _ref5.data, config = _ref5.config;
317
+ if (!((data === null || data === void 0 ? void 0 : data.open_quotation) === 0 && (data === null || data === void 0 ? void 0 : data.application_code) === 'kiosk')) {
318
+ _context3.next = 3;
319
+ break;
320
+ }
321
+ return _context3.abrupt("return", _this.queryRawKioskProductPool(data));
322
+ case 3:
317
323
  menu_list_ids = data.menu_list_ids, customer_id = data.customer_id, ids = data.ids, extension_type = data.extension_type, application_code = data.application_code, strategy_context = data.strategy_context;
318
324
  _this$resolveProductQ = _this.resolveProductQueryScheduleContext({
319
325
  schedule_date: data.schedule_date,
@@ -350,7 +356,7 @@ var Server = /*#__PURE__*/function () {
350
356
  totalSubscribers: _this.productQuerySubscribers.size
351
357
  });
352
358
  }
353
- _context3.next = 8;
359
+ _context3.next = 10;
354
360
  return _this.computeProductQueryResult({
355
361
  menu_list_ids: menu_list_ids,
356
362
  ids: ids,
@@ -361,7 +367,7 @@ var Server = /*#__PURE__*/function () {
361
367
  application_code: application_code,
362
368
  strategy_context: strategy_context
363
369
  });
364
- case 8:
370
+ case 10:
365
371
  result = _context3.sent;
366
372
  if (subscriberId && typeof callback === 'function') {
367
373
  _this.syncProductQueryScheduleTimers({
@@ -371,7 +377,7 @@ var Server = /*#__PURE__*/function () {
371
377
  });
372
378
  }
373
379
  return _context3.abrupt("return", result);
374
- case 11:
380
+ case 13:
375
381
  case "end":
376
382
  return _context3.stop();
377
383
  }
@@ -4207,13 +4213,91 @@ var Server = /*#__PURE__*/function () {
4207
4213
  }
4208
4214
  }
4209
4215
  }, {
4210
- key: "resolveProductQueryScheduleContext",
4211
- value:
4216
+ key: "queryRawKioskProductPool",
4217
+ value: function () {
4218
+ var _queryRawKioskProductPool = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(data) {
4219
+ var _this$products3;
4220
+ var preload, products, filterSet, ids, collections, categories, extensionTypes, list;
4221
+ return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4222
+ while (1) switch (_context50.prev = _context50.next) {
4223
+ case 0:
4224
+ preload = this.startupModulePreloadInFlight;
4225
+ if (!preload) {
4226
+ _context50.next = 4;
4227
+ break;
4228
+ }
4229
+ _context50.next = 4;
4230
+ return preload;
4231
+ case 4:
4232
+ if ((_this$products3 = this.products) !== null && _this$products3 !== void 0 && _this$products3.getProducts) {
4233
+ _context50.next = 6;
4234
+ break;
4235
+ }
4236
+ throw new Error('The local product catalog is not ready.');
4237
+ case 6:
4238
+ _context50.next = 8;
4239
+ return this.products.getProducts();
4240
+ case 8:
4241
+ products = _context50.sent;
4242
+ if (Array.isArray(products)) {
4243
+ _context50.next = 11;
4244
+ break;
4245
+ }
4246
+ throw new Error('The local product catalog is unavailable.');
4247
+ case 11:
4248
+ filterSet = function filterSet(value) {
4249
+ return Array.isArray(value) && value.length ? new Set(value.filter(function (item) {
4250
+ return typeof item === 'string' || typeof item === 'number';
4251
+ }).map(function (item) {
4252
+ return String(item).trim();
4253
+ }).filter(Boolean)) : undefined;
4254
+ };
4255
+ ids = filterSet(data.ids);
4256
+ collections = filterSet(typeof data.collection === 'number' ? [data.collection] : data.collection);
4257
+ categories = filterSet(data.category_ids);
4258
+ extensionTypes = filterSet(data.extension_type);
4259
+ list = products.filter(function (product) {
4260
+ var _product$collection, _product$categories;
4261
+ if ((product.status || 'published') !== 'published' || 'deleted_at' in product && product.deleted_at) return false;
4262
+ if (!Array.isArray(product.channel_application) || !product.channel_application.includes('kiosk')) return false;
4263
+ if (ids && !ids.has(String(product.id))) return false;
4264
+ if (collections && !((_product$collection = product.collection) !== null && _product$collection !== void 0 && _product$collection.some(function (collection) {
4265
+ return collections.has(String(collection.id));
4266
+ }))) return false;
4267
+ if (categories && !((_product$categories = product.categories) !== null && _product$categories !== void 0 && _product$categories.some(function (category) {
4268
+ var _category$pivot;
4269
+ return categories.has(String(category.id)) || categories.has(String((_category$pivot = category.pivot) === null || _category$pivot === void 0 ? void 0 : _category$pivot.product_category_id));
4270
+ }))) return false;
4271
+ return !extensionTypes || extensionTypes.has(String(product.extension_type));
4272
+ });
4273
+ return _context50.abrupt("return", {
4274
+ code: 200,
4275
+ status: true,
4276
+ message: '',
4277
+ data: {
4278
+ list: list,
4279
+ count: list.length,
4280
+ schedule_time_points: []
4281
+ }
4282
+ });
4283
+ case 18:
4284
+ case "end":
4285
+ return _context50.stop();
4286
+ }
4287
+ }, _callee50, this);
4288
+ }));
4289
+ function queryRawKioskProductPool(_x50) {
4290
+ return _queryRawKioskProductPool.apply(this, arguments);
4291
+ }
4292
+ return queryRawKioskProductPool;
4293
+ }()
4212
4294
  /**
4213
4295
  * ProductList callers such as standalone retail pages do not always have a selected schedule.
4214
4296
  * In that case query against the current local time so menu availability can still be evaluated.
4215
4297
  */
4216
- function resolveProductQueryScheduleContext(params) {
4298
+ }, {
4299
+ key: "resolveProductQueryScheduleContext",
4300
+ value: function resolveProductQueryScheduleContext(params) {
4217
4301
  var now = dayjs();
4218
4302
  var schedule_datetime = typeof params.schedule_datetime === 'string' && params.schedule_datetime.trim() ? params.schedule_datetime : now.format('YYYY-MM-DD HH:mm:ss');
4219
4303
  var schedule_date = typeof params.schedule_date === 'string' && params.schedule_date.trim() ? params.schedule_date : dayjs(schedule_datetime).isValid() ? dayjs(schedule_datetime).format('YYYY-MM-DD') : now.format('YYYY-MM-DD');
@@ -4230,24 +4314,24 @@ var Server = /*#__PURE__*/function () {
4230
4314
  }, {
4231
4315
  key: "refreshMenuScheduleCacheAfterEmptyResult",
4232
4316
  value: (function () {
4233
- var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50() {
4317
+ var _refreshMenuScheduleCacheAfterEmptyResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51() {
4234
4318
  var _this12 = this;
4235
4319
  var now;
4236
- return _regeneratorRuntime().wrap(function _callee50$(_context50) {
4237
- while (1) switch (_context50.prev = _context50.next) {
4320
+ return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4321
+ while (1) switch (_context51.prev = _context51.next) {
4238
4322
  case 0:
4239
4323
  if (!(!this.menu || !this.schedule)) {
4240
- _context50.next = 2;
4324
+ _context51.next = 2;
4241
4325
  break;
4242
4326
  }
4243
- return _context50.abrupt("return", false);
4327
+ return _context51.abrupt("return", false);
4244
4328
  case 2:
4245
4329
  now = Date.now();
4246
4330
  if (!(now - this.lastMenuScheduleRefreshAt < this.MENU_SCHEDULE_REFRESH_COOLDOWN_MS)) {
4247
- _context50.next = 5;
4331
+ _context51.next = 5;
4248
4332
  break;
4249
4333
  }
4250
- return _context50.abrupt("return", false);
4334
+ return _context51.abrupt("return", false);
4251
4335
  case 5:
4252
4336
  if (!this.menuScheduleRefreshInFlight) {
4253
4337
  this.lastMenuScheduleRefreshAt = now;
@@ -4261,15 +4345,15 @@ var Server = /*#__PURE__*/function () {
4261
4345
  _this12.menuScheduleRefreshInFlight = null;
4262
4346
  });
4263
4347
  }
4264
- _context50.next = 8;
4348
+ _context51.next = 8;
4265
4349
  return this.menuScheduleRefreshInFlight;
4266
4350
  case 8:
4267
- return _context50.abrupt("return", true);
4351
+ return _context51.abrupt("return", true);
4268
4352
  case 9:
4269
4353
  case "end":
4270
- return _context50.stop();
4354
+ return _context51.stop();
4271
4355
  }
4272
- }, _callee50, this);
4356
+ }, _callee51, this);
4273
4357
  }));
4274
4358
  function refreshMenuScheduleCacheAfterEmptyResult() {
4275
4359
  return _refreshMenuScheduleCacheAfterEmptyResult.apply(this, arguments);
@@ -4287,16 +4371,16 @@ var Server = /*#__PURE__*/function () {
4287
4371
  * const result = await this.handleSalesSearchRequest('single', '/shop/es/search/sales', { keyword: '1001' }, {})
4288
4372
  */
4289
4373
  function () {
4290
- var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(kind, backendPath, data, config) {
4374
+ var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(kind, backendPath, data, config) {
4291
4375
  var queryPayload, result, _ref68, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
4292
- return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4293
- while (1) switch (_context51.prev = _context51.next) {
4376
+ return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4377
+ while (1) switch (_context52.prev = _context52.next) {
4294
4378
  case 0:
4295
4379
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
4296
- _context51.next = 3;
4380
+ _context52.next = 3;
4297
4381
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
4298
4382
  case 3:
4299
- result = _context51.sent;
4383
+ result = _context52.sent;
4300
4384
  _ref68 = config || {}, callback = _ref68.callback, subscriberId = _ref68.subscriberId, resetVisibleOrderIds = _ref68.resetVisibleOrderIds;
4301
4385
  if (subscriberId && typeof callback === 'function') {
4302
4386
  contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
@@ -4328,14 +4412,14 @@ var Server = /*#__PURE__*/function () {
4328
4412
  visibleCount: visibleOrderIds.size
4329
4413
  });
4330
4414
  }
4331
- return _context51.abrupt("return", result);
4415
+ return _context52.abrupt("return", result);
4332
4416
  case 7:
4333
4417
  case "end":
4334
- return _context51.stop();
4418
+ return _context52.stop();
4335
4419
  }
4336
- }, _callee51, this);
4420
+ }, _callee52, this);
4337
4421
  }));
4338
- function handleSalesSearchRequest(_x50, _x51, _x52, _x53) {
4422
+ function handleSalesSearchRequest(_x51, _x52, _x53, _x54) {
4339
4423
  return _handleSalesSearchRequest.apply(this, arguments);
4340
4424
  }
4341
4425
  return handleSalesSearchRequest;
@@ -4350,20 +4434,20 @@ var Server = /*#__PURE__*/function () {
4350
4434
  }, {
4351
4435
  key: "fetchSalesSearchFromAPI",
4352
4436
  value: (function () {
4353
- var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(backendPath, data) {
4437
+ var _fetchSalesSearchFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(backendPath, data) {
4354
4438
  var _this$app7;
4355
4439
  var _response$data3, _response$code2, _response$status2, _response$message2, response, _payload, errorMessage;
4356
- return _regeneratorRuntime().wrap(function _callee52$(_context52) {
4357
- while (1) switch (_context52.prev = _context52.next) {
4440
+ return _regeneratorRuntime().wrap(function _callee53$(_context53) {
4441
+ while (1) switch (_context53.prev = _context53.next) {
4358
4442
  case 0:
4359
4443
  if ((_this$app7 = this.app) !== null && _this$app7 !== void 0 && _this$app7.request) {
4360
- _context52.next = 3;
4444
+ _context53.next = 3;
4361
4445
  break;
4362
4446
  }
4363
4447
  this.logError('fetchSalesSearchFromAPI: app.request 不可用', {
4364
4448
  backendPath: backendPath
4365
4449
  });
4366
- return _context52.abrupt("return", {
4450
+ return _context53.abrupt("return", {
4367
4451
  code: 500,
4368
4452
  message: 'app.request 不可用',
4369
4453
  data: backendPath === '/shop/es/search' ? {
@@ -4375,29 +4459,29 @@ var Server = /*#__PURE__*/function () {
4375
4459
  status: false
4376
4460
  });
4377
4461
  case 3:
4378
- _context52.prev = 3;
4379
- _context52.next = 6;
4462
+ _context53.prev = 3;
4463
+ _context53.next = 6;
4380
4464
  return this.app.request.post(backendPath, data, {
4381
4465
  isShopApi: true
4382
4466
  });
4383
4467
  case 6:
4384
- response = _context52.sent;
4468
+ response = _context53.sent;
4385
4469
  _payload = (_response$data3 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data3 !== void 0 ? _response$data3 : response;
4386
- return _context52.abrupt("return", {
4470
+ return _context53.abrupt("return", {
4387
4471
  code: (_response$code2 = response === null || response === void 0 ? void 0 : response.code) !== null && _response$code2 !== void 0 ? _response$code2 : 200,
4388
4472
  status: (_response$status2 = response === null || response === void 0 ? void 0 : response.status) !== null && _response$status2 !== void 0 ? _response$status2 : true,
4389
4473
  message: (_response$message2 = response === null || response === void 0 ? void 0 : response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '',
4390
4474
  data: _payload
4391
4475
  });
4392
4476
  case 11:
4393
- _context52.prev = 11;
4394
- _context52.t0 = _context52["catch"](3);
4395
- errorMessage = _context52.t0 instanceof Error ? _context52.t0.message : String(_context52.t0);
4477
+ _context53.prev = 11;
4478
+ _context53.t0 = _context53["catch"](3);
4479
+ errorMessage = _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0);
4396
4480
  this.logError('fetchSalesSearchFromAPI: 请求失败', {
4397
4481
  backendPath: backendPath,
4398
4482
  error: errorMessage
4399
4483
  });
4400
- return _context52.abrupt("return", {
4484
+ return _context53.abrupt("return", {
4401
4485
  code: 500,
4402
4486
  message: errorMessage,
4403
4487
  data: backendPath === '/shop/es/search' ? {
@@ -4410,11 +4494,11 @@ var Server = /*#__PURE__*/function () {
4410
4494
  });
4411
4495
  case 16:
4412
4496
  case "end":
4413
- return _context52.stop();
4497
+ return _context53.stop();
4414
4498
  }
4415
- }, _callee52, this, [[3, 11]]);
4499
+ }, _callee53, this, [[3, 11]]);
4416
4500
  }));
4417
- function fetchSalesSearchFromAPI(_x54, _x55) {
4501
+ function fetchSalesSearchFromAPI(_x55, _x56) {
4418
4502
  return _fetchSalesSearchFromAPI.apply(this, arguments);
4419
4503
  }
4420
4504
  return fetchSalesSearchFromAPI;
@@ -4937,18 +5021,18 @@ var Server = /*#__PURE__*/function () {
4937
5021
  }, {
4938
5022
  key: "fetchOrderListFromAPI",
4939
5023
  value: (function () {
4940
- var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(data) {
5024
+ var _fetchOrderListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(data) {
4941
5025
  var _this$app8;
4942
5026
  var _response$data4, response, _payload2, list, count, errorMessage;
4943
- return _regeneratorRuntime().wrap(function _callee53$(_context53) {
4944
- while (1) switch (_context53.prev = _context53.next) {
5027
+ return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5028
+ while (1) switch (_context54.prev = _context54.next) {
4945
5029
  case 0:
4946
5030
  if ((_this$app8 = this.app) !== null && _this$app8 !== void 0 && _this$app8.request) {
4947
- _context53.next = 3;
5031
+ _context54.next = 3;
4948
5032
  break;
4949
5033
  }
4950
5034
  this.logError('fetchOrderListFromAPI: app.request 不可用');
4951
- return _context53.abrupt("return", {
5035
+ return _context54.abrupt("return", {
4952
5036
  code: 500,
4953
5037
  message: 'app.request 不可用',
4954
5038
  data: {
@@ -4958,19 +5042,19 @@ var Server = /*#__PURE__*/function () {
4958
5042
  status: false
4959
5043
  });
4960
5044
  case 3:
4961
- _context53.prev = 3;
4962
- _context53.next = 6;
5045
+ _context54.prev = 3;
5046
+ _context54.next = 6;
4963
5047
  return this.app.request.post('/shop/order/v2/list', _objectSpread(_objectSpread({}, data), {}, {
4964
5048
  with: _toConsumableArray(new Set([].concat(_toConsumableArray(Array.isArray(data.with) ? data.with : []), ['buzzer'])))
4965
5049
  }), {
4966
5050
  isShopApi: true
4967
5051
  });
4968
5052
  case 6:
4969
- response = _context53.sent;
5053
+ response = _context54.sent;
4970
5054
  _payload2 = (_response$data4 = response === null || response === void 0 ? void 0 : response.data) !== null && _response$data4 !== void 0 ? _response$data4 : response;
4971
5055
  list = Array.isArray(_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.list) ? _payload2.list : [];
4972
5056
  count = typeof (_payload2 === null || _payload2 === void 0 ? void 0 : _payload2.count) === 'number' ? _payload2.count : list.length;
4973
- return _context53.abrupt("return", {
5057
+ return _context54.abrupt("return", {
4974
5058
  code: 200,
4975
5059
  data: _objectSpread(_objectSpread({}, _payload2), {}, {
4976
5060
  list: list,
@@ -4980,13 +5064,13 @@ var Server = /*#__PURE__*/function () {
4980
5064
  status: true
4981
5065
  });
4982
5066
  case 13:
4983
- _context53.prev = 13;
4984
- _context53.t0 = _context53["catch"](3);
4985
- errorMessage = _context53.t0 instanceof Error ? _context53.t0.message : String(_context53.t0);
5067
+ _context54.prev = 13;
5068
+ _context54.t0 = _context54["catch"](3);
5069
+ errorMessage = _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0);
4986
5070
  this.logError('fetchOrderListFromAPI: 请求失败', {
4987
5071
  error: errorMessage
4988
5072
  });
4989
- return _context53.abrupt("return", {
5073
+ return _context54.abrupt("return", {
4990
5074
  code: 500,
4991
5075
  message: errorMessage,
4992
5076
  data: {
@@ -4997,11 +5081,11 @@ var Server = /*#__PURE__*/function () {
4997
5081
  });
4998
5082
  case 18:
4999
5083
  case "end":
5000
- return _context53.stop();
5084
+ return _context54.stop();
5001
5085
  }
5002
- }, _callee53, this, [[3, 13]]);
5086
+ }, _callee54, this, [[3, 13]]);
5003
5087
  }));
5004
- function fetchOrderListFromAPI(_x56) {
5088
+ function fetchOrderListFromAPI(_x57) {
5005
5089
  return _fetchOrderListFromAPI.apply(this, arguments);
5006
5090
  }
5007
5091
  return fetchOrderListFromAPI;
@@ -5013,17 +5097,17 @@ var Server = /*#__PURE__*/function () {
5013
5097
  }, {
5014
5098
  key: "fetchBookingListFromAPI",
5015
5099
  value: (function () {
5016
- var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(data) {
5100
+ var _fetchBookingListFromAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(data) {
5017
5101
  var memoryCacheEnabled, withFields, requestPayload, cacheKey, cached, rawList, bookingResult, _bookingResult$list, errorMessage;
5018
- return _regeneratorRuntime().wrap(function _callee54$(_context54) {
5019
- while (1) switch (_context54.prev = _context54.next) {
5102
+ return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5103
+ while (1) switch (_context55.prev = _context55.next) {
5020
5104
  case 0:
5021
5105
  if (this.order) {
5022
- _context54.next = 3;
5106
+ _context55.next = 3;
5023
5107
  break;
5024
5108
  }
5025
5109
  this.logError('fetchBookingListFromAPI: Order 模块不可用');
5026
- return _context54.abrupt("return", {
5110
+ return _context55.abrupt("return", {
5027
5111
  code: 500,
5028
5112
  message: 'Order 模块不可用',
5029
5113
  data: {
@@ -5033,18 +5117,18 @@ var Server = /*#__PURE__*/function () {
5033
5117
  status: false
5034
5118
  });
5035
5119
  case 3:
5036
- _context54.prev = 3;
5120
+ _context55.prev = 3;
5037
5121
  memoryCacheEnabled = this.isBookingRemoteMemoryCacheEnabled(data);
5038
5122
  withFields = this.resolveBookingSalesWith(data);
5039
5123
  requestPayload = this.normalizeBookingRemoteQueryPayload(data, withFields);
5040
5124
  cacheKey = this.buildBookingRemoteCacheKey(requestPayload);
5041
5125
  if (!memoryCacheEnabled) {
5042
- _context54.next = 13;
5126
+ _context55.next = 13;
5043
5127
  break;
5044
5128
  }
5045
5129
  cached = this.readBookingRemoteCache(cacheKey);
5046
5130
  if (!cached) {
5047
- _context54.next = 13;
5131
+ _context55.next = 13;
5048
5132
  break;
5049
5133
  }
5050
5134
  this.logInfo('fetchBookingListFromAPI: 命中内存缓存', {
@@ -5052,14 +5136,14 @@ var Server = /*#__PURE__*/function () {
5052
5136
  listCount: cached.bookingResult.count,
5053
5137
  withFields: cached.withFields
5054
5138
  });
5055
- return _context54.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
5139
+ return _context55.abrupt("return", this.buildBookingResponse(cached.bookingResult, {
5056
5140
  cache_hit: true
5057
5141
  }));
5058
5142
  case 13:
5059
- _context54.next = 15;
5143
+ _context55.next = 15;
5060
5144
  return this.order.fetchOrdersBySSE(requestPayload);
5061
5145
  case 15:
5062
- rawList = _context54.sent;
5146
+ rawList = _context55.sent;
5063
5147
  bookingResult = sortBookings(filterBookingsFromOrders(rawList, data), data); // DEBUG: 挂到 window 上方便排查 SSE → 日历数据丢失问题
5064
5148
  if (typeof globalThis !== 'undefined') {
5065
5149
  globalThis.__SSE_BOOKING_DEBUG__ = {
@@ -5106,15 +5190,15 @@ var Server = /*#__PURE__*/function () {
5106
5190
  cacheKey: cacheKey,
5107
5191
  withFields: withFields
5108
5192
  });
5109
- return _context54.abrupt("return", this.buildBookingResponse(bookingResult));
5193
+ return _context55.abrupt("return", this.buildBookingResponse(bookingResult));
5110
5194
  case 23:
5111
- _context54.prev = 23;
5112
- _context54.t0 = _context54["catch"](3);
5113
- errorMessage = _context54.t0 instanceof Error ? _context54.t0.message : String(_context54.t0);
5195
+ _context55.prev = 23;
5196
+ _context55.t0 = _context55["catch"](3);
5197
+ errorMessage = _context55.t0 instanceof Error ? _context55.t0.message : String(_context55.t0);
5114
5198
  this.logError('fetchBookingListFromAPI: SSE 请求失败', {
5115
5199
  error: errorMessage
5116
5200
  });
5117
- return _context54.abrupt("return", {
5201
+ return _context55.abrupt("return", {
5118
5202
  code: 500,
5119
5203
  message: errorMessage,
5120
5204
  data: {
@@ -5125,11 +5209,11 @@ var Server = /*#__PURE__*/function () {
5125
5209
  });
5126
5210
  case 28:
5127
5211
  case "end":
5128
- return _context54.stop();
5212
+ return _context55.stop();
5129
5213
  }
5130
- }, _callee54, this, [[3, 23]]);
5214
+ }, _callee55, this, [[3, 23]]);
5131
5215
  }));
5132
- function fetchBookingListFromAPI(_x57) {
5216
+ function fetchBookingListFromAPI(_x58) {
5133
5217
  return _fetchBookingListFromAPI.apply(this, arguments);
5134
5218
  }
5135
5219
  return fetchBookingListFromAPI;
@@ -5213,11 +5297,11 @@ var Server = /*#__PURE__*/function () {
5213
5297
  }, {
5214
5298
  key: "runLocalPaymentUpdateInQueue",
5215
5299
  value: function () {
5216
- var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(key, task, context) {
5300
+ var _runLocalPaymentUpdateInQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(key, task, context) {
5217
5301
  var _this16 = this;
5218
5302
  var queuedAt, hasPreviousTask, previous, current, tail, _data, result, released;
5219
- return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5220
- while (1) switch (_context56.prev = _context56.next) {
5303
+ return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5304
+ while (1) switch (_context57.prev = _context57.next) {
5221
5305
  case 0:
5222
5306
  queuedAt = Date.now();
5223
5307
  hasPreviousTask = this.localPaymentUpdateQueues.has(key);
@@ -5229,20 +5313,20 @@ var Server = /*#__PURE__*/function () {
5229
5313
  }));
5230
5314
  current = previous.catch(function () {
5231
5315
  return undefined;
5232
- }).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55() {
5233
- return _regeneratorRuntime().wrap(function _callee55$(_context55) {
5234
- while (1) switch (_context55.prev = _context55.next) {
5316
+ }).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56() {
5317
+ return _regeneratorRuntime().wrap(function _callee56$(_context56) {
5318
+ while (1) switch (_context56.prev = _context56.next) {
5235
5319
  case 0:
5236
5320
  _this16.logInfo('handleUpdateLocalPayment: 串行队列开始执行', _objectSpread(_objectSpread({}, context), {}, {
5237
5321
  queue_key: key,
5238
5322
  queue_wait_ms: Date.now() - queuedAt
5239
5323
  }));
5240
- return _context55.abrupt("return", task());
5324
+ return _context56.abrupt("return", task());
5241
5325
  case 2:
5242
5326
  case "end":
5243
- return _context55.stop();
5327
+ return _context56.stop();
5244
5328
  }
5245
- }, _callee55);
5329
+ }, _callee56);
5246
5330
  })));
5247
5331
  tail = current.then(function () {
5248
5332
  return undefined;
@@ -5250,11 +5334,11 @@ var Server = /*#__PURE__*/function () {
5250
5334
  return undefined;
5251
5335
  });
5252
5336
  this.localPaymentUpdateQueues.set(key, tail);
5253
- _context56.prev = 7;
5254
- _context56.next = 10;
5337
+ _context57.prev = 7;
5338
+ _context57.next = 10;
5255
5339
  return current;
5256
5340
  case 10:
5257
- result = _context56.sent;
5341
+ result = _context57.sent;
5258
5342
  this.logInfo('handleUpdateLocalPayment: 串行队列执行完成', _objectSpread(_objectSpread({}, context), {}, {
5259
5343
  queue_key: key,
5260
5344
  total_duration_ms: Date.now() - queuedAt,
@@ -5262,19 +5346,19 @@ var Server = /*#__PURE__*/function () {
5262
5346
  result_status: result === null || result === void 0 ? void 0 : result.status,
5263
5347
  payment: result === null || result === void 0 || (_data = result.data) === null || _data === void 0 ? void 0 : _data.payment
5264
5348
  }));
5265
- return _context56.abrupt("return", result);
5349
+ return _context57.abrupt("return", result);
5266
5350
  case 15:
5267
- _context56.prev = 15;
5268
- _context56.t0 = _context56["catch"](7);
5351
+ _context57.prev = 15;
5352
+ _context57.t0 = _context57["catch"](7);
5269
5353
  this.logError('handleUpdateLocalPayment: 串行队列执行失败', _objectSpread(_objectSpread({}, context), {}, {
5270
5354
  queue_key: key,
5271
5355
  total_duration_ms: Date.now() - queuedAt,
5272
- error: _context56.t0 instanceof Error ? _context56.t0.message : String(_context56.t0),
5273
- error_detail: this.normalizeUnknownError(_context56.t0)
5356
+ error: _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0),
5357
+ error_detail: this.normalizeUnknownError(_context57.t0)
5274
5358
  }));
5275
- throw _context56.t0;
5359
+ throw _context57.t0;
5276
5360
  case 19:
5277
- _context56.prev = 19;
5361
+ _context57.prev = 19;
5278
5362
  released = false;
5279
5363
  if (this.localPaymentUpdateQueues.get(key) === tail) {
5280
5364
  this.localPaymentUpdateQueues.delete(key);
@@ -5285,14 +5369,14 @@ var Server = /*#__PURE__*/function () {
5285
5369
  released: released,
5286
5370
  active_queue_count: this.localPaymentUpdateQueues.size
5287
5371
  }));
5288
- return _context56.finish(19);
5372
+ return _context57.finish(19);
5289
5373
  case 24:
5290
5374
  case "end":
5291
- return _context56.stop();
5375
+ return _context57.stop();
5292
5376
  }
5293
- }, _callee56, this, [[7, 15, 19, 24]]);
5377
+ }, _callee57, this, [[7, 15, 19, 24]]);
5294
5378
  }));
5295
- function runLocalPaymentUpdateInQueue(_x58, _x59, _x60) {
5379
+ function runLocalPaymentUpdateInQueue(_x59, _x60, _x61) {
5296
5380
  return _runLocalPaymentUpdateInQueue.apply(this, arguments);
5297
5381
  }
5298
5382
  return runLocalPaymentUpdateInQueue;
@@ -5300,11 +5384,11 @@ var Server = /*#__PURE__*/function () {
5300
5384
  }, {
5301
5385
  key: "processLocalPaymentUpdate",
5302
5386
  value: function () {
5303
- var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
5387
+ var _processLocalPaymentUpdate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5304
5388
  var _params$serviceCharge4, _params$cardReaderSur, _found$payment, _found$payment2;
5305
5389
  var requestContext, found, surchargeUpdate, incomingPaymentUpdate, transactions, existingTransaction, hasRecordedSuccess, orderIsDraft, foundContext, alreadyRecordedFailure, updated;
5306
- return _regeneratorRuntime().wrap(function _callee57$(_context57) {
5307
- while (1) switch (_context57.prev = _context57.next) {
5390
+ return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5391
+ while (1) switch (_context58.prev = _context58.next) {
5308
5392
  case 0:
5309
5393
  requestContext = {
5310
5394
  operation_id: params.operationId,
@@ -5317,11 +5401,11 @@ var Server = /*#__PURE__*/function () {
5317
5401
  };
5318
5402
  this.logInfo('processLocalPaymentUpdate: 开始处理', requestContext);
5319
5403
  if (this.order) {
5320
- _context57.next = 5;
5404
+ _context58.next = 5;
5321
5405
  break;
5322
5406
  }
5323
5407
  this.logError('processLocalPaymentUpdate: Order 模块未注册', requestContext);
5324
- return _context57.abrupt("return", {
5408
+ return _context58.abrupt("return", {
5325
5409
  code: 500,
5326
5410
  status: false,
5327
5411
  message: 'Order 模块未注册',
@@ -5329,20 +5413,20 @@ var Server = /*#__PURE__*/function () {
5329
5413
  });
5330
5414
  case 5:
5331
5415
  this.logInfo('processLocalPaymentUpdate: 开始查询本地支付项', requestContext);
5332
- _context57.next = 8;
5416
+ _context58.next = 8;
5333
5417
  return this.order.getLocalPayment({
5334
5418
  saleId: params.saleId,
5335
5419
  paymentNumber: params.paymentNumber,
5336
5420
  operationId: params.operationId
5337
5421
  });
5338
5422
  case 8:
5339
- found = _context57.sent;
5423
+ found = _context58.sent;
5340
5424
  if (found) {
5341
- _context57.next = 12;
5425
+ _context58.next = 12;
5342
5426
  break;
5343
5427
  }
5344
5428
  this.logWarning('processLocalPaymentUpdate: 本地支付项不存在', requestContext);
5345
- return _context57.abrupt("return", {
5429
+ return _context58.abrupt("return", {
5346
5430
  code: 404,
5347
5431
  status: false,
5348
5432
  message: '本地支付项不存在',
@@ -5391,13 +5475,13 @@ var Server = /*#__PURE__*/function () {
5391
5475
  });
5392
5476
  this.logInfo('processLocalPaymentUpdate: 查询命中', foundContext);
5393
5477
  if (!(params.status === 'fail' && (found.payment.status === 'paid' || hasRecordedSuccess))) {
5394
- _context57.next = 23;
5478
+ _context58.next = 23;
5395
5479
  break;
5396
5480
  }
5397
5481
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
5398
5482
  idempotent_reason: 'ignore_failure_after_success'
5399
5483
  }));
5400
- return _context57.abrupt("return", {
5484
+ return _context58.abrupt("return", {
5401
5485
  code: 200,
5402
5486
  status: true,
5403
5487
  message: '',
@@ -5410,13 +5494,13 @@ var Server = /*#__PURE__*/function () {
5410
5494
  case 23:
5411
5495
  alreadyRecordedFailure = params.status === 'fail' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'fail';
5412
5496
  if (!alreadyRecordedFailure) {
5413
- _context57.next = 27;
5497
+ _context58.next = 27;
5414
5498
  break;
5415
5499
  }
5416
5500
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
5417
5501
  idempotent_reason: 'failure_already_recorded'
5418
5502
  }));
5419
- return _context57.abrupt("return", {
5503
+ return _context58.abrupt("return", {
5420
5504
  code: 200,
5421
5505
  status: true,
5422
5506
  message: '',
@@ -5428,13 +5512,13 @@ var Server = /*#__PURE__*/function () {
5428
5512
  });
5429
5513
  case 27:
5430
5514
  if (!(params.status === 'success' && (existingTransaction === null || existingTransaction === void 0 ? void 0 : existingTransaction.status) === 'success' && found.payment.status === 'paid' && !orderIsDraft)) {
5431
- _context57.next = 30;
5515
+ _context58.next = 30;
5432
5516
  break;
5433
5517
  }
5434
5518
  this.logInfo('processLocalPaymentUpdate: 幂等返回', _objectSpread(_objectSpread({}, foundContext), {}, {
5435
5519
  idempotent_reason: 'success_already_committed'
5436
5520
  }));
5437
- return _context57.abrupt("return", {
5521
+ return _context58.abrupt("return", {
5438
5522
  code: 200,
5439
5523
  status: true,
5440
5524
  message: '',
@@ -5446,13 +5530,13 @@ var Server = /*#__PURE__*/function () {
5446
5530
  });
5447
5531
  case 30:
5448
5532
  if (!(params.status === 'success')) {
5449
- _context57.next = 33;
5533
+ _context58.next = 33;
5450
5534
  break;
5451
5535
  }
5452
5536
  this.logInfo('processLocalPaymentUpdate: 进入 success 恢复分支', _objectSpread(_objectSpread({}, foundContext), {}, {
5453
5537
  force_submit_if_paid: found.payment.status === 'paid' && orderIsDraft
5454
5538
  }));
5455
- return _context57.abrupt("return", this.processSuccessfulLocalPayment(_objectSpread(_objectSpread({}, params), {}, {
5539
+ return _context58.abrupt("return", this.processSuccessfulLocalPayment(_objectSpread(_objectSpread({}, params), {}, {
5456
5540
  order: found.order,
5457
5541
  payment: found.payment,
5458
5542
  matchBy: found.matchedBy === 'payment_number' ? 'payment_number' : 'compat',
@@ -5463,8 +5547,8 @@ var Server = /*#__PURE__*/function () {
5463
5547
  this.logInfo('processLocalPaymentUpdate: 进入 fail 本地更新分支', _objectSpread(_objectSpread({}, foundContext), {}, {
5464
5548
  incoming_payment_update: incomingPaymentUpdate
5465
5549
  }));
5466
- _context57.prev = 34;
5467
- _context57.next = 37;
5550
+ _context58.prev = 34;
5551
+ _context58.next = 37;
5468
5552
  return this.order.updateLocalPayment({
5469
5553
  saleId: params.saleId,
5470
5554
  paymentNumber: params.paymentNumber,
@@ -5472,25 +5556,25 @@ var Server = /*#__PURE__*/function () {
5472
5556
  updates: incomingPaymentUpdate
5473
5557
  });
5474
5558
  case 37:
5475
- updated = _context57.sent;
5476
- _context57.next = 44;
5559
+ updated = _context58.sent;
5560
+ _context58.next = 44;
5477
5561
  break;
5478
5562
  case 40:
5479
- _context57.prev = 40;
5480
- _context57.t0 = _context57["catch"](34);
5563
+ _context58.prev = 40;
5564
+ _context58.t0 = _context58["catch"](34);
5481
5565
  this.logError('processLocalPaymentUpdate: fail 本地更新失败', _objectSpread(_objectSpread({}, foundContext), {}, {
5482
5566
  incoming_payment_update: incomingPaymentUpdate,
5483
- error: _context57.t0 instanceof Error ? _context57.t0.message : String(_context57.t0),
5484
- error_detail: this.normalizeUnknownError(_context57.t0)
5567
+ error: _context58.t0 instanceof Error ? _context58.t0.message : String(_context58.t0),
5568
+ error_detail: this.normalizeUnknownError(_context58.t0)
5485
5569
  }));
5486
- throw _context57.t0;
5570
+ throw _context58.t0;
5487
5571
  case 44:
5488
5572
  if (updated) {
5489
- _context57.next = 47;
5573
+ _context58.next = 47;
5490
5574
  break;
5491
5575
  }
5492
5576
  this.logWarning('processLocalPaymentUpdate: fail 本地更新未命中', foundContext);
5493
- return _context57.abrupt("return", {
5577
+ return _context58.abrupt("return", {
5494
5578
  code: 404,
5495
5579
  status: false,
5496
5580
  message: '本地支付项不存在',
@@ -5501,7 +5585,7 @@ var Server = /*#__PURE__*/function () {
5501
5585
  previous_payment: updated.previousPayment,
5502
5586
  payment: updated.payment
5503
5587
  }));
5504
- return _context57.abrupt("return", {
5588
+ return _context58.abrupt("return", {
5505
5589
  code: 200,
5506
5590
  status: true,
5507
5591
  message: '',
@@ -5513,11 +5597,11 @@ var Server = /*#__PURE__*/function () {
5513
5597
  });
5514
5598
  case 49:
5515
5599
  case "end":
5516
- return _context57.stop();
5600
+ return _context58.stop();
5517
5601
  }
5518
- }, _callee57, this, [[34, 40]]);
5602
+ }, _callee58, this, [[34, 40]]);
5519
5603
  }));
5520
- function processLocalPaymentUpdate(_x61) {
5604
+ function processLocalPaymentUpdate(_x62) {
5521
5605
  return _processLocalPaymentUpdate.apply(this, arguments);
5522
5606
  }
5523
5607
  return processLocalPaymentUpdate;
@@ -5525,10 +5609,10 @@ var Server = /*#__PURE__*/function () {
5525
5609
  }, {
5526
5610
  key: "processSuccessfulLocalPayment",
5527
5611
  value: function () {
5528
- var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
5612
+ var _processSuccessfulLocalPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(params) {
5529
5613
  var moduleName, baseSales, startedAt, recoveryContext, _order$order_id3, _result$payments, _result$syncResult$su, _result$syncResult$su2, _result$draftResult, _result$draftResult2, order, result, message;
5530
- return _regeneratorRuntime().wrap(function _callee58$(_context58) {
5531
- while (1) switch (_context58.prev = _context58.next) {
5614
+ return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5615
+ while (1) switch (_context59.prev = _context59.next) {
5532
5616
  case 0:
5533
5617
  moduleName = "local_payment_recovery_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 8));
5534
5618
  baseSales = new BaseSalesImpl(moduleName);
@@ -5547,13 +5631,13 @@ var Server = /*#__PURE__*/function () {
5547
5631
  payment: params.payment
5548
5632
  });
5549
5633
  this.logInfo('processSuccessfulLocalPayment: 创建临时 BaseSales', recoveryContext);
5550
- _context58.prev = 5;
5634
+ _context59.prev = 5;
5551
5635
  order = this.sanitizeLocalRecoveryOrder(params.order);
5552
5636
  this.logInfo('processSuccessfulLocalPayment: 本地订单清洗完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5553
5637
  sanitized_order_id: (_order$order_id3 = order.order_id) !== null && _order$order_id3 !== void 0 ? _order$order_id3 : null,
5554
5638
  removed_synthetic_order_id: params.order.order_id != null && order.order_id == null
5555
5639
  }));
5556
- _context58.next = 10;
5640
+ _context59.next = 10;
5557
5641
  return baseSales.initialize(this.core, {
5558
5642
  otherParams: {
5559
5643
  platform: order.platform,
@@ -5566,14 +5650,14 @@ var Server = /*#__PURE__*/function () {
5566
5650
  });
5567
5651
  case 10:
5568
5652
  this.logInfo('processSuccessfulLocalPayment: BaseSales 初始化完成', recoveryContext);
5569
- _context58.next = 13;
5653
+ _context59.next = 13;
5570
5654
  return baseSales.replaceTempOrder(order);
5571
5655
  case 13:
5572
5656
  this.logInfo('processSuccessfulLocalPayment: 本地订单 tempOrder 恢复完成', recoveryContext);
5573
5657
  this.logInfo('processSuccessfulLocalPayment: 开始更新支付项并提交', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5574
5658
  incoming_payment_update: params.paymentUpdate
5575
5659
  }));
5576
- _context58.next = 17;
5660
+ _context59.next = 17;
5577
5661
  return baseSales.updateOrderPayment(params.paymentNumber, params.paymentUpdate, {
5578
5662
  submitWhenPaid: true,
5579
5663
  matchBy: params.matchBy,
@@ -5582,7 +5666,7 @@ var Server = /*#__PURE__*/function () {
5582
5666
  smallTicketDataFlag: 1
5583
5667
  });
5584
5668
  case 17:
5585
- result = _context58.sent;
5669
+ result = _context59.sent;
5586
5670
  this.logInfo('processSuccessfulLocalPayment: 支付恢复完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5587
5671
  duration_ms: Date.now() - startedAt,
5588
5672
  payment: result.payment,
@@ -5604,7 +5688,7 @@ var Server = /*#__PURE__*/function () {
5604
5688
  } : null,
5605
5689
  draft_error: result.draftError instanceof Error ? result.draftError.message : result.draftError
5606
5690
  }));
5607
- return _context58.abrupt("return", {
5691
+ return _context59.abrupt("return", {
5608
5692
  code: 200,
5609
5693
  status: true,
5610
5694
  message: '',
@@ -5616,48 +5700,48 @@ var Server = /*#__PURE__*/function () {
5616
5700
  }
5617
5701
  });
5618
5702
  case 22:
5619
- _context58.prev = 22;
5620
- _context58.t0 = _context58["catch"](5);
5621
- message = _context58.t0 instanceof Error ? _context58.t0.message : String(_context58.t0);
5703
+ _context59.prev = 22;
5704
+ _context59.t0 = _context59["catch"](5);
5705
+ message = _context59.t0 instanceof Error ? _context59.t0.message : String(_context59.t0);
5622
5706
  this.logError('processSuccessfulLocalPayment: 支付恢复失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5623
5707
  duration_ms: Date.now() - startedAt,
5624
5708
  error: message,
5625
- error_detail: this.normalizeUnknownError(_context58.t0)
5709
+ error_detail: this.normalizeUnknownError(_context59.t0)
5626
5710
  }));
5627
- return _context58.abrupt("return", {
5711
+ return _context59.abrupt("return", {
5628
5712
  code: 500,
5629
5713
  status: false,
5630
5714
  message: message,
5631
5715
  data: null
5632
5716
  });
5633
5717
  case 27:
5634
- _context58.prev = 27;
5635
- _context58.prev = 28;
5636
- _context58.next = 31;
5718
+ _context59.prev = 27;
5719
+ _context59.prev = 28;
5720
+ _context59.next = 31;
5637
5721
  return baseSales.destroy();
5638
5722
  case 31:
5639
5723
  this.logInfo('processSuccessfulLocalPayment: 临时 BaseSales 销毁完成', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5640
5724
  duration_ms: Date.now() - startedAt
5641
5725
  }));
5642
- _context58.next = 37;
5726
+ _context59.next = 37;
5643
5727
  break;
5644
5728
  case 34:
5645
- _context58.prev = 34;
5646
- _context58.t1 = _context58["catch"](28);
5729
+ _context59.prev = 34;
5730
+ _context59.t1 = _context59["catch"](28);
5647
5731
  this.logError('processSuccessfulLocalPayment: 临时 BaseSales 销毁失败', _objectSpread(_objectSpread({}, recoveryContext), {}, {
5648
5732
  duration_ms: Date.now() - startedAt,
5649
- error: _context58.t1 instanceof Error ? _context58.t1.message : String(_context58.t1),
5650
- error_detail: this.normalizeUnknownError(_context58.t1)
5733
+ error: _context59.t1 instanceof Error ? _context59.t1.message : String(_context59.t1),
5734
+ error_detail: this.normalizeUnknownError(_context59.t1)
5651
5735
  }));
5652
5736
  case 37:
5653
- return _context58.finish(27);
5737
+ return _context59.finish(27);
5654
5738
  case 38:
5655
5739
  case "end":
5656
- return _context58.stop();
5740
+ return _context59.stop();
5657
5741
  }
5658
- }, _callee58, this, [[5, 22, 27, 38], [28, 34]]);
5742
+ }, _callee59, this, [[5, 22, 27, 38], [28, 34]]);
5659
5743
  }));
5660
- function processSuccessfulLocalPayment(_x62) {
5744
+ function processSuccessfulLocalPayment(_x63) {
5661
5745
  return _processSuccessfulLocalPayment.apply(this, arguments);
5662
5746
  }
5663
5747
  return processSuccessfulLocalPayment;
@@ -5753,32 +5837,32 @@ var Server = /*#__PURE__*/function () {
5753
5837
  }, {
5754
5838
  key: "getShortNumberOrDeviceId",
5755
5839
  value: function () {
5756
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59() {
5840
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60() {
5757
5841
  var getAsyncIotDeviceInfo, res;
5758
- return _regeneratorRuntime().wrap(function _callee59$(_context59) {
5759
- while (1) switch (_context59.prev = _context59.next) {
5842
+ return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5843
+ while (1) switch (_context60.prev = _context60.next) {
5760
5844
  case 0:
5761
5845
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
5762
5846
  if (!getAsyncIotDeviceInfo) {
5763
- _context59.next = 7;
5847
+ _context60.next = 7;
5764
5848
  break;
5765
5849
  }
5766
- _context59.next = 4;
5850
+ _context60.next = 4;
5767
5851
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
5768
5852
  case 4:
5769
- res = _context59.sent;
5853
+ res = _context60.sent;
5770
5854
  if (!(res !== null && res !== void 0 && res.short_number)) {
5771
- _context59.next = 7;
5855
+ _context60.next = 7;
5772
5856
  break;
5773
5857
  }
5774
- return _context59.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
5858
+ return _context60.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
5775
5859
  case 7:
5776
- return _context59.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
5860
+ return _context60.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
5777
5861
  case 8:
5778
5862
  case "end":
5779
- return _context59.stop();
5863
+ return _context60.stop();
5780
5864
  }
5781
- }, _callee59, this);
5865
+ }, _callee60, this);
5782
5866
  }));
5783
5867
  function getShortNumberOrDeviceId() {
5784
5868
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -5915,16 +5999,16 @@ var Server = /*#__PURE__*/function () {
5915
5999
  }, {
5916
6000
  key: "normalizeCheckoutSubmitData",
5917
6001
  value: function () {
5918
- var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(data, title) {
6002
+ var _normalizeCheckoutSubmitData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(data, title) {
5919
6003
  var next, externalSaleNumber, shouldClearLocalOrderId, hasCheckoutOrderNumbers, localOrder;
5920
- return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5921
- while (1) switch (_context60.prev = _context60.next) {
6004
+ return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6005
+ while (1) switch (_context61.prev = _context61.next) {
5922
6006
  case 0:
5923
6007
  if (!(!data || _typeof(data) !== 'object')) {
5924
- _context60.next = 2;
6008
+ _context61.next = 2;
5925
6009
  break;
5926
6010
  }
5927
- return _context60.abrupt("return", data);
6011
+ return _context61.abrupt("return", data);
5928
6012
  case 2:
5929
6013
  next = _objectSpread({}, data);
5930
6014
  externalSaleNumber = next.external_sale_number;
@@ -5934,7 +6018,7 @@ var Server = /*#__PURE__*/function () {
5934
6018
  delete next.vouchers;
5935
6019
  hasCheckoutOrderNumbers = !this.isBlankCheckoutValue(next.shop_order_number) && !this.isBlankCheckoutValue(next.shop_full_order_number);
5936
6020
  if (!hasCheckoutOrderNumbers) {
5937
- _context60.next = 11;
6021
+ _context61.next = 11;
5938
6022
  break;
5939
6023
  }
5940
6024
  this.logInfo("".concat(title, ": checkout \u5DF2\u643A\u5E26\u8BA2\u5355\u53F7\uFF0C\u8DF3\u8FC7\u67E5\u91CD"), {
@@ -5944,10 +6028,10 @@ var Server = /*#__PURE__*/function () {
5944
6028
  shop_order_number: next.shop_order_number,
5945
6029
  shop_full_order_number: next.shop_full_order_number
5946
6030
  });
5947
- return _context60.abrupt("return", next);
6031
+ return _context61.abrupt("return", next);
5948
6032
  case 11:
5949
6033
  if (!this.isBlankCheckoutValue(externalSaleNumber)) {
5950
- _context60.next = 14;
6034
+ _context61.next = 14;
5951
6035
  break;
5952
6036
  }
5953
6037
  if (shouldClearLocalOrderId) {
@@ -5956,10 +6040,10 @@ var Server = /*#__PURE__*/function () {
5956
6040
  order_id: next.order_id
5957
6041
  });
5958
6042
  }
5959
- return _context60.abrupt("return", next);
6043
+ return _context61.abrupt("return", next);
5960
6044
  case 14:
5961
6045
  if (!(!this.order || typeof this.order.getLocalOrderFromMemoryByLookup !== 'function')) {
5962
- _context60.next = 17;
6046
+ _context61.next = 17;
5963
6047
  break;
5964
6048
  }
5965
6049
  if (shouldClearLocalOrderId) {
@@ -5968,12 +6052,12 @@ var Server = /*#__PURE__*/function () {
5968
6052
  external_sale_number: externalSaleNumber
5969
6053
  });
5970
6054
  }
5971
- return _context60.abrupt("return", next);
6055
+ return _context61.abrupt("return", next);
5972
6056
  case 17:
5973
- _context60.prev = 17;
6057
+ _context61.prev = 17;
5974
6058
  localOrder = this.order.getLocalOrderFromMemoryByLookup(externalSaleNumber);
5975
6059
  if (localOrder) {
5976
- _context60.next = 22;
6060
+ _context61.next = 22;
5977
6061
  break;
5978
6062
  }
5979
6063
  if (shouldClearLocalOrderId) {
@@ -5983,7 +6067,7 @@ var Server = /*#__PURE__*/function () {
5983
6067
  localOrderFound: false
5984
6068
  });
5985
6069
  }
5986
- return _context60.abrupt("return", next);
6070
+ return _context61.abrupt("return", next);
5987
6071
  case 22:
5988
6072
  if (this.isBlankCheckoutValue(next.shop_order_number)) {
5989
6073
  next.shop_order_number = localOrder.shop_order_number;
@@ -6000,23 +6084,23 @@ var Server = /*#__PURE__*/function () {
6000
6084
  shop_full_order_number: next.shop_full_order_number
6001
6085
  });
6002
6086
  // 删除 数据体中的 vouchers,对小票和后端来说他们不需要,这个字段只是单向同步给前端用的,而且目前对订单来说还没什么用
6003
- return _context60.abrupt("return", next);
6087
+ return _context61.abrupt("return", next);
6004
6088
  case 28:
6005
- _context60.prev = 28;
6006
- _context60.t0 = _context60["catch"](17);
6089
+ _context61.prev = 28;
6090
+ _context61.t0 = _context61["catch"](17);
6007
6091
  this.logWarning("".concat(title, ": checkout \u67E5\u627E\u672C\u5730\u8BA2\u5355\u5931\u8D25"), {
6008
6092
  external_sale_number: externalSaleNumber,
6009
- error: this.getUnknownErrorMessage(_context60.t0),
6010
- error_detail: this.normalizeUnknownError(_context60.t0)
6093
+ error: this.getUnknownErrorMessage(_context61.t0),
6094
+ error_detail: this.normalizeUnknownError(_context61.t0)
6011
6095
  });
6012
- return _context60.abrupt("return", next);
6096
+ return _context61.abrupt("return", next);
6013
6097
  case 32:
6014
6098
  case "end":
6015
- return _context60.stop();
6099
+ return _context61.stop();
6016
6100
  }
6017
- }, _callee60, this, [[17, 28]]);
6101
+ }, _callee61, this, [[17, 28]]);
6018
6102
  }));
6019
- function normalizeCheckoutSubmitData(_x63, _x64) {
6103
+ function normalizeCheckoutSubmitData(_x64, _x65) {
6020
6104
  return _normalizeCheckoutSubmitData.apply(this, arguments);
6021
6105
  }
6022
6106
  return normalizeCheckoutSubmitData;
@@ -6024,94 +6108,94 @@ var Server = /*#__PURE__*/function () {
6024
6108
  }, {
6025
6109
  key: "ensureCheckoutOrderNumbers",
6026
6110
  value: function () {
6027
- var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(data, title) {
6111
+ var _ensureCheckoutOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(data, title) {
6028
6112
  var next, needsShopOrderNumber, needsShopFullOrderNumber, idGenerator, _idGenerator$getConfi, _biz;
6029
- return _regeneratorRuntime().wrap(function _callee61$(_context61) {
6030
- while (1) switch (_context61.prev = _context61.next) {
6113
+ return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6114
+ while (1) switch (_context62.prev = _context62.next) {
6031
6115
  case 0:
6032
6116
  if (!(!data || _typeof(data) !== 'object')) {
6033
- _context61.next = 2;
6117
+ _context62.next = 2;
6034
6118
  break;
6035
6119
  }
6036
- return _context61.abrupt("return", data);
6120
+ return _context62.abrupt("return", data);
6037
6121
  case 2:
6038
6122
  next = _objectSpread({}, data);
6039
6123
  needsShopOrderNumber = next.shop_order_number === undefined || next.shop_order_number === null || next.shop_order_number === '';
6040
6124
  needsShopFullOrderNumber = next.shop_full_order_number === undefined || next.shop_full_order_number === null || next.shop_full_order_number === '';
6041
6125
  if (!(!needsShopOrderNumber && !needsShopFullOrderNumber)) {
6042
- _context61.next = 7;
6126
+ _context62.next = 7;
6043
6127
  break;
6044
6128
  }
6045
- return _context61.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6129
+ return _context62.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6046
6130
  case 7:
6047
6131
  idGenerator = this.getIdGeneratorPlugin();
6048
6132
  if (idGenerator) {
6049
- _context61.next = 11;
6133
+ _context62.next = 11;
6050
6134
  break;
6051
6135
  }
6052
6136
  this.logWarning("".concat(title, ": idGenerator \u63D2\u4EF6\u4E0D\u53EF\u7528\uFF0C\u65E0\u6CD5\u751F\u6210\u8BA2\u5355\u53F7"), {
6053
6137
  needsShopOrderNumber: needsShopOrderNumber,
6054
6138
  needsShopFullOrderNumber: needsShopFullOrderNumber
6055
6139
  });
6056
- return _context61.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6140
+ return _context62.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6057
6141
  case 11:
6058
- _context61.prev = 11;
6142
+ _context62.prev = 11;
6059
6143
  if (!(needsShopOrderNumber && idGenerator.generateShopOrderNumber)) {
6060
- _context61.next = 16;
6144
+ _context62.next = 16;
6061
6145
  break;
6062
6146
  }
6063
- _context61.next = 15;
6147
+ _context62.next = 15;
6064
6148
  return idGenerator.generateShopOrderNumber({
6065
6149
  biz: next.business_code || 'ticket'
6066
6150
  });
6067
6151
  case 15:
6068
- next.shop_order_number = _context61.sent;
6152
+ next.shop_order_number = _context62.sent;
6069
6153
  case 16:
6070
6154
  if (!needsShopFullOrderNumber) {
6071
- _context61.next = 26;
6155
+ _context62.next = 26;
6072
6156
  break;
6073
6157
  }
6074
6158
  _biz = next.business_code || 'ticket';
6075
6159
  if (!(((_idGenerator$getConfi = idGenerator.getConfig) === null || _idGenerator$getConfi === void 0 || (_idGenerator$getConfi = _idGenerator$getConfi.call(idGenerator, _biz)) === null || _idGenerator$getConfi === void 0 ? void 0 : _idGenerator$getConfi.enableShortNumber) === false)) {
6076
- _context61.next = 22;
6160
+ _context62.next = 22;
6077
6161
  break;
6078
6162
  }
6079
6163
  next.shop_full_order_number = next.shop_order_number;
6080
- _context61.next = 26;
6164
+ _context62.next = 26;
6081
6165
  break;
6082
6166
  case 22:
6083
6167
  if (!idGenerator.generateReceiptId) {
6084
- _context61.next = 26;
6168
+ _context62.next = 26;
6085
6169
  break;
6086
6170
  }
6087
- _context61.next = 25;
6171
+ _context62.next = 25;
6088
6172
  return idGenerator.generateReceiptId({
6089
6173
  biz: _biz
6090
6174
  });
6091
6175
  case 25:
6092
- next.shop_full_order_number = _context61.sent;
6176
+ next.shop_full_order_number = _context62.sent;
6093
6177
  case 26:
6094
6178
  this.logInfo("".concat(title, ": checkout \u8BA2\u5355\u53F7\u5DF2\u51C6\u5907"), {
6095
6179
  shop_order_number: next.shop_order_number,
6096
6180
  shop_full_order_number: next.shop_full_order_number
6097
6181
  });
6098
- _context61.next = 32;
6182
+ _context62.next = 32;
6099
6183
  break;
6100
6184
  case 29:
6101
- _context61.prev = 29;
6102
- _context61.t0 = _context61["catch"](11);
6185
+ _context62.prev = 29;
6186
+ _context62.t0 = _context62["catch"](11);
6103
6187
  this.logError("".concat(title, ": \u751F\u6210 checkout \u8BA2\u5355\u53F7\u5931\u8D25"), {
6104
- error: _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0)
6188
+ error: _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0)
6105
6189
  });
6106
6190
  case 32:
6107
- return _context61.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6191
+ return _context62.abrupt("return", this.finalizeCheckoutSalesNotes(next, title));
6108
6192
  case 33:
6109
6193
  case "end":
6110
- return _context61.stop();
6194
+ return _context62.stop();
6111
6195
  }
6112
- }, _callee61, this, [[11, 29]]);
6196
+ }, _callee62, this, [[11, 29]]);
6113
6197
  }));
6114
- function ensureCheckoutOrderNumbers(_x65, _x66) {
6198
+ function ensureCheckoutOrderNumbers(_x66, _x67) {
6115
6199
  return _ensureCheckoutOrderNumbers.apply(this, arguments);
6116
6200
  }
6117
6201
  return ensureCheckoutOrderNumbers;
@@ -6158,27 +6242,27 @@ var Server = /*#__PURE__*/function () {
6158
6242
  }, {
6159
6243
  key: "dispatchCheckoutSyncTask",
6160
6244
  value: function () {
6161
- var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(params) {
6245
+ var _dispatchCheckoutSyncTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6162
6246
  var deviceTask, debugDeviceId, debugIdempotencyKey, _params$data, _params$data2, _params$data3, _params$data4, result;
6163
- return _regeneratorRuntime().wrap(function _callee62$(_context62) {
6164
- while (1) switch (_context62.prev = _context62.next) {
6247
+ return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6248
+ while (1) switch (_context63.prev = _context63.next) {
6165
6249
  case 0:
6166
6250
  this.registerDeviceTaskActions();
6167
6251
  deviceTask = this.getDeviceTaskPlugin();
6168
- _context62.next = 4;
6252
+ _context63.next = 4;
6169
6253
  return this.getShortNumberOrDeviceId();
6170
6254
  case 4:
6171
- debugDeviceId = _context62.sent;
6255
+ debugDeviceId = _context63.sent;
6172
6256
  debugIdempotencyKey = this.buildCheckoutTaskIdempotencyKey(params.data);
6173
6257
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
6174
- _context62.next = 9;
6258
+ _context63.next = 9;
6175
6259
  break;
6176
6260
  }
6177
6261
  this.logError("".concat(params.title, ": deviceTask.dispatch \u4E0D\u53EF\u7528"));
6178
- return _context62.abrupt("return");
6262
+ return _context63.abrupt("return");
6179
6263
  case 9:
6180
- _context62.prev = 9;
6181
- _context62.next = 12;
6264
+ _context63.prev = 9;
6265
+ _context63.next = 12;
6182
6266
  return deviceTask.dispatch({
6183
6267
  action: 'sync_sales',
6184
6268
  device_id: debugDeviceId,
@@ -6198,27 +6282,27 @@ var Server = /*#__PURE__*/function () {
6198
6282
  source_id: ((_params$data2 = params.data) === null || _params$data2 === void 0 ? void 0 : _params$data2.order_id) || ((_params$data3 = params.data) === null || _params$data3 === void 0 ? void 0 : _params$data3.external_sale_number) || ((_params$data4 = params.data) === null || _params$data4 === void 0 ? void 0 : _params$data4.shop_order_number)
6199
6283
  });
6200
6284
  case 12:
6201
- result = _context62.sent;
6285
+ result = _context63.sent;
6202
6286
  this.logInfo("".concat(params.title, ": sync_sales \u4EFB\u52A1\u5DF2\u6D3E\u53D1"), {
6203
6287
  uuid: result === null || result === void 0 ? void 0 : result.uuid,
6204
6288
  status: result === null || result === void 0 ? void 0 : result.status,
6205
6289
  reused: result === null || result === void 0 ? void 0 : result.reused
6206
6290
  });
6207
- _context62.next = 19;
6291
+ _context63.next = 19;
6208
6292
  break;
6209
6293
  case 16:
6210
- _context62.prev = 16;
6211
- _context62.t0 = _context62["catch"](9);
6294
+ _context63.prev = 16;
6295
+ _context63.t0 = _context63["catch"](9);
6212
6296
  this.logError("".concat(params.title, ": \u6D3E\u53D1 sync_sales \u4EFB\u52A1\u5931\u8D25"), {
6213
- error: _context62.t0 instanceof Error ? _context62.t0.message : String(_context62.t0)
6297
+ error: _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0)
6214
6298
  });
6215
6299
  case 19:
6216
6300
  case "end":
6217
- return _context62.stop();
6301
+ return _context63.stop();
6218
6302
  }
6219
- }, _callee62, this, [[9, 16]]);
6303
+ }, _callee63, this, [[9, 16]]);
6220
6304
  }));
6221
- function dispatchCheckoutSyncTask(_x67) {
6305
+ function dispatchCheckoutSyncTask(_x68) {
6222
6306
  return _dispatchCheckoutSyncTask.apply(this, arguments);
6223
6307
  }
6224
6308
  return dispatchCheckoutSyncTask;
@@ -6226,26 +6310,26 @@ var Server = /*#__PURE__*/function () {
6226
6310
  }, {
6227
6311
  key: "dispatchPrintOtherReceiptTask",
6228
6312
  value: function () {
6229
- var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(params) {
6313
+ var _dispatchPrintOtherReceiptTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6230
6314
  var deviceTask, _params$deviceId, _params$syncedOrder, _params$syncedOrder2, _params$syncedOrder3, printIdentity, deviceId;
6231
- return _regeneratorRuntime().wrap(function _callee63$(_context63) {
6232
- while (1) switch (_context63.prev = _context63.next) {
6315
+ return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6316
+ while (1) switch (_context64.prev = _context64.next) {
6233
6317
  case 0:
6234
6318
  deviceTask = this.getDeviceTaskPlugin();
6235
6319
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
6236
- _context63.next = 4;
6320
+ _context64.next = 4;
6237
6321
  break;
6238
6322
  }
6239
6323
  this.logWarning('dispatchPrintOtherReceiptTask: deviceTask.dispatch 不可用');
6240
- return _context63.abrupt("return");
6324
+ return _context64.abrupt("return");
6241
6325
  case 4:
6242
- _context63.prev = 4;
6326
+ _context64.prev = 4;
6243
6327
  printIdentity = this.getPrintOrderIdentity(params.syncedOrder);
6244
- _context63.next = 8;
6328
+ _context64.next = 8;
6245
6329
  return this.getShortNumberOrDeviceId();
6246
6330
  case 8:
6247
- deviceId = _context63.sent;
6248
- _context63.next = 11;
6331
+ deviceId = _context64.sent;
6332
+ _context64.next = 11;
6249
6333
  return deviceTask.dispatch({
6250
6334
  action: 'print_all',
6251
6335
  device_id: (_params$deviceId = params.deviceId) !== null && _params$deviceId !== void 0 ? _params$deviceId : deviceId,
@@ -6274,21 +6358,21 @@ var Server = /*#__PURE__*/function () {
6274
6358
  source_id: printIdentity
6275
6359
  });
6276
6360
  case 11:
6277
- _context63.next = 16;
6361
+ _context64.next = 16;
6278
6362
  break;
6279
6363
  case 13:
6280
- _context63.prev = 13;
6281
- _context63.t0 = _context63["catch"](4);
6364
+ _context64.prev = 13;
6365
+ _context64.t0 = _context64["catch"](4);
6282
6366
  this.logError('dispatchPrintOtherReceiptTask: 派发失败', {
6283
- error: _context63.t0 instanceof Error ? _context63.t0.message : String(_context63.t0)
6367
+ error: _context64.t0 instanceof Error ? _context64.t0.message : String(_context64.t0)
6284
6368
  });
6285
6369
  case 16:
6286
6370
  case "end":
6287
- return _context63.stop();
6371
+ return _context64.stop();
6288
6372
  }
6289
- }, _callee63, this, [[4, 13]]);
6373
+ }, _callee64, this, [[4, 13]]);
6290
6374
  }));
6291
- function dispatchPrintOtherReceiptTask(_x68) {
6375
+ function dispatchPrintOtherReceiptTask(_x69) {
6292
6376
  return _dispatchPrintOtherReceiptTask.apply(this, arguments);
6293
6377
  }
6294
6378
  return dispatchPrintOtherReceiptTask;
@@ -6308,34 +6392,34 @@ var Server = /*#__PURE__*/function () {
6308
6392
  }, {
6309
6393
  key: "dispatchLocalReceiptPrint",
6310
6394
  value: function () {
6311
- var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(params) {
6395
+ var _dispatchLocalReceiptPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(params) {
6312
6396
  var _payment_info2;
6313
6397
  var printableOrder;
6314
- return _regeneratorRuntime().wrap(function _callee64$(_context64) {
6315
- while (1) switch (_context64.prev = _context64.next) {
6398
+ return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6399
+ while (1) switch (_context65.prev = _context65.next) {
6316
6400
  case 0:
6317
6401
  if (!(params.requireFullyPaid && !this.isSalesOrderFullyPaid(params.order))) {
6318
- _context64.next = 2;
6402
+ _context65.next = 2;
6319
6403
  break;
6320
6404
  }
6321
- return _context64.abrupt("return", {
6405
+ return _context65.abrupt("return", {
6322
6406
  printed: false,
6323
6407
  order: params.order
6324
6408
  });
6325
6409
  case 2:
6326
- _context64.next = 4;
6410
+ _context65.next = 4;
6327
6411
  return this.withLocalSmallTicketData(params.order, {
6328
6412
  requireFullyPaid: params.requireFullyPaid,
6329
6413
  invoiceTemplateSettings: params.invoiceTemplateSettings,
6330
6414
  applyTemplateVisibility: true
6331
6415
  });
6332
6416
  case 4:
6333
- printableOrder = _context64.sent;
6417
+ printableOrder = _context65.sent;
6334
6418
  if (hasSmallTicketData((_payment_info2 = printableOrder.payment_info) === null || _payment_info2 === void 0 ? void 0 : _payment_info2.small_ticket_data)) {
6335
- _context64.next = 7;
6419
+ _context65.next = 7;
6336
6420
  break;
6337
6421
  }
6338
- return _context64.abrupt("return", {
6422
+ return _context65.abrupt("return", {
6339
6423
  printed: false,
6340
6424
  order: printableOrder
6341
6425
  });
@@ -6345,7 +6429,7 @@ var Server = /*#__PURE__*/function () {
6345
6429
  printableOrder: printableOrder,
6346
6430
  response: params.response
6347
6431
  });
6348
- _context64.next = 10;
6432
+ _context65.next = 10;
6349
6433
  return this.dispatchPrintOtherReceiptTask({
6350
6434
  checkoutData: params.checkoutData,
6351
6435
  syncedOrder: printableOrder,
@@ -6356,17 +6440,17 @@ var Server = /*#__PURE__*/function () {
6356
6440
  invoiceTemplateSettings: params.invoiceTemplateSettings
6357
6441
  });
6358
6442
  case 10:
6359
- return _context64.abrupt("return", {
6443
+ return _context65.abrupt("return", {
6360
6444
  printed: true,
6361
6445
  order: requiresInvoiceDataFiltering(params.invoiceTemplateSettings) ? params.order : printableOrder
6362
6446
  });
6363
6447
  case 11:
6364
6448
  case "end":
6365
- return _context64.stop();
6449
+ return _context65.stop();
6366
6450
  }
6367
- }, _callee64, this);
6451
+ }, _callee65, this);
6368
6452
  }));
6369
- function dispatchLocalReceiptPrint(_x69) {
6453
+ function dispatchLocalReceiptPrint(_x70) {
6370
6454
  return _dispatchLocalReceiptPrint.apply(this, arguments);
6371
6455
  }
6372
6456
  return dispatchLocalReceiptPrint;
@@ -6425,57 +6509,57 @@ var Server = /*#__PURE__*/function () {
6425
6509
  }, {
6426
6510
  key: "syncMachinecodeRedeemStatusToLocalOrder",
6427
6511
  value: function () {
6428
- var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(data, ids, status) {
6512
+ var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(data, ids, status) {
6429
6513
  var _this$order5, _data$order_id2;
6430
6514
  var title, lookup, localOrder, orderId, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
6431
- return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6432
- while (1) switch (_context65.prev = _context65.next) {
6515
+ return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6516
+ while (1) switch (_context66.prev = _context66.next) {
6433
6517
  case 0:
6434
6518
  title = 'handleMachinecodeBatchMetadata';
6435
6519
  lookup = this.resolveMachinecodeBatchMetadataLookup(data);
6436
6520
  if (!(lookup === undefined)) {
6437
- _context65.next = 5;
6521
+ _context66.next = 5;
6438
6522
  break;
6439
6523
  }
6440
6524
  this.logWarning("".concat(title, ": order lookup \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
6441
6525
  batchSize: ids.length,
6442
6526
  status: status
6443
6527
  });
6444
- return _context65.abrupt("return");
6528
+ return _context66.abrupt("return");
6445
6529
  case 5:
6446
6530
  if ((_this$order5 = this.order) !== null && _this$order5 !== void 0 && _this$order5.getLocalOrderByLookup) {
6447
- _context65.next = 8;
6531
+ _context66.next = 8;
6448
6532
  break;
6449
6533
  }
6450
6534
  this.logWarning("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
6451
6535
  lookup: lookup,
6452
6536
  status: status
6453
6537
  });
6454
- return _context65.abrupt("return");
6538
+ return _context66.abrupt("return");
6455
6539
  case 8:
6456
- _context65.next = 10;
6540
+ _context66.next = 10;
6457
6541
  return this.order.getLocalOrderByLookup(lookup);
6458
6542
  case 10:
6459
- localOrder = _context65.sent;
6543
+ localOrder = _context66.sent;
6460
6544
  orderId = (_data$order_id2 = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id2 !== void 0 ? _data$order_id2 : data === null || data === void 0 ? void 0 : data.orderId;
6461
6545
  if (!(!localOrder && orderId !== undefined && orderId !== null && orderId !== '' && String(orderId) !== String(lookup))) {
6462
- _context65.next = 16;
6546
+ _context66.next = 16;
6463
6547
  break;
6464
6548
  }
6465
- _context65.next = 15;
6549
+ _context66.next = 15;
6466
6550
  return this.order.getLocalOrderByLookup(orderId);
6467
6551
  case 15:
6468
- localOrder = _context65.sent;
6552
+ localOrder = _context66.sent;
6469
6553
  case 16:
6470
6554
  if (localOrder) {
6471
- _context65.next = 19;
6555
+ _context66.next = 19;
6472
6556
  break;
6473
6557
  }
6474
6558
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
6475
6559
  lookup: lookup,
6476
6560
  status: status
6477
6561
  });
6478
- return _context65.abrupt("return");
6562
+ return _context66.abrupt("return");
6479
6563
  case 19:
6480
6564
  voucherIdSet = new Set(ids.filter(function (id) {
6481
6565
  return id !== undefined && id !== null && id !== '';
@@ -6483,14 +6567,14 @@ var Server = /*#__PURE__*/function () {
6483
6567
  return String(id);
6484
6568
  }));
6485
6569
  if (!(voucherIdSet.size === 0)) {
6486
- _context65.next = 23;
6570
+ _context66.next = 23;
6487
6571
  break;
6488
6572
  }
6489
6573
  this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
6490
6574
  lookup: lookup,
6491
6575
  status: status
6492
6576
  });
6493
- return _context65.abrupt("return");
6577
+ return _context66.abrupt("return");
6494
6578
  case 23:
6495
6579
  vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
6496
6580
  hasUpdatedVoucher = false;
@@ -6504,7 +6588,7 @@ var Server = /*#__PURE__*/function () {
6504
6588
  });
6505
6589
  });
6506
6590
  if (hasUpdatedVoucher) {
6507
- _context65.next = 29;
6591
+ _context66.next = 29;
6508
6592
  break;
6509
6593
  }
6510
6594
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
@@ -6512,13 +6596,13 @@ var Server = /*#__PURE__*/function () {
6512
6596
  voucher_ids: Array.from(voucherIdSet),
6513
6597
  status: status
6514
6598
  });
6515
- return _context65.abrupt("return");
6599
+ return _context66.abrupt("return");
6516
6600
  case 29:
6517
6601
  if (!(typeof this.order.overwriteExistingOrder === 'function')) {
6518
- _context65.next = 34;
6602
+ _context66.next = 34;
6519
6603
  break;
6520
6604
  }
6521
- _context65.next = 32;
6605
+ _context66.next = 32;
6522
6606
  return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
6523
6607
  vouchers: nextVouchers
6524
6608
  }));
@@ -6528,13 +6612,13 @@ var Server = /*#__PURE__*/function () {
6528
6612
  updatedCount: voucherIdSet.size,
6529
6613
  status: status
6530
6614
  });
6531
- return _context65.abrupt("return");
6615
+ return _context66.abrupt("return");
6532
6616
  case 34:
6533
6617
  if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
6534
- _context65.next = 39;
6618
+ _context66.next = 39;
6535
6619
  break;
6536
6620
  }
6537
- _context65.next = 37;
6621
+ _context66.next = 37;
6538
6622
  return this.order.markOrderSyncedByExternalSaleNumber({
6539
6623
  externalSaleNumber: data.external_sale_number,
6540
6624
  patch: {
@@ -6547,7 +6631,7 @@ var Server = /*#__PURE__*/function () {
6547
6631
  updatedCount: voucherIdSet.size,
6548
6632
  status: status
6549
6633
  });
6550
- return _context65.abrupt("return");
6634
+ return _context66.abrupt("return");
6551
6635
  case 39:
6552
6636
  this.logWarning("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8BA2\u5355\u8986\u76D6\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
6553
6637
  lookup: lookup,
@@ -6555,11 +6639,11 @@ var Server = /*#__PURE__*/function () {
6555
6639
  });
6556
6640
  case 40:
6557
6641
  case "end":
6558
- return _context65.stop();
6642
+ return _context66.stop();
6559
6643
  }
6560
- }, _callee65, this);
6644
+ }, _callee66, this);
6561
6645
  }));
6562
- function syncMachinecodeRedeemStatusToLocalOrder(_x70, _x71, _x72) {
6646
+ function syncMachinecodeRedeemStatusToLocalOrder(_x71, _x72, _x73) {
6563
6647
  return _syncMachinecodeRedeemStatusToLocalOrder.apply(this, arguments);
6564
6648
  }
6565
6649
  return syncMachinecodeRedeemStatusToLocalOrder;
@@ -6567,30 +6651,30 @@ var Server = /*#__PURE__*/function () {
6567
6651
  }, {
6568
6652
  key: "handleOrderCheckoutSubmit",
6569
6653
  value: function () {
6570
- var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(params) {
6654
+ var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6571
6655
  var _params$data5, _params$data6, _this$order6, _this$order6$getLocal;
6572
6656
  var backendPath, title, lookup, localOrder, extractedInvoice, extractedTemplateSettings, data, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, normalizedData, numberedData, checkoutData, pendingResult, pendingOrder;
6573
- return _regeneratorRuntime().wrap(function _callee66$(_context66) {
6574
- while (1) switch (_context66.prev = _context66.next) {
6657
+ return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6658
+ while (1) switch (_context67.prev = _context67.next) {
6575
6659
  case 0:
6576
6660
  backendPath = params.backendPath, title = params.title;
6577
6661
  lookup = ((_params$data5 = params.data) === null || _params$data5 === void 0 ? void 0 : _params$data5.order_id) || ((_params$data6 = params.data) === null || _params$data6 === void 0 ? void 0 : _params$data6.external_sale_number);
6578
- _context66.t0 = lookup;
6579
- if (!_context66.t0) {
6580
- _context66.next = 7;
6662
+ _context67.t0 = lookup;
6663
+ if (!_context67.t0) {
6664
+ _context67.next = 7;
6581
6665
  break;
6582
6666
  }
6583
- _context66.next = 6;
6667
+ _context67.next = 6;
6584
6668
  return (_this$order6 = this.order) === null || _this$order6 === void 0 || (_this$order6$getLocal = _this$order6.getLocalOrderByLookup) === null || _this$order6$getLocal === void 0 ? void 0 : _this$order6$getLocal.call(_this$order6, lookup);
6585
6669
  case 6:
6586
- _context66.t0 = _context66.sent;
6670
+ _context67.t0 = _context67.sent;
6587
6671
  case 7:
6588
- localOrder = _context66.t0;
6672
+ localOrder = _context67.t0;
6589
6673
  if (!(requiresLocalPaymentRefresh(params.data) || requiresLocalPaymentRefresh(localOrder))) {
6590
- _context66.next = 10;
6674
+ _context67.next = 10;
6591
6675
  break;
6592
6676
  }
6593
- return _context66.abrupt("return", {
6677
+ return _context67.abrupt("return", {
6594
6678
  code: 409,
6595
6679
  status: false,
6596
6680
  message: PAYMENT_REFRESH_MESSAGE,
@@ -6614,10 +6698,10 @@ var Server = /*#__PURE__*/function () {
6614
6698
  order_number: data === null || data === void 0 ? void 0 : data.order_number
6615
6699
  });
6616
6700
  if (!(data !== null && data !== void 0 && data.sync_mode || data !== null && data !== void 0 && data.syncMode)) {
6617
- _context66.next = 19;
6701
+ _context67.next = 19;
6618
6702
  break;
6619
6703
  }
6620
- return _context66.abrupt("return", this.handleSyncCheckoutSubmit({
6704
+ return _context67.abrupt("return", this.handleSyncCheckoutSubmit({
6621
6705
  backendPath: backendPath,
6622
6706
  data: data,
6623
6707
  title: title,
@@ -6626,16 +6710,16 @@ var Server = /*#__PURE__*/function () {
6626
6710
  receiptAutoPrintPaymentStatuses: receiptAutoPrintPaymentStatuses
6627
6711
  }));
6628
6712
  case 19:
6629
- _context66.next = 21;
6713
+ _context67.next = 21;
6630
6714
  return this.normalizeCheckoutSubmitData(data, title);
6631
6715
  case 21:
6632
- normalizedData = _context66.sent;
6633
- _context66.next = 24;
6716
+ normalizedData = _context67.sent;
6717
+ _context67.next = 24;
6634
6718
  return this.ensureCheckoutOrderNumbers(normalizedData, title);
6635
6719
  case 24:
6636
- numberedData = _context66.sent;
6720
+ numberedData = _context67.sent;
6637
6721
  checkoutData = this.normalizeCheckoutCollections(stripOsPrivatePayloadFields(this.applyCheckoutFulfillmentBuzzer(numberedData, title)));
6638
- _context66.next = 28;
6722
+ _context67.next = 28;
6639
6723
  return this.handlePendingSyncCheckoutOrder({
6640
6724
  backendPath: backendPath,
6641
6725
  data: checkoutData,
@@ -6644,18 +6728,18 @@ var Server = /*#__PURE__*/function () {
6644
6728
  invoiceTemplateSettings: invoiceTemplateSettings
6645
6729
  });
6646
6730
  case 28:
6647
- pendingResult = _context66.sent;
6731
+ pendingResult = _context67.sent;
6648
6732
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
6649
- _context66.next = 43;
6733
+ _context67.next = 43;
6650
6734
  break;
6651
6735
  }
6652
6736
  pendingOrder = pendingResult.data;
6653
6737
  if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(pendingOrder, receiptAutoPrintPaymentStatuses) && this.shouldAutoPrintCheckoutReceipt())) {
6654
- _context66.next = 41;
6738
+ _context67.next = 41;
6655
6739
  break;
6656
6740
  }
6657
- _context66.prev = 32;
6658
- _context66.next = 35;
6741
+ _context67.prev = 32;
6742
+ _context67.next = 35;
6659
6743
  return this.dispatchLocalReceiptPrint({
6660
6744
  checkoutData: checkoutData,
6661
6745
  order: pendingOrder,
@@ -6665,19 +6749,19 @@ var Server = /*#__PURE__*/function () {
6665
6749
  invoiceTemplateSettings: invoiceTemplateSettings
6666
6750
  });
6667
6751
  case 35:
6668
- _context66.next = 41;
6752
+ _context67.next = 41;
6669
6753
  break;
6670
6754
  case 37:
6671
- _context66.prev = 37;
6672
- _context66.t1 = _context66["catch"](32);
6755
+ _context67.prev = 37;
6756
+ _context67.t1 = _context67["catch"](32);
6673
6757
  // The sale is already persisted. A failed receipt must not cancel its
6674
6758
  // sync task or send an unfiltered fallback to the printer.
6675
- pendingResult.receipt_print_error = this.getUnknownErrorMessage(_context66.t1);
6759
+ pendingResult.receipt_print_error = this.getUnknownErrorMessage(_context67.t1);
6676
6760
  this.logError("".concat(title, ": \u5C0F\u7968\u751F\u6210\u5931\u8D25\uFF0C\u8BA2\u5355\u4ECD\u7EE7\u7EED\u540C\u6B65"), {
6677
6761
  error: pendingResult.receipt_print_error
6678
6762
  });
6679
6763
  case 41:
6680
- _context66.next = 43;
6764
+ _context67.next = 43;
6681
6765
  return this.dispatchCheckoutSyncTask({
6682
6766
  backendPath: backendPath,
6683
6767
  data: checkoutData,
@@ -6687,23 +6771,23 @@ var Server = /*#__PURE__*/function () {
6687
6771
  });
6688
6772
  case 43:
6689
6773
  if (pendingResult.data.order_id) {
6690
- _context66.next = 45;
6774
+ _context67.next = 45;
6691
6775
  break;
6692
6776
  }
6693
- return _context66.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
6777
+ return _context67.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
6694
6778
  data: _objectSpread(_objectSpread({}, pendingResult.data), {}, {
6695
6779
  order_id: pendingResult.data.external_sale_number
6696
6780
  })
6697
6781
  }));
6698
6782
  case 45:
6699
- return _context66.abrupt("return", pendingResult);
6783
+ return _context67.abrupt("return", pendingResult);
6700
6784
  case 46:
6701
6785
  case "end":
6702
- return _context66.stop();
6786
+ return _context67.stop();
6703
6787
  }
6704
- }, _callee66, this, [[32, 37]]);
6788
+ }, _callee67, this, [[32, 37]]);
6705
6789
  }));
6706
- function handleOrderCheckoutSubmit(_x73) {
6790
+ function handleOrderCheckoutSubmit(_x74) {
6707
6791
  return _handleOrderCheckoutSubmit.apply(this, arguments);
6708
6792
  }
6709
6793
  return handleOrderCheckoutSubmit;
@@ -6711,27 +6795,27 @@ var Server = /*#__PURE__*/function () {
6711
6795
  }, {
6712
6796
  key: "handleSyncCheckoutSubmit",
6713
6797
  value: function () {
6714
- var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6798
+ var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6715
6799
  var _this$app17;
6716
6800
  var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
6717
- return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6718
- while (1) switch (_context67.prev = _context67.next) {
6801
+ return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6802
+ while (1) switch (_context68.prev = _context68.next) {
6719
6803
  case 0:
6720
6804
  backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings, receiptAutoPrintPaymentStatuses = params.receiptAutoPrintPaymentStatuses;
6721
6805
  if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.post) {
6722
- _context67.next = 4;
6806
+ _context68.next = 4;
6723
6807
  break;
6724
6808
  }
6725
6809
  this.logError("".concat(title, ": sync checkout app.request \u4E0D\u53EF\u7528"));
6726
- return _context67.abrupt("return", {
6810
+ return _context68.abrupt("return", {
6727
6811
  code: 500,
6728
6812
  status: false,
6729
6813
  message: 'app.request 不可用',
6730
6814
  data: null
6731
6815
  });
6732
6816
  case 4:
6733
- _context67.prev = 4;
6734
- _context67.next = 7;
6817
+ _context68.prev = 4;
6818
+ _context68.next = 7;
6735
6819
  return this.runCheckoutSync({
6736
6820
  backendPath: backendPath,
6737
6821
  data: data,
@@ -6741,13 +6825,13 @@ var Server = /*#__PURE__*/function () {
6741
6825
  invoiceTemplateSettings: invoiceTemplateSettings
6742
6826
  });
6743
6827
  case 7:
6744
- syncResult = _context67.sent;
6828
+ syncResult = _context68.sent;
6745
6829
  if (!syncResult.rejected) {
6746
- _context67.next = 11;
6830
+ _context68.next = 11;
6747
6831
  break;
6748
6832
  }
6749
6833
  normalized = this.normalizeCheckoutResponse(syncResult.errorResponse);
6750
- return _context67.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
6834
+ return _context68.abrupt("return", _objectSpread(_objectSpread({}, normalized), {}, {
6751
6835
  status: false,
6752
6836
  message: syncResult.message || (normalized === null || normalized === void 0 ? void 0 : normalized.message) || '后端明确拒绝 checkout',
6753
6837
  data: (_normalized$data = normalized === null || normalized === void 0 ? void 0 : normalized.data) !== null && _normalized$data !== void 0 ? _normalized$data : null
@@ -6756,11 +6840,11 @@ var Server = /*#__PURE__*/function () {
6756
6840
  response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
6757
6841
  syncedOrder = syncResult.syncedOrder;
6758
6842
  if (!(syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(syncedOrder, receiptAutoPrintPaymentStatuses) && (receiptAutoPrintPaymentStatuses === undefined || this.shouldAutoPrintCheckoutReceipt()))) {
6759
- _context67.next = 23;
6843
+ _context68.next = 23;
6760
6844
  break;
6761
6845
  }
6762
- _context67.prev = 14;
6763
- _context67.next = 17;
6846
+ _context68.prev = 14;
6847
+ _context68.next = 17;
6764
6848
  return this.dispatchLocalReceiptPrint({
6765
6849
  checkoutData: syncResult.checkoutData,
6766
6850
  order: syncedOrder,
@@ -6770,41 +6854,41 @@ var Server = /*#__PURE__*/function () {
6770
6854
  invoiceTemplateSettings: invoiceTemplateSettings
6771
6855
  });
6772
6856
  case 17:
6773
- _context67.next = 23;
6857
+ _context68.next = 23;
6774
6858
  break;
6775
6859
  case 19:
6776
- _context67.prev = 19;
6777
- _context67.t0 = _context67["catch"](14);
6860
+ _context68.prev = 19;
6861
+ _context68.t0 = _context68["catch"](14);
6778
6862
  // Checkout already succeeded remotely; report the receipt failure
6779
6863
  // separately instead of implying that payment/order creation failed.
6780
- response.receipt_print_error = this.getUnknownErrorMessage(_context67.t0);
6864
+ response.receipt_print_error = this.getUnknownErrorMessage(_context68.t0);
6781
6865
  this.logError("".concat(title, ": \u5C0F\u7968\u751F\u6210\u5931\u8D25\uFF0C\u8BA2\u5355\u5DF2\u540C\u6B65"), {
6782
6866
  error: response.receipt_print_error
6783
6867
  });
6784
6868
  case 23:
6785
- return _context67.abrupt("return", response);
6869
+ return _context68.abrupt("return", response);
6786
6870
  case 26:
6787
- _context67.prev = 26;
6788
- _context67.t1 = _context67["catch"](4);
6789
- backendError = this.extractBackendErrorResponse(_context67.t1);
6871
+ _context68.prev = 26;
6872
+ _context68.t1 = _context68["catch"](4);
6873
+ backendError = this.extractBackendErrorResponse(_context68.t1);
6790
6874
  if (!backendError) {
6791
- _context67.next = 32;
6875
+ _context68.next = 32;
6792
6876
  break;
6793
6877
  }
6794
6878
  _normalized = this.normalizeCheckoutResponse(backendError);
6795
- return _context67.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
6879
+ return _context68.abrupt("return", _objectSpread(_objectSpread({}, _normalized), {}, {
6796
6880
  status: false,
6797
6881
  message: (backendError === null || backendError === void 0 ? void 0 : backendError.message) || (_normalized === null || _normalized === void 0 ? void 0 : _normalized.message) || '后端明确拒绝 checkout',
6798
6882
  data: (_normalized$data2 = _normalized === null || _normalized === void 0 ? void 0 : _normalized.data) !== null && _normalized$data2 !== void 0 ? _normalized$data2 : null
6799
6883
  }));
6800
6884
  case 32:
6801
- message = this.getUnknownErrorMessage(_context67.t1);
6885
+ message = this.getUnknownErrorMessage(_context68.t1);
6802
6886
  this.logError("".concat(title, ": sync checkout \u8BF7\u6C42\u672A\u660E\u786E\u6210\u529F"), {
6803
6887
  backendPath: backendPath,
6804
6888
  error: message,
6805
- error_detail: this.normalizeUnknownError(_context67.t1)
6889
+ error_detail: this.normalizeUnknownError(_context68.t1)
6806
6890
  });
6807
- return _context67.abrupt("return", {
6891
+ return _context68.abrupt("return", {
6808
6892
  code: 500,
6809
6893
  status: false,
6810
6894
  message: message,
@@ -6812,11 +6896,11 @@ var Server = /*#__PURE__*/function () {
6812
6896
  });
6813
6897
  case 35:
6814
6898
  case "end":
6815
- return _context67.stop();
6899
+ return _context68.stop();
6816
6900
  }
6817
- }, _callee67, this, [[4, 26], [14, 19]]);
6901
+ }, _callee68, this, [[4, 26], [14, 19]]);
6818
6902
  }));
6819
- function handleSyncCheckoutSubmit(_x74) {
6903
+ function handleSyncCheckoutSubmit(_x75) {
6820
6904
  return _handleSyncCheckoutSubmit.apply(this, arguments);
6821
6905
  }
6822
6906
  return handleSyncCheckoutSubmit;
@@ -6824,10 +6908,10 @@ var Server = /*#__PURE__*/function () {
6824
6908
  }, {
6825
6909
  key: "handleOrderDraftSubmit",
6826
6910
  value: function () {
6827
- var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(params) {
6911
+ var _handleOrderDraftSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(params) {
6828
6912
  var title, extractedInvoice, _this$extractInvoiceT, data, normalizedData, createdAt, draftOrder, _draftOrder$summary, _draftOrder$summary2, _draftOrder$summary3, errorMessage;
6829
- return _regeneratorRuntime().wrap(function _callee68$(_context68) {
6830
- while (1) switch (_context68.prev = _context68.next) {
6913
+ return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6914
+ while (1) switch (_context69.prev = _context69.next) {
6831
6915
  case 0:
6832
6916
  title = params.title;
6833
6917
  extractedInvoice = this.extractInvoiceLayoutConfig(params.data, {
@@ -6841,10 +6925,10 @@ var Server = /*#__PURE__*/function () {
6841
6925
  external_sale_number: data === null || data === void 0 ? void 0 : data.external_sale_number,
6842
6926
  order_number: data === null || data === void 0 ? void 0 : data.order_number
6843
6927
  });
6844
- _context68.next = 6;
6928
+ _context69.next = 6;
6845
6929
  return this.normalizeCheckoutSubmitData(data, title);
6846
6930
  case 6:
6847
- normalizedData = _context68.sent;
6931
+ normalizedData = _context69.sent;
6848
6932
  createdAt = normalizedData.created_at || normalizedData.create_date || dayjs().format('YYYY-MM-DD HH:mm:ss');
6849
6933
  draftOrder = _objectSpread(_objectSpread({}, normalizedData), {}, {
6850
6934
  external_sale_number: normalizedData.external_sale_number || "LOCAL_DRAFT_".concat(Date.now(), "_").concat(Math.random().toString(36).slice(2, 10)),
@@ -6854,26 +6938,26 @@ var Server = /*#__PURE__*/function () {
6854
6938
  is_draft_order: 1
6855
6939
  });
6856
6940
  if (!(!this.order || typeof this.order.upsertLocalDraftOrders !== 'function')) {
6857
- _context68.next = 12;
6941
+ _context69.next = 12;
6858
6942
  break;
6859
6943
  }
6860
6944
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u8349\u7A3F\u5199\u5165"));
6861
- return _context68.abrupt("return", {
6945
+ return _context69.abrupt("return", {
6862
6946
  code: 500,
6863
6947
  status: false,
6864
6948
  message: 'Order 模块不支持本地草稿写入',
6865
6949
  data: null
6866
6950
  });
6867
6951
  case 12:
6868
- _context68.prev = 12;
6869
- _context68.next = 15;
6952
+ _context69.prev = 12;
6953
+ _context69.next = 15;
6870
6954
  return this.order.upsertLocalDraftOrders([draftOrder]);
6871
6955
  case 15:
6872
6956
  this.logInfo("".concat(title, ": \u8349\u7A3F\u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730"), {
6873
6957
  order_id: draftOrder.order_id,
6874
6958
  external_sale_number: draftOrder.external_sale_number
6875
6959
  });
6876
- return _context68.abrupt("return", {
6960
+ return _context69.abrupt("return", {
6877
6961
  code: 200,
6878
6962
  status: true,
6879
6963
  message: '',
@@ -6885,13 +6969,13 @@ var Server = /*#__PURE__*/function () {
6885
6969
  })
6886
6970
  });
6887
6971
  case 19:
6888
- _context68.prev = 19;
6889
- _context68.t0 = _context68["catch"](12);
6890
- errorMessage = _context68.t0 instanceof Error ? _context68.t0.message : String(_context68.t0);
6972
+ _context69.prev = 19;
6973
+ _context69.t0 = _context69["catch"](12);
6974
+ errorMessage = _context69.t0 instanceof Error ? _context69.t0.message : String(_context69.t0);
6891
6975
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u8349\u7A3F\u8BA2\u5355\u5931\u8D25"), {
6892
6976
  error: errorMessage
6893
6977
  });
6894
- return _context68.abrupt("return", {
6978
+ return _context69.abrupt("return", {
6895
6979
  code: 500,
6896
6980
  status: false,
6897
6981
  message: errorMessage,
@@ -6899,11 +6983,11 @@ var Server = /*#__PURE__*/function () {
6899
6983
  });
6900
6984
  case 24:
6901
6985
  case "end":
6902
- return _context68.stop();
6986
+ return _context69.stop();
6903
6987
  }
6904
- }, _callee68, this, [[12, 19]]);
6988
+ }, _callee69, this, [[12, 19]]);
6905
6989
  }));
6906
- function handleOrderDraftSubmit(_x75) {
6990
+ function handleOrderDraftSubmit(_x76) {
6907
6991
  return _handleOrderDraftSubmit.apply(this, arguments);
6908
6992
  }
6909
6993
  return handleOrderDraftSubmit;
@@ -6911,26 +6995,26 @@ var Server = /*#__PURE__*/function () {
6911
6995
  }, {
6912
6996
  key: "handlePendingSyncCheckoutOrder",
6913
6997
  value: function () {
6914
- var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(params) {
6998
+ var _handlePendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(params) {
6915
6999
  var _this17 = this;
6916
7000
  var backendPath, data, title, reason, invoiceTemplateSettings, pendingOrder, _pendingOrder$payment, _pendingOrder$summary, _pendingOrder$summary2, _pendingOrder$summary3, changeGivenAmount, errorMessage;
6917
- return _regeneratorRuntime().wrap(function _callee69$(_context69) {
6918
- while (1) switch (_context69.prev = _context69.next) {
7001
+ return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7002
+ while (1) switch (_context70.prev = _context70.next) {
6919
7003
  case 0:
6920
7004
  backendPath = params.backendPath, data = params.data, title = params.title, reason = params.reason, invoiceTemplateSettings = params.invoiceTemplateSettings;
6921
- _context69.next = 3;
7005
+ _context70.next = 3;
6922
7006
  return this.buildPendingSyncCheckoutOrder(data, invoiceTemplateSettings);
6923
7007
  case 3:
6924
- pendingOrder = _context69.sent;
7008
+ pendingOrder = _context70.sent;
6925
7009
  if (pendingOrder) {
6926
- _context69.next = 7;
7010
+ _context70.next = 7;
6927
7011
  break;
6928
7012
  }
6929
7013
  this.logError("".concat(title, ": checkout \u5931\u8D25\u4E14\u8BA2\u5355\u7F3A\u5C11\u672C\u5730\u5B58\u50A8\u6807\u8BC6"), {
6930
7014
  backendPath: backendPath,
6931
7015
  reason: reason
6932
7016
  });
6933
- return _context69.abrupt("return", {
7017
+ return _context70.abrupt("return", {
6934
7018
  code: 500,
6935
7019
  status: false,
6936
7020
  message: '订单缺少本地存储标识,无法写入待同步队列',
@@ -6938,22 +7022,22 @@ var Server = /*#__PURE__*/function () {
6938
7022
  });
6939
7023
  case 7:
6940
7024
  if (!(!this.order || typeof this.order.upsertPendingSyncOrders !== 'function')) {
6941
- _context69.next = 10;
7025
+ _context70.next = 10;
6942
7026
  break;
6943
7027
  }
6944
7028
  this.logError("".concat(title, ": Order \u6A21\u5757\u4E0D\u652F\u6301\u672C\u5730\u5F85\u540C\u6B65\u5199\u5165"), {
6945
7029
  backendPath: backendPath,
6946
7030
  reason: reason
6947
7031
  });
6948
- return _context69.abrupt("return", {
7032
+ return _context70.abrupt("return", {
6949
7033
  code: 500,
6950
7034
  status: false,
6951
7035
  message: 'Order 模块不支持本地待同步写入',
6952
7036
  data: null
6953
7037
  });
6954
7038
  case 10:
6955
- _context69.prev = 10;
6956
- _context69.next = 13;
7039
+ _context70.prev = 10;
7040
+ _context70.next = 13;
6957
7041
  return this.order.upsertPendingSyncOrders([pendingOrder]);
6958
7042
  case 13:
6959
7043
  this.logInfo("".concat(title, ": \u8BA2\u5355\u5DF2\u5199\u5165\u672C\u5730\u5F85\u540C\u6B65"), {
@@ -6967,7 +7051,7 @@ var Server = /*#__PURE__*/function () {
6967
7051
  var _payment$metadata;
6968
7052
  return sum + _this17.toAmountNumber(payment === null || payment === void 0 || (_payment$metadata = payment.metadata) === null || _payment$metadata === void 0 ? void 0 : _payment$metadata.change_given_amount);
6969
7053
  }, 0);
6970
- return _context69.abrupt("return", {
7054
+ return _context70.abrupt("return", {
6971
7055
  code: 200,
6972
7056
  status: true,
6973
7057
  message: '',
@@ -6982,15 +7066,15 @@ var Server = /*#__PURE__*/function () {
6982
7066
  })
6983
7067
  });
6984
7068
  case 18:
6985
- _context69.prev = 18;
6986
- _context69.t0 = _context69["catch"](10);
6987
- errorMessage = _context69.t0 instanceof Error ? _context69.t0.message : String(_context69.t0);
7069
+ _context70.prev = 18;
7070
+ _context70.t0 = _context70["catch"](10);
7071
+ errorMessage = _context70.t0 instanceof Error ? _context70.t0.message : String(_context70.t0);
6988
7072
  this.logError("".concat(title, ": \u5199\u5165\u672C\u5730\u5F85\u540C\u6B65\u8BA2\u5355\u5931\u8D25"), {
6989
7073
  backendPath: backendPath,
6990
7074
  reason: reason,
6991
7075
  error: errorMessage
6992
7076
  });
6993
- return _context69.abrupt("return", {
7077
+ return _context70.abrupt("return", {
6994
7078
  code: 500,
6995
7079
  status: false,
6996
7080
  message: errorMessage,
@@ -6998,11 +7082,11 @@ var Server = /*#__PURE__*/function () {
6998
7082
  });
6999
7083
  case 23:
7000
7084
  case "end":
7001
- return _context69.stop();
7085
+ return _context70.stop();
7002
7086
  }
7003
- }, _callee69, this, [[10, 18]]);
7087
+ }, _callee70, this, [[10, 18]]);
7004
7088
  }));
7005
- function handlePendingSyncCheckoutOrder(_x76) {
7089
+ function handlePendingSyncCheckoutOrder(_x77) {
7006
7090
  return _handlePendingSyncCheckoutOrder.apply(this, arguments);
7007
7091
  }
7008
7092
  return handlePendingSyncCheckoutOrder;
@@ -7010,45 +7094,45 @@ var Server = /*#__PURE__*/function () {
7010
7094
  }, {
7011
7095
  key: "buildPendingSyncCheckoutOrder",
7012
7096
  value: function () {
7013
- var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(data, invoiceTemplateSettings) {
7097
+ var _buildPendingSyncCheckoutOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(data, invoiceTemplateSettings) {
7014
7098
  var hasStorageKey, pendingOrder, productMap, orderWithProductTitles;
7015
- return _regeneratorRuntime().wrap(function _callee70$(_context70) {
7016
- while (1) switch (_context70.prev = _context70.next) {
7099
+ return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7100
+ while (1) switch (_context71.prev = _context71.next) {
7017
7101
  case 0:
7018
7102
  if (!(!data || _typeof(data) !== 'object')) {
7019
- _context70.next = 2;
7103
+ _context71.next = 2;
7020
7104
  break;
7021
7105
  }
7022
- return _context70.abrupt("return", null);
7106
+ return _context71.abrupt("return", null);
7023
7107
  case 2:
7024
7108
  hasStorageKey = data.external_sale_number !== undefined && data.external_sale_number !== null && data.external_sale_number !== '' ? true : data.order_id !== undefined && data.order_id !== null && data.order_id !== '';
7025
7109
  if (hasStorageKey) {
7026
- _context70.next = 5;
7110
+ _context71.next = 5;
7027
7111
  break;
7028
7112
  }
7029
- return _context70.abrupt("return", null);
7113
+ return _context71.abrupt("return", null);
7030
7114
  case 5:
7031
7115
  pendingOrder = this.normalizeCheckoutCollections(_objectSpread(_objectSpread({}, data), {}, {
7032
7116
  need_sync: 1,
7033
7117
  is_draft_order: 0
7034
7118
  }));
7035
- _context70.next = 8;
7119
+ _context71.next = 8;
7036
7120
  return this.buildSmallTicketProductMap(pendingOrder);
7037
7121
  case 8:
7038
- productMap = _context70.sent;
7122
+ productMap = _context71.sent;
7039
7123
  orderWithProductTitles = this.withPendingSyncProductTitles(pendingOrder, productMap);
7040
- return _context70.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
7124
+ return _context71.abrupt("return", this.withLocalSmallTicketData(orderWithProductTitles, {
7041
7125
  requireFullyPaid: true,
7042
7126
  productMap: productMap,
7043
7127
  invoiceTemplateSettings: invoiceTemplateSettings
7044
7128
  }));
7045
7129
  case 11:
7046
7130
  case "end":
7047
- return _context70.stop();
7131
+ return _context71.stop();
7048
7132
  }
7049
- }, _callee70, this);
7133
+ }, _callee71, this);
7050
7134
  }));
7051
- function buildPendingSyncCheckoutOrder(_x77, _x78) {
7135
+ function buildPendingSyncCheckoutOrder(_x78, _x79) {
7052
7136
  return _buildPendingSyncCheckoutOrder.apply(this, arguments);
7053
7137
  }
7054
7138
  return buildPendingSyncCheckoutOrder;
@@ -7157,12 +7241,12 @@ var Server = /*#__PURE__*/function () {
7157
7241
  }, {
7158
7242
  key: "buildSmallTicketProductMap",
7159
7243
  value: function () {
7160
- var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(order) {
7161
- var _this$products3,
7244
+ var _buildSmallTicketProductMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(order) {
7245
+ var _this$products4,
7162
7246
  _this20 = this;
7163
7247
  var products, productIdSet, productIds, entries;
7164
- return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7165
- while (1) switch (_context72.prev = _context72.next) {
7248
+ return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7249
+ while (1) switch (_context73.prev = _context73.next) {
7166
7250
  case 0:
7167
7251
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
7168
7252
  productIdSet = new Set();
@@ -7183,46 +7267,46 @@ var Server = /*#__PURE__*/function () {
7183
7267
  }
7184
7268
  });
7185
7269
  productIds = Array.from(productIdSet);
7186
- if (!(!productIds.length || typeof ((_this$products3 = this.products) === null || _this$products3 === void 0 ? void 0 : _this$products3.getProductById) !== 'function')) {
7187
- _context72.next = 6;
7270
+ if (!(!productIds.length || typeof ((_this$products4 = this.products) === null || _this$products4 === void 0 ? void 0 : _this$products4.getProductById) !== 'function')) {
7271
+ _context73.next = 6;
7188
7272
  break;
7189
7273
  }
7190
- return _context72.abrupt("return", {});
7274
+ return _context73.abrupt("return", {});
7191
7275
  case 6:
7192
- _context72.next = 8;
7276
+ _context73.next = 8;
7193
7277
  return Promise.all(productIds.map( /*#__PURE__*/function () {
7194
- var _ref77 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(id) {
7278
+ var _ref77 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee72(id) {
7195
7279
  var _this20$products, _this20$products$getP, product;
7196
- return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7197
- while (1) switch (_context71.prev = _context71.next) {
7280
+ return _regeneratorRuntime().wrap(function _callee72$(_context72) {
7281
+ while (1) switch (_context72.prev = _context72.next) {
7198
7282
  case 0:
7199
- _context71.prev = 0;
7200
- _context71.next = 3;
7283
+ _context72.prev = 0;
7284
+ _context72.next = 3;
7201
7285
  return (_this20$products = _this20.products) === null || _this20$products === void 0 || (_this20$products$getP = _this20$products.getProductById) === null || _this20$products$getP === void 0 ? void 0 : _this20$products$getP.call(_this20$products, Number(id));
7202
7286
  case 3:
7203
- product = _context71.sent;
7204
- return _context71.abrupt("return", product ? [String(id), product] : null);
7287
+ product = _context72.sent;
7288
+ return _context72.abrupt("return", product ? [String(id), product] : null);
7205
7289
  case 7:
7206
- _context71.prev = 7;
7207
- _context71.t0 = _context71["catch"](0);
7290
+ _context72.prev = 7;
7291
+ _context72.t0 = _context72["catch"](0);
7208
7292
  _this20.logWarning('buildSmallTicketProductMap: 查询本地商品失败', {
7209
7293
  product_id: id,
7210
- error: _context71.t0 instanceof Error ? _context71.t0.message : String(_context71.t0)
7294
+ error: _context72.t0 instanceof Error ? _context72.t0.message : String(_context72.t0)
7211
7295
  });
7212
- return _context71.abrupt("return", null);
7296
+ return _context72.abrupt("return", null);
7213
7297
  case 11:
7214
7298
  case "end":
7215
- return _context71.stop();
7299
+ return _context72.stop();
7216
7300
  }
7217
- }, _callee71, null, [[0, 7]]);
7301
+ }, _callee72, null, [[0, 7]]);
7218
7302
  }));
7219
- return function (_x80) {
7303
+ return function (_x81) {
7220
7304
  return _ref77.apply(this, arguments);
7221
7305
  };
7222
7306
  }()));
7223
7307
  case 8:
7224
- entries = _context72.sent;
7225
- return _context72.abrupt("return", entries.reduce(function (map, entry) {
7308
+ entries = _context73.sent;
7309
+ return _context73.abrupt("return", entries.reduce(function (map, entry) {
7226
7310
  if (!entry) return map;
7227
7311
  var _entry = _slicedToArray(entry, 2),
7228
7312
  id = _entry[0],
@@ -7232,11 +7316,11 @@ var Server = /*#__PURE__*/function () {
7232
7316
  }, {}));
7233
7317
  case 10:
7234
7318
  case "end":
7235
- return _context72.stop();
7319
+ return _context73.stop();
7236
7320
  }
7237
- }, _callee72, this);
7321
+ }, _callee73, this);
7238
7322
  }));
7239
- function buildSmallTicketProductMap(_x79) {
7323
+ function buildSmallTicketProductMap(_x80) {
7240
7324
  return _buildSmallTicketProductMap.apply(this, arguments);
7241
7325
  }
7242
7326
  return buildSmallTicketProductMap;
@@ -7266,40 +7350,40 @@ var Server = /*#__PURE__*/function () {
7266
7350
  }, {
7267
7351
  key: "buildSalesDetailProductSnapshotMap",
7268
7352
  value: function () {
7269
- var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee73(order) {
7270
- var _this$products4;
7353
+ var _buildSalesDetailProductSnapshotMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(order) {
7354
+ var _this$products5;
7271
7355
  var productIds, getSnapshots;
7272
- return _regeneratorRuntime().wrap(function _callee73$(_context73) {
7273
- while (1) switch (_context73.prev = _context73.next) {
7356
+ return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7357
+ while (1) switch (_context74.prev = _context74.next) {
7274
7358
  case 0:
7275
7359
  productIds = this.collectSalesDetailProductIds(order);
7276
- getSnapshots = (_this$products4 = this.products) === null || _this$products4 === void 0 ? void 0 : _this$products4.getProductSnapshotsByIds;
7360
+ getSnapshots = (_this$products5 = this.products) === null || _this$products5 === void 0 ? void 0 : _this$products5.getProductSnapshotsByIds;
7277
7361
  if (!(!productIds.length || typeof getSnapshots !== 'function')) {
7278
- _context73.next = 4;
7362
+ _context74.next = 4;
7279
7363
  break;
7280
7364
  }
7281
- return _context73.abrupt("return", {});
7365
+ return _context74.abrupt("return", {});
7282
7366
  case 4:
7283
- _context73.prev = 4;
7284
- _context73.next = 7;
7367
+ _context74.prev = 4;
7368
+ _context74.next = 7;
7285
7369
  return getSnapshots.call(this.products, productIds);
7286
7370
  case 7:
7287
- return _context73.abrupt("return", _context73.sent);
7371
+ return _context74.abrupt("return", _context74.sent);
7288
7372
  case 10:
7289
- _context73.prev = 10;
7290
- _context73.t0 = _context73["catch"](4);
7373
+ _context74.prev = 10;
7374
+ _context74.t0 = _context74["catch"](4);
7291
7375
  this.logWarning('buildSalesDetailProductSnapshotMap: 查询本地商品快照失败', {
7292
7376
  product_ids: productIds,
7293
- error: _context73.t0 instanceof Error ? _context73.t0.message : String(_context73.t0)
7377
+ error: _context74.t0 instanceof Error ? _context74.t0.message : String(_context74.t0)
7294
7378
  });
7295
- return _context73.abrupt("return", {});
7379
+ return _context74.abrupt("return", {});
7296
7380
  case 14:
7297
7381
  case "end":
7298
- return _context73.stop();
7382
+ return _context74.stop();
7299
7383
  }
7300
- }, _callee73, this, [[4, 10]]);
7384
+ }, _callee74, this, [[4, 10]]);
7301
7385
  }));
7302
- function buildSalesDetailProductSnapshotMap(_x81) {
7386
+ function buildSalesDetailProductSnapshotMap(_x82) {
7303
7387
  return _buildSalesDetailProductSnapshotMap.apply(this, arguments);
7304
7388
  }
7305
7389
  return buildSalesDetailProductSnapshotMap;
@@ -7355,28 +7439,28 @@ var Server = /*#__PURE__*/function () {
7355
7439
  }, {
7356
7440
  key: "withSalesDetailProductSnapshots",
7357
7441
  value: function () {
7358
- var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee74(order) {
7442
+ var _withSalesDetailProductSnapshots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(order) {
7359
7443
  var _this21 = this;
7360
7444
  var products, snapshotMap, hasChanged, enrichedProducts, enrichedOrder;
7361
- return _regeneratorRuntime().wrap(function _callee74$(_context74) {
7362
- while (1) switch (_context74.prev = _context74.next) {
7445
+ return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7446
+ while (1) switch (_context75.prev = _context75.next) {
7363
7447
  case 0:
7364
7448
  products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : null;
7365
7449
  if (products !== null && products !== void 0 && products.length) {
7366
- _context74.next = 3;
7450
+ _context75.next = 3;
7367
7451
  break;
7368
7452
  }
7369
- return _context74.abrupt("return", order);
7453
+ return _context75.abrupt("return", order);
7370
7454
  case 3:
7371
- _context74.next = 5;
7455
+ _context75.next = 5;
7372
7456
  return this.buildSalesDetailProductSnapshotMap(order);
7373
7457
  case 5:
7374
- snapshotMap = _context74.sent;
7458
+ snapshotMap = _context75.sent;
7375
7459
  if (Object.keys(snapshotMap).length) {
7376
- _context74.next = 8;
7460
+ _context75.next = 8;
7377
7461
  break;
7378
7462
  }
7379
- return _context74.abrupt("return", order);
7463
+ return _context75.abrupt("return", order);
7380
7464
  case 8:
7381
7465
  hasChanged = false;
7382
7466
  enrichedProducts = products.map(function (product) {
@@ -7386,22 +7470,22 @@ var Server = /*#__PURE__*/function () {
7386
7470
  return nextProduct;
7387
7471
  });
7388
7472
  if (hasChanged) {
7389
- _context74.next = 12;
7473
+ _context75.next = 12;
7390
7474
  break;
7391
7475
  }
7392
- return _context74.abrupt("return", order);
7476
+ return _context75.abrupt("return", order);
7393
7477
  case 12:
7394
7478
  enrichedOrder = _objectSpread(_objectSpread({}, order), {}, {
7395
7479
  products: enrichedProducts
7396
7480
  });
7397
- return _context74.abrupt("return", enrichedOrder);
7481
+ return _context75.abrupt("return", enrichedOrder);
7398
7482
  case 14:
7399
7483
  case "end":
7400
- return _context74.stop();
7484
+ return _context75.stop();
7401
7485
  }
7402
- }, _callee74, this);
7486
+ }, _callee75, this);
7403
7487
  }));
7404
- function withSalesDetailProductSnapshots(_x82) {
7488
+ function withSalesDetailProductSnapshots(_x83) {
7405
7489
  return _withSalesDetailProductSnapshots.apply(this, arguments);
7406
7490
  }
7407
7491
  return withSalesDetailProductSnapshots;
@@ -7532,31 +7616,31 @@ var Server = /*#__PURE__*/function () {
7532
7616
  }, {
7533
7617
  key: "enrichPaymentNamesByCode",
7534
7618
  value: function () {
7535
- var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee75(order) {
7619
+ var _enrichPaymentNamesByCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(order) {
7536
7620
  var _this24 = this;
7537
7621
  var payments, hasMissingName, paymentModule, payMethods, nameByCode, _iterator12, _step12, method, codeKey, name, hasResolvedName, enrichedPayments;
7538
- return _regeneratorRuntime().wrap(function _callee75$(_context75) {
7539
- while (1) switch (_context75.prev = _context75.next) {
7622
+ return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7623
+ while (1) switch (_context76.prev = _context76.next) {
7540
7624
  case 0:
7541
7625
  payments = Array.isArray(order === null || order === void 0 ? void 0 : order.payments) ? order.payments : [];
7542
7626
  hasMissingName = payments.some(function (payment) {
7543
7627
  return _this24.isBlankPaymentName(payment === null || payment === void 0 ? void 0 : payment.name) && _this24.shouldLookupPaymentMethodNameByCode(payment === null || payment === void 0 ? void 0 : payment.code);
7544
7628
  });
7545
7629
  if (hasMissingName) {
7546
- _context75.next = 4;
7630
+ _context76.next = 4;
7547
7631
  break;
7548
7632
  }
7549
- return _context75.abrupt("return", order);
7633
+ return _context76.abrupt("return", order);
7550
7634
  case 4:
7551
- _context75.prev = 4;
7552
- _context75.next = 7;
7635
+ _context76.prev = 4;
7636
+ _context76.next = 7;
7553
7637
  return this.getPaymentRouteModule();
7554
7638
  case 7:
7555
- paymentModule = _context75.sent;
7556
- _context75.next = 10;
7639
+ paymentModule = _context76.sent;
7640
+ _context76.next = 10;
7557
7641
  return paymentModule.getPayMethodListAsync();
7558
7642
  case 10:
7559
- payMethods = _context75.sent;
7643
+ payMethods = _context76.sent;
7560
7644
  nameByCode = new Map();
7561
7645
  _iterator12 = _createForOfIteratorHelper(payMethods || []);
7562
7646
  try {
@@ -7583,28 +7667,28 @@ var Server = /*#__PURE__*/function () {
7583
7667
  });
7584
7668
  });
7585
7669
  if (hasResolvedName) {
7586
- _context75.next = 18;
7670
+ _context76.next = 18;
7587
7671
  break;
7588
7672
  }
7589
- return _context75.abrupt("return", order);
7673
+ return _context76.abrupt("return", order);
7590
7674
  case 18:
7591
- return _context75.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
7675
+ return _context76.abrupt("return", _objectSpread(_objectSpread({}, order), {}, {
7592
7676
  payments: enrichedPayments
7593
7677
  }));
7594
7678
  case 21:
7595
- _context75.prev = 21;
7596
- _context75.t0 = _context75["catch"](4);
7679
+ _context76.prev = 21;
7680
+ _context76.t0 = _context76["catch"](4);
7597
7681
  this.logWarning('enrichPaymentNamesByCode: 支付方式名称回填失败', {
7598
- error: _context75.t0 instanceof Error ? _context75.t0.message : String(_context75.t0)
7682
+ error: _context76.t0 instanceof Error ? _context76.t0.message : String(_context76.t0)
7599
7683
  });
7600
- return _context75.abrupt("return", order);
7684
+ return _context76.abrupt("return", order);
7601
7685
  case 25:
7602
7686
  case "end":
7603
- return _context75.stop();
7687
+ return _context76.stop();
7604
7688
  }
7605
- }, _callee75, this, [[4, 21]]);
7689
+ }, _callee76, this, [[4, 21]]);
7606
7690
  }));
7607
- function enrichPaymentNamesByCode(_x83) {
7691
+ function enrichPaymentNamesByCode(_x84) {
7608
7692
  return _enrichPaymentNamesByCode.apply(this, arguments);
7609
7693
  }
7610
7694
  return enrichPaymentNamesByCode;
@@ -7612,25 +7696,25 @@ var Server = /*#__PURE__*/function () {
7612
7696
  }, {
7613
7697
  key: "withLocalSmallTicketData",
7614
7698
  value: function () {
7615
- var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(order, options) {
7699
+ var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(order, options) {
7616
7700
  var mustApplyVisibility, _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts, _ref82, _ref83, _order_id, enrichedOrder, productMap, smallTicketData;
7617
- return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7618
- while (1) switch (_context76.prev = _context76.next) {
7701
+ return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7702
+ while (1) switch (_context77.prev = _context77.next) {
7619
7703
  case 0:
7620
7704
  mustApplyVisibility = (options === null || options === void 0 ? void 0 : options.applyTemplateVisibility) === true && requiresInvoiceDataFiltering(options.invoiceTemplateSettings);
7621
7705
  if (!(!this.shouldBuildSmallTicketData(order) && !mustApplyVisibility)) {
7622
- _context76.next = 3;
7706
+ _context77.next = 3;
7623
7707
  break;
7624
7708
  }
7625
- return _context76.abrupt("return", order);
7709
+ return _context77.abrupt("return", order);
7626
7710
  case 3:
7627
7711
  if (!(options !== null && options !== void 0 && options.requireFullyPaid && !this.isSalesOrderFullyPaid(order))) {
7628
- _context76.next = 5;
7712
+ _context77.next = 5;
7629
7713
  break;
7630
7714
  }
7631
- return _context76.abrupt("return", order);
7715
+ return _context77.abrupt("return", order);
7632
7716
  case 5:
7633
- _context76.prev = 5;
7717
+ _context77.prev = 5;
7634
7718
  normalizedCollections = normalizeOrderCollections(order, {
7635
7719
  ensureUid: false
7636
7720
  });
@@ -7648,24 +7732,24 @@ var Server = /*#__PURE__*/function () {
7648
7732
  collapsed_duplicate_counts: collapsedDuplicateCounts
7649
7733
  });
7650
7734
  }
7651
- _context76.next = 12;
7735
+ _context77.next = 12;
7652
7736
  return this.enrichPaymentNamesByCode(normalizedOrder);
7653
7737
  case 12:
7654
- enrichedOrder = _context76.sent;
7738
+ enrichedOrder = _context77.sent;
7655
7739
  if (!((_options$productMap = options === null || options === void 0 ? void 0 : options.productMap) !== null && _options$productMap !== void 0)) {
7656
- _context76.next = 17;
7740
+ _context77.next = 17;
7657
7741
  break;
7658
7742
  }
7659
- _context76.t0 = _options$productMap;
7660
- _context76.next = 20;
7743
+ _context77.t0 = _options$productMap;
7744
+ _context77.next = 20;
7661
7745
  break;
7662
7746
  case 17:
7663
- _context76.next = 19;
7747
+ _context77.next = 19;
7664
7748
  return this.buildSmallTicketProductMap(enrichedOrder);
7665
7749
  case 19:
7666
- _context76.t0 = _context76.sent;
7750
+ _context77.t0 = _context77.sent;
7667
7751
  case 20:
7668
- productMap = _context76.t0;
7752
+ productMap = _context77.t0;
7669
7753
  smallTicketData = buildSmallTicketData({
7670
7754
  order: enrichedOrder,
7671
7755
  shopInfo: this.getSmallTicketShopInfo(),
@@ -7674,31 +7758,31 @@ var Server = /*#__PURE__*/function () {
7674
7758
  includeReceiptKeys: options === null || options === void 0 ? void 0 : options.includeReceiptKeys,
7675
7759
  templateSettings: options !== null && options !== void 0 && options.applyTemplateVisibility ? options.invoiceTemplateSettings : undefined
7676
7760
  });
7677
- return _context76.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
7761
+ return _context77.abrupt("return", _objectSpread(_objectSpread({}, enrichedOrder), {}, {
7678
7762
  payment_info: _objectSpread(_objectSpread({}, enrichedOrder.payment_info || {}), {}, {
7679
7763
  small_ticket_data: smallTicketData
7680
7764
  })
7681
7765
  }));
7682
7766
  case 25:
7683
- _context76.prev = 25;
7684
- _context76.t1 = _context76["catch"](5);
7767
+ _context77.prev = 25;
7768
+ _context77.t1 = _context77["catch"](5);
7685
7769
  this.logError('withLocalSmallTicketData: 生成本地小票数据失败', {
7686
- error: _context76.t1 instanceof Error ? _context76.t1.message : String(_context76.t1)
7770
+ error: _context77.t1 instanceof Error ? _context77.t1.message : String(_context77.t1)
7687
7771
  });
7688
7772
  if (!mustApplyVisibility) {
7689
- _context76.next = 30;
7773
+ _context77.next = 30;
7690
7774
  break;
7691
7775
  }
7692
- throw _context76.t1;
7776
+ throw _context77.t1;
7693
7777
  case 30:
7694
- return _context76.abrupt("return", order);
7778
+ return _context77.abrupt("return", order);
7695
7779
  case 31:
7696
7780
  case "end":
7697
- return _context76.stop();
7781
+ return _context77.stop();
7698
7782
  }
7699
- }, _callee76, this, [[5, 25]]);
7783
+ }, _callee77, this, [[5, 25]]);
7700
7784
  }));
7701
- function withLocalSmallTicketData(_x84, _x85) {
7785
+ function withLocalSmallTicketData(_x85, _x86) {
7702
7786
  return _withLocalSmallTicketData.apply(this, arguments);
7703
7787
  }
7704
7788
  return withLocalSmallTicketData;
@@ -7713,37 +7797,37 @@ var Server = /*#__PURE__*/function () {
7713
7797
  }, {
7714
7798
  key: "fetchAndPersistSalesOrderByLookup",
7715
7799
  value: function () {
7716
- var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(lookup, data, title, paymentIdentityOrder) {
7800
+ var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(lookup, data, title, paymentIdentityOrder) {
7717
7801
  var _this$order7, _this$order8, _this$app19;
7718
7802
  var backendPath, _this$order$getLocalO, _this$order9, response, _response$code3, responseStatusCode, code, message, fresh, localBeforeRefresh, orderToPersist, remotePayments, paidPayments, paymentIdsComplete, savedOrder, _errorRecord$response, backendError, errorRecord, _responseStatusCode, _ref84, _backendError$code2, backendStatusCode, _code, _message2, _message3;
7719
- return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7720
- while (1) switch (_context77.prev = _context77.next) {
7803
+ return _regeneratorRuntime().wrap(function _callee78$(_context78) {
7804
+ while (1) switch (_context78.prev = _context78.next) {
7721
7805
  case 0:
7722
7806
  if (!(!((_this$order7 = this.order) !== null && _this$order7 !== void 0 && _this$order7.getLocalOrderByLookup) || !((_this$order8 = this.order) !== null && _this$order8 !== void 0 && _this$order8.upsertOrdersFromRemote))) {
7723
- _context77.next = 3;
7807
+ _context78.next = 3;
7724
7808
  break;
7725
7809
  }
7726
7810
  this.logError("".concat(title, ": Order \u6A21\u5757\u672A\u6CE8\u518C"));
7727
- return _context77.abrupt("return", {
7811
+ return _context78.abrupt("return", {
7728
7812
  code: 500,
7729
7813
  message: 'Order 模块未注册',
7730
7814
  order: null
7731
7815
  });
7732
7816
  case 3:
7733
7817
  if ((_this$app19 = this.app) !== null && _this$app19 !== void 0 && (_this$app19 = _this$app19.request) !== null && _this$app19 !== void 0 && _this$app19.get) {
7734
- _context77.next = 6;
7818
+ _context78.next = 6;
7735
7819
  break;
7736
7820
  }
7737
7821
  this.logError("".concat(title, ": app.request \u4E0D\u53EF\u7528"));
7738
- return _context77.abrupt("return", {
7822
+ return _context78.abrupt("return", {
7739
7823
  code: 500,
7740
7824
  message: 'app.request 不可用',
7741
7825
  order: null
7742
7826
  });
7743
7827
  case 6:
7744
7828
  backendPath = this.buildOrderSalesDetailBackendPath(String(lookup), data);
7745
- _context77.prev = 7;
7746
- _context77.next = 10;
7829
+ _context78.prev = 7;
7830
+ _context78.next = 10;
7747
7831
  return this.app.request.get(backendPath, {
7748
7832
  lookup_mode: 'multi'
7749
7833
  }, {
@@ -7751,9 +7835,9 @@ var Server = /*#__PURE__*/function () {
7751
7835
  customToast: function customToast() {}
7752
7836
  });
7753
7837
  case 10:
7754
- response = _context77.sent;
7838
+ response = _context78.sent;
7755
7839
  if (!this.isCheckoutResponseRejected(response)) {
7756
- _context77.next = 17;
7840
+ _context78.next = 17;
7757
7841
  break;
7758
7842
  }
7759
7843
  responseStatusCode = typeof (response === null || response === void 0 ? void 0 : response.status) === 'number' ? response.status : undefined;
@@ -7765,7 +7849,7 @@ var Server = /*#__PURE__*/function () {
7765
7849
  code: code,
7766
7850
  message: message
7767
7851
  });
7768
- return _context77.abrupt("return", {
7852
+ return _context78.abrupt("return", {
7769
7853
  code: code,
7770
7854
  message: message,
7771
7855
  order: null
@@ -7773,56 +7857,56 @@ var Server = /*#__PURE__*/function () {
7773
7857
  case 17:
7774
7858
  fresh = this.extractOrderDataFromCheckoutResponse(response);
7775
7859
  if (!(!fresh || fresh.order_id === undefined || fresh.order_id === null || String(fresh.order_id).trim() === '')) {
7776
- _context77.next = 21;
7860
+ _context78.next = 21;
7777
7861
  break;
7778
7862
  }
7779
7863
  this.logInfo("".concat(title, ": \u540E\u7AEF\u8FD4\u56DE\u8BA2\u5355\u4E3A\u7A7A"), {
7780
7864
  lookup: lookup,
7781
7865
  backendPath: backendPath
7782
7866
  });
7783
- return _context77.abrupt("return", {
7867
+ return _context78.abrupt("return", {
7784
7868
  code: 500,
7785
7869
  message: '后端返回订单为空',
7786
7870
  order: null
7787
7871
  });
7788
7872
  case 21:
7789
- _context77.t0 = (_this$order$getLocalO = (_this$order9 = this.order).getLocalOrderFromMemoryByLookup) === null || _this$order$getLocalO === void 0 ? void 0 : _this$order$getLocalO.call(_this$order9, lookup);
7790
- if (_context77.t0) {
7791
- _context77.next = 31;
7873
+ _context78.t0 = (_this$order$getLocalO = (_this$order9 = this.order).getLocalOrderFromMemoryByLookup) === null || _this$order$getLocalO === void 0 ? void 0 : _this$order$getLocalO.call(_this$order9, lookup);
7874
+ if (_context78.t0) {
7875
+ _context78.next = 31;
7792
7876
  break;
7793
7877
  }
7794
7878
  if (!this.shouldForceRemoteSalesDetail(data)) {
7795
- _context77.next = 29;
7879
+ _context78.next = 29;
7796
7880
  break;
7797
7881
  }
7798
- _context77.next = 26;
7882
+ _context78.next = 26;
7799
7883
  return this.order.getLocalOrderByLookup(lookup);
7800
7884
  case 26:
7801
- _context77.t1 = _context77.sent;
7802
- _context77.next = 30;
7885
+ _context78.t1 = _context78.sent;
7886
+ _context78.next = 30;
7803
7887
  break;
7804
7888
  case 29:
7805
- _context77.t1 = null;
7889
+ _context78.t1 = null;
7806
7890
  case 30:
7807
- _context77.t0 = _context77.t1;
7891
+ _context78.t0 = _context78.t1;
7808
7892
  case 31:
7809
- localBeforeRefresh = _context77.t0;
7893
+ localBeforeRefresh = _context78.t0;
7810
7894
  orderToPersist = fresh;
7811
7895
  if (!paymentIdentityOrder) {
7812
- _context77.next = 44;
7896
+ _context78.next = 44;
7813
7897
  break;
7814
7898
  }
7815
7899
  if (!(String(fresh.order_id) !== String(paymentIdentityOrder.order_id) || fresh.external_sale_number && paymentIdentityOrder.external_sale_number && fresh.external_sale_number !== paymentIdentityOrder.external_sale_number || !Array.isArray(fresh.payments))) {
7816
- _context77.next = 36;
7900
+ _context78.next = 36;
7817
7901
  break;
7818
7902
  }
7819
7903
  throw new Error('远端订单身份不匹配或缺少付款明细,暂不补齐付款 ID');
7820
7904
  case 36:
7821
7905
  if (!(!localBeforeRefresh || Number(localBeforeRefresh.need_sync || 0) === 1 || Number(localBeforeRefresh.is_draft_order || 0) === 1)) {
7822
- _context77.next = 38;
7906
+ _context78.next = 38;
7823
7907
  break;
7824
7908
  }
7825
- return _context77.abrupt("return", {
7909
+ return _context78.abrupt("return", {
7826
7910
  code: 200,
7827
7911
  message: '',
7828
7912
  order: localBeforeRefresh || paymentIdentityOrder
@@ -7844,7 +7928,7 @@ var Server = /*#__PURE__*/function () {
7844
7928
  return matches.length === 1 && paymentId !== undefined && paymentId !== null && String(paymentId).trim() !== '';
7845
7929
  });
7846
7930
  if (paymentIdsComplete) {
7847
- _context77.next = 43;
7931
+ _context78.next = 43;
7848
7932
  break;
7849
7933
  }
7850
7934
  throw new Error('远端付款 ID 尚未齐全或付款身份匹配不唯一,保留本地付款等待重试');
@@ -7856,46 +7940,46 @@ var Server = /*#__PURE__*/function () {
7856
7940
  });
7857
7941
  case 44:
7858
7942
  if (!requiresLocalPaymentRefresh(localBeforeRefresh)) {
7859
- _context77.next = 51;
7943
+ _context78.next = 51;
7860
7944
  break;
7861
7945
  }
7862
7946
  if (!(String(fresh.order_id) !== String(localBeforeRefresh.order_id))) {
7863
- _context77.next = 47;
7947
+ _context78.next = 47;
7864
7948
  break;
7865
7949
  }
7866
7950
  throw new Error('远端订单身份不匹配,请重新刷新');
7867
7951
  case 47:
7868
- _context77.next = 49;
7952
+ _context78.next = 49;
7869
7953
  return this.order.completeLocalPaymentRefresh(orderToPersist);
7870
7954
  case 49:
7871
- _context77.next = 53;
7955
+ _context78.next = 53;
7872
7956
  break;
7873
7957
  case 51:
7874
- _context77.next = 53;
7958
+ _context78.next = 53;
7875
7959
  return this.order.upsertOrdersFromRemote([orderToPersist]);
7876
7960
  case 53:
7877
- _context77.next = 55;
7961
+ _context78.next = 55;
7878
7962
  return this.order.getLocalOrderByLookup(lookup);
7879
7963
  case 55:
7880
- savedOrder = _context77.sent;
7964
+ savedOrder = _context78.sent;
7881
7965
  if (!(!savedOrder && fresh.order_id !== undefined && fresh.order_id !== null && String(fresh.order_id) !== String(lookup))) {
7882
- _context77.next = 60;
7966
+ _context78.next = 60;
7883
7967
  break;
7884
7968
  }
7885
- _context77.next = 59;
7969
+ _context78.next = 59;
7886
7970
  return this.order.getLocalOrderByLookup(fresh.order_id);
7887
7971
  case 59:
7888
- savedOrder = _context77.sent;
7972
+ savedOrder = _context78.sent;
7889
7973
  case 60:
7890
7974
  if (savedOrder) {
7891
- _context77.next = 63;
7975
+ _context78.next = 63;
7892
7976
  break;
7893
7977
  }
7894
7978
  this.logError("".concat(title, ": \u8BA2\u5355\u5199\u5165\u540E\u56DE\u8BFB\u5931\u8D25"), {
7895
7979
  lookup: lookup,
7896
7980
  remote_order_id: fresh.order_id
7897
7981
  });
7898
- return _context77.abrupt("return", {
7982
+ return _context78.abrupt("return", {
7899
7983
  code: 500,
7900
7984
  message: '订单写入后回读失败',
7901
7985
  order: null
@@ -7905,54 +7989,54 @@ var Server = /*#__PURE__*/function () {
7905
7989
  lookup: lookup,
7906
7990
  remote_order_id: fresh.order_id
7907
7991
  });
7908
- return _context77.abrupt("return", {
7992
+ return _context78.abrupt("return", {
7909
7993
  code: 200,
7910
7994
  message: '',
7911
7995
  order: savedOrder
7912
7996
  });
7913
7997
  case 67:
7914
- _context77.prev = 67;
7915
- _context77.t2 = _context77["catch"](7);
7916
- backendError = this.extractBackendErrorResponse(_context77.t2);
7917
- errorRecord = _context77.t2;
7998
+ _context78.prev = 67;
7999
+ _context78.t2 = _context78["catch"](7);
8000
+ backendError = this.extractBackendErrorResponse(_context78.t2);
8001
+ errorRecord = _context78.t2;
7918
8002
  _responseStatusCode = typeof (errorRecord === null || errorRecord === void 0 || (_errorRecord$response = errorRecord.response) === null || _errorRecord$response === void 0 ? void 0 : _errorRecord$response.status) === 'number' ? errorRecord.response.status : undefined;
7919
8003
  if (!(backendError || _responseStatusCode !== undefined)) {
7920
- _context77.next = 78;
8004
+ _context78.next = 78;
7921
8005
  break;
7922
8006
  }
7923
8007
  backendStatusCode = typeof (backendError === null || backendError === void 0 ? void 0 : backendError.status) === 'number' ? backendError.status : undefined;
7924
8008
  _code = this.normalizeRemoteSalesOrderErrorCode((_ref84 = (_backendError$code2 = backendError === null || backendError === void 0 ? void 0 : backendError.code) !== null && _backendError$code2 !== void 0 ? _backendError$code2 : backendStatusCode) !== null && _ref84 !== void 0 ? _ref84 : _responseStatusCode);
7925
- _message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(_context77.t2);
8009
+ _message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(_context78.t2);
7926
8010
  this.logInfo("".concat(title, ": \u540E\u7AEF\u8BA2\u5355\u67E5\u8BE2\u5931\u8D25"), {
7927
8011
  lookup: lookup,
7928
8012
  backendPath: backendPath,
7929
8013
  code: _code,
7930
8014
  message: _message2
7931
8015
  });
7932
- return _context77.abrupt("return", {
8016
+ return _context78.abrupt("return", {
7933
8017
  code: _code,
7934
8018
  message: _message2,
7935
8019
  order: null
7936
8020
  });
7937
8021
  case 78:
7938
- _message3 = this.getUnknownErrorMessage(_context77.t2);
8022
+ _message3 = this.getUnknownErrorMessage(_context78.t2);
7939
8023
  this.logInfo("".concat(title, ": \u8BF7\u6C42\u5931\u8D25"), {
7940
8024
  lookup: lookup,
7941
8025
  backendPath: backendPath,
7942
8026
  error: _message3
7943
8027
  });
7944
- return _context77.abrupt("return", {
8028
+ return _context78.abrupt("return", {
7945
8029
  code: 500,
7946
8030
  message: _message3,
7947
8031
  order: null
7948
8032
  });
7949
8033
  case 81:
7950
8034
  case "end":
7951
- return _context77.stop();
8035
+ return _context78.stop();
7952
8036
  }
7953
- }, _callee77, this, [[7, 67]]);
8037
+ }, _callee78, this, [[7, 67]]);
7954
8038
  }));
7955
- function fetchAndPersistSalesOrderByLookup(_x86, _x87, _x88, _x89) {
8039
+ function fetchAndPersistSalesOrderByLookup(_x87, _x88, _x89, _x90) {
7956
8040
  return _fetchAndPersistSalesOrderByLookup.apply(this, arguments);
7957
8041
  }
7958
8042
  return fetchAndPersistSalesOrderByLookup;
@@ -8014,22 +8098,22 @@ var Server = /*#__PURE__*/function () {
8014
8098
  }, {
8015
8099
  key: "handleUpdateLocalOrdersBatch",
8016
8100
  value: (function () {
8017
- var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(orderIds) {
8101
+ var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(orderIds) {
8018
8102
  var _this$app20;
8019
8103
  var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message4, overwritten, inserted;
8020
- return _regeneratorRuntime().wrap(function _callee78$(_context78) {
8021
- while (1) switch (_context78.prev = _context78.next) {
8104
+ return _regeneratorRuntime().wrap(function _callee79$(_context79) {
8105
+ while (1) switch (_context79.prev = _context79.next) {
8022
8106
  case 0:
8023
8107
  this.logInfo('handleUpdateLocalOrdersBatch: 开始处理', {
8024
8108
  count: orderIds.length,
8025
8109
  orderIds: orderIds
8026
8110
  });
8027
8111
  if (this.order) {
8028
- _context78.next = 4;
8112
+ _context79.next = 4;
8029
8113
  break;
8030
8114
  }
8031
8115
  this.logError('handleUpdateLocalOrdersBatch: Order 模块未注册');
8032
- return _context78.abrupt("return", {
8116
+ return _context79.abrupt("return", {
8033
8117
  code: 500,
8034
8118
  status: false,
8035
8119
  message: 'Order 模块未注册',
@@ -8037,11 +8121,11 @@ var Server = /*#__PURE__*/function () {
8037
8121
  });
8038
8122
  case 4:
8039
8123
  if ((_this$app20 = this.app) !== null && _this$app20 !== void 0 && _this$app20.request) {
8040
- _context78.next = 7;
8124
+ _context79.next = 7;
8041
8125
  break;
8042
8126
  }
8043
8127
  this.logError('handleUpdateLocalOrdersBatch: app.request 不可用');
8044
- return _context78.abrupt("return", {
8128
+ return _context79.abrupt("return", {
8045
8129
  code: 500,
8046
8130
  status: false,
8047
8131
  message: 'app.request 不可用',
@@ -8064,21 +8148,21 @@ var Server = /*#__PURE__*/function () {
8064
8148
  _iterator13.f();
8065
8149
  }
8066
8150
  fetched = [];
8067
- _context78.prev = 11;
8068
- _context78.next = 14;
8151
+ _context79.prev = 11;
8152
+ _context79.next = 14;
8069
8153
  return this.order.fetchOrdersByHttp(orderIds);
8070
8154
  case 14:
8071
- fetched = _context78.sent;
8072
- _context78.next = 22;
8155
+ fetched = _context79.sent;
8156
+ _context79.next = 22;
8073
8157
  break;
8074
8158
  case 17:
8075
- _context78.prev = 17;
8076
- _context78.t0 = _context78["catch"](11);
8077
- message = _context78.t0 instanceof Error ? _context78.t0.message : String(_context78.t0);
8159
+ _context79.prev = 17;
8160
+ _context79.t0 = _context79["catch"](11);
8161
+ message = _context79.t0 instanceof Error ? _context79.t0.message : String(_context79.t0);
8078
8162
  this.logError('handleUpdateLocalOrdersBatch: 批量拉取失败', {
8079
8163
  message: message
8080
8164
  });
8081
- return _context78.abrupt("return", {
8165
+ return _context79.abrupt("return", {
8082
8166
  code: 500,
8083
8167
  status: false,
8084
8168
  message: message,
@@ -8088,36 +8172,36 @@ var Server = /*#__PURE__*/function () {
8088
8172
  // 按返回结果中的 order_id 建索引,未命中即视为单笔失败
8089
8173
  fetchedMap = new Map();
8090
8174
  _iterator14 = _createForOfIteratorHelper(fetched);
8091
- _context78.prev = 24;
8175
+ _context79.prev = 24;
8092
8176
  _iterator14.s();
8093
8177
  case 26:
8094
8178
  if ((_step14 = _iterator14.n()).done) {
8095
- _context78.next = 34;
8179
+ _context79.next = 34;
8096
8180
  break;
8097
8181
  }
8098
8182
  order = _step14.value;
8099
8183
  oid = order === null || order === void 0 ? void 0 : order.order_id;
8100
8184
  if (!(oid === undefined || oid === null)) {
8101
- _context78.next = 31;
8185
+ _context79.next = 31;
8102
8186
  break;
8103
8187
  }
8104
- return _context78.abrupt("continue", 32);
8188
+ return _context79.abrupt("continue", 32);
8105
8189
  case 31:
8106
8190
  fetchedMap.set(String(oid), order);
8107
8191
  case 32:
8108
- _context78.next = 26;
8192
+ _context79.next = 26;
8109
8193
  break;
8110
8194
  case 34:
8111
- _context78.next = 39;
8195
+ _context79.next = 39;
8112
8196
  break;
8113
8197
  case 36:
8114
- _context78.prev = 36;
8115
- _context78.t1 = _context78["catch"](24);
8116
- _iterator14.e(_context78.t1);
8198
+ _context79.prev = 36;
8199
+ _context79.t1 = _context79["catch"](24);
8200
+ _iterator14.e(_context79.t1);
8117
8201
  case 39:
8118
- _context78.prev = 39;
8202
+ _context79.prev = 39;
8119
8203
  _iterator14.f();
8120
- return _context78.finish(39);
8204
+ return _context79.finish(39);
8121
8205
  case 42:
8122
8206
  freshOrders = [];
8123
8207
  succeedIds = [];
@@ -8143,23 +8227,23 @@ var Server = /*#__PURE__*/function () {
8143
8227
  _iterator15.f();
8144
8228
  }
8145
8229
  if (!(freshOrders.length > 0)) {
8146
- _context78.next = 58;
8230
+ _context79.next = 58;
8147
8231
  break;
8148
8232
  }
8149
- _context78.prev = 48;
8150
- _context78.next = 51;
8233
+ _context79.prev = 48;
8234
+ _context79.next = 51;
8151
8235
  return this.order.upsertOrdersFromRemote(freshOrders);
8152
8236
  case 51:
8153
- _context78.next = 58;
8237
+ _context79.next = 58;
8154
8238
  break;
8155
8239
  case 53:
8156
- _context78.prev = 53;
8157
- _context78.t2 = _context78["catch"](48);
8158
- _message4 = _context78.t2 instanceof Error ? _context78.t2.message : String(_context78.t2);
8240
+ _context79.prev = 53;
8241
+ _context79.t2 = _context79["catch"](48);
8242
+ _message4 = _context79.t2 instanceof Error ? _context79.t2.message : String(_context79.t2);
8159
8243
  this.logError('handleUpdateLocalOrdersBatch: 合并写入失败', {
8160
8244
  message: _message4
8161
8245
  });
8162
- return _context78.abrupt("return", {
8246
+ return _context79.abrupt("return", {
8163
8247
  code: 500,
8164
8248
  status: false,
8165
8249
  message: _message4,
@@ -8178,7 +8262,7 @@ var Server = /*#__PURE__*/function () {
8178
8262
  insertedCount: inserted.length,
8179
8263
  failedCount: failed.length
8180
8264
  });
8181
- return _context78.abrupt("return", {
8265
+ return _context79.abrupt("return", {
8182
8266
  code: 200,
8183
8267
  status: true,
8184
8268
  message: '',
@@ -8190,11 +8274,11 @@ var Server = /*#__PURE__*/function () {
8190
8274
  });
8191
8275
  case 62:
8192
8276
  case "end":
8193
- return _context78.stop();
8277
+ return _context79.stop();
8194
8278
  }
8195
- }, _callee78, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
8279
+ }, _callee79, this, [[11, 17], [24, 36, 39, 42], [48, 53]]);
8196
8280
  }));
8197
- function handleUpdateLocalOrdersBatch(_x90) {
8281
+ function handleUpdateLocalOrdersBatch(_x91) {
8198
8282
  return _handleUpdateLocalOrdersBatch.apply(this, arguments);
8199
8283
  }
8200
8284
  return handleUpdateLocalOrdersBatch;
@@ -8563,16 +8647,16 @@ var Server = /*#__PURE__*/function () {
8563
8647
  }, {
8564
8648
  key: "recomputeAndNotifyFloorPlanQuery",
8565
8649
  value: (function () {
8566
- var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79() {
8650
+ var _recomputeAndNotifyFloorPlanQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
8567
8651
  var _iterator17, _step17, _step17$value, subscriberId, sub, result, errorMessage;
8568
- return _regeneratorRuntime().wrap(function _callee79$(_context79) {
8569
- while (1) switch (_context79.prev = _context79.next) {
8652
+ return _regeneratorRuntime().wrap(function _callee80$(_context80) {
8653
+ while (1) switch (_context80.prev = _context80.next) {
8570
8654
  case 0:
8571
8655
  if (!(this.floorPlanQuerySubscribers.size === 0)) {
8572
- _context79.next = 2;
8656
+ _context80.next = 2;
8573
8657
  break;
8574
8658
  }
8575
- return _context79.abrupt("return");
8659
+ return _context80.abrupt("return");
8576
8660
  case 2:
8577
8661
  this.logInfo('recomputeAndNotifyFloorPlanQuery: 开始推送', {
8578
8662
  subscriberCount: this.floorPlanQuerySubscribers.size
@@ -8602,9 +8686,9 @@ var Server = /*#__PURE__*/function () {
8602
8686
  }
8603
8687
  case 5:
8604
8688
  case "end":
8605
- return _context79.stop();
8689
+ return _context80.stop();
8606
8690
  }
8607
- }, _callee79, this);
8691
+ }, _callee80, this);
8608
8692
  }));
8609
8693
  function recomputeAndNotifyFloorPlanQuery() {
8610
8694
  return _recomputeAndNotifyFloorPlanQuery.apply(this, arguments);
@@ -8634,20 +8718,20 @@ var Server = /*#__PURE__*/function () {
8634
8718
  * filter 逻辑暂为 mock,仅记录参数
8635
8719
  */
8636
8720
  function () {
8637
- var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80(data) {
8721
+ var _computeOrderQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(data) {
8638
8722
  var rawList, result;
8639
- return _regeneratorRuntime().wrap(function _callee80$(_context80) {
8640
- while (1) switch (_context80.prev = _context80.next) {
8723
+ return _regeneratorRuntime().wrap(function _callee81$(_context81) {
8724
+ while (1) switch (_context81.prev = _context81.next) {
8641
8725
  case 0:
8642
8726
  this.logInfo('computeOrderQueryResult: 开始过滤', {
8643
8727
  data: data
8644
8728
  });
8645
8729
  if (this.order) {
8646
- _context80.next = 4;
8730
+ _context81.next = 4;
8647
8731
  break;
8648
8732
  }
8649
8733
  this.logError('computeOrderQueryResult: Order 模块未注册');
8650
- return _context80.abrupt("return", {
8734
+ return _context81.abrupt("return", {
8651
8735
  code: 500,
8652
8736
  message: 'Order 模块未注册',
8653
8737
  data: {
@@ -8679,7 +8763,7 @@ var Server = /*#__PURE__*/function () {
8679
8763
  skip: result.skip,
8680
8764
  rejected: result.rejected
8681
8765
  });
8682
- return _context80.abrupt("return", {
8766
+ return _context81.abrupt("return", {
8683
8767
  code: 200,
8684
8768
  data: result,
8685
8769
  message: '',
@@ -8687,11 +8771,11 @@ var Server = /*#__PURE__*/function () {
8687
8771
  });
8688
8772
  case 10:
8689
8773
  case "end":
8690
- return _context80.stop();
8774
+ return _context81.stop();
8691
8775
  }
8692
- }, _callee80, this);
8776
+ }, _callee81, this);
8693
8777
  }));
8694
- function computeOrderQueryResult(_x91) {
8778
+ function computeOrderQueryResult(_x92) {
8695
8779
  return _computeOrderQueryResult.apply(this, arguments);
8696
8780
  }
8697
8781
  return computeOrderQueryResult;
@@ -8704,17 +8788,17 @@ var Server = /*#__PURE__*/function () {
8704
8788
  }, {
8705
8789
  key: "computeBookingQueryResult",
8706
8790
  value: (function () {
8707
- var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(data) {
8791
+ var _computeBookingQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(data) {
8708
8792
  var rawOrders, result;
8709
- return _regeneratorRuntime().wrap(function _callee81$(_context81) {
8710
- while (1) switch (_context81.prev = _context81.next) {
8793
+ return _regeneratorRuntime().wrap(function _callee82$(_context82) {
8794
+ while (1) switch (_context82.prev = _context82.next) {
8711
8795
  case 0:
8712
8796
  if (this.order) {
8713
- _context81.next = 3;
8797
+ _context82.next = 3;
8714
8798
  break;
8715
8799
  }
8716
8800
  this.logError('computeBookingQueryResult: Order 模块未注册');
8717
- return _context81.abrupt("return", {
8801
+ return _context82.abrupt("return", {
8718
8802
  code: 500,
8719
8803
  message: 'Order 模块未注册',
8720
8804
  data: {
@@ -8733,7 +8817,7 @@ var Server = /*#__PURE__*/function () {
8733
8817
  size: result.size,
8734
8818
  skip: result.skip
8735
8819
  });
8736
- return _context81.abrupt("return", {
8820
+ return _context82.abrupt("return", {
8737
8821
  code: 200,
8738
8822
  data: result,
8739
8823
  message: '',
@@ -8741,11 +8825,11 @@ var Server = /*#__PURE__*/function () {
8741
8825
  });
8742
8826
  case 8:
8743
8827
  case "end":
8744
- return _context81.stop();
8828
+ return _context82.stop();
8745
8829
  }
8746
- }, _callee81, this);
8830
+ }, _callee82, this);
8747
8831
  }));
8748
- function computeBookingQueryResult(_x92) {
8832
+ function computeBookingQueryResult(_x93) {
8749
8833
  return _computeBookingQueryResult.apply(this, arguments);
8750
8834
  }
8751
8835
  return computeBookingQueryResult;
@@ -8804,12 +8888,12 @@ var Server = /*#__PURE__*/function () {
8804
8888
  }, {
8805
8889
  key: "computeProductQueryResult",
8806
8890
  value: (function () {
8807
- var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(context, options) {
8891
+ var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(context, options) {
8808
8892
  var _menu_list_ids$length3,
8809
8893
  _this26 = this;
8810
8894
  var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, application_code, strategy_context, isVisibleProduct, queryIds, startupPreloadTask, formatterContext, uniqueIds, _tPrice, productsWithPrice, _filteredProducts, extensionFilteredProducts, _published$find, pid, _tPrice2, allProductsWithPrice, published, item, _tPrice3, _filteredProducts2, _tStatus, _beforeStatusCount, _tExtensionType, _beforeExtensionTypeCount, _tSort, activeMenuList, tMenu, getActiveMenus, tFilter, productScope, scopedProductIds, tPrice, filteredProducts, tStatus, beforeStatusCount, tExtensionType, beforeExtensionTypeCount, tSort;
8811
- return _regeneratorRuntime().wrap(function _callee82$(_context82) {
8812
- while (1) switch (_context82.prev = _context82.next) {
8895
+ return _regeneratorRuntime().wrap(function _callee83$(_context83) {
8896
+ while (1) switch (_context83.prev = _context83.next) {
8813
8897
  case 0:
8814
8898
  tTotal = performance.now();
8815
8899
  menu_list_ids = context.menu_list_ids, ids = context.ids, schedule_date = context.schedule_date, schedule_datetime = context.schedule_datetime, customer_id = context.customer_id, extension_type = context.extension_type, product_id = context.product_id, application_code = context.application_code, strategy_context = context.strategy_context; // 仅 Kiosk 查询额外按商品销售渠道过滤。
@@ -8838,10 +8922,10 @@ var Server = /*#__PURE__*/function () {
8838
8922
  // SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
8839
8923
  startupPreloadTask = this.startupModulePreloadInFlight;
8840
8924
  if (!startupPreloadTask) {
8841
- _context82.next = 9;
8925
+ _context83.next = 9;
8842
8926
  break;
8843
8927
  }
8844
- _context82.next = 9;
8928
+ _context83.next = 9;
8845
8929
  return startupPreloadTask;
8846
8930
  case 9:
8847
8931
  // Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
@@ -8853,28 +8937,28 @@ var Server = /*#__PURE__*/function () {
8853
8937
  strategy_context: strategy_context
8854
8938
  });
8855
8939
  if (this.products) {
8856
- _context82.next = 13;
8940
+ _context83.next = 13;
8857
8941
  break;
8858
8942
  }
8859
8943
  this.logError('computeProductQueryResult: Products 模块未注册');
8860
- return _context82.abrupt("return", {
8944
+ return _context83.abrupt("return", {
8861
8945
  message: 'Products 模块未注册',
8862
8946
  data: this.buildProductQueryResultPayload([], 0)
8863
8947
  });
8864
8948
  case 13:
8865
8949
  if (!(queryIds.length > 0)) {
8866
- _context82.next = 25;
8950
+ _context83.next = 25;
8867
8951
  break;
8868
8952
  }
8869
8953
  uniqueIds = Array.from(new Set(queryIds));
8870
8954
  _tPrice = performance.now();
8871
- _context82.next = 18;
8955
+ _context83.next = 18;
8872
8956
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8873
8957
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
8874
8958
  productIds: uniqueIds
8875
8959
  });
8876
8960
  case 18:
8877
- productsWithPrice = _context82.sent;
8961
+ productsWithPrice = _context83.sent;
8878
8962
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
8879
8963
  count: productsWithPrice.length,
8880
8964
  ids: uniqueIds
@@ -8892,7 +8976,7 @@ var Server = /*#__PURE__*/function () {
8892
8976
  ids: uniqueIds,
8893
8977
  count: extensionFilteredProducts.length
8894
8978
  });
8895
- return _context82.abrupt("return", {
8979
+ return _context83.abrupt("return", {
8896
8980
  code: 200,
8897
8981
  data: this.buildProductQueryResultPayload(extensionFilteredProducts),
8898
8982
  message: '',
@@ -8900,17 +8984,17 @@ var Server = /*#__PURE__*/function () {
8900
8984
  });
8901
8985
  case 25:
8902
8986
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
8903
- _context82.next = 37;
8987
+ _context83.next = 37;
8904
8988
  break;
8905
8989
  }
8906
8990
  pid = Number(product_id);
8907
8991
  _tPrice2 = performance.now();
8908
- _context82.next = 30;
8992
+ _context83.next = 30;
8909
8993
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8910
8994
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
8911
8995
  });
8912
8996
  case 30:
8913
- allProductsWithPrice = _context82.sent;
8997
+ allProductsWithPrice = _context83.sent;
8914
8998
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
8915
8999
  count: allProductsWithPrice.length,
8916
9000
  productId: pid
@@ -8928,7 +9012,7 @@ var Server = /*#__PURE__*/function () {
8928
9012
  productId: pid,
8929
9013
  found: !!item
8930
9014
  });
8931
- return _context82.abrupt("return", {
9015
+ return _context83.abrupt("return", {
8932
9016
  code: 200,
8933
9017
  data: item,
8934
9018
  message: item ? '' : '商品不存在或未发布',
@@ -8936,16 +9020,16 @@ var Server = /*#__PURE__*/function () {
8936
9020
  });
8937
9021
  case 37:
8938
9022
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
8939
- _context82.next = 57;
9023
+ _context83.next = 57;
8940
9024
  break;
8941
9025
  }
8942
9026
  _tPrice3 = performance.now();
8943
- _context82.next = 41;
9027
+ _context83.next = 41;
8944
9028
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8945
9029
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
8946
9030
  });
8947
9031
  case 41:
8948
- _filteredProducts2 = _context82.sent;
9032
+ _filteredProducts2 = _context83.sent;
8949
9033
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
8950
9034
  count: _filteredProducts2.length,
8951
9035
  extension_type: extension_type
@@ -8982,7 +9066,7 @@ var Server = /*#__PURE__*/function () {
8982
9066
  filteredCount: _filteredProducts2.length,
8983
9067
  extension_type: extension_type
8984
9068
  });
8985
- return _context82.abrupt("return", {
9069
+ return _context83.abrupt("return", {
8986
9070
  code: 200,
8987
9071
  data: this.buildProductQueryResultPayload(_filteredProducts2),
8988
9072
  message: '',
@@ -8990,28 +9074,28 @@ var Server = /*#__PURE__*/function () {
8990
9074
  });
8991
9075
  case 57:
8992
9076
  if (this.menu) {
8993
- _context82.next = 60;
9077
+ _context83.next = 60;
8994
9078
  break;
8995
9079
  }
8996
9080
  this.logError('computeProductQueryResult: Menu 模块未注册');
8997
- return _context82.abrupt("return", {
9081
+ return _context83.abrupt("return", {
8998
9082
  message: 'Menu 模块未注册',
8999
9083
  data: this.buildProductQueryResultPayload([], 0)
9000
9084
  });
9001
9085
  case 60:
9002
9086
  if (this.schedule) {
9003
- _context82.next = 63;
9087
+ _context83.next = 63;
9004
9088
  break;
9005
9089
  }
9006
9090
  this.logError('computeProductQueryResult: Schedule 模块未注册');
9007
- return _context82.abrupt("return", {
9091
+ return _context83.abrupt("return", {
9008
9092
  message: 'Schedule 模块未注册',
9009
9093
  data: this.buildProductQueryResultPayload([], 0)
9010
9094
  });
9011
9095
  case 63:
9012
9096
  activeMenuList = [];
9013
9097
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
9014
- _context82.next = 76;
9098
+ _context83.next = 76;
9015
9099
  break;
9016
9100
  }
9017
9101
  tMenu = performance.now();
@@ -9022,18 +9106,18 @@ var Server = /*#__PURE__*/function () {
9022
9106
  });
9023
9107
  };
9024
9108
  activeMenuList = getActiveMenus();
9025
- _context82.t0 = !activeMenuList.length;
9026
- if (!_context82.t0) {
9027
- _context82.next = 73;
9109
+ _context83.t0 = !activeMenuList.length;
9110
+ if (!_context83.t0) {
9111
+ _context83.next = 73;
9028
9112
  break;
9029
9113
  }
9030
- _context82.next = 72;
9114
+ _context83.next = 72;
9031
9115
  return this.refreshMenuScheduleCacheAfterEmptyResult();
9032
9116
  case 72:
9033
- _context82.t0 = _context82.sent;
9117
+ _context83.t0 = _context83.sent;
9034
9118
  case 73:
9035
- if (!_context82.t0) {
9036
- _context82.next = 75;
9119
+ if (!_context83.t0) {
9120
+ _context83.next = 75;
9037
9121
  break;
9038
9122
  }
9039
9123
  activeMenuList = getActiveMenus();
@@ -9053,22 +9137,22 @@ var Server = /*#__PURE__*/function () {
9053
9137
  });
9054
9138
  tPrice = performance.now();
9055
9139
  if (!(scopedProductIds.length > 0)) {
9056
- _context82.next = 87;
9140
+ _context83.next = 87;
9057
9141
  break;
9058
9142
  }
9059
- _context82.next = 84;
9143
+ _context83.next = 84;
9060
9144
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
9061
9145
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
9062
9146
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
9063
9147
  });
9064
9148
  case 84:
9065
- _context82.t1 = _context82.sent;
9066
- _context82.next = 88;
9149
+ _context83.t1 = _context83.sent;
9150
+ _context83.next = 88;
9067
9151
  break;
9068
9152
  case 87:
9069
- _context82.t1 = [];
9153
+ _context83.t1 = [];
9070
9154
  case 88:
9071
- filteredProducts = _context82.t1;
9155
+ filteredProducts = _context83.t1;
9072
9156
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
9073
9157
  count: filteredProducts.length,
9074
9158
  scopedProductCount: scopedProductIds.length
@@ -9107,7 +9191,7 @@ var Server = /*#__PURE__*/function () {
9107
9191
  filteredCount: filteredProducts.length,
9108
9192
  activeMenuCount: activeMenuList.length
9109
9193
  });
9110
- return _context82.abrupt("return", {
9194
+ return _context83.abrupt("return", {
9111
9195
  code: 200,
9112
9196
  data: this.buildProductQueryResultPayload(filteredProducts),
9113
9197
  message: '',
@@ -9115,11 +9199,11 @@ var Server = /*#__PURE__*/function () {
9115
9199
  });
9116
9200
  case 104:
9117
9201
  case "end":
9118
- return _context82.stop();
9202
+ return _context83.stop();
9119
9203
  }
9120
- }, _callee82, this);
9204
+ }, _callee83, this);
9121
9205
  }));
9122
- function computeProductQueryResult(_x93, _x94) {
9206
+ function computeProductQueryResult(_x94, _x95) {
9123
9207
  return _computeProductQueryResult.apply(this, arguments);
9124
9208
  }
9125
9209
  return computeProductQueryResult;
@@ -9157,74 +9241,74 @@ var Server = /*#__PURE__*/function () {
9157
9241
  }, {
9158
9242
  key: "recomputeAndNotifyProductQuery",
9159
9243
  value: (function () {
9160
- var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(options) {
9244
+ var _recomputeAndNotifyProductQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(options) {
9161
9245
  var _iterator18, _step18, _step18$value, subscriberId, subscriber, result, errorMessage;
9162
- return _regeneratorRuntime().wrap(function _callee83$(_context83) {
9163
- while (1) switch (_context83.prev = _context83.next) {
9246
+ return _regeneratorRuntime().wrap(function _callee84$(_context84) {
9247
+ while (1) switch (_context84.prev = _context84.next) {
9164
9248
  case 0:
9165
9249
  if (!(this.productQuerySubscribers.size === 0)) {
9166
- _context83.next = 2;
9250
+ _context84.next = 2;
9167
9251
  break;
9168
9252
  }
9169
- return _context83.abrupt("return");
9253
+ return _context84.abrupt("return");
9170
9254
  case 2:
9171
9255
  this.logInfo('recomputeAndNotifyProductQuery: 开始推送', {
9172
9256
  subscriberCount: this.productQuerySubscribers.size,
9173
9257
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
9174
9258
  });
9175
9259
  _iterator18 = _createForOfIteratorHelper(this.productQuerySubscribers.entries());
9176
- _context83.prev = 4;
9260
+ _context84.prev = 4;
9177
9261
  _iterator18.s();
9178
9262
  case 6:
9179
9263
  if ((_step18 = _iterator18.n()).done) {
9180
- _context83.next = 23;
9264
+ _context84.next = 23;
9181
9265
  break;
9182
9266
  }
9183
9267
  _step18$value = _slicedToArray(_step18.value, 2), subscriberId = _step18$value[0], subscriber = _step18$value[1];
9184
- _context83.prev = 8;
9185
- _context83.next = 11;
9268
+ _context84.prev = 8;
9269
+ _context84.next = 11;
9186
9270
  return this.computeProductQueryResult(subscriber.context, {
9187
9271
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
9188
9272
  });
9189
9273
  case 11:
9190
- result = _context83.sent;
9191
- _context83.next = 14;
9274
+ result = _context84.sent;
9275
+ _context84.next = 14;
9192
9276
  return subscriber.callback(result);
9193
9277
  case 14:
9194
9278
  this.logInfo('recomputeAndNotifyProductQuery: 已推送', {
9195
9279
  subscriberId: subscriberId
9196
9280
  });
9197
- _context83.next = 21;
9281
+ _context84.next = 21;
9198
9282
  break;
9199
9283
  case 17:
9200
- _context83.prev = 17;
9201
- _context83.t0 = _context83["catch"](8);
9202
- errorMessage = _context83.t0 instanceof Error ? _context83.t0.message : String(_context83.t0);
9284
+ _context84.prev = 17;
9285
+ _context84.t0 = _context84["catch"](8);
9286
+ errorMessage = _context84.t0 instanceof Error ? _context84.t0.message : String(_context84.t0);
9203
9287
  this.logError('recomputeAndNotifyProductQuery: 推送失败', {
9204
9288
  subscriberId: subscriberId,
9205
9289
  error: errorMessage
9206
9290
  });
9207
9291
  case 21:
9208
- _context83.next = 6;
9292
+ _context84.next = 6;
9209
9293
  break;
9210
9294
  case 23:
9211
- _context83.next = 28;
9295
+ _context84.next = 28;
9212
9296
  break;
9213
9297
  case 25:
9214
- _context83.prev = 25;
9215
- _context83.t1 = _context83["catch"](4);
9216
- _iterator18.e(_context83.t1);
9298
+ _context84.prev = 25;
9299
+ _context84.t1 = _context84["catch"](4);
9300
+ _iterator18.e(_context84.t1);
9217
9301
  case 28:
9218
- _context83.prev = 28;
9302
+ _context84.prev = 28;
9219
9303
  _iterator18.f();
9220
- return _context83.finish(28);
9304
+ return _context84.finish(28);
9221
9305
  case 31:
9222
9306
  case "end":
9223
- return _context83.stop();
9307
+ return _context84.stop();
9224
9308
  }
9225
- }, _callee83, this, [[4, 25, 28, 31], [8, 17]]);
9309
+ }, _callee84, this, [[4, 25, 28, 31], [8, 17]]);
9226
9310
  }));
9227
- function recomputeAndNotifyProductQuery(_x95) {
9311
+ function recomputeAndNotifyProductQuery(_x96) {
9228
9312
  return _recomputeAndNotifyProductQuery.apply(this, arguments);
9229
9313
  }
9230
9314
  return recomputeAndNotifyProductQuery;
@@ -9236,16 +9320,16 @@ var Server = /*#__PURE__*/function () {
9236
9320
  }, {
9237
9321
  key: "recomputeAndNotifyOrderQuery",
9238
9322
  value: (function () {
9239
- var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84() {
9323
+ var _recomputeAndNotifyOrderQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
9240
9324
  var notifyStartAt, _iterator19, _step19, _step19$value, subscriberId, subscriber, computeStartAt, result, computeEndAt, callbackStartAt, callbackEndAt, errorMessage, notifyEndAt;
9241
- return _regeneratorRuntime().wrap(function _callee84$(_context84) {
9242
- while (1) switch (_context84.prev = _context84.next) {
9325
+ return _regeneratorRuntime().wrap(function _callee85$(_context85) {
9326
+ while (1) switch (_context85.prev = _context85.next) {
9243
9327
  case 0:
9244
9328
  if (!(this.orderQuerySubscribers.size === 0)) {
9245
- _context84.next = 2;
9329
+ _context85.next = 2;
9246
9330
  break;
9247
9331
  }
9248
- return _context84.abrupt("return");
9332
+ return _context85.abrupt("return");
9249
9333
  case 2:
9250
9334
  notifyStartAt = Date.now();
9251
9335
  this.logInfo('recomputeAndNotifyOrderQuery: 开始推送', {
@@ -9253,20 +9337,20 @@ var Server = /*#__PURE__*/function () {
9253
9337
  notifyStartAt: new Date(notifyStartAt).toISOString()
9254
9338
  });
9255
9339
  _iterator19 = _createForOfIteratorHelper(this.orderQuerySubscribers.entries());
9256
- _context84.prev = 5;
9340
+ _context85.prev = 5;
9257
9341
  _iterator19.s();
9258
9342
  case 7:
9259
9343
  if ((_step19 = _iterator19.n()).done) {
9260
- _context84.next = 27;
9344
+ _context85.next = 27;
9261
9345
  break;
9262
9346
  }
9263
9347
  _step19$value = _slicedToArray(_step19.value, 2), subscriberId = _step19$value[0], subscriber = _step19$value[1];
9264
- _context84.prev = 9;
9348
+ _context85.prev = 9;
9265
9349
  computeStartAt = Date.now();
9266
- _context84.next = 13;
9350
+ _context85.next = 13;
9267
9351
  return this.computeOrderQueryResult(subscriber.context);
9268
9352
  case 13:
9269
- result = _context84.sent;
9353
+ result = _context85.sent;
9270
9354
  computeEndAt = Date.now();
9271
9355
  callbackStartAt = Date.now();
9272
9356
  subscriber.callback(result);
@@ -9277,30 +9361,30 @@ var Server = /*#__PURE__*/function () {
9277
9361
  callbackDurationMs: callbackEndAt - callbackStartAt,
9278
9362
  totalDurationMs: callbackEndAt - computeStartAt
9279
9363
  });
9280
- _context84.next = 25;
9364
+ _context85.next = 25;
9281
9365
  break;
9282
9366
  case 21:
9283
- _context84.prev = 21;
9284
- _context84.t0 = _context84["catch"](9);
9285
- errorMessage = _context84.t0 instanceof Error ? _context84.t0.message : String(_context84.t0);
9367
+ _context85.prev = 21;
9368
+ _context85.t0 = _context85["catch"](9);
9369
+ errorMessage = _context85.t0 instanceof Error ? _context85.t0.message : String(_context85.t0);
9286
9370
  this.logError('recomputeAndNotifyOrderQuery: 推送失败', {
9287
9371
  subscriberId: subscriberId,
9288
9372
  error: errorMessage
9289
9373
  });
9290
9374
  case 25:
9291
- _context84.next = 7;
9375
+ _context85.next = 7;
9292
9376
  break;
9293
9377
  case 27:
9294
- _context84.next = 32;
9378
+ _context85.next = 32;
9295
9379
  break;
9296
9380
  case 29:
9297
- _context84.prev = 29;
9298
- _context84.t1 = _context84["catch"](5);
9299
- _iterator19.e(_context84.t1);
9381
+ _context85.prev = 29;
9382
+ _context85.t1 = _context85["catch"](5);
9383
+ _iterator19.e(_context85.t1);
9300
9384
  case 32:
9301
- _context84.prev = 32;
9385
+ _context85.prev = 32;
9302
9386
  _iterator19.f();
9303
- return _context84.finish(32);
9387
+ return _context85.finish(32);
9304
9388
  case 35:
9305
9389
  notifyEndAt = Date.now();
9306
9390
  this.logInfo('recomputeAndNotifyOrderQuery: 推送完成', {
@@ -9309,9 +9393,9 @@ var Server = /*#__PURE__*/function () {
9309
9393
  });
9310
9394
  case 37:
9311
9395
  case "end":
9312
- return _context84.stop();
9396
+ return _context85.stop();
9313
9397
  }
9314
- }, _callee84, this, [[5, 29, 32, 35], [9, 21]]);
9398
+ }, _callee85, this, [[5, 29, 32, 35], [9, 21]]);
9315
9399
  }));
9316
9400
  function recomputeAndNotifyOrderQuery() {
9317
9401
  return _recomputeAndNotifyOrderQuery.apply(this, arguments);
@@ -9452,67 +9536,67 @@ var Server = /*#__PURE__*/function () {
9452
9536
  }, {
9453
9537
  key: "recomputeAndNotifyBookingQuery",
9454
9538
  value: (function () {
9455
- var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85() {
9539
+ var _recomputeAndNotifyBookingQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86() {
9456
9540
  var _iterator21, _step21, _step21$value, subscriberId, subscriber, result, errorMessage;
9457
- return _regeneratorRuntime().wrap(function _callee85$(_context85) {
9458
- while (1) switch (_context85.prev = _context85.next) {
9541
+ return _regeneratorRuntime().wrap(function _callee86$(_context86) {
9542
+ while (1) switch (_context86.prev = _context86.next) {
9459
9543
  case 0:
9460
9544
  if (!(this.bookingQuerySubscribers.size === 0)) {
9461
- _context85.next = 2;
9545
+ _context86.next = 2;
9462
9546
  break;
9463
9547
  }
9464
- return _context85.abrupt("return");
9548
+ return _context86.abrupt("return");
9465
9549
  case 2:
9466
9550
  this.logInfo('recomputeAndNotifyBookingQuery: 开始推送', {
9467
9551
  subscriberCount: this.bookingQuerySubscribers.size
9468
9552
  });
9469
9553
  _iterator21 = _createForOfIteratorHelper(this.bookingQuerySubscribers.entries());
9470
- _context85.prev = 4;
9554
+ _context86.prev = 4;
9471
9555
  _iterator21.s();
9472
9556
  case 6:
9473
9557
  if ((_step21 = _iterator21.n()).done) {
9474
- _context85.next = 22;
9558
+ _context86.next = 22;
9475
9559
  break;
9476
9560
  }
9477
9561
  _step21$value = _slicedToArray(_step21.value, 2), subscriberId = _step21$value[0], subscriber = _step21$value[1];
9478
- _context85.prev = 8;
9479
- _context85.next = 11;
9562
+ _context86.prev = 8;
9563
+ _context86.next = 11;
9480
9564
  return this.computeBookingQueryResult(subscriber.context);
9481
9565
  case 11:
9482
- result = _context85.sent;
9566
+ result = _context86.sent;
9483
9567
  subscriber.callback(result);
9484
9568
  this.logInfo('recomputeAndNotifyBookingQuery: 已推送', {
9485
9569
  subscriberId: subscriberId
9486
9570
  });
9487
- _context85.next = 20;
9571
+ _context86.next = 20;
9488
9572
  break;
9489
9573
  case 16:
9490
- _context85.prev = 16;
9491
- _context85.t0 = _context85["catch"](8);
9492
- errorMessage = _context85.t0 instanceof Error ? _context85.t0.message : String(_context85.t0);
9574
+ _context86.prev = 16;
9575
+ _context86.t0 = _context86["catch"](8);
9576
+ errorMessage = _context86.t0 instanceof Error ? _context86.t0.message : String(_context86.t0);
9493
9577
  this.logError('recomputeAndNotifyBookingQuery: 推送失败', {
9494
9578
  subscriberId: subscriberId,
9495
9579
  error: errorMessage
9496
9580
  });
9497
9581
  case 20:
9498
- _context85.next = 6;
9582
+ _context86.next = 6;
9499
9583
  break;
9500
9584
  case 22:
9501
- _context85.next = 27;
9585
+ _context86.next = 27;
9502
9586
  break;
9503
9587
  case 24:
9504
- _context85.prev = 24;
9505
- _context85.t1 = _context85["catch"](4);
9506
- _iterator21.e(_context85.t1);
9588
+ _context86.prev = 24;
9589
+ _context86.t1 = _context86["catch"](4);
9590
+ _iterator21.e(_context86.t1);
9507
9591
  case 27:
9508
- _context85.prev = 27;
9592
+ _context86.prev = 27;
9509
9593
  _iterator21.f();
9510
- return _context85.finish(27);
9594
+ return _context86.finish(27);
9511
9595
  case 30:
9512
9596
  case "end":
9513
- return _context85.stop();
9597
+ return _context86.stop();
9514
9598
  }
9515
- }, _callee85, this, [[4, 24, 27, 30], [8, 16]]);
9599
+ }, _callee86, this, [[4, 24, 27, 30], [8, 16]]);
9516
9600
  }));
9517
9601
  function recomputeAndNotifyBookingQuery() {
9518
9602
  return _recomputeAndNotifyBookingQuery.apply(this, arguments);