@pisell/pisellos 0.10.8 → 0.10.9

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 (98) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  3. package/dist/model/strategy/adapter/dataVariant/evaluator.js +287 -101
  4. package/dist/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  6. package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
  7. package/dist/model/strategy/adapter/walletPass/type.d.ts +5 -0
  8. package/dist/model/strategy/adapter/walletPass/utils.js +57 -26
  9. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  10. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  11. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  12. package/dist/modules/Customer/index.d.ts +4 -0
  13. package/dist/modules/Customer/index.js +91 -59
  14. package/dist/modules/Customer/types.d.ts +2 -0
  15. package/dist/modules/Discount/index.d.ts +2 -0
  16. package/dist/modules/Discount/index.js +38 -5
  17. package/dist/modules/Discount/types.d.ts +11 -0
  18. package/dist/modules/Order/index.d.ts +20 -1
  19. package/dist/modules/Order/index.js +976 -730
  20. package/dist/modules/Order/types.d.ts +6 -1
  21. package/dist/modules/Order/utils/virtualSettlement.d.ts +56 -0
  22. package/dist/modules/Order/utils/virtualSettlement.js +271 -0
  23. package/dist/modules/Order/utils.js +89 -48
  24. package/dist/modules/Payment/types.d.ts +2 -0
  25. package/dist/modules/Payment/utils.js +4 -1
  26. package/dist/modules/Payment/walletpass.d.ts +11 -0
  27. package/dist/modules/Payment/walletpass.js +235 -60
  28. package/dist/modules/Product/types.d.ts +23 -0
  29. package/dist/modules/ProductList/index.d.ts +15 -2
  30. package/dist/modules/ProductList/index.js +92 -13
  31. package/dist/modules/SalesSummary/index.d.ts +1 -0
  32. package/dist/modules/SalesSummary/index.js +4 -3
  33. package/dist/modules/SalesSummary/types.d.ts +1 -0
  34. package/dist/modules/SalesSummary/utils.d.ts +1 -0
  35. package/dist/modules/SalesSummary/utils.js +21 -1
  36. package/dist/server/index.d.ts +9 -0
  37. package/dist/server/index.js +90 -58
  38. package/dist/server/modules/order/index.d.ts +1 -0
  39. package/dist/server/modules/order/index.js +252 -94
  40. package/dist/server/utils/small-ticket.js +2 -1
  41. package/dist/solution/BaseSales/index.d.ts +26 -2
  42. package/dist/solution/BaseSales/index.js +1310 -931
  43. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  44. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +78 -12
  45. package/dist/solution/BookingByStep/index.d.ts +3 -3
  46. package/dist/solution/BookingTicket/index.d.ts +5 -1
  47. package/dist/solution/BookingTicket/index.js +221 -159
  48. package/dist/solution/BookingTicket/utils/addProductDecision.js +2 -1
  49. package/dist/solution/ScanOrder/index.js +25 -64
  50. package/lib/core/index.js +0 -1
  51. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +18 -2
  52. package/lib/model/strategy/adapter/dataVariant/evaluator.js +170 -7
  53. package/lib/model/strategy/adapter/dataVariant/type.d.ts +25 -0
  54. package/lib/model/strategy/adapter/walletPass/evaluator.js +0 -2
  55. package/lib/model/strategy/adapter/walletPass/type.d.ts +5 -0
  56. package/lib/model/strategy/adapter/walletPass/utils.js +62 -11
  57. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  58. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  59. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  60. package/lib/modules/Customer/index.d.ts +4 -0
  61. package/lib/modules/Customer/index.js +11 -0
  62. package/lib/modules/Customer/types.d.ts +2 -0
  63. package/lib/modules/Discount/index.d.ts +2 -0
  64. package/lib/modules/Discount/index.js +37 -3
  65. package/lib/modules/Discount/types.d.ts +11 -0
  66. package/lib/modules/Order/index.d.ts +20 -1
  67. package/lib/modules/Order/index.js +393 -128
  68. package/lib/modules/Order/types.d.ts +6 -1
  69. package/lib/modules/Order/utils/virtualSettlement.d.ts +56 -0
  70. package/lib/modules/Order/utils/virtualSettlement.js +300 -0
  71. package/lib/modules/Order/utils.js +65 -21
  72. package/lib/modules/Payment/types.d.ts +2 -0
  73. package/lib/modules/Payment/utils.js +5 -1
  74. package/lib/modules/Payment/walletpass.d.ts +11 -0
  75. package/lib/modules/Payment/walletpass.js +198 -17
  76. package/lib/modules/Product/types.d.ts +23 -0
  77. package/lib/modules/ProductList/index.d.ts +15 -2
  78. package/lib/modules/ProductList/index.js +85 -3
  79. package/lib/modules/SalesSummary/index.d.ts +1 -0
  80. package/lib/modules/SalesSummary/index.js +10 -2
  81. package/lib/modules/SalesSummary/types.d.ts +1 -0
  82. package/lib/modules/SalesSummary/utils.d.ts +1 -0
  83. package/lib/modules/SalesSummary/utils.js +25 -1
  84. package/lib/server/index.d.ts +9 -0
  85. package/lib/server/index.js +54 -14
  86. package/lib/server/modules/order/index.d.ts +1 -0
  87. package/lib/server/modules/order/index.js +66 -2
  88. package/lib/server/utils/small-ticket.js +1 -1
  89. package/lib/solution/BaseSales/index.d.ts +26 -2
  90. package/lib/solution/BaseSales/index.js +261 -23
  91. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +1 -0
  92. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +61 -11
  93. package/lib/solution/BookingByStep/index.d.ts +3 -3
  94. package/lib/solution/BookingTicket/index.d.ts +5 -1
  95. package/lib/solution/BookingTicket/index.js +30 -2
  96. package/lib/solution/BookingTicket/utils/addProductDecision.js +2 -1
  97. package/lib/solution/ScanOrder/index.js +17 -54
  98. package/package.json +1 -1
