@pisell/pisellos 0.10.90 → 0.10.93

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 (229) hide show
  1. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  2. package/dist/model/strategy/adapter/itemRule/adapter.js +74 -7
  3. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  4. package/dist/model/strategy/adapter/itemRule/evaluator.js +13 -0
  5. package/dist/model/strategy/adapter/itemRule/type.d.ts +40 -1
  6. package/dist/model/strategy/adapter/itemRule/type.js +10 -0
  7. package/dist/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
  8. package/dist/model/strategy/adapter/promotion/evaluator.js +103 -112
  9. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  10. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  11. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  12. package/dist/modules/BookingContext/utils/index.js +1 -0
  13. package/dist/modules/BookingContext/utils/productExtend.d.ts +21 -0
  14. package/dist/modules/BookingContext/utils/productExtend.js +132 -33
  15. package/dist/modules/BookingContext/utils/resources.js +1 -1
  16. package/dist/modules/Cart/index.js +4 -3
  17. package/dist/modules/Cart/types.d.ts +2 -0
  18. package/dist/modules/Cart/utils/cartProduct.d.ts +3 -1
  19. package/dist/modules/Cart/utils/cartProduct.js +59 -32
  20. package/dist/modules/Date/index.d.ts +1 -1
  21. package/dist/modules/Date/index.js +60 -14
  22. package/dist/modules/Date/types.d.ts +5 -0
  23. package/dist/modules/OpenData/salesSettings.js +1 -1
  24. package/dist/modules/OpenData/types.d.ts +9 -0
  25. package/dist/modules/OpenData/utils.d.ts +1 -1
  26. package/dist/modules/OpenData/utils.js +3 -2
  27. package/dist/modules/Order/index.d.ts +22 -7
  28. package/dist/modules/Order/index.js +1565 -1161
  29. package/dist/modules/Order/localEftposState.d.ts +13 -0
  30. package/dist/modules/Order/localEftposState.js +39 -0
  31. package/dist/modules/Order/types.d.ts +33 -11
  32. package/dist/modules/Order/types.js +2 -2
  33. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  34. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  35. package/dist/modules/Order/utils.d.ts +4 -1
  36. package/dist/modules/Order/utils.js +75 -52
  37. package/dist/modules/Payment/walletpass.js +32 -6
  38. package/dist/modules/Product/index.d.ts +1 -1
  39. package/dist/modules/Product/types.d.ts +16 -0
  40. package/dist/modules/ProductList/index.js +1 -1
  41. package/dist/modules/ResourcePlanner/planner.d.ts +2 -0
  42. package/dist/modules/ResourcePlanner/planner.js +383 -24
  43. package/dist/modules/ResourcePlanner/types.d.ts +42 -0
  44. package/dist/modules/Rules/index.js +86 -54
  45. package/dist/modules/Schedule/index.d.ts +7 -1
  46. package/dist/modules/Schedule/index.js +155 -39
  47. package/dist/modules/Schedule/types.d.ts +2 -0
  48. package/dist/modules/bookingReadValidation.d.ts +6 -0
  49. package/dist/modules/bookingReadValidation.js +72 -0
  50. package/dist/plugins/request.d.ts +2 -0
  51. package/dist/server/index.d.ts +9 -0
  52. package/dist/server/index.js +1928 -1462
  53. package/dist/server/modules/form/index.d.ts +19 -0
  54. package/dist/server/modules/form/index.js +205 -0
  55. package/dist/server/modules/form/types.d.ts +13 -0
  56. package/dist/server/modules/form/types.js +3 -0
  57. package/dist/server/modules/index.d.ts +3 -0
  58. package/dist/server/modules/index.js +4 -0
  59. package/dist/server/modules/order/index.d.ts +21 -0
  60. package/dist/server/modules/order/index.js +1399 -831
  61. package/dist/server/modules/order/types.d.ts +3 -0
  62. package/dist/server/modules/order/utils/filterOrders.js +20 -0
  63. package/dist/server/modules/products/index.d.ts +28 -7
  64. package/dist/server/modules/products/index.js +1295 -769
  65. package/dist/server/modules/products/replication.d.ts +8 -0
  66. package/dist/server/modules/products/replication.js +69 -0
  67. package/dist/server/modules/products/types.d.ts +12 -1
  68. package/dist/server/modules/products/types.js +4 -0
  69. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  70. package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
  71. package/dist/shared/receipt/small-ticket.d.ts +1 -0
  72. package/dist/shared/receipt/small-ticket.js +58 -26
  73. package/dist/shared/receipt/templateVisibility.d.ts +3 -0
  74. package/dist/shared/receipt/templateVisibility.js +6 -2
  75. package/dist/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  76. package/dist/solution/BaseSales/fulfillmentItemRules.js +750 -0
  77. package/dist/solution/BaseSales/index.d.ts +22 -6
  78. package/dist/solution/BaseSales/index.js +1881 -1347
  79. package/dist/solution/BaseSales/pickupTiming.d.ts +4 -0
  80. package/dist/solution/BaseSales/pickupTiming.js +35 -8
  81. package/dist/solution/BaseSales/types.d.ts +4 -0
  82. package/dist/solution/BaseSales/types.js +1 -0
  83. package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
  84. package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
  85. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
  86. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
  87. package/dist/solution/BookingByStep/index.d.ts +20 -4
  88. package/dist/solution/BookingByStep/index.js +681 -361
  89. package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
  90. package/dist/solution/BookingByStep/utils/resources.js +117 -76
  91. package/dist/solution/BookingTicket/index.d.ts +10 -0
  92. package/dist/solution/BookingTicket/index.js +686 -598
  93. package/dist/solution/BookingTicket/types.d.ts +1 -1
  94. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  95. package/dist/solution/BookingTicket/utils/addProductDecision.js +35 -8
  96. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
  97. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  98. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  99. package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +58 -94
  100. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
  101. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +33 -62
  102. package/dist/solution/OrderInvoicePreview/index.js +4 -3
  103. package/dist/solution/Sales/index.js +1 -1
  104. package/dist/solution/ScanOrder/index.d.ts +2 -0
  105. package/dist/solution/ScanOrder/index.js +230 -97
  106. package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
  107. package/dist/solution/ScanOrder/menuAvailability.js +363 -0
  108. package/dist/solution/ScanOrder/types.d.ts +3 -0
  109. package/dist/solution/UnifiedBookingSales/index.d.ts +42 -10
  110. package/dist/solution/UnifiedBookingSales/index.js +2493 -1496
  111. package/dist/solution/UnifiedBookingSales/salesSettings.js +1 -1
  112. package/dist/solution/UnifiedBookingSales/types.d.ts +20 -5
  113. package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
  114. package/dist/utils/pos-receipt-auto-print.js +14 -0
  115. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +3 -1
  116. package/lib/model/strategy/adapter/itemRule/adapter.js +54 -4
  117. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +3 -1
  118. package/lib/model/strategy/adapter/itemRule/evaluator.js +9 -0
  119. package/lib/model/strategy/adapter/itemRule/type.d.ts +40 -1
  120. package/lib/model/strategy/adapter/itemRule/type.js +10 -0
  121. package/lib/model/strategy/adapter/promotion/evaluator.d.ts +2 -1
  122. package/lib/model/strategy/adapter/promotion/evaluator.js +22 -21
  123. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  124. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  125. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  126. package/lib/modules/BookingContext/utils/index.js +11 -0
  127. package/lib/modules/BookingContext/utils/productExtend.d.ts +21 -0
  128. package/lib/modules/BookingContext/utils/productExtend.js +104 -5
  129. package/lib/modules/BookingContext/utils/resources.js +1 -1
  130. package/lib/modules/Cart/index.js +4 -2
  131. package/lib/modules/Cart/types.d.ts +2 -0
  132. package/lib/modules/Cart/utils/cartProduct.d.ts +3 -1
  133. package/lib/modules/Cart/utils/cartProduct.js +39 -20
  134. package/lib/modules/Date/index.d.ts +1 -1
  135. package/lib/modules/Date/index.js +28 -5
  136. package/lib/modules/Date/types.d.ts +5 -0
  137. package/lib/modules/OpenData/salesSettings.js +1 -1
  138. package/lib/modules/OpenData/types.d.ts +9 -0
  139. package/lib/modules/OpenData/utils.d.ts +1 -1
  140. package/lib/modules/OpenData/utils.js +3 -2
  141. package/lib/modules/Order/index.d.ts +22 -7
  142. package/lib/modules/Order/index.js +457 -174
  143. package/lib/modules/Order/localEftposState.d.ts +13 -0
  144. package/lib/modules/Order/localEftposState.js +44 -0
  145. package/lib/modules/Order/types.d.ts +33 -11
  146. package/lib/modules/Order/types.js +2 -2
  147. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  148. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  149. package/lib/modules/Order/utils.d.ts +4 -1
  150. package/lib/modules/Order/utils.js +29 -3
  151. package/lib/modules/Payment/walletpass.js +23 -1
  152. package/lib/modules/Product/index.d.ts +1 -1
  153. package/lib/modules/Product/types.d.ts +16 -0
  154. package/lib/modules/ProductList/index.js +1 -1
  155. package/lib/modules/ResourcePlanner/planner.d.ts +2 -0
  156. package/lib/modules/ResourcePlanner/planner.js +299 -9
  157. package/lib/modules/ResourcePlanner/types.d.ts +42 -0
  158. package/lib/modules/Rules/index.js +32 -3
  159. package/lib/modules/Schedule/index.d.ts +7 -1
  160. package/lib/modules/Schedule/index.js +68 -4
  161. package/lib/modules/Schedule/types.d.ts +2 -0
  162. package/lib/modules/bookingReadValidation.d.ts +6 -0
  163. package/lib/modules/bookingReadValidation.js +56 -0
  164. package/lib/plugins/request.d.ts +2 -0
  165. package/lib/server/index.d.ts +9 -0
  166. package/lib/server/index.js +279 -30
  167. package/lib/server/modules/form/index.d.ts +19 -0
  168. package/lib/server/modules/form/index.js +73 -0
  169. package/lib/server/modules/form/types.d.ts +13 -0
  170. package/lib/server/modules/form/types.js +9 -0
  171. package/lib/server/modules/index.d.ts +3 -0
  172. package/lib/server/modules/index.js +15 -1
  173. package/lib/server/modules/order/index.d.ts +21 -0
  174. package/lib/server/modules/order/index.js +344 -35
  175. package/lib/server/modules/order/types.d.ts +3 -0
  176. package/lib/server/modules/order/utils/filterOrders.js +18 -0
  177. package/lib/server/modules/products/index.d.ts +28 -7
  178. package/lib/server/modules/products/index.js +224 -62
  179. package/lib/server/modules/products/replication.d.ts +8 -0
  180. package/lib/server/modules/products/replication.js +30 -0
  181. package/lib/server/modules/products/types.d.ts +12 -1
  182. package/lib/server/modules/products/types.js +3 -0
  183. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  184. package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
  185. package/lib/shared/receipt/small-ticket.d.ts +1 -0
  186. package/lib/shared/receipt/small-ticket.js +53 -25
  187. package/lib/shared/receipt/templateVisibility.d.ts +3 -0
  188. package/lib/shared/receipt/templateVisibility.js +6 -2
  189. package/lib/solution/BaseSales/fulfillmentItemRules.d.ts +27 -0
  190. package/lib/solution/BaseSales/fulfillmentItemRules.js +259 -0
  191. package/lib/solution/BaseSales/index.d.ts +22 -6
  192. package/lib/solution/BaseSales/index.js +347 -59
  193. package/lib/solution/BaseSales/pickupTiming.d.ts +4 -0
  194. package/lib/solution/BaseSales/pickupTiming.js +24 -3
  195. package/lib/solution/BaseSales/types.d.ts +4 -0
  196. package/lib/solution/BaseSales/types.js +1 -0
  197. package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
  198. package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
  199. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
  200. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
  201. package/lib/solution/BookingByStep/index.d.ts +20 -4
  202. package/lib/solution/BookingByStep/index.js +229 -17
  203. package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
  204. package/lib/solution/BookingByStep/utils/resources.js +25 -15
  205. package/lib/solution/BookingTicket/index.d.ts +10 -0
  206. package/lib/solution/BookingTicket/index.js +57 -6
  207. package/lib/solution/BookingTicket/types.d.ts +1 -1
  208. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  209. package/lib/solution/BookingTicket/utils/addProductDecision.js +34 -4
  210. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +8 -8
  211. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  212. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  213. package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +2 -14
  214. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -3
  215. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +17 -34
  216. package/lib/solution/OrderInvoicePreview/index.js +1 -0
  217. package/lib/solution/Sales/index.js +1 -1
  218. package/lib/solution/ScanOrder/index.d.ts +2 -0
  219. package/lib/solution/ScanOrder/index.js +131 -22
  220. package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
  221. package/lib/solution/ScanOrder/menuAvailability.js +203 -0
  222. package/lib/solution/ScanOrder/types.d.ts +3 -0
  223. package/lib/solution/UnifiedBookingSales/index.d.ts +42 -10
  224. package/lib/solution/UnifiedBookingSales/index.js +717 -144
  225. package/lib/solution/UnifiedBookingSales/salesSettings.js +1 -1
  226. package/lib/solution/UnifiedBookingSales/types.d.ts +20 -5
  227. package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
  228. package/lib/utils/pos-receipt-auto-print.js +13 -0
  229. package/package.json +1 -1
@@ -56,6 +56,7 @@ import { createUuidV4 } from "../../modules/Order/utils";
56
56
  import { extractCustomerContactInfo, isContactRecord } from "../../modules/OpenData/contactInfo";
57
57
  import { isCustomerUserPlatform } from "../../utils/platform";
58
58
  import { cloneDeep } from 'lodash-es';
59
+ import { FormHooks } from "../../server/modules/form/types";
59
60
  var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents'];
60
61
  var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
61
62
  var USER_PLATFORM = ['pc', 'h5'];
@@ -214,6 +215,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
214
215
  return !channel || channel === 'system' ? 'pos' : channel;
215
216
  }
216
217
 
