@pisell/pisellos 2.3.195 → 2.3.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  2. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  3. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  4. package/dist/modules/BookingContext/utils/index.js +1 -0
  5. package/dist/modules/BookingContext/utils/productExtend.d.ts +6 -0
  6. package/dist/modules/BookingContext/utils/productExtend.js +21 -0
  7. package/dist/modules/Order/index.d.ts +3 -0
  8. package/dist/modules/Order/index.js +127 -46
  9. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  10. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  11. package/dist/modules/Product/index.d.ts +1 -1
  12. package/dist/modules/ResourcePlanner/planner.js +24 -0
  13. package/dist/modules/ResourcePlanner/types.d.ts +7 -0
  14. package/dist/server/index.js +207 -193
  15. package/dist/server/modules/order/index.js +2 -1
  16. package/dist/shared/receipt/small-ticket.d.ts +3 -0
  17. package/dist/shared/receipt/small-ticket.js +26 -3
  18. package/dist/solution/BookingByStep/index.d.ts +2 -2
  19. package/dist/solution/BookingTicket/index.d.ts +2 -14
  20. package/dist/solution/BookingTicket/index.js +8 -4
  21. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
  22. package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
  23. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  24. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  25. package/dist/solution/OrderInvoicePreview/index.js +13 -8
  26. package/dist/solution/UnifiedBookingSales/index.d.ts +16 -2
  27. package/dist/solution/UnifiedBookingSales/index.js +1670 -1377
  28. package/dist/solution/UnifiedBookingSales/types.d.ts +1 -0
  29. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +11 -5
  30. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  31. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  32. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  33. package/lib/modules/BookingContext/utils/index.js +11 -0
  34. package/lib/modules/BookingContext/utils/productExtend.d.ts +6 -0
  35. package/lib/modules/BookingContext/utils/productExtend.js +23 -0
  36. package/lib/modules/Order/index.d.ts +3 -0
  37. package/lib/modules/Order/index.js +85 -16
  38. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  39. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  40. package/lib/modules/Product/index.d.ts +1 -1
  41. package/lib/modules/ResourcePlanner/planner.js +23 -0
  42. package/lib/modules/ResourcePlanner/types.d.ts +7 -0
  43. package/lib/server/index.js +21 -5
  44. package/lib/server/modules/order/index.js +2 -1
  45. package/lib/shared/receipt/small-ticket.d.ts +3 -0
  46. package/lib/shared/receipt/small-ticket.js +24 -1
  47. package/lib/solution/BookingByStep/index.d.ts +2 -2
  48. package/lib/solution/BookingTicket/index.d.ts +2 -14
  49. package/lib/solution/BookingTicket/index.js +4 -2
  50. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -0
  51. package/lib/solution/BookingTicket/utils/addProductDecision.js +33 -3
  52. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  53. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  54. package/lib/solution/OrderInvoicePreview/index.js +6 -1
  55. package/lib/solution/UnifiedBookingSales/index.d.ts +16 -2
  56. package/lib/solution/UnifiedBookingSales/index.js +176 -36
  57. package/lib/solution/UnifiedBookingSales/types.d.ts +1 -0
  58. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +9 -5
  59. package/package.json +1 -1