@@ -33,6 +33,7 @@ import { FloorPlanModule } from "./modules/floor-plan";
33
33
  import { FloorPlanHooks } from "./modules/floor-plan/types";
34
34
  import { PaymentServerModule } from "./modules/payment";
35
35
  import { extractScheduleIdsFromMenus, extractTimePointsFromSchedules } from "./utils/schedule";
36
+ import { sortTimePoints } from "./utils/time";
36
37
  import { ProductsHooks } from "./modules/products/types";
37
38
  import { perfMark } from "./utils/product";
38
39
  import { OrderModule } from "./modules/order";
@@ -58,6 +59,7 @@ import { getOrderPaymentIdentityKeys, isIdentifiedPendingOrderPayment, isPending
58
59
  /** 平面图 GET 查询订阅者(列表 / id 详情 / code 详情) */
59
60
 
60
61
  var PRODUCT_TITLE_SNAPSHOT_KEYS = ['en', 'ja', 'pt', 'auto', 'zh-CN', 'zh-HK', 'kitchen', 'original'];
62
+ var AUTO_PRINT_STORAGE_KEY = 'auto_print';
61
63
 
62
64
  /**
63
65
  * Server 类
@@ -336,7 +338,11 @@ var Server = /*#__PURE__*/function () {
336
338
  case 9:
337
339
  result = _context3.sent;
338
340
  if (subscriberId && typeof callback === 'function') {
339
- _this.syncProductQueryScheduleTimers(subscriberId, strategy_context);
341
+ _this.syncProductQueryScheduleTimers({
342
+ subscriberId: subscriberId,
343
+ menu_list_ids: menu_list_ids,
344
+ strategy_context: strategy_context
345
+ });
340
346
  }
341
347
  return _context3.abrupt("return", result);
342
348
  case 12:
@@ -1679,7 +1685,7 @@ var Server = /*#__PURE__*/function () {
1679
1685
  _defineProperty(this, "handleGetScheduleTimePoints", /*#__PURE__*/function () {
1680
1686
  var _ref59 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(_ref58) {
1681
1687
  var _menu_list_ids$length;
1682
- var url, method, data, config, menu_list_ids, _menu_list_ids$length2, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1688
+ var url, method, data, config, menu_list_ids, _menu_list_ids$length2, _this$getMenuSchedule, menuList, scheduleIds, scheduleList, timePoints, errorMessage;
1683
1689
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1684
1690
  while (1) switch (_context24.prev = _context24.next) {
1685
1691
  case 0:
@@ -1735,8 +1741,7 @@ var Server = /*#__PURE__*/function () {
1735
1741
  });
1736
1742
  case 16:
1737
1743
  _context24.prev = 16;
1738
- // 1. 获取餐牌列表
1739
- menuList = _this.menu.getMenuByIds(menu_list_ids);
1744
+ _this$getMenuSchedule = _this.getMenuScheduleTimePoints(menu_list_ids), menuList = _this$getMenuSchedule.menuList, scheduleIds = _this$getMenuSchedule.scheduleIds, scheduleList = _this$getMenuSchedule.scheduleList, timePoints = _this$getMenuSchedule.timePoints;
1740
1745
  console.log("[Server] \u627E\u5230 ".concat(menuList.length, " \u4E2A\u9910\u724C"));
1741
1746
  _this.logInfo('handleGetScheduleTimePoints: 获取到餐牌列表', {
1742
1747
  requestedCount: menu_list_ids.length,
@@ -1744,15 +1749,12 @@ var Server = /*#__PURE__*/function () {
1744
1749
  menu_list_ids: menu_list_ids,
1745
1750
  menuList: menuList
1746
1751
  });
1747
-
1748
- // 2. 提取所有的 schedule IDs
1749
- scheduleIds = extractScheduleIdsFromMenus(menuList);
1750
1752
  console.log("[Server] \u63D0\u53D6\u5230 ".concat(scheduleIds.length, " \u4E2A\u65E5\u7A0BID:"), scheduleIds);
1751
1753
  _this.logInfo('handleGetScheduleTimePoints: 提取到日程 IDs', {
1752
1754
  scheduleCount: scheduleIds.length
1753
1755
  });
1754
1756
  if (!(scheduleIds.length === 0)) {
1755
- _context24.next = 26;
1757
+ _context24.next = 25;
1756
1758
  break;
1757
1759
  }
1758
1760
  _this.logInfo('handleGetScheduleTimePoints: 没有找到相关日程', {
@@ -1764,17 +1766,12 @@ var Server = /*#__PURE__*/function () {
1764
1766
  data: [],
1765
1767
  status: true
1766
1768
  });
1767
- case 26:
1768
- // 3. 获取日程详情
1769
- scheduleList = _this.schedule.getScheduleByIds(scheduleIds);
1769
+ case 25:
1770
1770
  console.log("[Server] \u627E\u5230 ".concat(scheduleList.length, " \u4E2A\u65E5\u7A0B"));
1771
1771
  _this.logInfo('handleGetScheduleTimePoints: 获取到日程详情', {
1772
1772
  requestedCount: scheduleIds.length,
1773
1773
  foundCount: scheduleList.length
1774
1774
  });
1775
-
1776
- // 4. 提取时间点
1777
- timePoints = extractTimePointsFromSchedules(scheduleList);
1778
1775
  console.log("[Server] \u63D0\u53D6\u5230 ".concat(timePoints.length, " \u4E2A\u65F6\u95F4\u70B9:"), timePoints);
1779
1776
  _this.logInfo('handleGetScheduleTimePoints 处理完成', {
1780
1777
  menuListIdsCount: menu_list_ids.length,
@@ -1788,8 +1785,8 @@ var Server = /*#__PURE__*/function () {
1788
1785
  data: timePoints,
1789
1786
  status: true
1790
1787
  });
1791
- case 35:
1792
- _context24.prev = 35;
1788
+ case 32:
1789
+ _context24.prev = 32;
1793
1790
  _context24.t0 = _context24["catch"](16);
1794
1791
  errorMessage = _context24.t0 instanceof Error ? _context24.t0.message : '未知错误';
1795
1792
  console.error('[Server] 获取日程时间点失败:', _context24.t0);
@@ -1803,11 +1800,11 @@ var Server = /*#__PURE__*/function () {
1803
1800
  data: [],
1804
1801
  status: false
1805
1802
  });
1806
- case 41:
1803
+ case 38:
1807
1804
  case "end":
1808
1805
  return _context24.stop();
1809
1806
  }
1810
- }, _callee24, null, [[16, 35]]);
1807
+ }, _callee24, null, [[16, 32]]);
1811
1808
  }));