218
+ /** 供销售展示层按 booking.resources[].form_id 读取当前多语言表单标题。 */
219
+ }, {
220
+ key: "getFormTitleMap",
221
+ value: function getFormTitleMap() {
222
+ var _this$core2, _this$core2$getTitleM;
223
+ return ((_this$core2 = this.core) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.server) === null || _this$core2 === void 0 || (_this$core2 = _this$core2.form) === null || _this$core2 === void 0 || (_this$core2$getTitleM = _this$core2.getTitleMap) === null || _this$core2$getTitleM === void 0 ? void 0 : _this$core2$getTitleM.call(_this$core2)) || {};
224
+ }
225
+
226
+ /** 表单定义由 Ably 更新后通知展示层刷新,不改动订单里的历史 metadata。 */
227
+ }, {
228
+ key: "onFormTitlesChanged",
229
+ value: function onFormTitlesChanged(callback) {
230
+ return this.core.effects.on(FormHooks.onChanged, callback);
231
+ }
232
+
217
233
  /**
218
234
  * 业务侧子模块工厂:BookingTicket 自带的 createBookingTicketModule 优先匹配;
219
235
  * 未识别的模块名(如 BookingByStep 公共类型)回退到父类工厂。
@@ -479,29 +495,48 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
479
495
  return loadContactInfoOpenData;
480
496
  }()
481
497
  }, {
482
- key: "getInvoiceLayoutConfig",
498
+ key: "loadFulfillmentItemRuleOpenData",
483
499
  value: function () {
484
- var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
485
- var openData;
500
+ var _loadFulfillmentItemRuleOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
486
501
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
487
502
  while (1) switch (_context6.prev = _context6.next) {
488
503
  case 0:
489
- _context6.next = 2;
504
+ return _context6.abrupt("return", this.store.openData ? this.getOpenData() : _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadFulfillmentItemRuleOpenData", this).call(this));
505
+ case 1:
506
+ case "end":
507
+ return _context6.stop();
508
+ }
509
+ }, _callee6, this);
510
+ }));
511
+ function loadFulfillmentItemRuleOpenData() {
512
+ return _loadFulfillmentItemRuleOpenData.apply(this, arguments);
513
+ }
514
+ return loadFulfillmentItemRuleOpenData;
515
+ }()
516
+ }, {
517
+ key: "getInvoiceLayoutConfig",
518
+ value: function () {
519
+ var _getInvoiceLayoutConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
520
+ var openData;
521
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
522
+ while (1) switch (_context7.prev = _context7.next) {
523
+ case 0:
524
+ _context7.next = 2;
490
525
  return this.loadOpenDataConfig();
491
526
  case 2:
492
- openData = _context6.sent;
527
+ openData = _context7.sent;
493
528
  if (openData) {
494
- _context6.next = 5;
529
+ _context7.next = 5;
495
530
  break;
496
531
  }
497
- return _context6.abrupt("return", getDefaultInvoiceLayoutConfig());
532
+ return _context7.abrupt("return", getDefaultInvoiceLayoutConfig());
498
533
  case 5:
499
- return _context6.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
534
+ return _context7.abrupt("return", this.store.openData.getInvoiceLayoutConfig());
500
535
  case 6:
501
536
  case "end":
502
- return _context6.stop();
537
+ return _context7.stop();
503
538
  }
504
- }, _callee6, this);
539
+ }, _callee7, this);
505
540
  }));
506
541
  function getInvoiceLayoutConfig() {
507
542
  return _getInvoiceLayoutConfig.apply(this, arguments);
@@ -511,27 +546,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
511
546
  }, {
512
547
  key: "getInvoiceTemplateSettings",
513
548
  value: function () {
514
- var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
549
+ var _getInvoiceTemplateSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
515
550
  var openData;
516
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
517
- while (1) switch (_context7.prev = _context7.next) {
551
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
552
+ while (1) switch (_context8.prev = _context8.next) {
518
553
  case 0:
519
- _context7.next = 2;
554
+ _context8.next = 2;
520
555
  return this.loadOpenDataConfig();
521
556
  case 2:
522
- openData = _context7.sent;
557
+ openData = _context8.sent;
523
558
  if (openData) {
524
- _context7.next = 5;
559
+ _context8.next = 5;
525
560
  break;
526
561
  }
527
- return _context7.abrupt("return", getDefaultInvoiceTemplateSettings());
562
+ return _context8.abrupt("return", getDefaultInvoiceTemplateSettings());
528
563
  case 5:
529
- return _context7.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
564
+ return _context8.abrupt("return", this.store.openData.getInvoiceTemplateSettings());
530
565
  case 6:
531
566
  case "end":
532
- return _context7.stop();
567
+ return _context8.stop();
533
568
  }
534
- }, _callee7, this);
569
+ }, _callee8, this);
535
570
  }));
536
571
  function getInvoiceTemplateSettings() {
537
572
  return _getInvoiceTemplateSettings.apply(this, arguments);
@@ -561,32 +596,32 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
561
596
  }, {
562
597
  key: "getShortNumberOrDeviceId",
563
598
  value: function () {
564
- var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
599
+ var _getShortNumberOrDeviceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
565
600
  var getAsyncIotDeviceInfo, res;
566
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
567
- while (1) switch (_context8.prev = _context8.next) {
601
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
602
+ while (1) switch (_context9.prev = _context9.next) {
568
603
  case 0:
569
604
  getAsyncIotDeviceInfo = this.getAppData('async_iot_device_info');
570
605
  if (!getAsyncIotDeviceInfo) {
571
- _context8.next = 7;
606
+ _context9.next = 7;
572
607
  break;
573
608
  }
574
- _context8.next = 4;
609
+ _context9.next = 4;
575
610
  return getAsyncIotDeviceInfo === null || getAsyncIotDeviceInfo === void 0 ? void 0 : getAsyncIotDeviceInfo();
576
611
  case 4:
577
- res = _context8.sent;
612
+ res = _context9.sent;
578
613
  if (!(res !== null && res !== void 0 && res.short_number)) {
579
- _context8.next = 7;
614
+ _context9.next = 7;
580
615
  break;
581
616
  }
582
- return _context8.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
617
+ return _context9.abrupt("return", res === null || res === void 0 ? void 0 : res.short_number);
583
618
  case 7:
584
- return _context8.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
619
+ return _context9.abrupt("return", String(this.getAppData('device_id') || 0).slice(-2));
585
620
  case 8:
586
621
  case "end":
587
- return _context8.stop();
622
+ return _context9.stop();
588
623
  }
589
- }, _callee8, this);
624
+ }, _callee9, this);
590
625
  }));
591
626
  function getShortNumberOrDeviceId() {
592
627
  return _getShortNumberOrDeviceId.apply(this, arguments);
@@ -596,40 +631,40 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
596
631
  }, {
597
632
  key: "configureIdGeneratorFromOpenData",
598
633
  value: function () {
599
- var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
634
+ var _configureIdGeneratorFromOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
600
635
  var _this$otherParams5, _openDataConfig, _openDataConfig2, _openDataConfig3, _openDataConfig4, _openDataConfig5, _openDataConfig6;
601
- var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode;
602
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
603
- while (1) switch (_context9.prev = _context9.next) {
636
+ var idGenerator, openDataConfig, receiptSequenceLength, receiptSequenceStart, prefix, shopOrderPrefix, resetReceiptSequenceDaily, operatingDayBoundary, deviceId, businessCode, _openDataConfig7, _openDataConfig8, _openDataConfig9;
637
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
638
+ while (1) switch (_context10.prev = _context10.next) {
604
639
  case 0:
605
640
  if (!isCustomerUserPlatform((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.platform)) {
606
- _context9.next = 2;
641
+ _context10.next = 2;
607
642
  break;
608
643
  }
609
- return _context9.abrupt("return");
644
+ return _context10.abrupt("return");
610
645
  case 2:
611
646
  // 业务码切换或配置失败时不能复用上一次初始化的短号。
612
647
  this.setPaymentNumberDevicePrefix(null);
613
648
  idGenerator = this.getIdGeneratorPlugin(); // Optional host capability. Do not warn or cache absence: POS may register it later.
614
649
  if (!(typeof (idGenerator === null || idGenerator === void 0 ? void 0 : idGenerator.configure) !== 'function')) {
615
- _context9.next = 6;
650
+ _context10.next = 6;
616
651
  break;
617
652
  }
618
- return _context9.abrupt("return");
653
+ return _context10.abrupt("return");
619
654
  case 6:
620
655
  openDataConfig = null;
621
- _context9.prev = 7;
622
- _context9.next = 10;
656
+ _context10.prev = 7;
657
+ _context10.next = 10;
623
658
  return this.loadOpenDataConfig();
624
659
  case 10:
625
- openDataConfig = _context9.sent;
626
- _context9.next = 17;
660
+ openDataConfig = _context10.sent;
661
+ _context10.next = 17;
627
662
  break;
628
663
  case 13:
629
- _context9.prev = 13;
630
- _context9.t0 = _context9["catch"](7);
631
- console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context9.t0);
632
- return _context9.abrupt("return");
664
+ _context10.prev = 13;
665
+ _context10.t0 = _context10["catch"](7);
666
+ console.warn('[BookingTicket] OpenData 配置加载失败,跳过 idGenerator 配置', _context10.t0);
667
+ return _context10.abrupt("return");
633
668
  case 17:
634
669
  // if (!openDataConfig) return;
635
670
  receiptSequenceLength = this.normalizePositiveInteger((_openDataConfig = openDataConfig) === null || _openDataConfig === void 0 ? void 0 : _openDataConfig['sale.short_number_digits'], 5);
@@ -641,29 +676,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
641
676
  "type": "start_time",
642
677
  "time": "00:00"
643
678
  };
644
- _context9.next = 25;
679
+ _context10.next = 25;
645
680
  return this.getShortNumberOrDeviceId();
646
681
  case 25:
647
- deviceId = _context9.sent;
682
+ deviceId = _context10.sent;
648
683
  this.setPaymentNumberDevicePrefix(deviceId);
649
684
  businessCode = this.getBookingTicketBusinessCode();
650
685
  if (businessCode) {
651
- _context9.next = 31;
686
+ _context10.next = 31;
652
687
  break;
653
688
  }
654
689
  console.warn('[BookingTicket] businessCode 缺失,跳过 idGenerator 配置');
655
- return _context9.abrupt("return");
690
+ return _context10.abrupt("return");
656
691
  case 31:
657
- _context9.prev = 31;
658
- _context9.next = 34;
692
+ _context10.prev = 31;
693
+ _context10.next = 34;
659
694
  return idGenerator.configure({
660
695
  biz: businessCode,
661
696
  config: {
662
697
  prefix: prefix,
663
698
  deviceCode: deviceId,
664
- // TODO 现在 picoding 没这个配置的 key
665
- padReceiptSequence: false,
699
+ padReceiptSequence: ((_openDataConfig7 = openDataConfig) === null || _openDataConfig7 === void 0 ? void 0 : _openDataConfig7['sale.pad_with_leading_zeros']) === true,
666
700
  receiptSequenceLength: receiptSequenceLength,
701
+ receiptSequenceMax: this.normalizeShortNumberMaximum((_openDataConfig8 = openDataConfig) === null || _openDataConfig8 === void 0 ? void 0 : _openDataConfig8['sale.maximum_number']),
702
+ randomReceiptSequence: ((_openDataConfig9 = openDataConfig) === null || _openDataConfig9 === void 0 ? void 0 : _openDataConfig9['sale.short_number_random']) === true,
667
703
  resetReceiptSequenceDaily: resetReceiptSequenceDaily,
668
704
  receiptSequenceResetTime: operatingDayBoundary === null || operatingDayBoundary === void 0 ? void 0 : operatingDayBoundary.time,
669
705
  receiptSequenceStart: receiptSequenceStart,
@@ -671,17 +707,17 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
671
707
  }
672
708
  });
673
709
  case 34:
674
- _context9.next = 39;
710
+ _context10.next = 39;
675
711
  break;
676
712
  case 36:
677
- _context9.prev = 36;
678
- _context9.t1 = _context9["catch"](31);
679
- console.warn('[BookingTicket] idGenerator 配置失败', _context9.t1);
713
+ _context10.prev = 36;
714
+ _context10.t1 = _context10["catch"](31);
715
+ console.warn('[BookingTicket] idGenerator 配置失败', _context10.t1);
680
716
  case 39:
681
717
  case "end":
682
- return _context9.stop();
718
+ return _context10.stop();
683
719
  }
684
- }, _callee9, this, [[7, 13], [31, 36]]);
720
+ }, _callee10, this, [[7, 13], [31, 36]]);
685
721
  }));
686
722
  function configureIdGeneratorFromOpenData() {
687
723
  return _configureIdGeneratorFromOpenData.apply(this, arguments);
@@ -695,6 +731,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
695
731
  if (!Number.isInteger(numeric) || numeric <= 0) return fallback;
696
732
  return numeric;
697
733
  }
734
+ }, {
735
+ key: "normalizeShortNumberMaximum",
736
+ value: function normalizeShortNumberMaximum(value) {
737
+ if (value === undefined || value === null || typeof value === 'string' && !value.trim()) return null;
738
+ if (typeof value !== 'number' && typeof value !== 'string') {
739
+ throw new Error('sale.maximum_number 必须是安全正整数或空值');
740
+ }
741
+ var numeric = Number(value);
742
+ if (!Number.isSafeInteger(numeric) || numeric <= 0) {
743
+ throw new Error('sale.maximum_number 必须是安全正整数或空值');
744
+ }
745
+ return numeric;
746
+ }
698
747
  }, {
699
748
  key: "normalizeIdPrefix",
700
749
  value: function normalizeIdPrefix(value, fallback) {
@@ -713,16 +762,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
713
762
  }, {
714
763
  key: "loadSalesDetail",
715
764
  value: (function () {
716
- var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(orderIdOrParams) {
765
+ var _loadSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(orderIdOrParams) {
717
766
  var _ref3;
718
767
  var sales, customerModule, detailCustomer, orderCustomerSnapshot, protocolCustomerId, protocolCustomer, selectedCustomer, _selectedCustomer$nam, _ref4, detailCustomerId, detailCustomerRest, rawId, customer;
719
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
720
- while (1) switch (_context10.prev = _context10.next) {
768
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
769
+ while (1) switch (_context11.prev = _context11.next) {
721
770
  case 0:
722
- _context10.next = 2;
771
+ _context11.next = 2;
723
772
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "loadSalesDetail", this).call(this, orderIdOrParams);
724
773
  case 2:
725
- sales = _context10.sent;
774
+ sales = _context11.sent;
726
775
  customerModule = this.store.customer;
727
776
  detailCustomer = sales === null || sales === void 0 ? void 0 : sales.customer;
728
777
  orderCustomerSnapshot = this.store.order.getOrderCustomerSnapshot();
@@ -754,12 +803,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
754
803
  });
755
804
  // await this.store.order.saveDraft();
756
805
  }
757
- return _context10.abrupt("return", sales);
806
+ return _context11.abrupt("return", sales);
758
807
  case 11:
759
808
  case "end":
760
- return _context10.stop();
809
+ return _context11.stop();
761
810
  }
762
- }, _callee10, this);
811
+ }, _callee11, this);
763
812
  }));
764
813
  function loadSalesDetail(_x3) {
765
814
  return _loadSalesDetail.apply(this, arguments);
@@ -769,56 +818,56 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
769
818
  }, {
770
819
  key: "scanPromotionCode",
771
820
  value: function () {
772
- var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(code, customerId) {
821
+ var _scanPromotionCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(code, customerId) {
773
822
  var raw, scannedList, extractedCustomerId, hasOrderCustomer, isUserPlatform, tempOrder;
774
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
775
- while (1) switch (_context11.prev = _context11.next) {
823
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
824
+ while (1) switch (_context12.prev = _context12.next) {
776
825
  case 0:
777
826
  if (this.store.order) {
778
- _context11.next = 2;
827
+ _context12.next = 2;
779
828
  break;
780
829
  }
781
830
  throw new Error('order 模块未初始化');
782
831
  case 2:
783
- _context11.next = 4;
832
+ _context12.next = 4;
784
833
  return this.store.order.scanCode(code, customerId);
785
834
  case 4:
786
- raw = _context11.sent;
835
+ raw = _context12.sent;
787
836
  scannedList = raw.scannedDiscountList || [];
788
837
  extractedCustomerId = this.getDiscountCustomerId(scannedList);
789
838
  hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
790
839
  isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
791
840
  if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
792
- _context11.next = 18;
841
+ _context12.next = 18;
793
842
  break;
794
843
  }
795
- _context11.prev = 10;
796
- _context11.next = 13;
844
+ _context12.prev = 10;
845
+ _context12.next = 13;
797
846
  return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
798
847
  case 13:
799
- _context11.next = 18;
848
+ _context12.next = 18;
800
849
  break;
801
850
  case 15:
802
- _context11.prev = 15;
803
- _context11.t0 = _context11["catch"](10);
851
+ _context12.prev = 15;
852
+ _context12.t0 = _context12["catch"](10);
804
853
  // 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
805
854
  console.warn('[BookingTicket] scan discount customer resolve failed', {
806
855
  customerId: extractedCustomerId,
807
- error: _context11.t0
856
+ error: _context12.t0
808
857
  });
809
858
  case 18:
810
859
  if (!raw.isAvailable) {
811
- _context11.next = 25;
860
+ _context12.next = 25;
812
861
  break;
813
862
  }
814
- _context11.next = 21;
863
+ _context12.next = 21;
815
864
  return this.store.order.recalculateSummary({
816
865
  createIfMissing: true
817
866
  });
818
867
  case 21:
819
868
  this.store.order.persistTempOrder();
820
869
  tempOrder = this.store.order.ensureTempOrder();
821
- _context11.next = 25;
870
+ _context12.next = 25;
822
871
  return this.effectsEmit('onDiscountApplied', {
823
872
  productList: tempOrder.products || [],
824
873
  discountList: this.store.order.getDiscountList(),
@@ -826,7 +875,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
826
875
  tempOrder: tempOrder
827
876
  });
828
877
  case 25:
829
- return _context11.abrupt("return", _objectSpread(_objectSpread({
878
+ return _context12.abrupt("return", _objectSpread(_objectSpread({
830
879
  isAvailable: raw.isAvailable
831
880
  }, raw.isAccepted !== undefined ? {
832
881
  isAccepted: raw.isAccepted
@@ -837,9 +886,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
837
886
  }));
838
887
  case 26:
839
888
  case "end":
840
- return _context11.stop();
889
+ return _context12.stop();
841
890
  }
842
- }, _callee11, this, [[10, 15]]);
891
+ }, _callee12, this, [[10, 15]]);
843
892
  }));
844
893
  function scanPromotionCode(_x4, _x5) {
845
894
  return _scanPromotionCode.apply(this, arguments);
@@ -849,42 +898,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
849
898
  }, {
850
899
  key: "hydrateOrderCustomerFromScanDiscounts",
851
900
  value: function () {
852
- var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(discounts) {
901
+ var _hydrateOrderCustomerFromScanDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(discounts) {
853
902
  var currentOrderCustomer, customerId, customer;
854
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
855
- while (1) switch (_context12.prev = _context12.next) {
903
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
904
+ while (1) switch (_context13.prev = _context13.next) {
856
905
  case 0:
857
906
  currentOrderCustomer = this.store.order.getOrderCustomer();
858
907
  if (!currentOrderCustomer) {
859
- _context12.next = 3;
908
+ _context13.next = 3;
860
909
  break;
861
910
  }
862
- return _context12.abrupt("return");
911
+ return _context13.abrupt("return");
863
912
  case 3:
864
913
  customerId = this.getDiscountCustomerId(discounts);
865
914
  if (customerId) {
866
- _context12.next = 6;
915
+ _context13.next = 6;
867
916
  break;
868
917
  }
869
- return _context12.abrupt("return");
918
+ return _context13.abrupt("return");
870
919
  case 6:
871
- _context12.next = 8;
920
+ _context13.next = 8;
872
921
  return this.resolveCustomerByDiscountCustomerId(customerId);
873
922
  case 8:
874
- customer = _context12.sent;
923
+ customer = _context13.sent;
875
924
  if (customer) {
876
- _context12.next = 11;
925
+ _context13.next = 11;
877
926
  break;
878
927
  }
879
- return _context12.abrupt("return");
928
+ return _context13.abrupt("return");
880
929
  case 11:
881
930
  this.store.customer.setSelectedCustomer(customer);
882
931
  this.setOrderCustomer(customer);
883
932
  case 13:
884
933
  case "end":
885
- return _context12.stop();
934
+ return _context13.stop();
886
935
  }
887
- }, _callee12, this);
936
+ }, _callee13, this);
888
937
  }));
889
938
  function hydrateOrderCustomerFromScanDiscounts(_x6) {
890
939
  return _hydrateOrderCustomerFromScanDiscounts.apply(this, arguments);
@@ -920,27 +969,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
920
969
  }, {
921
970
  key: "resolveCustomerById",
922
971
  value: function () {
923
- var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(customerId) {
972
+ var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(customerId) {
924
973
  var _this2 = this;
925
974
  var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
926
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
927
- while (1) switch (_context13.prev = _context13.next) {
975
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
976
+ while (1) switch (_context14.prev = _context14.next) {
928
977
  case 0:
929
978
  rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
930
979
  numericCustomerId = Number(rawCustomerId);
931
980
  if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
932
- _context13.next = 4;
981
+ _context14.next = 4;
933
982
  break;
934
983
  }
935
- return _context13.abrupt("return", null);
984
+ return _context14.abrupt("return", null);
936
985
  case 4:
937
986
  normalizedCustomerId = String(numericCustomerId);
938
987
  existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
939
988
  if (!existingRequest) {
940
- _context13.next = 8;
989
+ _context14.next = 8;
941
990
  break;
942
991
  }
943
- return _context13.abrupt("return", existingRequest);
992
+ return _context14.abrupt("return", existingRequest);
944
993
  case 8:
945
994
  request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
946
995
  with_franchisor_data: 1,
@@ -960,12 +1009,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
960
1009
  }
961
1010
  });
962
1011
  this.customerResolveRequests.set(normalizedCustomerId, request);
963
- return _context13.abrupt("return", request);
1012
+ return _context14.abrupt("return", request);
964
1013
  case 11:
965
1014
  case "end":
966
- return _context13.stop();
1015
+ return _context14.stop();
967
1016
  }
968
- }, _callee13, this);
1017
+ }, _callee14, this);
969
1018
  }));
970
1019
  function resolveCustomerById(_x7) {
971
1020
  return _resolveCustomerById.apply(this, arguments);
@@ -1017,60 +1066,60 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1017
1066
  }, {
1018
1067
  key: "setBookingStatus",
1019
1068
  value: (function () {
1020
- var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(status) {
1069
+ var _setBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(status) {
1021
1070
  var _this$store$order2, _this$store$order2$ge;
1022
1071
  var tempOrder, orderId, scheduleId, bookings, previous, _data, res;
1023
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1024
- while (1) switch (_context14.prev = _context14.next) {
1072
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1073
+ while (1) switch (_context15.prev = _context15.next) {
1025
1074
  case 0:
1026
1075
  tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
1027
1076
  if (tempOrder) {
1028
- _context14.next = 3;
1077
+ _context15.next = 3;
1029
1078
  break;
1030
1079
  }
1031
1080
  throw new Error('setBookingStatus: tempOrder 未加载');
1032
1081
  case 3:
1033
1082
  orderId = tempOrder.order_id;
1034
1083
  if (!(orderId === undefined || orderId === null)) {
1035
- _context14.next = 6;
1084
+ _context15.next = 6;
1036
1085
  break;
1037
1086
  }
1038
1087
  throw new Error('setBookingStatus: tempOrder.order_id 缺失');
1039
1088
  case 6:
1040
1089
  scheduleId = resolveScheduleId(tempOrder);
1041
1090
  if (!(scheduleId === null)) {
1042
- _context14.next = 9;
1091
+ _context15.next = 9;
1043
1092
  break;
1044
1093
  }
1045
1094
  throw new Error('setBookingStatus: 无法解析 schedule id(metadata 与 root booking 均缺失)');
1046
1095
  case 9:
1047
1096
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1048
1097
  previous = applyBookingsStatus(bookings, status);
1049
- _context14.prev = 11;
1050
- _context14.next = 14;
1098
+ _context15.prev = 11;
1099
+ _context15.next = 14;
1051
1100
  return this.request.put("/schedule/booking/appointment-status/".concat(scheduleId), {
1052
1101
  appointment_status: status
1053
1102
  });
1054
1103
  case 14:
1055
- res = _context14.sent;
1056
- _context14.next = 17;
1104
+ res = _context15.sent;
1105
+ _context15.next = 17;
1057
1106
  return this.refreshSalesDetail();
1058
1107
  case 17:
1059
1108
  this.core.effects.emit("".concat(this.name, ":onBookingStatusChange"), {
1060
1109
  orderId: orderId,
1061
1110
  status: status
1062
1111
  });
1063
- return _context14.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1112
+ return _context15.abrupt("return", (_data = res === null || res === void 0 ? void 0 : res.data) !== null && _data !== void 0 ? _data : res);
1064
1113
  case 21:
1065
- _context14.prev = 21;
1066
- _context14.t0 = _context14["catch"](11);
1114
+ _context15.prev = 21;
1115
+ _context15.t0 = _context15["catch"](11);
1067
1116
  restoreBookingsStatus(bookings, previous);
1068
- throw _context14.t0;
1117
+ throw _context15.t0;
1069
1118
  case 25:
1070
1119
  case "end":
1071
- return _context14.stop();
1120
+ return _context15.stop();
1072
1121
  }
1073
- }, _callee14, this, [[11, 21]]);
1122
+ }, _callee15, this, [[11, 21]]);
1074
1123
  }));
1075
1124
  function setBookingStatus(_x8) {
1076
1125
  return _setBookingStatus.apply(this, arguments);
@@ -1101,35 +1150,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1101
1150
  }, {
1102
1151
  key: "transitionChildBooking",
1103
1152
  value: (function () {
1104
- var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1153
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1105
1154
  var _this$store$order3, _this$store$order3$ge;
1106
1155
  var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
1107
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1108
- while (1) switch (_context15.prev = _context15.next) {
1156
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1157
+ while (1) switch (_context16.prev = _context16.next) {
1109
1158
  case 0:
1110
1159
  schedule_event_id = params.schedule_event_id, action = params.action;
1111
1160
  if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
1112
- _context15.next = 3;
1161
+ _context16.next = 3;
1113
1162
  break;
1114
1163
  }
1115
1164
  throw new Error('transitionChildBooking: schedule_event_id 不能为空');
1116
1165
  case 3:
1117
1166
  if (action) {
1118
- _context15.next = 5;
1167
+ _context16.next = 5;
1119
1168
  break;
1120
1169
  }
1121
1170
  throw new Error('transitionChildBooking: action 不能为空');
1122
1171
  case 5:
1123
1172
  tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
1124
1173
  if (tempOrder) {
1125
- _context15.next = 8;
1174
+ _context16.next = 8;
1126
1175
  break;
1127
1176
  }
1128
1177
  throw new Error('transitionChildBooking: tempOrder 未加载');
1129
1178
  case 8:
1130
1179
  orderId = tempOrder.order_id;
1131
1180
  if (!(orderId === undefined || orderId === null)) {
1132
- _context15.next = 11;
1181
+ _context16.next = 11;
1133
1182
  break;
1134
1183
  }
1135
1184
  throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
@@ -1137,14 +1186,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1137
1186
  bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
1138
1187
  targetStatus = resolveStatusAfterTransition(action);
1139
1188
  previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
1140
- _context15.prev = 14;
1141
- _context15.next = 17;
1189
+ _context16.prev = 14;
1190
+ _context16.next = 17;
1142
1191
  return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
1143
1192
  action: action
1144
1193
  });
1145
1194
  case 17:
1146
- res = _context15.sent;
1147
- _context15.next = 20;
1195
+ res = _context16.sent;
1196
+ _context16.next = 20;
1148
1197
  return this.refreshSalesDetail();
1149
1198
  case 20:
1150
1199
  this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
@@ -1153,19 +1202,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1153
1202
  action: action,
1154
1203
  status: targetStatus
1155
1204
  });
1156
- return _context15.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1205
+ return _context16.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
1157
1206
  case 24:
1158
- _context15.prev = 24;
1159
- _context15.t0 = _context15["catch"](14);
1207
+ _context16.prev = 24;
1208
+ _context16.t0 = _context16["catch"](14);
1160
1209
  if (previous !== undefined) {
1161
1210
  restoreChildBookingStatus(bookings, schedule_event_id, previous);
1162
1211
  }
1163
- throw _context15.t0;
1212
+ throw _context16.t0;
1164
1213
  case 28:
1165
1214
  case "end":
1166
- return _context15.stop();
1215
+ return _context16.stop();
1167
1216
  }
1168
- }, _callee15, this, [[14, 24]]);
1217
+ }, _callee16, this, [[14, 24]]);
1169
1218
  }));
1170
1219
  function transitionChildBooking(_x9) {
1171
1220
  return _transitionChildBooking.apply(this, arguments);
@@ -1186,19 +1235,19 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1186
1235
  }, {
1187
1236
  key: "refreshSalesDetail",
1188
1237
  value: (function () {
1189
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1238
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1190
1239
  var _this$store$order4, _this$store$order4$ge;
1191
1240
  var params,
1192
1241
  tempOrder,
1193
1242
  orderId,
1194
- _args16 = arguments;
1195
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1196
- while (1) switch (_context16.prev = _context16.next) {
1243
+ _args17 = arguments;
1244
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1245
+ while (1) switch (_context17.prev = _context17.next) {
1197
1246
  case 0:
1198
- params = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
1247
+ params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1199
1248
  tempOrder = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 || (_this$store$order4$ge = _this$store$order4.getTempOrder) === null || _this$store$order4$ge === void 0 ? void 0 : _this$store$order4$ge.call(_this$store$order4);
1200
1249
  if (tempOrder) {
1201
- _context16.next = 4;
1250
+ _context17.next = 4;
1202
1251
  break;
1203
1252
  }
1204
1253
  throw new Error('refreshSalesDetail: tempOrder 未加载');
@@ -1206,21 +1255,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1206
1255
  debugger;
1207
1256
  orderId = tempOrder.order_id || tempOrder.external_sale_number;
1208
1257
  if (!(orderId === undefined || orderId === null)) {
1209
- _context16.next = 8;
1258
+ _context17.next = 8;
1210
1259
  break;
1211
1260
  }
1212
- return _context16.abrupt("return", {});
1261
+ return _context17.abrupt("return", {});
1213
1262
  case 8:
1214
- return _context16.abrupt("return", this.loadSalesDetail({
1263
+ return _context17.abrupt("return", this.loadSalesDetail({
1215
1264
  orderId: orderId,
1216
1265
  // merge: true
1217
1266
  forceRemote: params.forceRemote
1218
1267
  }));
1219
1268
  case 9:
1220
1269
  case "end":
1221
- return _context16.stop();
1270
+ return _context17.stop();
1222
1271
  }
1223
- }, _callee16, this);
1272
+ }, _callee17, this);
1224
1273
  }));
1225
1274
  function refreshSalesDetail() {
1226
1275
  return _refreshSalesDetail.apply(this, arguments);
@@ -1236,7 +1285,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1236
1285
  }, {
1237
1286
  key: "loadProducts",
1238
1287
  value: (function () {
1239
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1288
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1240
1289
  var params,
1241
1290
  options,
1242
1291
  schedule_date,
@@ -1245,20 +1294,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1245
1294
  schedule_datetime,
1246
1295
  bookingDate,
1247
1296
  _result,
1248
- _args17 = arguments;
1249
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1250
- while (1) switch (_context17.prev = _context17.next) {
1297
+ _args18 = arguments;
1298
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1299
+ while (1) switch (_context18.prev = _context18.next) {
1251
1300
  case 0:
1252
- params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1253
- options = _args17.length > 1 ? _args17[1] : undefined;
1301
+ params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1302
+ options = _args18.length > 1 ? _args18[1] : undefined;
1254
1303
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
1255
1304
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
1256
1305
  bookingDate = schedule_datetime || schedule_date || '';
1257
1306
  if (bookingDate) {
1258
1307
  this.setBookingDate(bookingDate);
1259
1308
  }
1260
- _context17.prev = 5;
1261
- _context17.next = 8;
1309
+ _context18.prev = 5;
1310
+ _context18.next = 8;
1262
1311
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1263
1312
  with_count: ['bundleGroup', 'optionGroup'],
1264
1313
  with_schedule: 1
@@ -1266,20 +1315,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1266
1315
  cacheId: this.cacheId
1267
1316
  }), options);
1268
1317
  case 8:
1269
- _result = _context17.sent;
1318
+ _result = _context18.sent;
1270
1319
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
1271
1320
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
1272
- return _context17.abrupt("return", _result);
1321
+ return _context18.abrupt("return", _result);
1273
1322
  case 14:
1274
- _context17.prev = 14;
1275
- _context17.t0 = _context17["catch"](5);
1276
- console.error('Failed to load products:', _context17.t0);
1277
- throw _context17.t0;
1323
+ _context18.prev = 14;
1324
+ _context18.t0 = _context18["catch"](5);
1325
+ console.error('Failed to load products:', _context18.t0);
1326
+ throw _context18.t0;
1278
1327
  case 18:
1279
1328
  case "end":
1280
- return _context17.stop();
1329
+ return _context18.stop();
1281
1330
  }
1282
- }, _callee17, this, [[5, 14]]);
1331
+ }, _callee18, this, [[5, 14]]);
1283
1332
  }));
1284
1333
  function loadProducts() {
1285
1334
  return _loadProducts.apply(this, arguments);
@@ -1296,27 +1345,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1296
1345
  }, {
1297
1346
  key: "getAddTimeProducts",
1298
1347
  value: (function () {
1299
- var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1348
+ var _getAddTimeProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1300
1349
  var params,
1301
1350
  result,
1302
- _args18 = arguments;
1303
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1304
- while (1) switch (_context18.prev = _context18.next) {
1351
+ _args19 = arguments;
1352
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1353
+ while (1) switch (_context19.prev = _context19.next) {
1305
1354
  case 0:
1306
- params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1307
- _context18.next = 3;
1355
+ params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1356
+ _context19.next = 3;
1308
1357
  return this.store.products.getAddTimeProducts(_objectSpread(_objectSpread({}, params), {}, {
1309
1358
  cacheId: this.cacheId
1310
1359
  }));
1311
1360
  case 3:
1312
- result = _context18.sent;
1361
+ result = _context19.sent;
1313
1362
  this.addTimeProductsCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
1314
- return _context18.abrupt("return", result);
1363
+ return _context19.abrupt("return", result);
1315
1364
  case 6:
1316
1365
  case "end":
1317
- return _context18.stop();
1366
+ return _context19.stop();
1318
1367
  }
1319
- }, _callee18, this);
1368
+ }, _callee19, this);
1320
1369
  }));
1321
1370
  function getAddTimeProducts() {
1322
1371
  return _getAddTimeProducts.apply(this, arguments);
@@ -1341,14 +1390,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1341
1390
  }, {
1342
1391
  key: "queryProductDetail",
1343
1392
  value: (function () {
1344
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params, options) {
1393
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
1345
1394
  var product_id, queryParams, _result2, list;
1346
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1347
- while (1) switch (_context19.prev = _context19.next) {
1395
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1396
+ while (1) switch (_context20.prev = _context20.next) {
1348
1397
  case 0:
1349
1398
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
1350
- _context19.prev = 1;
1351
- _context19.next = 4;
1399
+ _context20.prev = 1;
1400
+ _context20.next = 4;
1352
1401
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1353
1402
  with_count: ['bundleGroup', 'optionGroup'],
1354
1403
  with_schedule: 1
@@ -1357,21 +1406,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1357
1406
  cacheId: this.cacheId
1358
1407
  }), options);
1359
1408
  case 4:
1360
- _result2 = _context19.sent;
1409
+ _result2 = _context20.sent;
1361
1410
  list = Array.isArray(_result2) ? _result2 : [];
1362
- return _context19.abrupt("return", list.find(function (product) {
1411
+ return _context20.abrupt("return", list.find(function (product) {
1363
1412
  return Number(product.id) === Number(product_id);
1364
1413
  }));
1365
1414
  case 9:
1366
- _context19.prev = 9;
1367
- _context19.t0 = _context19["catch"](1);
1368
- console.error('Failed to query product detail:', _context19.t0);
1369
- throw _context19.t0;
1415
+ _context20.prev = 9;
1416
+ _context20.t0 = _context20["catch"](1);
1417
+ console.error('Failed to query product detail:', _context20.t0);
1418
+ throw _context20.t0;
1370
1419
  case 13:
1371
1420
  case "end":
1372
- return _context19.stop();
1421
+ return _context20.stop();
1373
1422
  }
1374
- }, _callee19, this, [[1, 9]]);
1423
+ }, _callee20, this, [[1, 9]]);
1375
1424
  }));
1376
1425
  function queryProductDetail(_x10, _x11) {
1377
1426
  return _queryProductDetail.apply(this, arguments);
@@ -1386,26 +1435,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1386
1435
  }, {
1387
1436
  key: "loadProductDetail",
1388
1437
  value: (function () {
1389
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params, options) {
1438
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params, options) {
1390
1439
  var product_id, queryParams, products;
1391
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1392
- while (1) switch (_context20.prev = _context20.next) {
1440
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1441
+ while (1) switch (_context21.prev = _context21.next) {
1393
1442
  case 0:
1394
1443
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
1395
- _context20.next = 3;
1444
+ _context21.next = 3;
1396
1445
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
1397
1446
  product_ids: [product_id]
1398
1447
  }), options);
1399
1448
  case 3:
1400
- products = _context20.sent;
1401
- return _context20.abrupt("return", products.find(function (product) {
1449
+ products = _context21.sent;
1450
+ return _context21.abrupt("return", products.find(function (product) {
1402
1451
  return Number(product.id) === Number(product_id);
1403
1452
  }));
1404
1453
  case 5:
1405
1454
  case "end":
1406
- return _context20.stop();
1455
+ return _context21.stop();
1407
1456
  }
1408
- }, _callee20, this);
1457
+ }, _callee21, this);
1409
1458
  }));
1410
1459
  function loadProductDetail(_x12, _x13) {
1411
1460
  return _loadProductDetail.apply(this, arguments);
@@ -1440,16 +1489,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1440
1489
  }, {
1441
1490
  key: "getProducts",
1442
1491
  value: (function () {
1443
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1444
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1445
- while (1) switch (_context21.prev = _context21.next) {
1492
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1493
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1494
+ while (1) switch (_context22.prev = _context22.next) {
1446
1495
  case 0:
1447
- return _context21.abrupt("return", this.store.products.getProducts());
1496
+ return _context22.abrupt("return", this.store.products.getProducts());
1448
1497
  case 1:
1449
1498
  case "end":
1450
- return _context21.stop();
1499
+ return _context22.stop();
1451
1500
  }
1452
- }, _callee21, this);
1501
+ }, _callee22, this);
1453
1502
  }));
1454
1503
  function getProducts() {
1455
1504
  return _getProducts.apply(this, arguments);
@@ -1514,33 +1563,33 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1514
1563
  }, {
1515
1564
  key: "getProductByIds",
1516
1565
  value: (function () {
1517
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(ids, options) {
1566
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(ids, options) {
1518
1567
  var _this$getOrderCustome, _this$getOrderCustome2, _this$getOrderCustome3;
1519
1568
  var normalizedIds, localProducts, localProductIds, missingIds, rawBookingDate, bookingDate, customerId, loadedProducts, productById;
1520
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1521
- while (1) switch (_context22.prev = _context22.next) {
1569
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1570
+ while (1) switch (_context23.prev = _context23.next) {
1522
1571
  case 0:
1523
1572
  normalizedIds = Array.from(new Set((ids || []).map(function (id) {
1524
1573
  return Number(id);
1525
1574
  }).filter(function (id) {
1526
1575
  return Number.isFinite(id);
1527
1576
  })));
1528
- _context22.next = 3;
1577
+ _context23.next = 3;
1529
1578
  return this.store.products.getProductByIds(normalizedIds);
1530
1579
  case 3:
1531
- _context22.t0 = _context22.sent;
1532
- if (_context22.t0) {
1533
- _context22.next = 6;
1580
+ _context23.t0 = _context23.sent;
1581
+ if (_context23.t0) {
1582
+ _context23.next = 6;
1534
1583
  break;
1535
1584
  }
1536
- _context22.t0 = [];
1585
+ _context23.t0 = [];
1537
1586
  case 6:
1538
- localProducts = _context22.t0;
1587
+ localProducts = _context23.t0;
1539
1588
  if (options !== null && options !== void 0 && options.loadMissing) {
1540
- _context22.next = 9;
1589
+ _context23.next = 9;
1541
1590
  break;
1542
1591
  }
1543
- return _context22.abrupt("return", localProducts);
1592
+ return _context23.abrupt("return", localProducts);
1544
1593
  case 9:
1545
1594
  localProductIds = new Set(localProducts.map(function (product) {
1546
1595
  return Number(product.id);
@@ -1549,15 +1598,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1549
1598
  return !localProductIds.has(id);
1550
1599
  });
1551
1600
  if (missingIds.length) {
1552
- _context22.next = 13;
1601
+ _context23.next = 13;
1553
1602
  break;
1554
1603
  }
1555
- return _context22.abrupt("return", localProducts);
1604
+ return _context23.abrupt("return", localProducts);
1556
1605
  case 13:
1557
1606
  rawBookingDate = this.getBookingDate();
1558
1607
  bookingDate = rawBookingDate && dayjs(rawBookingDate).isValid() ? dayjs(rawBookingDate) : null;
1559
1608
  customerId = Number((_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$getOrderCustome3 = this.getOrderCustomer()) === null || _this$getOrderCustome3 === void 0 ? void 0 : _this$getOrderCustome3.customer_id);
1560
- _context22.next = 18;
1609
+ _context23.next = 18;
1561
1610
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
1562
1611
  product_ids: missingIds,
1563
1612
  with_count: ['bundleGroup', 'optionGroup'],
@@ -1570,7 +1619,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1570
1619
  customer_id: customerId
1571
1620
  } : {}));
1572
1621
  case 18:
1573
- loadedProducts = _context22.sent;
1622
+ loadedProducts = _context23.sent;
1574
1623
  productById = new Map();
1575
1624
  [].concat(_toConsumableArray(localProducts), _toConsumableArray(loadedProducts || [])).forEach(function (product) {
1576
1625
  var productId = Number(product.id);
@@ -1578,16 +1627,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1578
1627
  productById.set(productId, product);
1579
1628
  }
1580
1629
  });
1581
- return _context22.abrupt("return", normalizedIds.map(function (id) {
1630
+ return _context23.abrupt("return", normalizedIds.map(function (id) {
1582
1631
  return productById.get(id);
1583
1632
  }).filter(function (product) {
1584
1633
  return Boolean(product);
1585
1634
  }));
1586
1635
  case 22:
1587
1636
  case "end":
1588
- return _context22.stop();
1637
+ return _context23.stop();
1589
1638
  }
1590
- }, _callee22, this);
1639
+ }, _callee23, this);
1591
1640
  }));
1592
1641
  function getProductByIds(_x14, _x15) {
1593
1642
  return _getProductByIds.apply(this, arguments);
@@ -1603,25 +1652,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1603
1652
  }, {
1604
1653
  key: "getScheduleTimePoints",
1605
1654
  value: (function () {
1606
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1655
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(params) {
1607
1656
  var result;
1608
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1609
- while (1) switch (_context23.prev = _context23.next) {
1657
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1658
+ while (1) switch (_context24.prev = _context24.next) {
1610
1659
  case 0:
1611
- _context23.next = 2;
1660
+ _context24.next = 2;
1612
1661
  return this.request.post('/menu/schedule-time-points', {
1613
1662
  menu_list_ids: params.menu_list_ids
1614
1663
  }, {
1615
1664
  osServer: true
1616
1665
  });
1617
1666
  case 2:
1618
- result = _context23.sent;
1619
- return _context23.abrupt("return", result.data || []);
1667
+ result = _context24.sent;
1668
+ return _context24.abrupt("return", result.data || []);
1620
1669
  case 4:
1621
1670
  case "end":
1622
- return _context23.stop();
1671
+ return _context24.stop();
1623
1672
  }
1624
- }, _callee23, this);
1673
+ }, _callee24, this);
1625
1674
  }));
1626
1675
  function getScheduleTimePoints(_x16) {
1627
1676
  return _getScheduleTimePoints.apply(this, arguments);
@@ -1637,30 +1686,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1637
1686
  }, {
1638
1687
  key: "getCustomerList",
1639
1688
  value: (function () {
1640
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1689
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1641
1690
  var params,
1642
1691
  _result3,
1643
- _args24 = arguments;
1644
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1645
- while (1) switch (_context24.prev = _context24.next) {
1692
+ _args25 = arguments;
1693
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1694
+ while (1) switch (_context25.prev = _context25.next) {
1646
1695
  case 0:
1647
- params = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
1648
- _context24.prev = 1;
1649
- _context24.next = 4;
1696
+ params = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
1697
+ _context25.prev = 1;
1698
+ _context25.next = 4;
1650
1699
  return this.store.customer.getCustomerList(params);
1651
1700
  case 4:
1652
- _result3 = _context24.sent;
1653
- return _context24.abrupt("return", _result3);
1701
+ _result3 = _context25.sent;
1702
+ return _context25.abrupt("return", _result3);
1654
1703
  case 8:
1655
- _context24.prev = 8;
1656
- _context24.t0 = _context24["catch"](1);
1657
- console.error('Failed to get customer list:', _context24.t0);
1658
- throw _context24.t0;
1704
+ _context25.prev = 8;
1705
+ _context25.t0 = _context25["catch"](1);
1706
+ console.error('Failed to get customer list:', _context25.t0);
1707
+ throw _context25.t0;
1659
1708
  case 12:
1660
1709
  case "end":
1661
- return _context24.stop();
1710
+ return _context25.stop();
1662
1711
  }
1663
- }, _callee24, this, [[1, 8]]);
1712
+ }, _callee25, this, [[1, 8]]);
1664
1713
  }));
1665
1714
  function getCustomerList() {
1666
1715
  return _getCustomerList.apply(this, arguments);
@@ -1861,25 +1910,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1861
1910
  }, {
1862
1911
  key: "replaceTempOrder",
1863
1912
  value: function () {
1864
- var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1913
+ var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
1865
1914
  var _get2;
1866
1915
  var _len2,
1867
1916
  args,
1868
1917
  _key2,
1869
- _args25 = arguments;
1870
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1871
- while (1) switch (_context25.prev = _context25.next) {
1918
+ _args26 = arguments;
1919
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1920
+ while (1) switch (_context26.prev = _context26.next) {
1872
1921
  case 0:
1873
1922
  this.orderCustomerContactRequest = null;
1874
- for (_len2 = _args25.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1875
- args[_key2] = _args25[_key2];
1923
+ for (_len2 = _args26.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1924
+ args[_key2] = _args26[_key2];
1876
1925
  }
1877
- return _context25.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
1926
+ return _context26.abrupt("return", (_get2 = _get(_getPrototypeOf(BookingTicketImpl.prototype), "replaceTempOrder", this)).call.apply(_get2, [this].concat(args)));
1878
1927
  case 3:
1879
1928
  case "end":
1880
- return _context25.stop();
1929
+ return _context26.stop();
1881
1930
  }
1882
- }, _callee25, this);
1931
+ }, _callee26, this);
1883
1932
  }));
1884
1933
  function replaceTempOrder() {
1885
1934
  return _replaceTempOrder.apply(this, arguments);
@@ -1889,21 +1938,21 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1889
1938
  }, {
1890
1939
  key: "applyDefaultOrderCustomerContactInfo",
1891
1940
  value: function () {
1892
- var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(contact) {
1893
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
1894
- while (1) switch (_context26.prev = _context26.next) {
1941
+ var _applyDefaultOrderCustomerContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(contact) {
1942
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1943
+ while (1) switch (_context27.prev = _context27.next) {
1895
1944
  case 0:
1896
1945
  this.store.order.updateTempOrderContactsInfo(cloneDeep(contact));
1897
1946
  // Metadata may finish after promotion/discount refresh; publish the updated cart explicitly.
1898
- _context26.next = 3;
1947
+ _context27.next = 3;
1899
1948
  return this.effectsEmit('onTempOrderReplaced', {
1900
1949
  tempOrder: this.getTempOrder()
1901
1950
  });
1902
1951
  case 3:
1903
1952
  case "end":
1904
- return _context26.stop();
1953
+ return _context27.stop();
1905
1954
  }
1906
- }, _callee26, this);
1955
+ }, _callee27, this);
1907
1956
  }));
1908
1957
  function applyDefaultOrderCustomerContactInfo(_x17) {
1909
1958
  return _applyDefaultOrderCustomerContactInfo.apply(this, arguments);
@@ -1948,69 +1997,69 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1948
1997
  };
1949
1998
  this.orderCustomerContactRequest = pending;
1950
1999
  var loadContact = /*#__PURE__*/function () {
1951
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
2000
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
1952
2001
  var _result4, resolved;
1953
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
1954
- while (1) switch (_context27.prev = _context27.next) {
2002
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2003
+ while (1) switch (_context28.prev = _context28.next) {
1955
2004
  case 0:
1956
2005
  if (!userPlatform) {
1957
- _context27.next = 7;
2006
+ _context28.next = 7;
1958
2007
  break;
1959
2008
  }
1960
- _context27.next = 3;
2009
+ _context28.next = 3;
1961
2010
  return _this4.request.get('/customer/metadata', {
1962
2011
  key: 'contacts_info'
1963
2012
  });
1964
2013
  case 3:
1965
- _result4 = _context27.sent;
2014
+ _result4 = _context28.sent;
1966
2015
  if (!((_result4 === null || _result4 === void 0 ? void 0 : _result4.code) !== 200 || (_result4 === null || _result4 === void 0 ? void 0 : _result4.status) === false)) {
1967
- _context27.next = 6;
2016
+ _context28.next = 6;
1968
2017
  break;
1969
2018
  }
1970
2019
  throw new Error('Customer contact lookup failed');
1971
2020
  case 6:
1972
- return _context27.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
2021
+ return _context28.abrupt("return", isContactRecord(_result4.data) ? _result4.data : null);
1973
2022
  case 7:
1974
- _context27.next = 9;
2023
+ _context28.next = 9;
1975
2024
  return _this4.resolveCustomerById(customerId);
1976
2025
  case 9:
1977
- resolved = _context27.sent;
1978
- return _context27.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
2026
+ resolved = _context28.sent;
2027
+ return _context28.abrupt("return", Number(resolved === null || resolved === void 0 ? void 0 : resolved.id) === customerId ? extractCustomerContactInfo(resolved) : null);
1979
2028
  case 11:
1980
2029
  case "end":
1981
- return _context27.stop();
2030
+ return _context28.stop();
1982
2031
  }
1983
- }, _callee27);
2032
+ }, _callee28);
1984
2033
  }));