@@ -308,12 +308,12 @@ var Server = /*#__PURE__*/function () {
308
308
  */
309
309
  _defineProperty(this, "handleProductQuery", /*#__PURE__*/function () {
310
310
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
311
- var url, method, data, config, menu_list_ids, customer_id, ids, extension_type, strategy_context, _this$resolveProductQ, schedule_date, schedule_datetime, _ref7, callback, subscriberId, result;
311
+ var url, method, data, config, menu_list_ids, customer_id, ids, extension_type, application_code, strategy_context, _this$resolveProductQ, schedule_date, schedule_datetime, _ref7, callback, subscriberId, result;
312
312
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
313
313
  while (1) switch (_context3.prev = _context3.next) {
314
314
  case 0:
315
315
  url = _ref5.url, method = _ref5.method, data = _ref5.data, config = _ref5.config;
316
- menu_list_ids = data.menu_list_ids, customer_id = data.customer_id, ids = data.ids, extension_type = data.extension_type, strategy_context = data.strategy_context;
316
+ 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;
317
317
  _this$resolveProductQ = _this.resolveProductQueryScheduleContext({
318
318
  schedule_date: data.schedule_date,
319
319
  schedule_datetime: data.schedule_datetime
@@ -340,6 +340,7 @@ var Server = /*#__PURE__*/function () {
340
340
  schedule_datetime: schedule_datetime,
341
341
  customer_id: customer_id,
342
342
  extension_type: extension_type,
343
+ application_code: application_code,
343
344
  strategy_context: strategy_context
344
345
  }
345
346
  });
@@ -356,6 +357,7 @@ var Server = /*#__PURE__*/function () {
356
357
  schedule_datetime: schedule_datetime,
357
358
  customer_id: customer_id,
358
359
  extension_type: extension_type,
360
+ application_code: application_code,
359
361
  strategy_context: strategy_context
360
362
  });
361
363
  case 8:
@@ -384,6 +386,7 @@ var Server = /*#__PURE__*/function () {
384
386
  */
385
387
  _defineProperty(this, "handleProductQueryById", /*#__PURE__*/function () {
386
388
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref8) {
389
+ var _ref10, _data$application_cod;
387
390
  var path, method, data, url, pathname, idMatch, productId, scheduleDateFromData, schedule_date, scheduleDtFromData, scheduleDtFromUrl, scheduleDatetime;
388
391
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
389
392
  while (1) switch (_context4.prev = _context4.next) {
@@ -435,7 +438,8 @@ var Server = /*#__PURE__*/function () {
435
438
  return _context4.abrupt("return", _this.computeProductQueryResult(_objectSpread({
436
439
  schedule_date: schedule_date,
437
440
  schedule_datetime: scheduleDatetime,
438
- product_id: productId
441
+ product_id: productId,
442
+ application_code: (_ref10 = (_data$application_cod = data === null || data === void 0 ? void 0 : data.application_code) !== null && _data$application_cod !== void 0 ? _data$application_cod : _this.extractQueryParam(url || '', 'application_code')) !== null && _ref10 !== void 0 ? _ref10 : undefined
439
443
  }, data && _typeof(data) === 'object' ? {
440
444
  customer_id: data.customer_id,
441
445
  strategy_context: data.strategy_context
@@ -454,13 +458,13 @@ var Server = /*#__PURE__*/function () {
454
458
  * 取消商品查询订阅(HTTP 路由入口)
455
459
  */
456
460
  _defineProperty(this, "handleUnsubscribeProductQuery", /*#__PURE__*/function () {
457
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref10) {
458
- var data, _ref12, subscriberId;
461
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref11) {
462
+ var data, _ref13, subscriberId;
459
463
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
460
464
  while (1) switch (_context5.prev = _context5.next) {
461
465
  case 0:
462
- data = _ref10.data;
463
- _ref12 = data || {}, subscriberId = _ref12.subscriberId;
466
+ data = _ref11.data;
467
+ _ref13 = data || {}, subscriberId = _ref13.subscriberId;
464
468
  _this.removeProductQuerySubscriber(subscriberId);
465
469
  return _context5.abrupt("return", {
466
470
  code: 200,
@@ -474,7 +478,7 @@ var Server = /*#__PURE__*/function () {
474
478
  }, _callee5);
475
479
  }));
476
480
  return function (_x5) {
477
- return _ref11.apply(this, arguments);
481
+ return _ref12.apply(this, arguments);
478
482
  };
479
483
  }());
480
484
  /**
@@ -482,14 +486,14 @@ var Server = /*#__PURE__*/function () {
482
486
  * 存储订阅者信息,本地计算结果;数据变更时通过 callback 推送
483
487
  */
484
488
  _defineProperty(this, "handleOrderList", /*#__PURE__*/function () {
485
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref13) {
486
- var url, method, data, config, queryPayload, _ref15, callback, subscriberId, useLocal;
489
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref14) {
490
+ var url, method, data, config, queryPayload, _ref16, callback, subscriberId, useLocal;
487
491
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
488
492
  while (1) switch (_context6.prev = _context6.next) {
489
493
  case 0:
490
- url = _ref13.url, method = _ref13.method, data = _ref13.data, config = _ref13.config;
494
+ url = _ref14.url, method = _ref14.method, data = _ref14.data, config = _ref14.config;
491
495
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
492
- _ref15 = config || {}, callback = _ref15.callback, subscriberId = _ref15.subscriberId;
496
+ _ref16 = config || {}, callback = _ref16.callback, subscriberId = _ref16.subscriberId;
493
497
  useLocal = _this.shouldUseLocalOrderQuery(queryPayload);
494
498
  _this.logInfo('handleOrderList: 开始处理订单列表请求', {
495
499
  data: queryPayload,
@@ -526,20 +530,20 @@ var Server = /*#__PURE__*/function () {
526
530
  }, _callee6);
527
531
  }));
528
532
  return function (_x6) {
529
- return _ref14.apply(this, arguments);
533
+ return _ref15.apply(this, arguments);
530
534
  };
531
535
  }());
532
536
  /**
533
537
  * 取消订单列表查询订阅(HTTP 路由入口)
534
538
  */
535
539
  _defineProperty(this, "handleUnsubscribeOrderQuery", /*#__PURE__*/function () {
536
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref16) {
537
- var data, _ref18, subscriberId;
540
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref17) {
541
+ var data, _ref19, subscriberId;
538
542
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
539
543
  while (1) switch (_context7.prev = _context7.next) {
540
544
  case 0:
541
- data = _ref16.data;
542
- _ref18 = data || {}, subscriberId = _ref18.subscriberId;
545
+ data = _ref17.data;
546
+ _ref19 = data || {}, subscriberId = _ref19.subscriberId;
543
547
  if (subscriberId) {
544
548
  _this.orderQuerySubscribers.delete(subscriberId);
545
549
  _this.logInfo('handleUnsubscribeOrderQuery: 已移除订阅者', {
@@ -559,7 +563,7 @@ var Server = /*#__PURE__*/function () {
559
563
  }, _callee7);
560
564
  }));
561
565
  return function (_x7) {
562
- return _ref17.apply(this, arguments);
566
+ return _ref18.apply(this, arguments);
563
567
  };
564
568
  }());
565
569
  /**
@@ -569,12 +573,12 @@ var Server = /*#__PURE__*/function () {
569
573
  * await this.handleSalesSearchModule({ url: '/shop/es/search/sales', method: 'post', data: { keyword: 'A' } })
570
574
  */
571
575
  _defineProperty(this, "handleSalesSearchModule", /*#__PURE__*/function () {
572
- var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref19) {
576
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref20) {
573
577
  var data, config;
574
578
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
575
579
  while (1) switch (_context8.prev = _context8.next) {
576
580
  case 0:
577
- data = _ref19.data, config = _ref19.config;
581
+ data = _ref20.data, config = _ref20.config;
578
582
  return _context8.abrupt("return", _this.handleSalesSearchRequest('single', '/shop/es/search/sales', data, config));
579
583
  case 2:
580
584
  case "end":
@@ -583,7 +587,7 @@ var Server = /*#__PURE__*/function () {
583
587
  }, _callee8);
584
588
  }));
585
589
  return function (_x8) {
586
- return _ref20.apply(this, arguments);
590
+ return _ref21.apply(this, arguments);
587
591
  };
588
592
  }());
589
593
  /**
@@ -593,12 +597,12 @@ var Server = /*#__PURE__*/function () {
593
597
  * await this.handleSalesSearchAggregate({ url: '/shop/es/search', method: 'post', data: { modules: [] } })
594
598
  */
595
599
  _defineProperty(this, "handleSalesSearchAggregate", /*#__PURE__*/function () {
596
- var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref21) {
600
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref22) {
597
601
  var data, config;
598
602
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
599
603
  while (1) switch (_context9.prev = _context9.next) {
600
604
  case 0:
601
- data = _ref21.data, config = _ref21.config;
605
+ data = _ref22.data, config = _ref22.config;
602
606
  return _context9.abrupt("return", _this.handleSalesSearchRequest('aggregate', '/shop/es/search', data, config));
603
607
  case 2:
604
608
  case "end":
@@ -607,7 +611,7 @@ var Server = /*#__PURE__*/function () {
607
611
  }, _callee9);
608
612
  }));
609
613
  return function (_x9) {
610
- return _ref22.apply(this, arguments);
614
+ return _ref23.apply(this, arguments);
611
615
  };
612
616
  }());
613
617
  /**
@@ -617,13 +621,13 @@ var Server = /*#__PURE__*/function () {
617
621
  * await this.handleUnsubscribeSalesSearch({ data: { subscriberId: 'global-search-order' } } as any)
618
622
  */
619
623
  _defineProperty(this, "handleUnsubscribeSalesSearch", /*#__PURE__*/function () {
620
- var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref23) {
621
- var data, _ref25, subscriberId;
624
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref24) {
625
+ var data, _ref26, subscriberId;
622
626
  return _regeneratorRuntime().wrap(function _callee10$(_context10) {
623
627
  while (1) switch (_context10.prev = _context10.next) {
624
628
  case 0:
625
- data = _ref23.data;
626
- _ref25 = data || {}, subscriberId = _ref25.subscriberId;
629
+ data = _ref24.data;
630
+ _ref26 = data || {}, subscriberId = _ref26.subscriberId;
627
631
  if (subscriberId) {
628
632
  _this.salesSearchSubscribers.delete(subscriberId);
629
633
  _this.logInfo('handleUnsubscribeSalesSearch: 已移除订阅者', {
@@ -643,7 +647,7 @@ var Server = /*#__PURE__*/function () {
643
647
  }, _callee10);
644
648
  }));
645
649
  return function (_x10) {
646
- return _ref24.apply(this, arguments);
650
+ return _ref25.apply(this, arguments);
647
651
  };
648
652
  }());
649
653
  /**
@@ -656,14 +660,14 @@ var Server = /*#__PURE__*/function () {
656
660
  * 今天:注册订阅者 + 本地数据筛选;非今天:清理订阅者 + 走真实 API
657
661
  */
658
662
  _defineProperty(this, "handleBookingList", /*#__PURE__*/function () {
659
- var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref26) {
660
- var url, method, data, config, queryPayload, _ref28, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
663
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref27) {
664
+ var url, method, data, config, queryPayload, _ref29, callback, subscriberId, useLocal, withFields, requestPayload, cacheKey;
661
665
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
662
666
  while (1) switch (_context11.prev = _context11.next) {
663
667
  case 0:
664
- url = _ref26.url, method = _ref26.method, data = _ref26.data, config = _ref26.config;
668
+ url = _ref27.url, method = _ref27.method, data = _ref27.data, config = _ref27.config;
665
669
  queryPayload = data && _typeof(data) === 'object' ? _objectSpread({}, data) : {};
666
- _ref28 = config || {}, callback = _ref28.callback, subscriberId = _ref28.subscriberId;
670
+ _ref29 = config || {}, callback = _ref29.callback, subscriberId = _ref29.subscriberId;
667
671
  useLocal = _this.shouldUseLocalBookingQuery(queryPayload);
668
672
  _this.logInfo('handleBookingList: 开始处理预约列表请求', {
669
673
  data: queryPayload,
@@ -720,7 +724,7 @@ var Server = /*#__PURE__*/function () {
720
724
  }, _callee11);
721
725
  }));
722
726
  return function (_x11) {
723
- return _ref27.apply(this, arguments);
727
+ return _ref28.apply(this, arguments);
724
728
  };
725
729
  }());
726
730
  /**
@@ -728,13 +732,13 @@ var Server = /*#__PURE__*/function () {
728
732
  * 转发到资源模块去
729
733
  */
730
734
  _defineProperty(this, "handleResourceList", /*#__PURE__*/function () {
731
- var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref29) {
735
+ var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref30) {
732
736
  var _this$resource;
733
737
  var url, method, data, config, list;
734
738
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
735
739
  while (1) switch (_context12.prev = _context12.next) {
736
740
  case 0:
737
- url = _ref29.url, method = _ref29.method, data = _ref29.data, config = _ref29.config;
741
+ url = _ref30.url, method = _ref30.method, data = _ref30.data, config = _ref30.config;
738
742
  list = (_this$resource = _this.resource) === null || _this$resource === void 0 ? void 0 : _this$resource.getResources({
739
743
  skip: (data === null || data === void 0 ? void 0 : data.skip) || 1,
740
744
  num: (data === null || data === void 0 ? void 0 : data.num) || 10
@@ -758,7 +762,7 @@ var Server = /*#__PURE__*/function () {
758
762
  }, _callee12);
759
763
  }));
760
764
  return function (_x12) {
761
- return _ref30.apply(this, arguments);
765
+ return _ref31.apply(this, arguments);
762
766
  };
763
767
  }());
764
768
  /**
@@ -776,13 +780,13 @@ var Server = /*#__PURE__*/function () {
776
780
  * @example 批量:GET /update/localOrder?order_ids=96971,96972,96973
777
781
  */
778
782
  _defineProperty(this, "handleUpdateLocalOrder", /*#__PURE__*/function () {
779
- var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref31) {
780
- var _data$order_id, _ref33, _this$app;
783
+ var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref32) {
784
+ var _data$order_id, _ref34, _this$app;
781
785
  var url, data, batchIds, rawOrderId, orderId, backendPath, _response$data, response, fresh, exists, _yield$_this$order$ov, overwritten, errorMessage;
782
786
  return _regeneratorRuntime().wrap(function _callee13$(_context13) {
783
787
  while (1) switch (_context13.prev = _context13.next) {
784
788
  case 0:
785
- url = _ref31.url, data = _ref31.data;
789
+ url = _ref32.url, data = _ref32.data;
786
790
  if (!(typeof (data === null || data === void 0 ? void 0 : data.order_id) === 'string' && data !== null && data !== void 0 && (_data$order_id = data.order_id) !== null && _data$order_id !== void 0 && _data$order_id.startsWith('LOCAL_'))) {
787
791
  _context13.next = 3;
788
792
  break;
@@ -799,7 +803,7 @@ var Server = /*#__PURE__*/function () {
799
803
  }
800
804
  return _context13.abrupt("return", _this.handleUpdateLocalOrdersBatch(batchIds));
801
805
  case 6:
802
- rawOrderId = (_ref33 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref33 !== void 0 ? _ref33 : _this.extractQueryParam(url, 'order_id');
806
+ rawOrderId = (_ref34 = data && _typeof(data) === 'object' ? data.order_id : undefined) !== null && _ref34 !== void 0 ? _ref34 : _this.extractQueryParam(url, 'order_id');
803
807
  orderId = rawOrderId === undefined || rawOrderId === null || rawOrderId === '' ? null : String(rawOrderId).trim();
804
808
  _this.logInfo('handleUpdateLocalOrder: 开始处理', {
805
809
  url: url,
@@ -931,16 +935,16 @@ var Server = /*#__PURE__*/function () {
931
935
  }, _callee13, null, [[19, 41]]);
932
936
  }));
933
937
  return function (_x13) {
934
- return _ref32.apply(this, arguments);
938
+ return _ref33.apply(this, arguments);
935
939
  };
936
940
  }());
937
941
  _defineProperty(this, "handleOrderSalesCheckout", /*#__PURE__*/function () {
938
- var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref34) {
942
+ var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref35) {
939
943
  var data;
940
944
  return _regeneratorRuntime().wrap(function _callee14$(_context14) {
941
945
  while (1) switch (_context14.prev = _context14.next) {
942
946
  case 0:
943
- data = _ref34.data;
947
+ data = _ref35.data;
944
948
  return _context14.abrupt("return", _this.handleOrderCheckoutSubmit({
945
949
  backendPath: '/shop/order/sales/checkout',
946
950
  data: data,
@@ -953,16 +957,16 @@ var Server = /*#__PURE__*/function () {
953
957
  }, _callee14);
954
958
  }));
955
959
  return function (_x14) {
956
- return _ref35.apply(this, arguments);
960
+ return _ref36.apply(this, arguments);
957
961
  };
958
962
  }());
959
963
  _defineProperty(this, "handleOrderSalesDraft", /*#__PURE__*/function () {
960
- var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref36) {
964
+ var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref37) {
961
965
  var data;
962
966
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
963
967
  while (1) switch (_context15.prev = _context15.next) {
964
968
  case 0:
965
- data = _ref36.data;
969
+ data = _ref37.data;
966
970
  return _context15.abrupt("return", _this.handleOrderDraftSubmit({
967
971
  data: data,
968
972
  title: 'handleOrderSalesDraft'
@@ -974,16 +978,16 @@ var Server = /*#__PURE__*/function () {
974
978
  }, _callee15);
975
979
  }));
976
980
  return function (_x15) {
977
- return _ref37.apply(this, arguments);
981
+ return _ref38.apply(this, arguments);
978
982
  };
979
983
  }());
980
984
  _defineProperty(this, "handleGetLocalPayment", /*#__PURE__*/function () {
981
- var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref38) {
985
+ var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref39) {
982
986
  var data, saleId, paymentNumber, operationId, requestContext, startedAt, found;
983
987
  return _regeneratorRuntime().wrap(function _callee16$(_context16) {
984
988
  while (1) switch (_context16.prev = _context16.next) {
985
989
  case 0:
986
- data = _ref38.data;
990
+ data = _ref39.data;
987
991
  saleId = data === null || data === void 0 ? void 0 : data.sale_id;
988
992
  paymentNumber = data === null || data === void 0 ? void 0 : data.payment_number;
989
993
  operationId = _this.createLocalPaymentOperationId('get');
@@ -1073,16 +1077,16 @@ var Server = /*#__PURE__*/function () {
1073
1077
  }, _callee16, null, [[13, 25]]);
1074
1078
  }));
1075
1079
  return function (_x16) {
1076
- return _ref39.apply(this, arguments);
1080
+ return _ref40.apply(this, arguments);
1077
1081
  };
1078
1082
  }());
1079
1083
  _defineProperty(this, "handleUpdateLocalPayment", /*#__PURE__*/function () {
1080
- var _ref41 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref40) {
1084
+ var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref41) {
1081
1085
  var data, saleId, paymentNumber, number, status, serviceCharge, cardReaderSurcharge, hasSurchargeInput, invalidSurchargeFields, operationId, requestContext, queueKey;
1082
1086
  return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1083
1087
  while (1) switch (_context17.prev = _context17.next) {
1084
1088
  case 0:
1085
- data = _ref40.data;
1089
+ data = _ref41.data;
1086
1090
  saleId = data === null || data === void 0 ? void 0 : data.sale_id;
1087
1091
  paymentNumber = data === null || data === void 0 ? void 0 : data.payment_number;
1088
1092
  number = data === null || data === void 0 ? void 0 : data.number;
@@ -1136,17 +1140,17 @@ var Server = /*#__PURE__*/function () {
1136
1140
  }, _callee17);
1137
1141
  }));
1138
1142
  return function (_x17) {
1139
- return _ref41.apply(this, arguments);
1143
+ return _ref42.apply(this, arguments);
1140
1144
  };
1141
1145
  }());
1142
1146
  _defineProperty(this, "handleFinalizeLocalEftposPayment", /*#__PURE__*/function () {
1143
- var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref42) {
1144
- var data, _ref44, saleId, paymentNumber, result, _ref44$failed_transac, numbers;
1147
+ var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref43) {
1148
+ var data, _ref45, saleId, paymentNumber, result, _ref45$failed_transac, numbers;
1145
1149
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1146
1150
  while (1) switch (_context19.prev = _context19.next) {
1147
1151
  case 0:
1148
- data = _ref42.data;
1149
- _ref44 = data || {}, saleId = _ref44.sale_id, paymentNumber = _ref44.payment_number, result = _ref44.result, _ref44$failed_transac = _ref44.failed_transaction_numbers, numbers = _ref44$failed_transac === void 0 ? [] : _ref44$failed_transac;
1152
+ data = _ref43.data;
1153
+ _ref45 = data || {}, saleId = _ref45.sale_id, paymentNumber = _ref45.payment_number, result = _ref45.result, _ref45$failed_transac = _ref45.failed_transaction_numbers, numbers = _ref45$failed_transac === void 0 ? [] : _ref45$failed_transac;
1150
1154
  if (!(!saleId || !paymentNumber || !Array.isArray(numbers) || numbers.some(function (number) {
1151
1155
  return typeof number !== 'string' || !number.trim();
1152
1156
  }) || result !== 'failed' && result !== 'not_started' || result === 'failed' && numbers.length === 0 || result === 'not_started' && numbers.length !== 0)) {
@@ -1202,16 +1206,16 @@ var Server = /*#__PURE__*/function () {
1202
1206
  }, _callee19);
1203
1207
  }));
1204
1208
  return function (_x18) {
1205
- return _ref43.apply(this, arguments);
1209
+ return _ref44.apply(this, arguments);
1206
1210
  };
1207
1211
  }());
1208
1212
  _defineProperty(this, "handleOrderCheckout", /*#__PURE__*/function () {
1209
- var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref46) {
1213
+ var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(_ref47) {
1210
1214
  var data;
1211
1215
  return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1212
1216
  while (1) switch (_context20.prev = _context20.next) {
1213
1217
  case 0:
1214
- data = _ref46.data;
1218
+ data = _ref47.data;
1215
1219
  return _context20.abrupt("return", _this.handleOrderCheckoutSubmit({
1216
1220
  backendPath: '/order/checkout',
1217
1221
  data: data,
@@ -1224,16 +1228,16 @@ var Server = /*#__PURE__*/function () {
1224
1228
  }, _callee20);
1225
1229
  }));
1226
1230
  return function (_x19) {
1227
- return _ref47.apply(this, arguments);
1231
+ return _ref48.apply(this, arguments);
1228
1232
  };
1229
1233
  }());
1230
1234
  _defineProperty(this, "handleLocalPrintOrder", /*#__PURE__*/function () {
1231
- var _ref49 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref48) {
1235
+ var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(_ref49) {
1232
1236
  var data, _extractedRequestTemp, _nestedOrderTemplateS, _extractedRequest$inv, _extractedRequestTemp2, _this$getLocalPrintOr, _need_sync, extractedRequest, extractedRequestTemplateSettings, requestOrder, nestedOrder, nestedOrderTemplateSettings, inputOrder, invoiceLayoutConfig, invoiceTemplateSettings, shouldLookup, lookup, sourceOrder, _this$order, localOrder, remoteResult, checkoutData, printableOrder, printResult, message;
1233
1237
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1234
1238
  while (1) switch (_context21.prev = _context21.next) {
1235
1239
  case 0:
1236
- data = _ref48.data;
1240
+ data = _ref49.data;
1237
1241
  _context21.prev = 1;
1238
1242
  extractedRequest = _this.extractInvoiceLayoutConfig(data, {
1239
1243
  includePublicInvoice: true
@@ -1394,17 +1398,17 @@ var Server = /*#__PURE__*/function () {
1394
1398
  }, _callee21, null, [[1, 43]]);
1395
1399
  }));
1396
1400
  return function (_x20) {
1397
- return _ref49.apply(this, arguments);
1401
+ return _ref50.apply(this, arguments);
1398
1402
  };
1399
1403
  }());
1400
1404
  _defineProperty(this, "handleLocalOrderReceiptSnapshot", /*#__PURE__*/function () {
1401
- var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref50) {
1405
+ var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(_ref51) {
1402
1406
  var _this$order2;
1403
1407
  var data, input, lookup, _payment_info, sourceOrder, remoteResult, paymentInfo, rebuiltOrder, smallTicketData, message;
1404
1408
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1405
1409
  while (1) switch (_context22.prev = _context22.next) {
1406
1410
  case 0:
1407
- data = _ref50.data;
1411
+ data = _ref51.data;
1408
1412
  input = data && _typeof(data) === 'object' && !Array.isArray(data) ? data : {};
1409
1413
  lookup = _this.getLocalPrintOrderLookup(input);
1410
1414
  if (!(lookup === undefined)) {
@@ -1530,17 +1534,17 @@ var Server = /*#__PURE__*/function () {
1530
1534
  }, _callee22, null, [[7, 29]]);
1531
1535
  }));
1532
1536
  return function (_x21) {
1533
- return _ref51.apply(this, arguments);
1537
+ return _ref52.apply(this, arguments);
1534
1538
  };
1535
1539
  }());
1536
1540
  _defineProperty(this, "handleMachinecodeBatchMeta", /*#__PURE__*/function () {
1537
- var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref52) {
1541
+ var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(_ref53) {
1538
1542
  var _this$resolveMachinec, _this$app2;
1539
1543
  var data, title, backendPath, ids, status, message, _response$code, _response$status, _response$message, _response$data2, response, backendError, _backendError$code, _backendError$status, _backendError$message, _backendError$data, _message;
1540
1544
  return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1541
1545
  while (1) switch (_context23.prev = _context23.next) {
1542
1546
  case 0:
1543
- data = _ref52.data;
1547
+ data = _ref53.data;
1544
1548
  title = 'handleMachinecodeBatchMeta';
1545
1549
  backendPath = '/shop/machinecode/batch';
1546
1550
  ids = Array.isArray(data === null || data === void 0 ? void 0 : data.ids) ? data.ids : [];
@@ -1659,16 +1663,16 @@ var Server = /*#__PURE__*/function () {
1659
1663
  }, _callee23, null, [[10, 15], [23, 30]]);
1660
1664
  }));
1661
1665
  return function (_x22) {
1662
- return _ref53.apply(this, arguments);
1666
+ return _ref54.apply(this, arguments);
1663
1667
  };
1664
1668
  }());
1665
1669
  _defineProperty(this, "handleOrderSalesDetail", /*#__PURE__*/function () {
1666
- var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref54) {
1670
+ var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref55) {
1667
1671
  var url, data, path, requestPath, lookup, localOrder, refreshedOrder, _enrichedOrder, remoteResult, enrichedOrder;
1668
1672
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1669
1673
  while (1) switch (_context24.prev = _context24.next) {
1670
1674
  case 0:
1671
- url = _ref54.url, data = _ref54.data, path = _ref54.path;
1675
+ url = _ref55.url, data = _ref55.data, path = _ref55.path;
1672
1676
  requestPath = _this.parseRequestPath(url, path);
1673
1677
  lookup = _this.extractOrderSalesDetailLookup(requestPath);
1674
1678
  _this.logInfo('handleOrderSalesDetail: 开始处理', {
@@ -1765,19 +1769,19 @@ var Server = /*#__PURE__*/function () {
1765
1769
  }, _callee24);
1766
1770
  }));
1767
1771
  return function (_x23) {
1768
- return _ref55.apply(this, arguments);
1772
+ return _ref56.apply(this, arguments);
1769
1773
  };
1770
1774
  }());
1771
1775
  /**
1772
1776
  * GET /shop/schedule/floor-plan* 前缀路由:读本地 store;支持 subscriberId + callback 订阅更新
1773
1777
  */
1774
1778
  _defineProperty(this, "handleFloorPlanGet", /*#__PURE__*/function () {
1775
- var _ref57 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref56) {
1776
- var url, data, config, routePath, base, path, _subscriberId, _ref58, callback, subscriberId, ctx;
1779
+ var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(_ref57) {
1780
+ var url, data, config, routePath, base, path, _subscriberId, _ref59, callback, subscriberId, ctx;
1777
1781
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1778
1782
  while (1) switch (_context25.prev = _context25.next) {
1779
1783
  case 0:
1780
- url = _ref56.url, data = _ref56.data, config = _ref56.config, routePath = _ref56.path;
1784
+ url = _ref57.url, data = _ref57.data, config = _ref57.config, routePath = _ref57.path;
1781
1785
  base = '/shop/schedule/floor-plan';
1782
1786
  path = _this.parseRequestPath(url, routePath);
1783
1787
  if (!(path === "".concat(base, "/unsubscribe") || path === "".concat(base, "/code/unsubscribe"))) {
@@ -1798,7 +1802,7 @@ var Server = /*#__PURE__*/function () {
1798
1802
  status: true
1799
1803
  });
1800
1804
  case 7:
1801
- _ref58 = config || {}, callback = _ref58.callback, subscriberId = _ref58.subscriberId;
1805
+ _ref59 = config || {}, callback = _ref59.callback, subscriberId = _ref59.subscriberId;
1802
1806
  ctx = _this.resolveFloorPlanQueryContext(path, base);
1803
1807
  if (ctx) {
1804
1808
  _context25.next = 11;
@@ -1830,20 +1834,20 @@ var Server = /*#__PURE__*/function () {
1830
1834
  }, _callee25);
1831
1835
  }));
1832
1836
  return function (_x24) {
1833
- return _ref57.apply(this, arguments);
1837
+ return _ref58.apply(this, arguments);
1834
1838
  };
1835
1839
  }());
1836
1840
  /**
1837
1841
  * 取消预约列表查询订阅(HTTP 路由入口)
1838
1842
  */
1839
1843
  _defineProperty(this, "handleUnsubscribeBookingQuery", /*#__PURE__*/function () {
1840
- var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(_ref59) {
1841
- var data, _ref61, subscriberId;
1844
+ var _ref61 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(_ref60) {
1845
+ var data, _ref62, subscriberId;
1842
1846
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1843
1847
  while (1) switch (_context26.prev = _context26.next) {
1844
1848
  case 0:
1845
- data = _ref59.data;
1846
- _ref61 = data || {}, subscriberId = _ref61.subscriberId;
1849
+ data = _ref60.data;
1850
+ _ref62 = data || {}, subscriberId = _ref62.subscriberId;
1847
1851
  if (subscriberId) {
1848
1852
  _this.bookingQuerySubscribers.delete(subscriberId);
1849
1853
  _this.bookingRemoteQuerySubscribers.delete(subscriberId);
@@ -1865,7 +1869,7 @@ var Server = /*#__PURE__*/function () {
1865
1869
  }, _callee26);
1866
1870
  }));
1867
1871
  return function (_x25) {
1868
- return _ref60.apply(this, arguments);
1872
+ return _ref61.apply(this, arguments);
1869
1873
  };
1870
1874
  }());
1871
1875
  /**
@@ -1873,13 +1877,13 @@ var Server = /*#__PURE__*/function () {
1873
1877
  * 通过餐牌ID列表获取所有相关日程的时间段点
1874
1878
  */
1875
1879
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
1876
- var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref62) {
1880
+ var _ref64 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(_ref63) {
1877
1881
  var _menu_list_ids$length;
1878
1882
  var url, method, data, config, menu_list_ids, _menu_list_ids$length2, _this$getMenuSchedule, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1879
1883
  return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1880
1884
  while (1) switch (_context27.prev = _context27.next) {
1881
1885
  case 0:
1882
- url = _ref62.url, method = _ref62.method, data = _ref62.data, config = _ref62.config;
1886
+ url = _ref63.url, method = _ref63.method, data = _ref63.data, config = _ref63.config;
1883
1887
  menu_list_ids = data.menu_list_ids;
1884
1888
  _this.logInfo('handleGetScheduleTimePoints 开始处理', {
1885
1889
  menuListIdsCount: (_menu_list_ids$length = menu_list_ids === null || menu_list_ids === void 0 ? void 0 : menu_list_ids.length) !== null && _menu_list_ids$length !== void 0 ? _menu_list_ids$length : 0,
@@ -1992,7 +1996,7 @@ var Server = /*#__PURE__*/function () {
1992
1996
  }, _callee27, null, [[15, 27]]);
1993
1997
  }));
1994
1998
  return function (_x26) {
1995
- return _ref63.apply(this, arguments);
1999
+ return _ref64.apply(this, arguments);
1996
2000
  };
1997
2001
  }());
1998
2002
  this.core = core;
@@ -3768,13 +3772,13 @@ var Server = /*#__PURE__*/function () {
3768
3772
  method: 'post',
3769
3773
  path: '/shop/local/orderPaymentReadiness',
3770
3774
  handler: function () {
3771
- var _handler = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(_ref64) {
3775
+ var _handler = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(_ref65) {
3772
3776
  var _this9$order;
3773
3777
  var data;
3774
3778
  return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3775
3779
  while (1) switch (_context44.prev = _context44.next) {
3776
3780
  case 0:
3777
- data = _ref64.data;
3781
+ data = _ref65.data;
3778
3782
  _context44.next = 3;
3779
3783
  return (_this9$order = _this9.order) === null || _this9$order === void 0 ? void 0 : _this9$order.getLocalOrderForPaymentReadiness(data === null || data === void 0 ? void 0 : data.sale_id);
3780
3784
  case 3:
@@ -4180,11 +4184,11 @@ var Server = /*#__PURE__*/function () {
4180
4184
  */
4181
4185
  }, {
4182
4186
  key: "syncProductQueryScheduleTimers",
4183
- value: function syncProductQueryScheduleTimers(_ref66) {
4187
+ value: function syncProductQueryScheduleTimers(_ref67) {
4184
4188
  var _this$products$getLas3, _this$products2, _this$products2$getLa;
4185
- var subscriberId = _ref66.subscriberId,
4186
- menu_list_ids = _ref66.menu_list_ids,
4187
- strategy_context = _ref66.strategy_context;
4189
+ var subscriberId = _ref67.subscriberId,
4190
+ menu_list_ids = _ref67.menu_list_ids,
4191
+ strategy_context = _ref67.strategy_context;
4188
4192
  this.clearSubscriberScheduleTimers(subscriberId);
4189
4193
  if (!this.shouldScheduleProductQueryReload(strategy_context)) {
4190
4194
  return;
@@ -4283,7 +4287,7 @@ var Server = /*#__PURE__*/function () {
4283
4287
  */
4284
4288
  function () {
4285
4289
  var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(kind, backendPath, data, config) {
4286
- var queryPayload, result, _ref67, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
4290
+ var queryPayload, result, _ref68, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
4287
4291
  return _regeneratorRuntime().wrap(function _callee51$(_context51) {
4288
4292
  while (1) switch (_context51.prev = _context51.next) {
4289
4293
  case 0:
@@ -4292,7 +4296,7 @@ var Server = /*#__PURE__*/function () {
4292
4296
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
4293
4297
  case 3:
4294
4298
  result = _context51.sent;
4295
- _ref67 = config || {}, callback = _ref67.callback, subscriberId = _ref67.subscriberId, resetVisibleOrderIds = _ref67.resetVisibleOrderIds;
4299
+ _ref68 = config || {}, callback = _ref68.callback, subscriberId = _ref68.subscriberId, resetVisibleOrderIds = _ref68.resetVisibleOrderIds;
4296
4300
  if (subscriberId && typeof callback === 'function') {
4297
4301
  contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
4298
4302
  existing = this.salesSearchSubscribers.get(subscriberId);
@@ -5698,9 +5702,14 @@ var Server = /*#__PURE__*/function () {
5698
5702
  }, {
5699
5703
  key: "getSmallTicketShopInfo",
5700
5704
  value: function getSmallTicketShopInfo() {
5701
- var _shopInfo$is_price_in;
5705
+ var _this$app15, _this$app15$getStore, _this$app15$getStore$, _this$app15$getStore$2, _this$app16, _this$app16$getStore, _this$app16$getStore$, _this$app16$getStore$2, _shopInfo$is_price_in;
5702
5706
  var shopInfo = this.getAppData('shop_info') || {};
5707
+ // WebPOS getData does not expose core/default_domain; read the business
5708
+ // shop model directly when the expanded shop_info has not loaded it yet.
5709
+ var shopCore = ((_this$app15 = this.app) === null || _this$app15 === void 0 || (_this$app15 = _this$app15.models) === null || _this$app15 === void 0 || (_this$app15$getStore = _this$app15.getStore) === null || _this$app15$getStore === void 0 || (_this$app15$getStore$ = (_this$app15$getStore$2 = _this$app15$getStore.call(_this$app15)).getDataByModel) === null || _this$app15$getStore$ === void 0 ? void 0 : _this$app15$getStore$.call(_this$app15$getStore$2, 'core', 'core')) || ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.data) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.store) === null || _this$app16 === void 0 || (_this$app16$getStore = _this$app16.getStore) === null || _this$app16$getStore === void 0 || (_this$app16$getStore$ = (_this$app16$getStore$2 = _this$app16$getStore.call(_this$app16)).getDataByModel) === null || _this$app16$getStore$ === void 0 ? void 0 : _this$app16$getStore$.call(_this$app16$getStore$2, 'core', 'core')) || {};
5703
5710
  return _objectSpread(_objectSpread({}, shopInfo), {}, {
5711
+ default_domain: shopInfo.default_domain || shopCore.default_domain,
5712
+ private_domain_protocol: shopInfo.private_domain_protocol || shopCore.private_domain_protocol,
5704
5713
  currency_symbol: shopInfo.currency_symbol || this.getAppData('shop_symbol') || this.getAppData('currency_symbol'),
5705
5714
  currency_code: shopInfo.currency_code || this.getAppData('shop_currency_code') || this.getAppData('currency_code'),
5706
5715
  tax_title: shopInfo.tax_title || this.getAppData('tax_title'),
@@ -6427,15 +6436,15 @@ var Server = /*#__PURE__*/function () {
6427
6436
  }, {
6428
6437
  key: "mergeLocalPrintOrderInput",
6429
6438
  value: function mergeLocalPrintOrderInput(localOrder, inputOrder) {
6430
- var _ref71, _localOrder$order_id, _ref72, _external_sale_number4;
6431
- var definedInput = Object.fromEntries(Object.entries(inputOrder || {}).filter(function (_ref69) {
6432
- var _ref70 = _slicedToArray(_ref69, 2),
6433
- value = _ref70[1];
6439
+ var _ref72, _localOrder$order_id, _ref73, _external_sale_number4;
6440
+ var definedInput = Object.fromEntries(Object.entries(inputOrder || {}).filter(function (_ref70) {
6441
+ var _ref71 = _slicedToArray(_ref70, 2),
6442
+ value = _ref71[1];
6434
6443
  return value !== undefined;
6435
6444
  }));
6436
6445
  return _objectSpread(_objectSpread(_objectSpread({}, localOrder), definedInput), {}, {
6437
- order_id: (_ref71 = (_localOrder$order_id = localOrder.order_id) !== null && _localOrder$order_id !== void 0 ? _localOrder$order_id : definedInput.order_id) !== null && _ref71 !== void 0 ? _ref71 : definedInput.orderId,
6438
- external_sale_number: (_ref72 = (_external_sale_number4 = localOrder.external_sale_number) !== null && _external_sale_number4 !== void 0 ? _external_sale_number4 : definedInput.external_sale_number) !== null && _ref72 !== void 0 ? _ref72 : definedInput.externalSaleNumber
6446
+ order_id: (_ref72 = (_localOrder$order_id = localOrder.order_id) !== null && _localOrder$order_id !== void 0 ? _localOrder$order_id : definedInput.order_id) !== null && _ref72 !== void 0 ? _ref72 : definedInput.orderId,
6447
+ external_sale_number: (_ref73 = (_external_sale_number4 = localOrder.external_sale_number) !== null && _external_sale_number4 !== void 0 ? _external_sale_number4 : definedInput.external_sale_number) !== null && _ref73 !== void 0 ? _ref73 : definedInput.externalSaleNumber
6439
6448
  });
6440
6449
  }
6441
6450
  }, {
@@ -6460,8 +6469,8 @@ var Server = /*#__PURE__*/function () {
6460
6469
  key: "syncMachinecodeRedeemStatusToLocalOrder",
6461
6470
  value: function () {
6462
6471
  var _syncMachinecodeRedeemStatusToLocalOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(data, ids, status) {
6463
- var _this$order5;
6464
- var title, lookup, localOrder, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
6472
+ var _this$order5, _data$order_id2;
6473
+ var title, lookup, localOrder, orderId, voucherIdSet, vouchers, hasUpdatedVoucher, nextVouchers;
6465
6474
  return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6466
6475
  while (1) switch (_context65.prev = _context65.next) {
6467
6476
  case 0:
@@ -6491,8 +6500,18 @@ var Server = /*#__PURE__*/function () {
6491
6500
  return this.order.getLocalOrderByLookup(lookup);
6492
6501
  case 10:
6493
6502
  localOrder = _context65.sent;
6503
+ 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;
6504
+ if (!(!localOrder && orderId !== undefined && orderId !== null && orderId !== '' && String(orderId) !== String(lookup))) {
6505
+ _context65.next = 16;
6506
+ break;
6507
+ }
6508
+ _context65.next = 15;
6509
+ return this.order.getLocalOrderByLookup(orderId);
6510
+ case 15:
6511
+ localOrder = _context65.sent;
6512
+ case 16:
6494
6513
  if (localOrder) {
6495
- _context65.next = 14;
6514
+ _context65.next = 19;
6496
6515
  break;
6497
6516
  }
6498
6517
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u4E0D\u5B58\u5728\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
@@ -6500,14 +6519,14 @@ var Server = /*#__PURE__*/function () {
6500
6519
  status: status
6501
6520
  });
6502
6521
  return _context65.abrupt("return");
6503
- case 14:
6522
+ case 19:
6504
6523
  voucherIdSet = new Set(ids.filter(function (id) {
6505
6524
  return id !== undefined && id !== null && id !== '';
6506
6525
  }).map(function (id) {
6507
6526
  return String(id);
6508
6527
  }));
6509
6528
  if (!(voucherIdSet.size === 0)) {
6510
- _context65.next = 18;
6529
+ _context65.next = 23;
6511
6530
  break;
6512
6531
  }
6513
6532
  this.logWarning("".concat(title, ": voucher ids \u7F3A\u5931\uFF0C\u8DF3\u8FC7\u672C\u5730\u8BA2\u5355\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
@@ -6515,7 +6534,7 @@ var Server = /*#__PURE__*/function () {
6515
6534
  status: status
6516
6535
  });
6517
6536
  return _context65.abrupt("return");
6518
- case 18:
6537
+ case 23:
6519
6538
  vouchers = Array.isArray(localOrder.vouchers) ? localOrder.vouchers : [];
6520
6539
  hasUpdatedVoucher = false;
6521
6540
  nextVouchers = vouchers.map(function (voucher) {
@@ -6528,7 +6547,7 @@ var Server = /*#__PURE__*/function () {
6528
6547
  });
6529
6548
  });
6530
6549
  if (hasUpdatedVoucher) {
6531
- _context65.next = 24;
6550
+ _context65.next = 29;
6532
6551
  break;
6533
6552
  }
6534
6553
  this.logWarning("".concat(title, ": \u672C\u5730\u8BA2\u5355\u672A\u547D\u4E2D\u4EFB\u4F55 voucher\uFF0C\u8DF3\u8FC7\u6838\u9500\u72B6\u6001\u66F4\u65B0"), {
@@ -6537,47 +6556,47 @@ var Server = /*#__PURE__*/function () {
6537
6556
  status: status
6538
6557
  });
6539
6558
  return _context65.abrupt("return");
6540
- case 24:
6559
+ case 29:
6541
6560
  if (!(typeof this.order.overwriteExistingOrder === 'function')) {
6542
- _context65.next = 29;
6561
+ _context65.next = 34;
6543
6562
  break;
6544
6563
  }
6545
- _context65.next = 27;
6564
+ _context65.next = 32;
6546
6565
  return this.order.overwriteExistingOrder(_objectSpread(_objectSpread({}, localOrder), {}, {
6547
6566
  vouchers: nextVouchers
6548
6567
  }));
6549
- case 27:
6568
+ case 32:
6550
6569
  this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers \u6838\u9500\u72B6\u6001\u5DF2\u66F4\u65B0"), {
6551
6570
  lookup: lookup,
6552
6571
  updatedCount: voucherIdSet.size,
6553
6572
  status: status
6554
6573
  });
6555
6574
  return _context65.abrupt("return");
6556
- case 29:
6575
+ case 34:
6557
6576
  if (!(data !== null && data !== void 0 && data.external_sale_number && typeof this.order.markOrderSyncedByExternalSaleNumber === 'function')) {
6558
- _context65.next = 34;
6577
+ _context65.next = 39;
6559
6578
  break;
6560
6579
  }
6561
- _context65.next = 32;
6580
+ _context65.next = 37;
6562
6581
  return this.order.markOrderSyncedByExternalSaleNumber({
6563
6582
  externalSaleNumber: data.external_sale_number,
6564
6583
  patch: {
6565
6584
  vouchers: nextVouchers
6566
6585
  }
6567
6586
  });
6568
- case 32:
6587
+ case 37:
6569
6588
  this.logInfo("".concat(title, ": \u672C\u5730\u8BA2\u5355 vouchers \u6838\u9500\u72B6\u6001\u5DF2\u66F4\u65B0"), {
6570
6589
  lookup: lookup,
6571
6590
  updatedCount: voucherIdSet.size,
6572
6591
  status: status
6573
6592
  });
6574
6593
  return _context65.abrupt("return");
6575
- case 34:
6594
+ case 39:
6576
6595
  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"), {
6577
6596
  lookup: lookup,
6578
6597
  status: status
6579
6598
  });
6580
- case 35:
6599
+ case 40:
6581
6600
  case "end":
6582
6601
  return _context65.stop();
6583
6602
  }
@@ -6736,13 +6755,13 @@ var Server = /*#__PURE__*/function () {
6736
6755
  key: "handleSyncCheckoutSubmit",
6737
6756
  value: function () {
6738
6757
  var _handleSyncCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(params) {
6739
- var _this$app15;
6758
+ var _this$app17;
6740
6759
  var backendPath, data, title, invoiceLayoutConfig, invoiceTemplateSettings, receiptAutoPrintPaymentStatuses, syncResult, _normalized$data, normalized, response, syncedOrder, backendError, _normalized$data2, _normalized, message;
6741
6760
  return _regeneratorRuntime().wrap(function _callee67$(_context67) {
6742
6761
  while (1) switch (_context67.prev = _context67.next) {
6743
6762
  case 0:
6744
6763
  backendPath = params.backendPath, data = params.data, title = params.title, invoiceLayoutConfig = params.invoiceLayoutConfig, invoiceTemplateSettings = params.invoiceTemplateSettings, receiptAutoPrintPaymentStatuses = params.receiptAutoPrintPaymentStatuses;
6745
- if ((_this$app15 = this.app) !== null && _this$app15 !== void 0 && (_this$app15 = _this$app15.request) !== null && _this$app15 !== void 0 && _this$app15.post) {
6764
+ if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.post) {
6746
6765
  _context67.next = 4;
6747
6766
  break;
6748
6767
  }
@@ -7100,9 +7119,9 @@ var Server = /*#__PURE__*/function () {
7100
7119
  }, {
7101
7120
  key: "shouldAutoPrintCheckoutReceipt",
7102
7121
  value: function shouldAutoPrintCheckoutReceipt() {
7103
- var _this$core$context2, _this$core$context2$g, _this$app16, _this$app16$getStorag;
7122
+ var _this$core$context2, _this$core$context2$g, _this$app18, _this$app18$getStorag;
7104
7123
  if (((_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 || (_this$core$context2$g = _this$core$context2.getPlatform) === null || _this$core$context2$g === void 0 ? void 0 : _this$core$context2$g.call(_this$core$context2)) !== 'android') return true;
7105
- return ((_this$app16 = this.app) === null || _this$app16 === void 0 || (_this$app16 = _this$app16.storage) === null || _this$app16 === void 0 || (_this$app16$getStorag = _this$app16.getStorage) === null || _this$app16$getStorag === void 0 ? void 0 : _this$app16$getStorag.call(_this$app16, AUTO_PRINT_STORAGE_KEY)) !== 'false';
7124
+ return ((_this$app18 = this.app) === null || _this$app18 === void 0 || (_this$app18 = _this$app18.storage) === null || _this$app18 === void 0 || (_this$app18$getStorag = _this$app18.getStorage) === null || _this$app18$getStorag === void 0 ? void 0 : _this$app18$getStorag.call(_this$app18, AUTO_PRINT_STORAGE_KEY)) !== 'false';
7106
7125
  }
7107
7126
 
7108
7127
  /** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
@@ -7142,7 +7161,7 @@ var Server = /*#__PURE__*/function () {
7142
7161
  }, {
7143
7162
  key: "isSalesOrderFullyPaid",
7144
7163
  value: function isSalesOrderFullyPaid(order) {
7145
- var _order$summary$amount, _order$summary, _ref73, _ref74, _order$summary$expect, _order$summary2, _order$summary3;
7164
+ var _order$summary$amount, _order$summary, _ref74, _ref75, _order$summary$expect, _order$summary2, _order$summary3;
7146
7165
  if (!order || _typeof(order) !== 'object') return false;
7147
7166
  var paymentStatus = String(order.payment_status || '').toLowerCase();
7148
7167
  if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
@@ -7154,7 +7173,7 @@ var Server = /*#__PURE__*/function () {
7154
7173
  return this.toAmountNumber(amountGap) <= 0;
7155
7174
  }
7156
7175
  var paidAmount = this.sumPaidOrderPayments(order.payments);
7157
- var targetAmount = this.toAmountNumber((_ref73 = (_ref74 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref74 !== void 0 ? _ref74 : order.expect_amount) !== null && _ref73 !== void 0 ? _ref73 : order.total_amount);
7176
+ var targetAmount = this.toAmountNumber((_ref74 = (_ref75 = (_order$summary$expect = (_order$summary2 = order.summary) === null || _order$summary2 === void 0 ? void 0 : _order$summary2.expect_amount) !== null && _order$summary$expect !== void 0 ? _order$summary$expect : (_order$summary3 = order.summary) === null || _order$summary3 === void 0 ? void 0 : _order$summary3.total_amount) !== null && _ref75 !== void 0 ? _ref75 : order.expect_amount) !== null && _ref74 !== void 0 ? _ref74 : order.total_amount);
7158
7177
  if (targetAmount <= 0) return paidAmount > 0;
7159
7178
  return paidAmount >= targetAmount;
7160
7179
  }
@@ -7198,8 +7217,8 @@ var Server = /*#__PURE__*/function () {
7198
7217
  }
7199
7218
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
7200
7219
  product.product_bundle.forEach(function (bundle) {
7201
- var _ref75, _bundle$bundle_produc;
7202
- var bundleProductId = (_ref75 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref75 !== void 0 ? _ref75 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
7220
+ var _ref76, _bundle$bundle_produc;
7221
+ var bundleProductId = (_ref76 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref76 !== void 0 ? _ref76 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
7203
7222
  if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
7204
7223
  productIdSet.add(bundleProductId);
7205
7224
  }
@@ -7215,7 +7234,7 @@ var Server = /*#__PURE__*/function () {
7215
7234
  case 6:
7216
7235
  _context72.next = 8;
7217
7236
  return Promise.all(productIds.map( /*#__PURE__*/function () {
7218
- var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(id) {
7237
+ var _ref77 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(id) {
7219
7238
  var _this21$products, _this21$products$getP, product;
7220
7239
  return _regeneratorRuntime().wrap(function _callee71$(_context71) {
7221
7240
  while (1) switch (_context71.prev = _context71.next) {
@@ -7241,7 +7260,7 @@ var Server = /*#__PURE__*/function () {
7241
7260
  }, _callee71, null, [[0, 7]]);
7242
7261
  }));
7243
7262
  return function (_x80) {
7244
- return _ref76.apply(this, arguments);
7263
+ return _ref77.apply(this, arguments);
7245
7264
  };
7246
7265
  }()));
7247
7266
  case 8:
@@ -7280,8 +7299,8 @@ var Server = /*#__PURE__*/function () {
7280
7299
  addProductId((_product$product_id2 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product === null || product === void 0 ? void 0 : product.id);
7281
7300
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
7282
7301
  product.product_bundle.forEach(function (bundle) {
7283
- var _ref77, _bundle$bundle_produc2;
7284
- addProductId((_ref77 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref77 !== void 0 ? _ref77 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
7302
+ var _ref78, _bundle$bundle_produc2;
7303
+ addProductId((_ref78 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref78 !== void 0 ? _ref78 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
7285
7304
  });
7286
7305
  }
7287
7306
  });
@@ -7357,9 +7376,9 @@ var Server = /*#__PURE__*/function () {
7357
7376
  if (!Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product;
7358
7377
  var hasChanged = false;
7359
7378
  var productBundle = product.product_bundle.map(function (bundle) {
7360
- var _ref78, _bundle$bundle_produc3;
7379
+ var _ref79, _bundle$bundle_produc3;
7361
7380
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
7362
- var rawProductId = (_ref78 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref78 !== void 0 ? _ref78 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
7381
+ var rawProductId = (_ref79 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref79 !== void 0 ? _ref79 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
7363
7382
  if (rawProductId === undefined || rawProductId === null || rawProductId === '') return bundle;
7364
7383
  var productId = Number(rawProductId);
7365
7384
  if (!Number.isFinite(productId)) return bundle;
@@ -7483,7 +7502,7 @@ var Server = /*#__PURE__*/function () {
7483
7502
  }, {
7484
7503
  key: "resolveProductTitleValue",
7485
7504
  value: function resolveProductTitleValue(value, key, currentLocale) {
7486
- var _ref79, _ref80, _value$key;
7505
+ var _ref80, _ref81, _value$key;
7487
7506
  if (value === undefined || value === null || value === '') return null;
7488
7507
  if (_typeof(value) !== 'object') {
7489
7508
  var title = String(value);
@@ -7493,7 +7512,7 @@ var Server = /*#__PURE__*/function () {
7493
7512
  }
7494
7513
  var normalizedKey = key.replace('-', '_');
7495
7514
  var dashedKey = key.replace('_', '-');
7496
- var rawValue = (_ref79 = (_ref80 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref80 !== void 0 ? _ref80 : value[dashedKey]) !== null && _ref79 !== void 0 ? _ref79 : key === 'auto' ? value.default : undefined;
7515
+ var rawValue = (_ref80 = (_ref81 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref81 !== void 0 ? _ref81 : value[dashedKey]) !== null && _ref80 !== void 0 ? _ref80 : key === 'auto' ? value.default : undefined;
7497
7516
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
7498
7517
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
7499
7518
  return String(rawValue);
@@ -7637,7 +7656,7 @@ var Server = /*#__PURE__*/function () {
7637
7656
  key: "withLocalSmallTicketData",
7638
7657
  value: function () {
7639
7658
  var _withLocalSmallTicketData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee76(order, options) {
7640
- var mustApplyVisibility, _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts, _ref81, _ref82, _order_id, enrichedOrder, productMap, smallTicketData;
7659
+ var mustApplyVisibility, _options$productMap, normalizedCollections, normalizedOrder, collapsedDuplicateCounts, _ref82, _ref83, _order_id, enrichedOrder, productMap, smallTicketData;
7641
7660
  return _regeneratorRuntime().wrap(function _callee76$(_context76) {
7642
7661
  while (1) switch (_context76.prev = _context76.next) {
7643
7662
  case 0:
@@ -7668,7 +7687,7 @@ var Server = /*#__PURE__*/function () {
7668
7687
  return count > 0;
7669
7688
  })) {
7670
7689
  this.logWarning('withLocalSmallTicketData: 折叠重复订单子项', {
7671
- order_identifier: (_ref81 = (_ref82 = (_order_id = normalizedOrder.order_id) !== null && _order_id !== void 0 ? _order_id : normalizedOrder.external_sale_number) !== null && _ref82 !== void 0 ? _ref82 : normalizedOrder.shop_order_number) !== null && _ref81 !== void 0 ? _ref81 : null,
7690
+ order_identifier: (_ref82 = (_ref83 = (_order_id = normalizedOrder.order_id) !== null && _order_id !== void 0 ? _order_id : normalizedOrder.external_sale_number) !== null && _ref83 !== void 0 ? _ref83 : normalizedOrder.shop_order_number) !== null && _ref82 !== void 0 ? _ref82 : null,
7672
7691
  collapsed_duplicate_counts: collapsedDuplicateCounts
7673
7692
  });
7674
7693
  }
@@ -7738,8 +7757,8 @@ var Server = /*#__PURE__*/function () {
7738
7757
  key: "fetchAndPersistSalesOrderByLookup",
7739
7758
  value: function () {
7740
7759
  var _fetchAndPersistSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee77(lookup, data, title, paymentIdentityOrder) {
7741
- var _this$order7, _this$order8, _this$app17;
7742
- 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, _ref83, _backendError$code2, backendStatusCode, _code, _message2, _message3;
7760
+ var _this$order7, _this$order8, _this$app19;
7761
+ 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;
7743
7762
  return _regeneratorRuntime().wrap(function _callee77$(_context77) {
7744
7763
  while (1) switch (_context77.prev = _context77.next) {
7745
7764
  case 0:
@@ -7754,7 +7773,7 @@ var Server = /*#__PURE__*/function () {
7754
7773
  order: null
7755
7774
  });
7756
7775
  case 3:
7757
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && (_this$app17 = _this$app17.request) !== null && _this$app17 !== void 0 && _this$app17.get) {
7776
+ if ((_this$app19 = this.app) !== null && _this$app19 !== void 0 && (_this$app19 = _this$app19.request) !== null && _this$app19 !== void 0 && _this$app19.get) {
7758
7777
  _context77.next = 6;
7759
7778
  break;
7760
7779
  }
@@ -7945,7 +7964,7 @@ var Server = /*#__PURE__*/function () {
7945
7964
  break;
7946
7965
  }
7947
7966
  backendStatusCode = typeof (backendError === null || backendError === void 0 ? void 0 : backendError.status) === 'number' ? backendError.status : undefined;
7948
- _code = this.normalizeRemoteSalesOrderErrorCode((_ref83 = (_backendError$code2 = backendError === null || backendError === void 0 ? void 0 : backendError.code) !== null && _backendError$code2 !== void 0 ? _backendError$code2 : backendStatusCode) !== null && _ref83 !== void 0 ? _ref83 : _responseStatusCode);
7967
+ _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);
7949
7968
  _message2 = (backendError === null || backendError === void 0 ? void 0 : backendError.message) || this.getUnknownErrorMessage(_context77.t2);
7950
7969
  this.logInfo("".concat(title, ": \u540E\u7AEF\u8BA2\u5355\u67E5\u8BE2\u5931\u8D25"), {
7951
7970
  lookup: lookup,
@@ -8039,7 +8058,7 @@ var Server = /*#__PURE__*/function () {
8039
8058
  key: "handleUpdateLocalOrdersBatch",
8040
8059
  value: (function () {
8041
8060
  var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee78(orderIds) {
8042
- var _this$app18;
8061
+ var _this$app20;
8043
8062
  var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message4, overwritten, inserted;
8044
8063
  return _regeneratorRuntime().wrap(function _callee78$(_context78) {
8045
8064
  while (1) switch (_context78.prev = _context78.next) {
@@ -8060,7 +8079,7 @@ var Server = /*#__PURE__*/function () {
8060
8079
  data: null
8061
8080
  });
8062
8081
  case 4:
8063
- if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
8082
+ if ((_this$app20 = this.app) !== null && _this$app20 !== void 0 && _this$app20.request) {
8064
8083
  _context78.next = 7;
8065
8084
  break;
8066
8085
  }
@@ -8831,12 +8850,15 @@ var Server = /*#__PURE__*/function () {
8831
8850
  var _computeProductQueryResult = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(context, options) {
8832
8851
  var _menu_list_ids$length3,
8833
8852
  _this27 = this;
8834
- var tTotal, menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, extension_type, product_id, strategy_context, 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;
8853
+ 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;
8835
8854
  return _regeneratorRuntime().wrap(function _callee82$(_context82) {
8836
8855
  while (1) switch (_context82.prev = _context82.next) {
8837
8856
  case 0:
8838
8857
  tTotal = performance.now();
8839
- 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, strategy_context = context.strategy_context;
8858
+ 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 查询额外按商品销售渠道过滤。
8859
+ isVisibleProduct = function isVisibleProduct(product) {
8860
+ return ((product === null || product === void 0 ? void 0 : product.status) || 'published') === 'published' && (application_code !== 'kiosk' || Array.isArray(product === null || product === void 0 ? void 0 : product.channel_application) && product.channel_application.includes('kiosk'));
8861
+ };
8840
8862
  queryIds = Array.isArray(ids) ? ids.map(function (id) {
8841
8863
  return Number(id);
8842
8864
  }).filter(function (id) {
@@ -8859,12 +8881,12 @@ var Server = /*#__PURE__*/function () {
8859
8881
  // SQLite/IndexDB,造成 preload 读到空数据并重复请求。正常运行期该字段为 null,不增加等待。
8860
8882
  startupPreloadTask = this.startupModulePreloadInFlight;
8861
8883
  if (!startupPreloadTask) {
8862
- _context82.next = 8;
8884
+ _context82.next = 9;
8863
8885
  break;
8864
8886
  }
8865
- _context82.next = 8;
8887
+ _context82.next = 9;
8866
8888
  return startupPreloadTask;
8867
- case 8:
8889
+ case 9:
8868
8890
  // Menu/Schedule preload 会替换 store 中的数组;必须在等待完成后再读取,
8869
8891
  // 避免 formatterContext 持有预加载前的空数组快照。
8870
8892
  formatterContext = this.buildProductFormatterContext({
@@ -8874,7 +8896,7 @@ var Server = /*#__PURE__*/function () {
8874
8896
  strategy_context: strategy_context
8875
8897
  });
8876
8898
  if (this.products) {
8877
- _context82.next = 12;
8899
+ _context82.next = 13;
8878
8900
  break;
8879
8901
  }
8880
8902
  this.logError('computeProductQueryResult: Products 模块未注册');
@@ -8882,19 +8904,19 @@ var Server = /*#__PURE__*/function () {
8882
8904
  message: 'Products 模块未注册',
8883
8905
  data: this.buildProductQueryResultPayload([], 0)
8884
8906
  });
8885
- case 12:
8907
+ case 13:
8886
8908
  if (!(queryIds.length > 0)) {
8887
- _context82.next = 24;
8909
+ _context82.next = 25;
8888
8910
  break;
8889
8911
  }
8890
8912
  uniqueIds = Array.from(new Set(queryIds));
8891
8913
  _tPrice = performance.now();
8892
- _context82.next = 17;
8914
+ _context82.next = 18;
8893
8915
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8894
8916
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
8895
8917
  productIds: uniqueIds
8896
8918
  });
8897
- case 17:
8919
+ case 18:
8898
8920
  productsWithPrice = _context82.sent;
8899
8921
  perfMark('computeQuery.getProductsWithPrice(ids)', performance.now() - _tPrice, {
8900
8922
  count: productsWithPrice.length,
@@ -8902,9 +8924,7 @@ var Server = /*#__PURE__*/function () {
8902
8924
  });
8903
8925
  _filteredProducts = productsWithPrice.filter(function (p) {
8904
8926
  return uniqueIds.includes(Number(p === null || p === void 0 ? void 0 : p.id));
8905
- }).filter(function (p) {
8906
- return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
8907
- });
8927
+ }).filter(isVisibleProduct);
8908
8928
  extensionFilteredProducts = this.filterProductsByExtensionTypes(_filteredProducts, extension_type);
8909
8929
  perfMark('computeProductQueryResult', performance.now() - tTotal, {
8910
8930
  mode: 'ids',
@@ -8921,26 +8941,24 @@ var Server = /*#__PURE__*/function () {
8921
8941
  message: '',
8922
8942
  status: true
8923
8943
  });
8924
- case 24:
8944
+ case 25:
8925
8945
  if (!(product_id != null && Number.isFinite(Number(product_id)))) {
8926
- _context82.next = 36;
8946
+ _context82.next = 37;
8927
8947
  break;
8928
8948
  }
8929
8949
  pid = Number(product_id);
8930
8950
  _tPrice2 = performance.now();
8931
- _context82.next = 29;
8951
+ _context82.next = 30;
8932
8952
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8933
8953
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
8934
8954
  });
8935
- case 29:
8955
+ case 30:
8936
8956
  allProductsWithPrice = _context82.sent;
8937
8957
  perfMark('computeQuery.getProductsWithPrice(single)', performance.now() - _tPrice2, {
8938
8958
  count: allProductsWithPrice.length,
8939
8959
  productId: pid
8940
8960
  });
8941
- published = this.filterProductsByExtensionTypes(allProductsWithPrice.filter(function (p) {
8942
- return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
8943
- }), extension_type);
8961
+ published = this.filterProductsByExtensionTypes(allProductsWithPrice.filter(isVisibleProduct), extension_type);
8944
8962
  item = (_published$find = published.find(function (p) {
8945
8963
  return Number(p.id) === pid;
8946
8964
  })) !== null && _published$find !== void 0 ? _published$find : null;
@@ -8959,17 +8977,17 @@ var Server = /*#__PURE__*/function () {
8959
8977
  message: item ? '' : '商品不存在或未发布',
8960
8978
  status: true
8961
8979
  });
8962
- case 36:
8980
+ case 37:
8963
8981
  if (!this.shouldQueryProductsByExtensionTypes(extension_type)) {
8964
- _context82.next = 56;
8982
+ _context82.next = 57;
8965
8983
  break;
8966
8984
  }
8967
8985
  _tPrice3 = performance.now();
8968
- _context82.next = 40;
8986
+ _context82.next = 41;
8969
8987
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
8970
8988
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds
8971
8989
  });
8972
- case 40:
8990
+ case 41:
8973
8991
  _filteredProducts2 = _context82.sent;
8974
8992
  perfMark('computeQuery.getProductsWithPrice(extensionType)', performance.now() - _tPrice3, {
8975
8993
  count: _filteredProducts2.length,
@@ -8977,9 +8995,7 @@ var Server = /*#__PURE__*/function () {
8977
8995
  });
8978
8996
  _tStatus = performance.now();
8979
8997
  _beforeStatusCount = _filteredProducts2.length;
8980
- _filteredProducts2 = _filteredProducts2.filter(function (p) {
8981
- return ((p === null || p === void 0 ? void 0 : p.status) || 'published') === 'published';
8982
- });
8998
+ _filteredProducts2 = _filteredProducts2.filter(isVisibleProduct);
8983
8999
  perfMark('computeQuery.filterByStatus(extensionType)', performance.now() - _tStatus, {
8984
9000
  before: _beforeStatusCount,
8985
9001
  after: _filteredProducts2.length
@@ -9015,9 +9031,9 @@ var Server = /*#__PURE__*/function () {
9015
9031
  message: '',
9016
9032
  status: true
9017
9033
  });
9018
- case 56:
9034
+ case 57:
9019
9035
  if (this.menu) {
9020
- _context82.next = 59;
9036
+ _context82.next = 60;
9021
9037
  break;
9022
9038
  }
9023
9039
  this.logError('computeProductQueryResult: Menu 模块未注册');
@@ -9025,9 +9041,9 @@ var Server = /*#__PURE__*/function () {
9025
9041
  message: 'Menu 模块未注册',
9026
9042
  data: this.buildProductQueryResultPayload([], 0)
9027
9043
  });
9028
- case 59:
9044
+ case 60:
9029
9045
  if (this.schedule) {
9030
- _context82.next = 62;
9046
+ _context82.next = 63;
9031
9047
  break;
9032
9048
  }
9033
9049
  this.logError('computeProductQueryResult: Schedule 模块未注册');
@@ -9035,10 +9051,10 @@ var Server = /*#__PURE__*/function () {
9035
9051
  message: 'Schedule 模块未注册',
9036
9052
  data: this.buildProductQueryResultPayload([], 0)
9037
9053
  });
9038
- case 62:
9054
+ case 63:
9039
9055
  activeMenuList = [];
9040
9056
  if (!(menu_list_ids && Array.isArray(menu_list_ids) && menu_list_ids.length > 0)) {
9041
- _context82.next = 75;
9057
+ _context82.next = 76;
9042
9058
  break;
9043
9059
  }
9044
9060
  tMenu = performance.now();
@@ -9051,25 +9067,25 @@ var Server = /*#__PURE__*/function () {
9051
9067
  activeMenuList = getActiveMenus();
9052
9068
  _context82.t0 = !activeMenuList.length;
9053
9069
  if (!_context82.t0) {
9054
- _context82.next = 72;
9070
+ _context82.next = 73;
9055
9071
  break;
9056
9072
  }
9057
- _context82.next = 71;
9073
+ _context82.next = 72;
9058
9074
  return this.refreshMenuScheduleCacheAfterEmptyResult();
9059
- case 71:
9060
- _context82.t0 = _context82.sent;
9061
9075
  case 72:
9076
+ _context82.t0 = _context82.sent;
9077
+ case 73:
9062
9078
  if (!_context82.t0) {
9063
- _context82.next = 74;
9079
+ _context82.next = 75;
9064
9080
  break;
9065
9081
  }
9066
9082
  activeMenuList = getActiveMenus();
9067
- case 74:
9083
+ case 75:
9068
9084
  perfMark('computeQuery.filterActiveMenu', performance.now() - tMenu, {
9069
9085
  totalMenu: menu_list_ids.length,
9070
9086
  activeMenu: activeMenuList.length
9071
9087
  });
9072
- case 75:
9088
+ case 76:
9073
9089
  tFilter = performance.now();
9074
9090
  productScope = this.getProductScopeByMenuConfig(activeMenuList);
9075
9091
  scopedProductIds = this.products.getProductIdsByScope(productScope);
@@ -9080,21 +9096,21 @@ var Server = /*#__PURE__*/function () {
9080
9096
  });
9081
9097
  tPrice = performance.now();
9082
9098
  if (!(scopedProductIds.length > 0)) {
9083
- _context82.next = 86;
9099
+ _context82.next = 87;
9084
9100
  break;
9085
9101
  }
9086
- _context82.next = 83;
9102
+ _context82.next = 84;
9087
9103
  return this.products.getProductsWithPrice(schedule_date, formatterContext, {
9088
9104
  changedIds: options === null || options === void 0 ? void 0 : options.changedIds,
9089
9105
  productIds: productScope.isAllProducts ? undefined : scopedProductIds
9090
9106
  });
9091
- case 83:
9107
+ case 84:
9092
9108
  _context82.t1 = _context82.sent;
9093
- _context82.next = 87;
9109
+ _context82.next = 88;
9094
9110
  break;
9095
- case 86:
9096
- _context82.t1 = [];
9097
9111
  case 87:
9112
+ _context82.t1 = [];
9113
+ case 88:
9098
9114
  filteredProducts = _context82.t1;
9099
9115
  perfMark('computeQuery.getProductsWithPrice', performance.now() - tPrice, {
9100
9116
  count: filteredProducts.length,
@@ -9102,9 +9118,7 @@ var Server = /*#__PURE__*/function () {
9102
9118
  });
9103
9119
  tStatus = performance.now();
9104
9120
  beforeStatusCount = filteredProducts.length;
9105
- filteredProducts = filteredProducts.filter(function (p) {
9106
- return ((p === null || p === void 0 ? void 0 : p.status) || "published") === 'published';
9107
- });
9121
+ filteredProducts = filteredProducts.filter(isVisibleProduct);
9108
9122
  perfMark('computeQuery.filterByStatus', performance.now() - tStatus, {
9109
9123
  before: beforeStatusCount,
9110
9124
  after: filteredProducts.length
@@ -9142,7 +9156,7 @@ var Server = /*#__PURE__*/function () {
9142
9156
  message: '',
9143
9157
  status: true
9144
9158
  });
9145
- case 103:
9159
+ case 104:
9146
9160
  case "end":
9147
9161
  return _context82.stop();
9148
9162
  }