1812
1809
  return function (_x24) {
1813
1810
  return _ref59.apply(this, arguments);
@@ -3709,18 +3706,48 @@ var Server = /*#__PURE__*/function () {
3709
3706
  return recomputeAndNotifySubscriber;
3710
3707
  }()
3711
3708
  /**
3712
- * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
3709
+ * 根据餐牌 ID 获取其绑定日程中的全部时间点。
3710
+ * 商品查询定时器与 schedule-time-points 路由共用此逻辑。
3713
3711
  */
3714
3712
  )
3713
+ }, {
3714
+ key: "getMenuScheduleTimePoints",
3715
+ value: function getMenuScheduleTimePoints(menuListIds) {
3716
+ var _this$menu$getMenuByI, _this$menu, _this$schedule$getSch, _this$schedule;
3717
+ var menuList = (_this$menu$getMenuByI = (_this$menu = this.menu) === null || _this$menu === void 0 ? void 0 : _this$menu.getMenuByIds(menuListIds)) !== null && _this$menu$getMenuByI !== void 0 ? _this$menu$getMenuByI : [];
3718
+ var scheduleIds = extractScheduleIdsFromMenus(menuList);
3719
+ var scheduleList = scheduleIds.length > 0 ? (_this$schedule$getSch = (_this$schedule = this.schedule) === null || _this$schedule === void 0 ? void 0 : _this$schedule.getScheduleByIds(scheduleIds)) !== null && _this$schedule$getSch !== void 0 ? _this$schedule$getSch : [] : [];
3720
+ var timePoints = extractTimePointsFromSchedules(scheduleList);
3721
+ return {
3722
+ menuList: menuList,
3723
+ scheduleIds: scheduleIds,
3724
+ scheduleList: scheduleList,
3725
+ timePoints: timePoints
3726
+ };
3727
+ }
3728
+
3729
+ /**
3730
+ * query 完成后为 subscriber 同步 schedule 定时器(先 clear 再 schedule)。
3731
+ */
3715
3732
  }, {
3716
3733
  key: "syncProductQueryScheduleTimers",
3717
- value: function syncProductQueryScheduleTimers(subscriberId, strategy_context) {
3734
+ value: function syncProductQueryScheduleTimers(_ref61) {
3718
3735
  var _this$products$getLas3, _this$products2, _this$products2$getLa;
3736
+ var subscriberId = _ref61.subscriberId,
3737
+ menu_list_ids = _ref61.menu_list_ids,
3738
+ strategy_context = _ref61.strategy_context;
3719
3739
  this.clearSubscriberScheduleTimers(subscriberId);
3720
3740
  if (!this.shouldScheduleProductQueryReload(strategy_context)) {
3721
3741
  return;
3722
3742
  }
3723
- var timePoints = (_this$products$getLas3 = (_this$products2 = this.products) === null || _this$products2 === void 0 || (_this$products2$getLa = _this$products2.getLastScheduleTimePoints) === null || _this$products2$getLa === void 0 ? void 0 : _this$products2$getLa.call(_this$products2)) !== null && _this$products$getLas3 !== void 0 ? _this$products$getLas3 : [];
3743
+ var productTimePoints = (_this$products$getLas3 = (_this$products2 = this.products) === null || _this$products2 === void 0 || (_this$products2$getLa = _this$products2.getLastScheduleTimePoints) === null || _this$products2$getLa === void 0 ? void 0 : _this$products2$getLa.call(_this$products2)) !== null && _this$products$getLas3 !== void 0 ? _this$products$getLas3 : [];
3744
+ var menuListIds = Array.isArray(menu_list_ids) ? Array.from(new Set(menu_list_ids.map(function (id) {
3745
+ return Number(id);
3746
+ }).filter(function (id) {
3747
+ return Number.isFinite(id);
3748
+ }))) : [];
3749
+ var menuTimePoints = this.getMenuScheduleTimePoints(menuListIds).timePoints;
3750
+ var timePoints = sortTimePoints(Array.from(new Set([].concat(_toConsumableArray(productTimePoints), _toConsumableArray(menuTimePoints)))));
3724
3751
  if (timePoints.length > 0) {
3725
3752
  this.scheduleSubscriberTimePointReloads(subscriberId, timePoints);
3726
3753
  }
@@ -3807,7 +3834,7 @@ var Server = /*#__PURE__*/function () {
3807
3834
  */
3808
3835
  function () {
3809
3836
  var _handleSalesSearchRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(kind, backendPath, data, config) {
3810
- var queryPayload, result, _ref61, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
3837
+ var queryPayload, result, _ref62, callback, subscriberId, resetVisibleOrderIds, contextSignature, existing, shouldReset, visibleOrderIds, _iterator5, _step5, orderId;
3811
3838
  return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3812
3839
  while (1) switch (_context45.prev = _context45.next) {
3813
3840
  case 0:
@@ -3816,7 +3843,7 @@ var Server = /*#__PURE__*/function () {
3816
3843
  return this.fetchSalesSearchFromAPI(backendPath, queryPayload);
3817
3844
  case 3:
3818
3845
  result = _context45.sent;
3819
- _ref61 = config || {}, callback = _ref61.callback, subscriberId = _ref61.subscriberId, resetVisibleOrderIds = _ref61.resetVisibleOrderIds;
3846
+ _ref62 = config || {}, callback = _ref62.callback, subscriberId = _ref62.subscriberId, resetVisibleOrderIds = _ref62.resetVisibleOrderIds;
3820
3847
  if (subscriberId && typeof callback === 'function') {
3821
3848
  contextSignature = this.buildSalesSearchSignature(kind, queryPayload);
3822
3849
  existing = this.salesSearchSubscribers.get(subscriberId);
@@ -5874,7 +5901,7 @@ var Server = /*#__PURE__*/function () {
5874
5901
  key: "handleOrderCheckoutSubmit",
5875
5902
  value: function () {
5876
5903
  var _handleOrderCheckoutSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(params) {
5877
- var backendPath, data, title, normalizedData, checkoutData, pendingResult, _this$core$context2, pendingOrder, platform, isAndroid;
5904
+ var backendPath, data, title, normalizedData, checkoutData, pendingResult, pendingOrder;
5878
5905
  return _regeneratorRuntime().wrap(function _callee60$(_context60) {
5879
5906
  while (1) switch (_context60.prev = _context60.next) {
5880
5907
  case 0:
@@ -5913,35 +5940,31 @@ var Server = /*#__PURE__*/function () {
5913
5940
  case 12:
5914
5941
  pendingResult = _context60.sent;
5915
5942
  if (!((pendingResult === null || pendingResult === void 0 ? void 0 : pendingResult.status) === true)) {
5916
- _context60.next = 22;
5943
+ _context60.next = 20;
5917
5944
  break;
5918
5945
  }
5919
5946
  pendingOrder = pendingResult.data;
5920
- platform = (_this$core$context2 = this.core.context) === null || _this$core$context2 === void 0 ? void 0 : _this$core$context2.getPlatform();
5921
- isAndroid = platform === 'android';
5922
- if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && (
5923
- // TODO 这里先加个兼容,如果是安卓,则需要 type=virtual 才走打印,如果是苹果则无限制
5924
- isAndroid ? checkoutData.type === 'virtual' : true))) {
5925
- _context60.next = 20;
5947
+ if (!(pendingOrder && this.shouldBuildSmallTicketData(checkoutData) && this.isSalesOrderFullyPaid(pendingOrder) && this.shouldAutoPrintCheckoutReceipt())) {
5948
+ _context60.next = 18;
5926
5949
  break;
5927
5950
  }
5928
- _context60.next = 20;
5951
+ _context60.next = 18;
5929
5952
  return this.dispatchLocalReceiptPrint({
5930
5953
  checkoutData: checkoutData,
5931
5954
  order: pendingOrder,
5932
5955
  response: pendingResult,
5933
5956
  requireFullyPaid: true
5934
5957
  });
5935
- case 20:
5936
- _context60.next = 22;
5958
+ case 18:
5959
+ _context60.next = 20;
5937
5960
  return this.dispatchCheckoutSyncTask({
5938
5961
  backendPath: backendPath,
5939
5962
  data: checkoutData,
5940
5963
  title: title
5941
5964
  });
5942
- case 22:
5965
+ case 20:
5943
5966
  if (pendingResult.data.order_id) {
5944
- _context60.next = 24;
5967
+ _context60.next = 22;
5945
5968
  break;
5946
5969
  }
5947
5970
  return _context60.abrupt("return", _objectSpread(_objectSpread({}, pendingResult), {}, {
@@ -5949,9 +5972,9 @@ var Server = /*#__PURE__*/function () {
5949
5972
  order_id: pendingResult.data.external_sale_number
5950
5973
  })
5951
5974
  }));
5952
- case 24:
5975
+ case 22:
5953
5976
  return _context60.abrupt("return", pendingResult);
5954
- case 25:
5977
+ case 23:
5955
5978
  case "end":
5956
5979
  return _context60.stop();
5957
5980
  }
@@ -6016,9 +6039,8 @@ var Server = /*#__PURE__*/function () {
6016
6039
  checkoutData: syncResult.checkoutData,
6017
6040
  order: syncedOrder,
6018
6041
  response: syncResult.normalizedResponse,
6019
- requireFullyPaid: true,
6042
+ requireFullyPaid: true
6020
6043
  // print_all 的 type=0 是收据打印;不要沿用同步成功后的券/手环打印 type=99。
6021
- isManualPrint: true
6022
6044
  });
6023
6045
  case 16:
6024
6046
  return _context61.abrupt("return", response);
@@ -6285,13 +6307,23 @@ var Server = /*#__PURE__*/function () {
6285
6307
  }
6286
6308
  return buildPendingSyncCheckoutOrder;
6287
6309
  }()
6310
+ /**
6311
+ * Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
6312
+ */
6313
+ }, {
6314
+ key: "shouldAutoPrintCheckoutReceipt",
6315
+ value: function shouldAutoPrintCheckoutReceipt() {
6316
+ var _this$core$context2, _this$core$context2$g, _this$app17, _this$app17$getStorag;
6317
+ 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;
6318
+ return ((_this$app17 = this.app) === null || _this$app17 === void 0 || (_this$app17 = _this$app17.storage) === null || _this$app17 === void 0 || (_this$app17$getStorag = _this$app17.getStorage) === null || _this$app17$getStorag === void 0 ? void 0 : _this$app17$getStorag.call(_this$app17, AUTO_PRINT_STORAGE_KEY)) !== 'false';
6319
+ }
6288
6320
  }, {
6289
6321
  key: "shouldBuildSmallTicketData",
6290
6322
  value: function shouldBuildSmallTicketData(order) {
6291
- var _ref63, _order$small_ticket_d;
6323
+ var _ref64, _order$small_ticket_d;
6292
6324
  if (!order || _typeof(order) !== 'object') return false;
6293
6325
  // if (hasSmallTicketData(order.payment_info?.small_ticket_data)) return false;
6294
- return Number((_ref63 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref63 !== void 0 ? _ref63 : 0) === 1;
6326
+ return Number((_ref64 = (_order$small_ticket_d = order.small_ticket_data_flag) !== null && _order$small_ticket_d !== void 0 ? _order$small_ticket_d : order.smallTicketDataFlag) !== null && _ref64 !== void 0 ? _ref64 : 0) === 1;
6295
6327
  }
6296
6328
  }, {
6297
6329
  key: "shouldPrintSyncedOrder",
@@ -6309,7 +6341,7 @@ var Server = /*#__PURE__*/function () {
6309
6341
  }, {
6310
6342
  key: "isSalesOrderFullyPaid",
6311
6343
  value: function isSalesOrderFullyPaid(order) {
6312
- var _order$summary$amount, _order$summary, _ref64, _ref65, _order$summary$expect, _order$summary2, _order$summary3;
6344
+ var _order$summary$amount, _order$summary, _ref65, _ref66, _order$summary$expect, _order$summary2, _order$summary3;
6313
6345
  if (!order || _typeof(order) !== 'object') return false;
6314
6346
  var paymentStatus = String(order.payment_status || '').toLowerCase();
6315
6347
  if (paymentStatus === 'paid' || paymentStatus === 'finished') return true;
@@ -6321,7 +6353,7 @@ var Server = /*#__PURE__*/function () {
6321
6353
  return this.toAmountNumber(amountGap) <= 0;
6322
6354
  }
6323
6355
  var paidAmount = this.sumPaidOrderPayments(order.payments);
6324
- var targetAmount = this.toAmountNumber((_ref64 = (_ref65 = (_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 && _ref65 !== void 0 ? _ref65 : order.expect_amount) !== null && _ref64 !== void 0 ? _ref64 : order.total_amount);
6356
+ var targetAmount = this.toAmountNumber((_ref65 = (_ref66 = (_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 && _ref66 !== void 0 ? _ref66 : order.expect_amount) !== null && _ref65 !== void 0 ? _ref65 : order.total_amount);
6325
6357
  if (targetAmount <= 0) return paidAmount > 0;
6326
6358
  return paidAmount >= targetAmount;
6327
6359
  }
@@ -6365,8 +6397,8 @@ var Server = /*#__PURE__*/function () {
6365
6397
  }
6366
6398
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
6367
6399
  product.product_bundle.forEach(function (bundle) {
6368
- var _ref66, _bundle$bundle_produc;
6369
- var bundleProductId = (_ref66 = (_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 && _ref66 !== void 0 ? _ref66 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6400
+ var _ref67, _bundle$bundle_produc;
6401
+ var bundleProductId = (_ref67 = (_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 && _ref67 !== void 0 ? _ref67 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6370
6402
  if (bundleProductId !== undefined && bundleProductId !== null && bundleProductId !== '') {
6371
6403
  productIdSet.add(bundleProductId);
6372
6404
  }
@@ -6382,7 +6414,7 @@ var Server = /*#__PURE__*/function () {
6382
6414
  case 6:
6383
6415
  _context66.next = 8;
6384
6416
  return Promise.all(productIds.map( /*#__PURE__*/function () {
6385
- var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6417
+ var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65(id) {
6386
6418
  var _this15$products, _this15$products$getP, product;
6387
6419
  return _regeneratorRuntime().wrap(function _callee65$(_context65) {
6388
6420
  while (1) switch (_context65.prev = _context65.next) {
@@ -6408,7 +6440,7 @@ var Server = /*#__PURE__*/function () {
6408
6440
  }, _callee65, null, [[0, 7]]);
6409
6441
  }));
6410
6442
  return function (_x73) {
6411
- return _ref67.apply(this, arguments);
6443
+ return _ref68.apply(this, arguments);
6412
6444
  };
6413
6445
  }()));
6414
6446
  case 8:
@@ -6447,8 +6479,8 @@ var Server = /*#__PURE__*/function () {
6447
6479
  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);
6448
6480
  if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
6449
6481
  product.product_bundle.forEach(function (bundle) {
6450
- var _ref68, _bundle$bundle_produc2;
6451
- addProductId((_ref68 = (_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 && _ref68 !== void 0 ? _ref68 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
6482
+ var _ref69, _bundle$bundle_produc2;
6483
+ addProductId((_ref69 = (_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 && _ref69 !== void 0 ? _ref69 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
6452
6484
  });
6453
6485
  }
6454
6486
  });
@@ -6524,9 +6556,9 @@ var Server = /*#__PURE__*/function () {
6524
6556
  if (!Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product;
6525
6557
  var hasChanged = false;
6526
6558
  var productBundle = product.product_bundle.map(function (bundle) {
6527
- var _ref69, _bundle$bundle_produc3;
6559
+ var _ref70, _bundle$bundle_produc3;
6528
6560
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
6529
- var rawProductId = (_ref69 = (_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 && _ref69 !== void 0 ? _ref69 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6561
+ var rawProductId = (_ref70 = (_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 && _ref70 !== void 0 ? _ref70 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
6530
6562
  if (rawProductId === undefined || rawProductId === null || rawProductId === '') return bundle;
6531
6563
  var productId = Number(rawProductId);
6532
6564
  if (!Number.isFinite(productId)) return bundle;
@@ -6650,7 +6682,7 @@ var Server = /*#__PURE__*/function () {
6650
6682
  }, {
6651
6683
  key: "resolveProductTitleValue",
6652
6684
  value: function resolveProductTitleValue(value, key, currentLocale) {
6653
- var _ref70, _ref71, _value$key;
6685
+ var _ref71, _ref72, _value$key;
6654
6686
  if (value === undefined || value === null || value === '') return null;
6655
6687
  if (_typeof(value) !== 'object') {
6656
6688
  var title = String(value);
@@ -6660,7 +6692,7 @@ var Server = /*#__PURE__*/function () {
6660
6692
  }
6661
6693
  var normalizedKey = key.replace('-', '_');
6662
6694
  var dashedKey = key.replace('_', '-');
6663
- var rawValue = (_ref70 = (_ref71 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref71 !== void 0 ? _ref71 : value[dashedKey]) !== null && _ref70 !== void 0 ? _ref70 : key === 'auto' ? value.default : undefined;
6695
+ var rawValue = (_ref71 = (_ref72 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref72 !== void 0 ? _ref72 : value[dashedKey]) !== null && _ref71 !== void 0 ? _ref71 : key === 'auto' ? value.default : undefined;
6664
6696
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
6665
6697
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
6666
6698
  return String(rawValue);
@@ -6925,7 +6957,7 @@ var Server = /*#__PURE__*/function () {
6925
6957
  key: "handleUpdateLocalOrdersBatch",
6926
6958
  value: (function () {
6927
6959
  var _handleUpdateLocalOrdersBatch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(orderIds) {
6928
- var _this$app17;
6960
+ var _this$app18;
6929
6961
  var existedBefore, _iterator13, _step13, id, fetched, message, fetchedMap, _iterator14, _step14, order, oid, freshOrders, succeedIds, failed, _iterator15, _step15, _id, fresh, _message2, overwritten, inserted;
6930
6962
  return _regeneratorRuntime().wrap(function _callee71$(_context71) {
6931
6963
  while (1) switch (_context71.prev = _context71.next) {
@@ -6946,7 +6978,7 @@ var Server = /*#__PURE__*/function () {
6946
6978
  data: null
6947
6979
  });
6948
6980
  case 4:
6949
- if ((_this$app17 = this.app) !== null && _this$app17 !== void 0 && _this$app17.request) {
6981
+ if ((_this$app18 = this.app) !== null && _this$app18 !== void 0 && _this$app18.request) {
6950
6982
  _context71.next = 7;
6951
6983
  break;
6952
6984
  }
@@ -8030,14 +8062,14 @@ var Server = /*#__PURE__*/function () {
8030
8062
  }, {
8031
8063
  key: "buildProductFormatterContext",
8032
8064
  value: function buildProductFormatterContext(context) {
8033
- var _this$menu, _this$menu$getMenuLis, _scheduleModule$getSc, _this$core$context5;
8065
+ var _this$menu2, _this$menu2$getMenuLi, _scheduleModule$getSc, _this$core$context5;
8034
8066
  var scheduleModule = this.getSchedule();
8035
8067
  return {
8036
8068
  scheduleModule: scheduleModule,
8037
8069
  schedule_datetime: context.schedule_datetime,
8038
8070
  customer_id: context.customer_id,
8039
8071
  strategy_context: context.strategy_context,
8040
- menuList: ((_this$menu = this.menu) === null || _this$menu === void 0 || (_this$menu$getMenuLis = _this$menu.getMenuList) === null || _this$menu$getMenuLis === void 0 ? void 0 : _this$menu$getMenuLis.call(_this$menu)) || [],
8072
+ menuList: ((_this$menu2 = this.menu) === null || _this$menu2 === void 0 || (_this$menu2$getMenuLi = _this$menu2.getMenuList) === null || _this$menu2$getMenuLi === void 0 ? void 0 : _this$menu2$getMenuLi.call(_this$menu2)) || [],
8041
8073
  scheduleList: (scheduleModule === null || scheduleModule === void 0 || (_scheduleModule$getSc = scheduleModule.getScheduleList) === null || _scheduleModule$getSc === void 0 ? void 0 : _scheduleModule$getSc.call(scheduleModule)) || [],
8042
8074
  dataVariantEvaluator: (_this$core$context5 = this.core.context) === null || _this$core$context5 === void 0 ? void 0 : _this$core$context5.dataVariantEvaluator
8043
8075
  };
@@ -274,6 +274,7 @@ export declare class OrderModule extends BaseModule implements Module {
274
274
  * // => 'S-1001'
275
275
  */
276
276
  private getOrderStorageKey;
277
+ private getPersistedOrderStorageKey;
277
278
  private getOrderIdentityMatchKeys;
278
279
  private doOrdersShareIdentity;
279
280
  private findOrderIndexByIdentity;