1985
2034
  return function loadContact() {
1986
2035
  return _ref11.apply(this, arguments);
1987
2036
  };
1988
2037
  }();
1989
2038
  pending.promise = loadContact().then( /*#__PURE__*/function () {
1990
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(value) {
2039
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(value) {
1991
2040
  var _current$_extend;
1992
2041
  var current;
1993
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
1994
- while (1) switch (_context28.prev = _context28.next) {
2042
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2043
+ while (1) switch (_context29.prev = _context29.next) {
1995
2044
  case 0:
1996
2045
  current = _this4.getTempOrder();
1997
2046
  if (!(_this4.orderCustomerContactRequest !== pending || _this4.getCustomerContactOrderKey() !== orderKey || Number(current === null || current === void 0 ? void 0 : current.customer_id) !== customerId || scope !== _this4.getCustomerContactScope() || current !== null && current !== void 0 && (_current$_extend = current._extend) !== null && _current$_extend !== void 0 && _current$_extend.contactInfoEdited || (current === null || current === void 0 ? void 0 : current.contacts_info) != null || userPlatform && getAuthenticatedCustomerId() !== customerId)) {
1998
- _context28.next = 3;
2047
+ _context29.next = 3;
1999
2048
  break;
2000
2049
  }
2001
- return _context28.abrupt("return");
2050
+ return _context29.abrupt("return");
2002
2051
  case 3:
2003
2052
  if (!value) {
2004
- _context28.next = 6;
2053
+ _context29.next = 6;
2005
2054
  break;
2006
2055
  }
2007
- _context28.next = 6;
2056
+ _context29.next = 6;
2008
2057
  return _this4.applyDefaultOrderCustomerContactInfo(value);
2009
2058
  case 6:
2010
2059
  case "end":
2011
- return _context28.stop();
2060
+ return _context29.stop();
2012
2061
  }
2013
- }, _callee28);
2062
+ }, _callee29);
2014
2063
  }));
2015
2064
  return function (_x18) {
2016
2065
  return _ref12.apply(this, arguments);
@@ -2030,31 +2079,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2030
2079
  }, {
2031
2080
  key: "validateContactInfo",
2032
2081
  value: function () {
2033
- var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2082
+ var _validateContactInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2034
2083
  var _this$getTempOrder, _this$getTempOrder2;
2035
2084
  var orderKey, customerId, scope;
2036
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2037
- while (1) switch (_context29.prev = _context29.next) {
2085
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2086
+ while (1) switch (_context30.prev = _context30.next) {
2038
2087
  case 0:
2039
2088
  orderKey = this.getCustomerContactOrderKey();
2040
2089
  customerId = (_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.customer_id;
2041
2090
  scope = this.getCustomerContactScope();
2042
- _context29.next = 5;
2091
+ _context30.next = 5;
2043
2092
  return this.waitForOrderCustomerContactInfo();
2044
2093
  case 5:
2045
2094
  if (!(this.getCustomerContactOrderKey() !== orderKey || ((_this$getTempOrder2 = this.getTempOrder()) === null || _this$getTempOrder2 === void 0 ? void 0 : _this$getTempOrder2.customer_id) !== customerId || this.getCustomerContactScope() !== scope)) {
2046
- _context29.next = 7;
2095
+ _context30.next = 7;
2047
2096
  break;
2048
2097
  }
2049
2098
  throw new Error('The order changed. Please try again.');
2050
2099
  case 7:
2051
- _context29.next = 9;
2100
+ _context30.next = 9;
2052
2101
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "validateContactInfo", this).call(this);
2053
2102
  case 9:
2054
2103
  case "end":
2055
- return _context29.stop();
2104
+ return _context30.stop();
2056
2105
  }
2057
- }, _callee29, this);
2106
+ }, _callee30, this);
2058
2107
  }));
2059
2108
  function validateContactInfo() {
2060
2109
  return _validateContactInfo.apply(this, arguments);
@@ -2129,24 +2178,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2129
2178
  }, {
2130
2179
  key: "restoreOrder",
2131
2180
  value: (function () {
2132
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2181
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2133
2182
  var _this$store$customer;
2134
2183
  var tempOrder;
2135
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2136
- while (1) switch (_context30.prev = _context30.next) {
2184
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2185
+ while (1) switch (_context31.prev = _context31.next) {
2137
2186
  case 0:
2138
- _context30.next = 2;
2187
+ _context31.next = 2;
2139
2188
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
2140
2189
  case 2:
2141
- tempOrder = _context30.sent;
2190
+ tempOrder = _context31.sent;
2142
2191
  this.clearOrderCustomer();
2143
2192
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
2144
- return _context30.abrupt("return", tempOrder);
2193
+ return _context31.abrupt("return", tempOrder);
2145
2194
  case 6:
2146
2195
  case "end":
2147
- return _context30.stop();
2196
+ return _context31.stop();
2148
2197
  }
2149
- }, _callee30, this);
2198
+ }, _callee31, this);
2150
2199
  }));
2151
2200
  function restoreOrder() {
2152
2201
  return _restoreOrder.apply(this, arguments);
@@ -2181,27 +2230,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2181
2230
  return this.orderCustomerDiscountRefreshInFlight;
2182
2231
  }
2183
2232
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
2184
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2233
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2185
2234
  var _this6$store$order$ge, _this6$store$order, _this6$getOrderIdenti;
2186
2235
  var currentCustomer, currentTempOrder, currentOrderIdentity, currentOrderId, currentAction, currentOrderTarget;
2187
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2188
- while (1) switch (_context31.prev = _context31.next) {
2236
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2237
+ while (1) switch (_context32.prev = _context32.next) {
2189
2238
  case 0:
2190
2239
  if (!previousRefresh) {
2191
- _context31.next = 3;
2240
+ _context32.next = 3;
2192
2241
  break;
2193
2242
  }
2194
- _context31.next = 3;
2243
+ _context32.next = 3;
2195
2244
  return previousRefresh.catch(function () {
2196
2245
  return undefined;
2197
2246
  });
2198
2247
  case 3:
2199
2248
  currentCustomer = _this6.store.order.getOrderCustomer();
2200
2249
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
2201
- _context31.next = 6;
2250
+ _context32.next = 6;
2202
2251
  break;
2203
2252
  }
2204
- return _context31.abrupt("return");
2253
+ return _context32.abrupt("return");
2205
2254
  case 6:
2206
2255
  currentTempOrder = (_this6$store$order$ge = (_this6$store$order = _this6.store.order).getTempOrder) === null || _this6$store$order$ge === void 0 ? void 0 : _this6$store$order$ge.call(_this6$store$order);
2207
2256
  currentOrderIdentity = (_this6$getOrderIdenti = _this6.getOrderIdentity) === null || _this6$getOrderIdenti === void 0 ? void 0 : _this6$getOrderIdenti.call(_this6);
@@ -2209,12 +2258,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2209
2258
  currentAction = !currentOrderId || String(currentOrderId).startsWith('local_order') ? 'create' : 'edit';
2210
2259
  currentOrderTarget = currentOrderId ? "order:".concat(String(currentOrderId)) : "external:".concat(String((currentTempOrder === null || currentTempOrder === void 0 ? void 0 : currentTempOrder.external_sale_number) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.externalSaleNumber) || (currentOrderIdentity === null || currentOrderIdentity === void 0 ? void 0 : currentOrderIdentity.localId) || 'new'));
2211
2260
  if (!("".concat(customerId, ":").concat(currentAction, ":").concat(currentOrderTarget) !== refreshTarget)) {
2212
- _context31.next = 13;
2261
+ _context32.next = 13;
2213
2262
  break;
2214
2263
  }
2215
- return _context31.abrupt("return");
2264
+ return _context32.abrupt("return");
2216
2265
  case 13:
2217
- _context31.next = 15;
2266
+ _context32.next = 15;
2218
2267
  return _this6.loadDiscountConfig({
2219
2268
  customerId: customerId,
2220
2269
  action: action,
@@ -2222,9 +2271,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2222
2271
  });
2223
2272
  case 15:
2224
2273
  case "end":
2225
- return _context31.stop();
2274
+ return _context32.stop();
2226
2275
  }
2227
- }, _callee31);
2276
+ }, _callee32);
2228
2277
  }))();
2229
2278
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
2230
2279
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -2247,28 +2296,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2247
2296
  }, {
2248
2297
  key: "prepareProductPriceQueryContext",
2249
2298
  value: function () {
2250
- var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(customerId) {
2299
+ var _prepareProductPriceQueryContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(customerId) {
2251
2300
  var normalizedCustomerId, refreshTask, shouldWait;
2252
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2253
- while (1) switch (_context32.prev = _context32.next) {
2301
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2302
+ while (1) switch (_context33.prev = _context33.next) {
2254
2303
  case 0:
2255
- _context32.next = 2;
2304
+ _context33.next = 2;
2256
2305
  return Promise.resolve();
2257
2306
  case 2:
2258
2307
  normalizedCustomerId = Number(customerId || 0);
2259
2308
  refreshTask = this.orderCustomerDiscountRefreshInFlight;
2260
2309
  shouldWait = normalizedCustomerId > 1 && this.orderCustomerDiscountRefreshCustomerId === normalizedCustomerId && Boolean(refreshTask);
2261
2310
  if (!(shouldWait && refreshTask)) {
2262
- _context32.next = 8;
2311
+ _context33.next = 8;
2263
2312
  break;
2264
2313
  }
2265
- _context32.next = 8;
2314
+ _context33.next = 8;
2266
2315
  return refreshTask;
2267
2316
  case 8:
2268
2317
  case "end":
2269
- return _context32.stop();
2318
+ return _context33.stop();
2270
2319
  }
2271
- }, _callee32, this);
2320
+ }, _callee33, this);
2272
2321
  }));
2273
2322
  function prepareProductPriceQueryContext(_x19) {
2274
2323
  return _prepareProductPriceQueryContext.apply(this, arguments);
@@ -2323,27 +2372,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2323
2372
  }, {
2324
2373
  key: "changeCustomerPage",
2325
2374
  value: (function () {
2326
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(page, pageSize) {
2375
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(page, pageSize) {
2327
2376
  var _result5;
2328
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2329
- while (1) switch (_context33.prev = _context33.next) {
2377
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2378
+ while (1) switch (_context34.prev = _context34.next) {
2330
2379
  case 0:
2331
- _context33.prev = 0;
2332
- _context33.next = 3;
2380
+ _context34.prev = 0;
2381
+ _context34.next = 3;
2333
2382
  return this.store.customer.changeCustomerPage(page, pageSize);
2334
2383
  case 3:
2335
- _result5 = _context33.sent;
2336
- return _context33.abrupt("return", _result5);
2384
+ _result5 = _context34.sent;
2385
+ return _context34.abrupt("return", _result5);
2337
2386
  case 7:
2338
- _context33.prev = 7;
2339
- _context33.t0 = _context33["catch"](0);
2340
- console.error('Failed to change customer page:', _context33.t0);
2341
- throw _context33.t0;
2387
+ _context34.prev = 7;
2388
+ _context34.t0 = _context34["catch"](0);
2389
+ console.error('Failed to change customer page:', _context34.t0);
2390
+ throw _context34.t0;
2342
2391
  case 11:
2343
2392
  case "end":
2344
- return _context33.stop();
2393
+ return _context34.stop();
2345
2394
  }
2346
- }, _callee33, this, [[0, 7]]);
2395
+ }, _callee34, this, [[0, 7]]);
2347
2396
  }));
2348
2397
  function changeCustomerPage(_x20, _x21) {
2349
2398
  return _changeCustomerPage.apply(this, arguments);
@@ -2358,28 +2407,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2358
2407
  }, {
2359
2408
  key: "loadMoreCustomers",
2360
2409
  value: (function () {
2361
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2410
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2362
2411
  var _result6;
2363
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2364
- while (1) switch (_context34.prev = _context34.next) {
2412
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2413
+ while (1) switch (_context35.prev = _context35.next) {
2365
2414
  case 0:
2366
- _context34.prev = 0;
2367
- _context34.next = 3;
2415
+ _context35.prev = 0;
2416
+ _context35.next = 3;
2368
2417
  return this.store.customer.loadMoreCustomers();
2369
2418
  case 3:
2370
- _result6 = _context34.sent;
2419
+ _result6 = _context35.sent;
2371
2420
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result6);
2372
- return _context34.abrupt("return", _result6);
2421
+ return _context35.abrupt("return", _result6);
2373
2422
  case 8:
2374
- _context34.prev = 8;
2375
- _context34.t0 = _context34["catch"](0);
2376
- console.error('Failed to load more customers:', _context34.t0);
2377
- throw _context34.t0;
2423
+ _context35.prev = 8;
2424
+ _context35.t0 = _context35["catch"](0);
2425
+ console.error('Failed to load more customers:', _context35.t0);
2426
+ throw _context35.t0;
2378
2427
  case 12:
2379
2428
  case "end":
2380
- return _context34.stop();
2429
+ return _context35.stop();
2381
2430
  }
2382
- }, _callee34, this, [[0, 8]]);
2431
+ }, _callee35, this, [[0, 8]]);
2383
2432
  }));
2384
2433
  function loadMoreCustomers() {
2385
2434
  return _loadMoreCustomers.apply(this, arguments);
@@ -2395,31 +2444,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2395
2444
  }, {
2396
2445
  key: "resetAndLoadCustomers",
2397
2446
  value: (function () {
2398
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2447
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2399
2448
  var params,
2400
2449
  _result7,
2401
- _args35 = arguments;
2402
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
2403
- while (1) switch (_context35.prev = _context35.next) {
2450
+ _args36 = arguments;
2451
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2452
+ while (1) switch (_context36.prev = _context36.next) {
2404
2453
  case 0:
2405
- params = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
2406
- _context35.prev = 1;
2407
- _context35.next = 4;
2454
+ params = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {};
2455
+ _context36.prev = 1;
2456
+ _context36.next = 4;
2408
2457
  return this.store.customer.resetAndLoadCustomers(params);
2409
2458
  case 4:
2410
- _result7 = _context35.sent;
2459
+ _result7 = _context36.sent;
2411
2460
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result7);
2412
- return _context35.abrupt("return", _result7);
2461
+ return _context36.abrupt("return", _result7);
2413
2462
  case 9:
2414
- _context35.prev = 9;
2415
- _context35.t0 = _context35["catch"](1);
2416
- console.error('Failed to reset and load customers:', _context35.t0);
2417
- throw _context35.t0;
2463
+ _context36.prev = 9;
2464
+ _context36.t0 = _context36["catch"](1);
2465
+ console.error('Failed to reset and load customers:', _context36.t0);
2466
+ throw _context36.t0;
2418
2467
  case 13:
2419
2468
  case "end":
2420
- return _context35.stop();
2469
+ return _context36.stop();
2421
2470
  }
2422
- }, _callee35, this, [[1, 9]]);
2471
+ }, _callee36, this, [[1, 9]]);
2423
2472
  }));
2424
2473
  function resetAndLoadCustomers() {
2425
2474
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -2580,16 +2629,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2580
2629
  }, {
2581
2630
  key: "getOtherParams",
2582
2631
  value: (function () {
2583
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2584
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2585
- while (1) switch (_context36.prev = _context36.next) {
2632
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
2633
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2634
+ while (1) switch (_context37.prev = _context37.next) {
2586
2635
  case 0:
2587
- return _context36.abrupt("return", this.otherParams);
2636
+ return _context37.abrupt("return", this.otherParams);
2588
2637
  case 1:
2589
2638
  case "end":
2590
- return _context36.stop();
2639
+ return _context37.stop();
2591
2640
  }
2592
- }, _callee36, this);
2641
+ }, _callee37, this);
2593
2642
  }));
2594
2643
  function getOtherParams() {
2595
2644
  return _getOtherParams.apply(this, arguments);
@@ -2696,16 +2745,26 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2696
2745
  }, {
2697
2746
  key: "buildBookingCalcContext",
2698
2747
  value: function buildBookingCalcContext(extra) {
2699
- var _extra$date, _extra$presetStartTim;
2748
+ var _extra$date,
2749
+ _extra$presetStartTim,
2750
+ _this$getOrderSession,
2751
+ _this8 = this,
2752
+ _this$otherParams10;
2700
2753
  var state = this.store.bookingContext.getState();
2701
2754
  var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
2702
- return _objectSpread({
2755
+ return _objectSpread(_objectSpread({
2703
2756
  bookingConfig: state.bookingConfig,
2704
2757
  resourcesOrigin: state.resourcesOrigin,
2705
2758
  resourcesOriginMap: state.resourcesOriginMap,
2706
2759
  date: date,
2707
2760
  presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
2708
- }, extra || {});
2761
+ }, extra || {}), {}, {
2762
+ orderSessionId: (_this$getOrderSession = this.getOrderSessionId()) !== null && _this$getOrderSession !== void 0 ? _this$getOrderSession : undefined,
2763
+ isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2764
+ return _this8.isOrderSessionCurrent(sessionId);
2765
+ },
2766
+ platform: String(((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.platform) || '').trim().toLowerCase()
2767
+ });
2709
2768
  }
2710
2769
 
2711
2770
  /**
@@ -2799,7 +2858,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2799
2858
  }, {
2800
2859
  key: "buildAddProductCtx",
2801
2860
  value: function buildAddProductCtx(extra) {
2802
- var _extra$date2, _ref14, _this$getOrderCustome4, _this$getOrderCustome5, _this$store$order$get5, _extra$presetStartTim2;
2861
+ var _extra$date2,
2862
+ _ref14,
2863
+ _this$getOrderCustome4,
2864
+ _this$getOrderCustome5,
2865
+ _this$store$order$get5,
2866
+ _extra$presetStartTim2,
2867
+ _this$getOrderSession2,
2868
+ _this9 = this,
2869
+ _this$otherParams11;
2803
2870
  var bookingContextState = this.store.bookingContext.getState();
2804
2871
  var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
2805
2872
  var orderCustomerId = (_ref14 = (_this$getOrderCustome4 = (_this$getOrderCustome5 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome5 === void 0 ? void 0 : _this$getOrderCustome5.id) !== null && _this$getOrderCustome4 !== void 0 ? _this$getOrderCustome4 : (_this$store$order$get5 = this.store.order.getTempOrder()) === null || _this$store$order$get5 === void 0 ? void 0 : _this$store$order$get5.customer_id) !== null && _ref14 !== void 0 ? _ref14 : undefined;
@@ -2811,7 +2878,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2811
2878
  presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
2812
2879
  customerId: orderCustomerId
2813
2880
  }, extra || {}), {}, {
2814
- channel: this.getSubmitOrderSalesChannel()
2881
+ channel: this.getSubmitOrderSalesChannel(),
2882
+ orderSessionId: (_this$getOrderSession2 = this.getOrderSessionId()) !== null && _this$getOrderSession2 !== void 0 ? _this$getOrderSession2 : undefined,
2883
+ isOrderSessionCurrent: function isOrderSessionCurrent(sessionId) {
2884
+ return _this9.isOrderSessionCurrent(sessionId);
2885
+ },
2886
+ platform: String(((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform) || '').trim().toLowerCase()
2815
2887
  });
2816
2888
  }
2817
2889
 
@@ -2913,16 +2985,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2913
2985
  }, {
2914
2986
  key: "updateProductInOrder",
2915
2987
  value: (function () {
2916
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
2917
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
2918
- while (1) switch (_context37.prev = _context37.next) {
2988
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(params) {
2989
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2990
+ while (1) switch (_context38.prev = _context38.next) {
2919
2991
  case 0:
2920
- return _context37.abrupt("return", this.updateOrderProduct(params));
2992
+ return _context38.abrupt("return", this.updateOrderProduct(params));
2921
2993
  case 1:
2922
2994
  case "end":
2923
- return _context37.stop();
2995
+ return _context38.stop();
2924
2996
  }
2925
- }, _callee37, this);
2997
+ }, _callee38, this);
2926
2998
  }));
2927
2999
  function updateProductInOrder(_x22) {
2928
3000
  return _updateProductInOrder.apply(this, arguments);
@@ -2946,24 +3018,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2946
3018
  }, {
2947
3019
  key: "handleGlobalScanCode",
2948
3020
  value: (function () {
2949
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(code, bridge) {
2950
- var _this8 = this;
3021
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code, bridge) {
3022
+ var _this10 = this;
2951
3023
  var trimmed, _bridge$onNotify, _bridge$refresh, beforeScanCommit, beforeScanDialog, guardCallback, guardedBridge, _promotion$isAccepted, promotion, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, host, _result8, _bridge$onNotify3, _bridge$isCurrent;
2952
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
2953
- while (1) switch (_context39.prev = _context39.next) {
3024
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3025
+ while (1) switch (_context40.prev = _context40.next) {
2954
3026
  case 0:
2955
3027
  trimmed = typeof code === 'string' ? code.trim() : '';
2956
3028
  if (trimmed) {
2957
- _context39.next = 4;
3029
+ _context40.next = 4;
2958
3030
  break;
2959
3031
  }
2960
3032
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
2961
- return _context39.abrupt("return", {
3033
+ return _context40.abrupt("return", {
2962
3034
  status: 'failed',
2963
3035
  reason: 'empty_code'
2964
3036
  });
2965
3037
  case 4:
2966
- _context39.prev = 4;
3038
+ _context40.prev = 4;
2967
3039
  // Capture before lookup/UI awaits, so a result cannot land in a new cart.
2968
3040
  // Unscoped POS Order modules return a no-op guard.
2969
3041
  beforeScanCommit = this.store.order.createCartIntentCommitGuard('add_product');
@@ -2990,23 +3062,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
2990
3062
  } : undefined
2991
3063
  }) : undefined;
2992
3064
  if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher')) {
2993
- _context39.next = 16;
3065
+ _context40.next = 16;
2994
3066
  break;
2995
3067
  }
2996
3068
  if (guardedBridge.applyPromotionCode) {
2997
- _context39.next = 12;
3069
+ _context40.next = 12;
2998
3070
  break;
2999
3071
  }
3000
- return _context39.abrupt("return", {
3072
+ return _context40.abrupt("return", {
3001
3073
  status: 'failed',
3002
3074
  reason: 'no_bridge'
3003
3075
  });
3004
3076
  case 12:
3005
- _context39.next = 14;
3077
+ _context40.next = 14;
3006
3078
  return guardedBridge.applyPromotionCode(trimmed);
3007
3079
  case 14:
3008
- promotion = _context39.sent;
3009
- return _context39.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
3080
+ promotion = _context40.sent;
3081
+ return _context40.abrupt("return", ((_promotion$isAccepted = promotion.isAccepted) !== null && _promotion$isAccepted !== void 0 ? _promotion$isAccepted : promotion.isAvailable) ? {
3010
3082
  status: 'success',
3011
3083
  kind: 'promotion'
3012
3084
  } : {
@@ -3015,23 +3087,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3015
3087
  });
3016
3088
  case 16:
3017
3089
  localSearch = function localSearch(v) {
3018
- return _this8.store.products.findProductsByCodeOrBarcode(v);
3090
+ return _this10.store.products.findProductsByCodeOrBarcode(v);
3019
3091
  };
3020
3092
  scanCallback = handleGlobalScan(this.request, localSearch, this.getSubmitOrderSalesChannel());
3021
- _context39.next = 20;
3093
+ _context40.next = 20;
3022
3094
  return scanCallback({
3023
3095
  type: 'nativeScanner',
3024
3096
  value: trimmed
3025
3097
  });
3026
3098
  case 20:
3027
- raw = _context39.sent;
3099
+ raw = _context40.sent;
3028
3100
  formatted = formatGlobalScanResult(raw, trimmed);
3029
3101
  if (formatted) {
3030
- _context39.next = 25;
3102
+ _context40.next = 25;
3031
3103
  break;
3032
3104
  }
3033
3105
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
3034
- return _context39.abrupt("return", {
3106
+ return _context40.abrupt("return", {
3035
3107
  status: 'failed',
3036
3108
  reason: 'not_found'
3037
3109
  });
@@ -3039,74 +3111,73 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3039
3111
  host = {
3040
3112
  setOrderCustomer: function setOrderCustomer(customer) {
3041
3113
  beforeScanCommit();
3042
- _this8.setOrderCustomer(customer);
3114
+ _this10.setOrderCustomer(customer);
3043
3115
  },
3044
3116
  getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
3045
- return _this8.getOrderCustomerSnapshot();
3117
+ return _this10.getOrderCustomerSnapshot();
3046
3118
  },
3047
3119
  resolveCustomerById: function resolveCustomerById(customerId) {
3048
- return _this8.resolveCustomerById(customerId);
3120
+ return _this10.resolveCustomerById(customerId);
3049
3121
  },
3050
3122
  getBusinessCode: function getBusinessCode() {
3051
- var _this8$otherParams;
3052
- return (_this8$otherParams = _this8.otherParams) === null || _this8$otherParams === void 0 ? void 0 : _this8$otherParams.businessCode;
3123
+ var _this10$otherParams;
3124
+ return (_this10$otherParams = _this10.otherParams) === null || _this10$otherParams === void 0 ? void 0 : _this10$otherParams.businessCode;
3053
3125
  },
3054
3126
  buildAddProductCtx: function buildAddProductCtx(extra) {
3055
- return _this8.buildAddProductCtx(extra);
3127
+ return _this10.buildAddProductCtx(extra);
3056
3128
  },
3057
3129
  decideAddProduct: function decideAddProduct(item, options) {
3058
- return _this8.decideAddProduct(item, options);
3130
+ return _this10.decideAddProduct(item, options);
3059
3131
  },
3060
3132
  decideAfterDetail: function decideAfterDetail(cacheItem, options) {
3061
- return _this8.decideAfterDetail(cacheItem, options);
3133
+ return _this10.decideAfterDetail(cacheItem, options);
3062
3134
  },
3063
3135
  transformDetailToProductAndBooking: function transformDetailToProductAndBooking(input) {
3064
- return _this8.transformDetailToProductAndBooking(input);
3136
+ return _this10.transformDetailToProductAndBooking(input);
3065
3137
  },
3066
3138
  addProductToOrder: function addProductToOrder(product, booking) {
3067
3139
  beforeScanCommit();
3068
- return _this8.addProductToOrder(product, booking);
3140
+ return _this10.addProductToOrder(product, booking);
3069
3141
  },
3070
3142
  refreshWalletAssets: function refreshWalletAssets(params) {
3071
- return _this8.refreshWalletAssets(params);
3143
+ return _this10.refreshWalletAssets(params);
3072
3144
  },
3073
3145
  scanWalletAsset: function scanWalletAsset(scanCode) {
3074
3146
  beforeScanCommit();
3075
- return _this8.scanWalletAsset(scanCode);
3147
+ return _this10.scanWalletAsset(scanCode);
3076
3148
  }
3077
3149
  };
3078
3150
  if (!((guardedBridge === null || guardedBridge === void 0 ? void 0 : guardedBridge.scanScope) === 'product-voucher-collection')) {
3079
- _context39.next = 32;
3151
+ _context40.next = 32;
3080
3152
  break;
3081
3153
  }
3082
- _context39.next = 29;
3154
+ _context40.next = 29;
3083
3155
  return applyProductVoucherCollectionScan(_objectSpread(_objectSpread({}, host), {}, {
3084
- waitForCustomerDiscounts: function waitForCustomerDiscounts() {
3085
- return _this8.orderCustomerDiscountRefreshInFlight || Promise.resolve();
3086
- },
3087
3156
  loadCustomerDiscounts: function () {
3088
- var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3089
- var _this8$getOrderCustom;
3157
+ var _loadCustomerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3158
+ var _this10$getOrderCusto;
3090
3159
  var customerId;
3091
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3092
- while (1) switch (_context38.prev = _context38.next) {
3160
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3161
+ while (1) switch (_context39.prev = _context39.next) {
3093
3162
  case 0:
3094
- customerId = Number(((_this8$getOrderCustom = _this8.getOrderCustomer()) === null || _this8$getOrderCustom === void 0 ? void 0 : _this8$getOrderCustom.customer_id) || 0);
3163
+ beforeScanCommit();
3164
+ customerId = Number(((_this10$getOrderCusto = _this10.getOrderCustomer()) === null || _this10$getOrderCusto === void 0 ? void 0 : _this10$getOrderCusto.customer_id) || 0);
3095
3165
  if (!(customerId <= 1)) {
3096
- _context38.next = 3;
3166
+ _context39.next = 4;
3097
3167
  break;
3098
3168
  }
3099
- return _context38.abrupt("return", []);
3100
- case 3:
3101
- _context38.next = 5;
3102
- return _this8.refreshDiscountConfigAfterOrderCustomerChange(customerId);
3103
- case 5:
3104
- return _context38.abrupt("return", _this8.getDiscountList());
3169
+ return _context39.abrupt("return", []);
3170
+ case 4:
3171
+ _context39.next = 6;
3172
+ return _this10.refreshDiscountConfigAfterOrderCustomerChange(customerId);
3105
3173
  case 6:
3174
+ beforeScanCommit();
3175
+ return _context39.abrupt("return", _this10.getDiscountList());
3176
+ case 8:
3106
3177
  case "end":
3107
- return _context38.stop();
3178
+ return _context39.stop();
3108
3179
  }
3109
- }, _callee38);
3180
+ }, _callee39);
3110
3181
  }));
3111
3182
  function loadCustomerDiscounts() {
3112
3183
  return _loadCustomerDiscounts.apply(this, arguments);
@@ -3115,49 +3186,49 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3115
3186
  }()
3116
3187
  }), formatted, guardedBridge);
3117
3188
  case 29:
3118
- _context39.t0 = _context39.sent;
3119
- _context39.next = 35;
3189
+ _context40.t0 = _context40.sent;
3190
+ _context40.next = 35;
3120
3191
  break;
3121
3192
  case 32:
3122
- _context39.next = 34;
3193
+ _context40.next = 34;
3123
3194
  return applyGlobalScan(host, formatted, guardedBridge);
3124
3195
  case 34:
3125
- _context39.t0 = _context39.sent;
3196
+ _context40.t0 = _context40.sent;
3126
3197
  case 35:
3127
- _result8 = _context39.t0;
3198
+ _result8 = _context40.t0;
3128
3199
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
3129
- return _context39.abrupt("return", _result8);
3200
+ return _context40.abrupt("return", _result8);
3130
3201
  case 40:
3131
- _context39.prev = 40;
3132
- _context39.t1 = _context39["catch"](4);
3202
+ _context40.prev = 40;
3203
+ _context40.t1 = _context40["catch"](4);
3133
3204
  if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection')) {
3134
- _context39.next = 46;
3205
+ _context40.next = 46;
3135
3206
  break;
3136
3207
  }
3137
3208
  if (!(((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false)) {
3138
- _context39.next = 45;
3209
+ _context40.next = 45;
3139
3210
  break;
3140
3211
  }
3141
- return _context39.abrupt("return", {
3212
+ return _context40.abrupt("return", {
3142
3213
  status: 'cancelled'
3143
3214
  });
3144
3215
  case 45:
3145
- return _context39.abrupt("return", {
3216
+ return _context40.abrupt("return", {
3146
3217
  status: 'failed',
3147
3218
  reason: 'entry_resolution_failed'
3148
3219
  });
3149
3220
  case 46:
3150
- console.error('[BookingTicket] handleGlobalScanCode failed', _context39.t1);
3221
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context40.t1);
3151
3222
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
3152
- return _context39.abrupt("return", {
3223
+ return _context40.abrupt("return", {
3153
3224
  status: 'failed',
3154
3225
  reason: 'not_found'
3155
3226
  });
3156
3227
  case 49:
3157
3228
  case "end":
3158
- return _context39.stop();
3229
+ return _context40.stop();
3159
3230
  }
3160
- }, _callee39, this, [[4, 40]]);
3231
+ }, _callee40, this, [[4, 40]]);
3161
3232
  }));
3162
3233
  function handleGlobalScanCode(_x23, _x24) {
3163
3234
  return _handleGlobalScanCode.apply(this, arguments);
@@ -3167,37 +3238,37 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3167
3238
  }, {
3168
3239
  key: "getGlobalScanCodeType",
3169
3240
  value: (function () {
3170
- var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(code) {
3171
- var _this9 = this,
3241
+ var _getGlobalScanCodeType = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(code) {
3242
+ var _this11 = this,
3172
3243
  _formatGlobalScanResu,
3173
3244
  _formatGlobalScanResu2;
3174
3245
  var trimmed, scan, raw;
3175
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3176
- while (1) switch (_context40.prev = _context40.next) {
3246
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3247
+ while (1) switch (_context41.prev = _context41.next) {
3177
3248
  case 0:
3178
3249
  trimmed = typeof code === 'string' ? code.trim() : '';
3179
3250
  if (trimmed) {
3180
- _context40.next = 3;
3251
+ _context41.next = 3;
3181
3252
  break;
3182
3253
  }
3183
- return _context40.abrupt("return", null);
3254
+ return _context41.abrupt("return", null);
3184
3255
  case 3:
3185
3256
  scan = handleGlobalScan(this.request, function (value) {
3186
- return _this9.store.products.findProductsByCodeOrBarcode(value);
3257
+ return _this11.store.products.findProductsByCodeOrBarcode(value);
3187
3258
  }, this.getSubmitOrderSalesChannel());
3188
- _context40.next = 6;
3259
+ _context41.next = 6;
3189
3260
  return scan({
3190
3261
  type: 'nativeScanner',
3191
3262
  value: trimmed
3192
3263
  });
3193
3264
  case 6:
3194
- raw = _context40.sent;
3195
- return _context40.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3265
+ raw = _context41.sent;
3266
+ return _context41.abrupt("return", (_formatGlobalScanResu = (_formatGlobalScanResu2 = formatGlobalScanResult(raw, trimmed)) === null || _formatGlobalScanResu2 === void 0 ? void 0 : _formatGlobalScanResu2.searchType) !== null && _formatGlobalScanResu !== void 0 ? _formatGlobalScanResu : null);
3196
3267
  case 8:
3197
3268
  case "end":
3198
- return _context40.stop();
3269
+ return _context41.stop();
3199
3270
  }
3200
- }, _callee40, this);
3271
+ }, _callee41, this);
3201
3272
  }));
3202
3273
  function getGlobalScanCodeType(_x25) {
3203
3274
  return _getGlobalScanCodeType.apply(this, arguments);
@@ -3281,11 +3352,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3281
3352
  }, {
3282
3353
  key: "addAddTimeProductToBooking",
3283
3354
  value: (function () {
3284
- var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(input) {
3285
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3286
- while (1) switch (_context41.prev = _context41.next) {
3355
+ var _addAddTimeProductToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
3356
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3357
+ while (1) switch (_context42.prev = _context42.next) {
3287
3358
  case 0:
3288
- return _context41.abrupt("return", this.addAddTimeProductsToBooking({
3359
+ return _context42.abrupt("return", this.addAddTimeProductsToBooking({
3289
3360
  booking: input.booking,
3290
3361
  products: [input],
3291
3362
  coveredMinutes: input.coveredMinutes,
@@ -3293,9 +3364,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3293
3364
  }));
3294
3365
  case 1:
3295
3366
  case "end":
3296
- return _context41.stop();
3367
+ return _context42.stop();
3297
3368
  }
3298
- }, _callee41, this);
3369
+ }, _callee42, this);
3299
3370
  }));
3300
3371
  function addAddTimeProductToBooking(_x26) {
3301
3372
  return _addAddTimeProductToBooking.apply(this, arguments);
@@ -3315,27 +3386,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3315
3386
  }, {
3316
3387
  key: "addAddTimeProductsToBooking",
3317
3388
  value: (function () {
3318
- var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(input) {
3319
- var _this10 = this,
3389
+ var _addAddTimeProductsToBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(input) {
3390
+ var _this12 = this,
3320
3391
  _input$bookingPatch;
3321
3392
  var bookingUid, orderLines, coveredMinutes, bookingTimePatch, result, _iterator2, _step2, line;
3322
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3323
- while (1) switch (_context42.prev = _context42.next) {
3393
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3394
+ while (1) switch (_context43.prev = _context43.next) {
3324
3395
  case 0:
3325
3396
  bookingUid = resolveBookingUidForAddTime(input === null || input === void 0 ? void 0 : input.booking);
3326
3397
  if (bookingUid) {
3327
- _context42.next = 3;
3398
+ _context43.next = 3;
3328
3399
  break;
3329
3400
  }
3330
3401
  throw new Error('[BookingTicket] addAddTimeProductToBooking: booking.metadata.unique_identification_number 缺失');
3331
3402
  case 3:
3332
3403
  orderLines = (input.products || []).map(function (line) {
3333
3404
  return {
3334
- product: _this10.buildAddTimeOrderLine(line, bookingUid)
3405
+ product: _this12.buildAddTimeOrderLine(line, bookingUid)
3335
3406
  };
3336
3407
  });
3337
3408
  if (this.store.order) {
3338
- _context42.next = 6;
3409
+ _context43.next = 6;
3339
3410
  break;
3340
3411
  }
3341
3412
  throw new Error('order 模块未初始化');
@@ -3349,53 +3420,53 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3349
3420
  });
3350
3421
  }
3351
3422
  if (!(typeof this.store.order.addProductsToOrder === 'function')) {
3352
- _context42.next = 11;
3423
+ _context43.next = 11;
3353
3424
  break;
3354
3425
  }
3355
- return _context42.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3426
+ return _context43.abrupt("return", this.store.order.addProductsToOrder(orderLines));
3356
3427
  case 11:
3357
3428
  result = [];
3358
3429
  _iterator2 = _createForOfIteratorHelper(orderLines);
3359
- _context42.prev = 13;
3430
+ _context43.prev = 13;
3360
3431
  _iterator2.s();
3361
3432
  case 15:
3362
3433
  if ((_step2 = _iterator2.n()).done) {
3363
- _context42.next = 29;
3434
+ _context43.next = 29;
3364
3435
  break;
3365
3436
  }
3366
3437
  line = _step2.value;
3367
- _context42.t0 = result.splice;
3368
- _context42.t1 = result;
3369
- _context42.t2 = [0, result.length];
3370
- _context42.t3 = _toConsumableArray;
3371
- _context42.next = 23;
3438
+ _context43.t0 = result.splice;
3439
+ _context43.t1 = result;
3440
+ _context43.t2 = [0, result.length];
3441
+ _context43.t3 = _toConsumableArray;
3442
+ _context43.next = 23;
3372
3443
  return this.addProductToOrder(line.product);
3373
3444
  case 23:
3374
- _context42.t4 = _context42.sent;
3375
- _context42.t5 = (0, _context42.t3)(_context42.t4);
3376
- _context42.t6 = _context42.t2.concat.call(_context42.t2, _context42.t5);
3377
- _context42.t0.apply.call(_context42.t0, _context42.t1, _context42.t6);
3445
+ _context43.t4 = _context43.sent;
3446
+ _context43.t5 = (0, _context43.t3)(_context43.t4);
3447
+ _context43.t6 = _context43.t2.concat.call(_context43.t2, _context43.t5);
3448
+ _context43.t0.apply.call(_context43.t0, _context43.t1, _context43.t6);
3378
3449
  case 27:
3379
- _context42.next = 15;
3450
+ _context43.next = 15;
3380
3451
  break;
3381
3452
  case 29:
3382
- _context42.next = 34;
3453
+ _context43.next = 34;
3383
3454
  break;
3384
3455
  case 31:
3385
- _context42.prev = 31;
3386
- _context42.t7 = _context42["catch"](13);
3387
- _iterator2.e(_context42.t7);
3456
+ _context43.prev = 31;
3457
+ _context43.t7 = _context43["catch"](13);
3458
+ _iterator2.e(_context43.t7);
3388
3459
  case 34:
3389
- _context42.prev = 34;
3460
+ _context43.prev = 34;
3390
3461
  _iterator2.f();
3391
- return _context42.finish(34);
3462
+ return _context43.finish(34);
3392
3463
  case 37:
3393
- return _context42.abrupt("return", result);
3464
+ return _context43.abrupt("return", result);
3394
3465
  case 38:
3395
3466
  case "end":
3396
- return _context42.stop();
3467
+ return _context43.stop();
3397
3468
  }
3398
- }, _callee42, this, [[13, 31, 34, 37]]);
3469
+ }, _callee43, this, [[13, 31, 34, 37]]);
3399
3470
  }));
3400
3471
  function addAddTimeProductsToBooking(_x27) {
3401
3472
  return _addAddTimeProductsToBooking.apply(this, arguments);
@@ -3405,47 +3476,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3405
3476
  }, {
3406
3477
  key: "setOtherParams",
3407
3478
  value: function () {
3408
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3409
- var _this11 = this;
3479
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3480
+ var _this13 = this;
3410
3481
  var _ref21,
3411
3482
  _ref21$cover,
3412
3483
  cover,
3413
3484
  nextParams,
3414
3485
  invoiceContextChanged,
3415
- _args43 = arguments;
3416
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3417
- while (1) switch (_context43.prev = _context43.next) {
3486
+ _args44 = arguments;
3487
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3488
+ while (1) switch (_context44.prev = _context44.next) {
3418
3489
  case 0:
3419
- _ref21 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3490
+ _ref21 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref21$cover = _ref21.cover, cover = _ref21$cover === void 0 ? false : _ref21$cover;
3420
3491
  nextParams = cover ? params : _objectSpread(_objectSpread({}, this.otherParams), params);
3421
3492
  if (['businessCode', 'business_code', 'channel', 'platform', 'shop_id', 'tenantId', 'cacheId'].some(function (key) {
3422
- var _this11$otherParams;
3423
- return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this11$otherParams = _this11.otherParams) === null || _this11$otherParams === void 0 ? void 0 : _this11$otherParams[key]);
3493
+ var _this13$otherParams;
3494
+ return (nextParams === null || nextParams === void 0 ? void 0 : nextParams[key]) !== ((_this13$otherParams = _this13.otherParams) === null || _this13$otherParams === void 0 ? void 0 : _this13$otherParams[key]);
3424
3495
  })) this.orderCustomerContactRequest = null;
3425
- _context43.next = 5;
3496
+ _context44.next = 5;
3426
3497
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "setOtherParams", this).call(this, params, {
3427
3498
  cover: cover
3428
3499
  });
3429
3500
  case 5:
3430
3501
  invoiceContextChanged = (params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined || (params === null || params === void 0 ? void 0 : params.channel) !== undefined || (params === null || params === void 0 ? void 0 : params.platform) !== undefined || Object.prototype.hasOwnProperty.call(params, 'openData');
3431
3502
  if (!invoiceContextChanged) {
3432
- _context43.next = 9;
3503
+ _context44.next = 9;
3433
3504
  break;
3434
3505
  }
3435
- _context43.next = 9;
3506
+ _context44.next = 9;
3436
3507
  return this.prepareInvoiceTemplateAtSolutionReady(Object.prototype.hasOwnProperty.call(params, 'openData') ? this.getInjectedOpenDataConfig() : undefined);
3437
3508
  case 9:
3438
3509
  if (!((params === null || params === void 0 ? void 0 : params.businessCode) !== undefined || (params === null || params === void 0 ? void 0 : params.business_code) !== undefined)) {
3439
- _context43.next = 12;
3510
+ _context44.next = 12;
3440
3511
  break;
3441
3512
  }
3442
- _context43.next = 12;
3513
+ _context44.next = 12;
3443
3514
  return this.configureIdGeneratorFromOpenData();
3444
3515
  case 12:
3445
3516
  case "end":
3446
- return _context43.stop();
3517
+ return _context44.stop();
3447
3518
  }
3448
- }, _callee43, this);
3519
+ }, _callee44, this);
3449
3520
  }));
3450
3521
  function setOtherParams(_x28) {
3451
3522
  return _setOtherParams.apply(this, arguments);
@@ -3464,15 +3535,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3464
3535
  }, {
3465
3536
  key: "handlePrintWristband",
3466
3537
  value: function () {
3467
- var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3538
+ var _handlePrintWristband = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3468
3539
  var _this$getOrderIdentit2;
3469
3540
  var deviceTask, deviceId, idempotencyKey;
3470
- return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3471
- while (1) switch (_context44.prev = _context44.next) {
3541
+ return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3542
+ while (1) switch (_context45.prev = _context45.next) {
3472
3543
  case 0:
3473
3544
  deviceTask = this.getDeviceTaskPlugin();
3474
3545
  if (deviceTask !== null && deviceTask !== void 0 && deviceTask.dispatch) {
3475
- _context44.next = 4;
3546
+ _context45.next = 4;
3476
3547
  break;
3477
3548
  }
3478
3549
  this.logger.addLog({
@@ -3482,7 +3553,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3482
3553
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3483
3554
  }
3484
3555
  });
3485
- return _context44.abrupt("return");
3556
+ return _context45.abrupt("return");
3486
3557
  case 4:
3487
3558
  this.logger.addLog({
3488
3559
  type: 'info',
@@ -3491,20 +3562,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3491
3562
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3492
3563
  }
3493
3564
  });
3494
- _context44.next = 7;
3565
+ _context45.next = 7;
3495
3566
  return this.getShortNumberOrDeviceId();
3496
3567
  case 7:
3497
- deviceId = _context44.sent;
3568
+ deviceId = _context45.sent;
3498
3569
  idempotencyKey = createUuidV4();
3499
3570
  deviceTask.dispatch({
3500
3571
  action: 'print_all',
3501
3572
  device_id: deviceId,
3502
3573
  payload: {
3503
3574
  type: 'WRISTBAND',
3504
- data: {
3505
- order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId,
3575
+ data: _objectSpread(_objectSpread({
3576
+ order_id: (_this$getOrderIdentit2 = this.getOrderIdentity()) === null || _this$getOrderIdentit2 === void 0 ? void 0 : _this$getOrderIdentit2.orderId
3577
+ }, params.voucher_times && {
3578
+ voucher_times: params.voucher_times
3579
+ }), {}, {
3506
3580
  voucher_ids: Array.isArray(params.voucher_ids) ? params.voucher_ids : [params.voucher_ids]
3507
- }
3581
+ })
3508
3582
  },
3509
3583
  idempotency_key: idempotencyKey,
3510
3584
  name: 'PRINT_WRISTBAND',
@@ -3514,9 +3588,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3514
3588
  });
3515
3589
  case 10:
3516
3590
  case "end":
3517
- return _context44.stop();
3591
+ return _context45.stop();
3518
3592
  }
3519
- }, _callee44, this);
3593
+ }, _callee45, this);
3520
3594
  }));
3521
3595
  function handlePrintWristband(_x29) {
3522
3596
  return _handlePrintWristband.apply(this, arguments);
@@ -3539,11 +3613,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3539
3613
  }, {
3540
3614
  key: "handleRedeem",
3541
3615
  value: function () {
3542
- var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
3616
+ var _handleRedeem = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
3543
3617
  var _this$store$order8, _this$store$order8$ge, _this$store$order9, _ref22, _tempOrder$order_id2;
3544
3618
  var voucherIds, status, voucherIdSet, tempOrder, vouchers, hasUpdatedVoucher, nextVouchers, write, identity, externalSaleNumber, orderId, orderLookup;
3545
- return _regeneratorRuntime().wrap(function _callee45$(_context45) {
3546
- while (1) switch (_context45.prev = _context45.next) {
3619
+ return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3620
+ while (1) switch (_context46.prev = _context46.next) {
3547
3621
  case 0:
3548
3622
  voucherIds = Array.isArray(params.voucher_ids) ? params.voucher_ids : [];
3549
3623
  status = params.is_checkin ? 'used' : 'unused';
@@ -3567,27 +3641,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3567
3641
  });
3568
3642
  });
3569
3643
  if (!(tempOrder && hasUpdatedVoucher)) {
3570
- _context45.next = 17;
3644
+ _context46.next = 17;
3571
3645
  break;
3572
3646
  }
3573
3647
  write = this.replaceTempOrder(_objectSpread(_objectSpread({}, tempOrder), {}, {
3574
3648
  vouchers: nextVouchers
3575
- }));
3649
+ }), {
3650
+ preserveOrderSessionId: this.getOrderSessionId() || undefined
3651
+ });
3576
3652
  this.redeemStatusWrite = write;
3577
- _context45.prev = 11;
3578
- _context45.next = 14;
3653
+ _context46.prev = 11;
3654
+ _context46.next = 14;
3579
3655
  return write;
3580
3656
  case 14:
3581
- _context45.prev = 14;
3657
+ _context46.prev = 14;
3582
3658
  if (this.redeemStatusWrite === write) this.redeemStatusWrite = undefined;
3583
- return _context45.finish(14);
3659
+ return _context46.finish(14);
3584
3660
  case 17:
3585
3661
  this.core.effects.emit("".concat(this.name, ":onVouchersChange"), {});
3586
3662
  if (!(voucherIds.length === 0)) {
3587
- _context45.next = 20;
3663
+ _context46.next = 20;
3588
3664
  break;
3589
3665
  }
3590
- return _context45.abrupt("return", {
3666
+ return _context46.abrupt("return", {
3591
3667
  code: 200,
3592
3668
  status: true,
3593
3669
  message: '',
@@ -3598,7 +3674,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3598
3674
  externalSaleNumber = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.external_sale_number) || (identity === null || identity === void 0 ? void 0 : identity.externalSaleNumber) || undefined;
3599
3675
  orderId = (_ref22 = (_tempOrder$order_id2 = tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) !== null && _tempOrder$order_id2 !== void 0 ? _tempOrder$order_id2 : identity === null || identity === void 0 ? void 0 : identity.orderId) !== null && _ref22 !== void 0 ? _ref22 : undefined;
3600
3676
  orderLookup = externalSaleNumber || orderId || (identity === null || identity === void 0 ? void 0 : identity.orderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopOrderNumber) || (identity === null || identity === void 0 ? void 0 : identity.shopFullOrderNumber) || undefined;
3601
- return _context45.abrupt("return", this.request.post('/machinecode/batch', {
3677
+ return _context46.abrupt("return", this.request.post('/machinecode/batch', {
3602
3678
  ids: voucherIds,
3603
3679
  status: status,
3604
3680
  order_lookup: orderLookup,
@@ -3609,9 +3685,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3609
3685
  }));
3610
3686
  case 25:
3611
3687
  case "end":
3612
- return _context45.stop();
3688
+ return _context46.stop();
3613
3689
  }
3614
- }, _callee45, this, [[11,, 14, 17]]);
3690
+ }, _callee46, this, [[11,, 14, 17]]);
3615
3691
  }));
3616
3692
  function handleRedeem(_x30) {
3617
3693
  return _handleRedeem.apply(this, arguments);
@@ -3621,25 +3697,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3621
3697
  }, {
3622
3698
  key: "updateTicketArrival",
3623
3699
  value: function () {
3624
- var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(voucherIds) {
3700
+ var _updateTicketArrival = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(voucherIds) {
3625
3701
  var _this$store$order10,
3626
3702
  _this$store$order10$g,
3627
- _this12 = this;
3703
+ _this14 = this;
3628
3704
  var window, tempOrder, log, operation, arrivalTime, updateArrival, completion;
3629
- return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3630
- while (1) switch (_context47.prev = _context47.next) {
3705
+ return _regeneratorRuntime().wrap(function _callee48$(_context48) {
3706
+ while (1) switch (_context48.prev = _context48.next) {
3631
3707
  case 0:
3632
3708
  window = this.getRedeemArrivalWindow();
3633
3709
  tempOrder = (_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$g = _this$store$order10.getTempOrder) === null || _this$store$order10$g === void 0 ? void 0 : _this$store$order10$g.call(_this$store$order10);
3634
3710
  log = createArrivalLogger(this.logger, tempOrder, voucherIds);
3635
3711
  if (!(!window || !tempOrder)) {
3636
- _context47.next = 6;
3712
+ _context48.next = 6;
3637
3713
  break;
3638
3714
  }
3639
3715
  log('skipped', {
3640
3716
  reason: !window ? 'no_effective_window' : 'missing_order'
3641
3717
  });
3642
- return _context47.abrupt("return");
3718
+ return _context48.abrupt("return");
3643
3719
  case 6:
3644
3720
  log('started', {
3645
3721
  early_minutes: window.earlyMinutes,
@@ -3648,23 +3724,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3648
3724
  operation = 'prepare';
3649
3725
  arrivalTime = new Date();
3650
3726
  updateArrival = /*#__PURE__*/function () {
3651
- var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46() {
3652
- var _this12$store$order, _this12$store$order$g, _next$summary;
3653
- var current, sameOrder, order, arrival, next, query, checkout, latest, patch;
3654
- return _regeneratorRuntime().wrap(function _callee46$(_context46) {
3655
- while (1) switch (_context46.prev = _context46.next) {
3727
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47() {
3728
+ var _this14$store$order, _this14$store$order$g, _next$summary;
3729
+ var current, sameOrder, order, arrival, next, query, checkout, latest, patch, voucherTimes;
3730
+ return _regeneratorRuntime().wrap(function _callee47$(_context47) {
3731
+ while (1) switch (_context47.prev = _context47.next) {
3656
3732
  case 0:
3657
- if (!_this12.redeemStatusWrite) {
3658
- _context46.next = 3;
3733
+ if (!_this14.redeemStatusWrite) {
3734
+ _context47.next = 3;
3659
3735
  break;
3660
3736
  }
3661
- _context46.next = 3;
3662
- return _this12.redeemStatusWrite.catch(function () {});
3737
+ _context47.next = 3;
3738
+ return _this14.redeemStatusWrite.catch(function () {});
3663
3739
  case 3:
3664
- current = (_this12$store$order = _this12.store.order) === null || _this12$store$order === void 0 || (_this12$store$order$g = _this12$store$order.getTempOrder) === null || _this12$store$order$g === void 0 ? void 0 : _this12$store$order$g.call(_this12$store$order);
3740
+ current = (_this14$store$order = _this14.store.order) === null || _this14$store$order === void 0 || (_this14$store$order$g = _this14$store$order.getTempOrder) === null || _this14$store$order$g === void 0 ? void 0 : _this14$store$order$g.call(_this14$store$order);
3665
3741
  sameOrder = function sameOrder() {
3666
- var _this12$store$order2, _this12$store$order2$;
3667
- var active = (_this12$store$order2 = _this12.store.order) === null || _this12$store$order2 === void 0 || (_this12$store$order2$ = _this12$store$order2.getTempOrder) === null || _this12$store$order2$ === void 0 ? void 0 : _this12$store$order2$.call(_this12$store$order2);
3742
+ var _this14$store$order2, _this14$store$order2$;
3743
+ var active = (_this14$store$order2 = _this14.store.order) === null || _this14$store$order2 === void 0 || (_this14$store$order2$ = _this14$store$order2.getTempOrder) === null || _this14$store$order2$ === void 0 ? void 0 : _this14$store$order2$.call(_this14$store$order2);
3668
3744
  return active && active.order_id === tempOrder.order_id && active.external_sale_number === tempOrder.external_sale_number;
3669
3745
  };
3670
3746
  order = current && sameOrder() ? current : tempOrder;
@@ -3674,51 +3750,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3674
3750
  });
3675
3751
  });
3676
3752
  if (arrival) {
3677
- _context46.next = 9;
3753
+ _context47.next = 9;
3678
3754
  break;
3679
3755
  }
3680
- return _context46.abrupt("return");
3756
+ return _context47.abrupt("return");
3681
3757
  case 9:
3682
3758
  next = _objectSpread(_objectSpread({}, order), arrival);
3683
- _context46.t0 = buildArrivalCheckoutQuery;
3684
- _context46.t1 = next;
3759
+ _context47.t0 = buildArrivalCheckoutQuery;
3760
+ _context47.t1 = next;
3685
3761
  if (!((_next$summary = next.summary) !== null && _next$summary !== void 0)) {
3686
- _context46.next = 16;
3762
+ _context47.next = 16;
3687
3763
  break;
3688
3764
  }
3689
- _context46.t2 = _next$summary;
3690
- _context46.next = 24;
3765
+ _context47.t2 = _next$summary;
3766
+ _context47.next = 24;
3691
3767
  break;
3692
3768
  case 16:
3693
3769
  if (!sameOrder()) {
3694
- _context46.next = 22;
3770
+ _context47.next = 22;
3695
3771
  break;
3696
3772
  }
3697
- _context46.next = 19;
3698
- return _this12.getSummary();
3773
+ _context47.next = 19;
3774
+ return _this14.getSummary();
3699
3775
  case 19:
3700
- _context46.t3 = _context46.sent;
3701
- _context46.next = 23;
3776
+ _context47.t3 = _context47.sent;
3777
+ _context47.next = 23;
3702
3778
  break;
3703
3779
  case 22:
3704
- _context46.t3 = undefined;
3780
+ _context47.t3 = undefined;
3705
3781
  case 23:
3706
- _context46.t2 = _context46.t3;
3782
+ _context47.t2 = _context47.t3;
3707
3783
  case 24:
3708
- _context46.t4 = _context46.t2;
3709
- query = (0, _context46.t0)(_context46.t1, _context46.t4);
3784
+ _context47.t4 = _context47.t2;
3785
+ query = (0, _context47.t0)(_context47.t1, _context47.t4);
3710
3786
  operation = 'checkout';
3711
3787
  log('checkout_requested', {
3712
3788
  bookings: describeChangedBookings(order.bookings, arrival.bookings)
3713
3789
  });
3714
- _context46.next = 30;
3715
- return _this12.store.order.submitSalesOrder({
3790
+ _context47.next = 30;
3791
+ return _this14.store.order.submitSalesOrder({
3716
3792
  query: query
3717
3793
  });
3718
3794
  case 30:
3719
- checkout = _context46.sent;
3795
+ checkout = _context47.sent;
3720
3796
  if (!((checkout === null || checkout === void 0 ? void 0 : checkout.status) === false || (checkout === null || checkout === void 0 ? void 0 : checkout.code) != null && checkout.code !== 200)) {
3721
- _context46.next = 34;
3797
+ _context47.next = 34;
3722
3798
  break;
3723
3799
  }
3724
3800
  log('checkout_rejected', {
@@ -3726,54 +3802,66 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3726
3802
  status: checkout.status,
3727
3803
  message: checkout.message
3728
3804
  }, true);
3729
- return _context46.abrupt("return", checkout);
3805
+ return _context47.abrupt("return", checkout);
3730
3806
  case 34:
3731
3807
  log('checkout_accepted', {
3732
3808
  code: checkout === null || checkout === void 0 ? void 0 : checkout.code
3733
3809
  });
3734
3810
  operation = 'local_update';
3735
- if (!_this12.redeemStatusWrite) {
3736
- _context46.next = 39;
3811
+ if (!_this14.redeemStatusWrite) {
3812
+ _context47.next = 39;
3737
3813
  break;
3738
3814
  }
3739
- _context46.next = 39;
3740
- return _this12.redeemStatusWrite.catch(function () {});
3815
+ _context47.next = 39;
3816
+ return _this14.redeemStatusWrite.catch(function () {});
3741
3817
  case 39:
3742
3818
  if (!sameOrder()) {
3743
- _context46.next = 52;
3819
+ _context47.next = 52;
3744
3820
  break;
3745
3821
  }
3746
- latest = _this12.store.order.getTempOrder();
3822
+ latest = _this14.store.order.getTempOrder();
3747
3823
  patch = applyRedeemArrival(latest, new Set(voucherIds.map(String)), arrivalTime, window);
3748
3824
  if (!patch) {
3749
- _context46.next = 49;
3825
+ _context47.next = 49;
3750
3826
  break;
3751
3827
  }
3752
- _context46.next = 45;
3753
- return _this12.replaceTempOrder(_objectSpread(_objectSpread({}, latest), patch));
3828
+ _context47.next = 45;
3829
+ return _this14.replaceTempOrder(_objectSpread(_objectSpread({}, latest), patch));
3754
3830
  case 45:
3755
3831
  log('local_updated');
3756
- _this12.core.effects.emit("".concat(_this12.name, ":onVouchersChange"), {});
3757
- _context46.next = 50;
3832
+ _this14.core.effects.emit("".concat(_this14.name, ":onVouchersChange"), {});
3833
+ _context47.next = 50;
3758
3834
  break;
3759
3835
  case 49:
3760
3836
  log('local_skipped', {
3761
3837
  reason: 'no_pending_change'
3762
3838
  });
3763
3839
  case 50:
3764
- _context46.next = 53;
3840
+ _context47.next = 53;
3765
3841
  break;
3766
3842
  case 52:
3767
3843
  log('local_skipped', {
3768
3844
  reason: 'order_changed'
3769
3845
  });
3770
3846
  case 53:
3771
- return _context46.abrupt("return", checkout);
3772
- case 54:
3847
+ // 从本次 checkout 已接受的快照取票面时间,避免打印接口短暂返回旧值。
3848
+ voucherTimes = {};
3849
+ arrival.vouchers.forEach(function (voucher, index) {
3850
+ if (voucher !== order.vouchers[index] && voucher.voucher_id != null && voucher.start_time && voucher.end_time) {
3851
+ voucherTimes[String(voucher.voucher_id)] = {
3852
+ start_time: voucher.start_time,
3853
+ end_time: voucher.end_time
3854
+ };
3855
+ }
3856
+ });
3857
+ return _context47.abrupt("return", Object.keys(voucherTimes).length ? _objectSpread(_objectSpread({}, checkout), {}, {
3858
+ voucher_times: voucherTimes
3859
+ }) : checkout);
3860
+ case 56:
3773
3861
  case "end":
3774
- return _context46.stop();
3862
+ return _context47.stop();
3775
3863
  }
3776
- }, _callee46);
3864
+ }, _callee47);
3777
3865
  }));
3778
3866
  return function updateArrival() {
3779
3867
  return _ref23.apply(this, arguments);
@@ -3787,12 +3875,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3787
3875
  throw error;
3788
3876
  });
3789
3877
  this.arrivalQueue = completion.then(function () {}, function () {});
3790
- return _context47.abrupt("return", completion);
3878
+ return _context48.abrupt("return", completion);
3791
3879
  case 13:
3792
3880
  case "end":
3793
- return _context47.stop();
3881
+ return _context48.stop();
3794
3882
  }
3795
- }, _callee47, this);
3883
+ }, _callee48, this);
3796
3884
  }));
3797
3885
  function updateTicketArrival(_x31) {
3798
3886
  return _updateTicketArrival.apply(this, arguments);
@@ -3806,13 +3894,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3806
3894
  }, {
3807
3895
  key: "destroy",
3808
3896
  value: (function () {
3809
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48() {
3897
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49() {
3810
3898
  var _this$scan;
3811
- return _regeneratorRuntime().wrap(function _callee48$(_context48) {
3812
- while (1) switch (_context48.prev = _context48.next) {
3899
+ return _regeneratorRuntime().wrap(function _callee49$(_context49) {
3900
+ while (1) switch (_context49.prev = _context49.next) {
3813
3901
  case 0:
3814
3902
  this.orderCustomerContactRequest = null;
3815
- _context48.next = 3;
3903
+ _context49.next = 3;
3816
3904
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
3817
3905
  case 3:
3818
3906
  try {
@@ -3823,9 +3911,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
3823
3911
  scanCache.clear();
3824
3912
  case 5:
3825
3913
  case "end":
3826
- return _context48.stop();
3914
+ return _context49.stop();
3827
3915
  }
3828
- }, _callee48, this);
3916
+ }, _callee49, this);
3829
3917
  }));
3830
3918
  function destroy() {
3831
3919
  return _destroy.apply(this, arguments);