@pisell/pisellos 2.2.162 → 2.2.164

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 (116) hide show
  1. package/dist/modules/BookingContext/index.d.ts +37 -0
  2. package/dist/modules/BookingContext/index.js +436 -0
  3. package/dist/modules/BookingContext/types.d.ts +102 -0
  4. package/dist/modules/BookingContext/types.js +51 -0
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +157 -0
  7. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +107 -0
  9. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +191 -0
  11. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  12. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  13. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  15. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  16. package/dist/modules/BookingContext/utils/index.js +11 -0
  17. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  18. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  19. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  20. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  21. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  23. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  25. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  26. package/dist/modules/BookingContext/utils/resources.js +486 -0
  27. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  29. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  31. package/dist/modules/Customer/index.js +23 -22
  32. package/dist/modules/Discount/index.js +4 -3
  33. package/dist/modules/Order/index.d.ts +17 -6
  34. package/dist/modules/Order/index.js +474 -287
  35. package/dist/modules/Order/types.d.ts +32 -12
  36. package/dist/modules/Order/utils.js +9 -8
  37. package/dist/modules/SalesSummary/index.js +4 -2
  38. package/dist/modules/index.d.ts +1 -0
  39. package/dist/modules/index.js +2 -1
  40. package/dist/solution/BaseSales/index.d.ts +38 -7
  41. package/dist/solution/BaseSales/index.js +797 -310
  42. package/dist/solution/BaseSales/types.d.ts +48 -1
  43. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  44. package/dist/solution/BaseSales/utils/quotationPrice.js +159 -0
  45. package/dist/solution/BookingByStep/index.d.ts +2 -2
  46. package/dist/solution/BookingTicket/index.d.ts +121 -1
  47. package/dist/solution/BookingTicket/index.js +401 -72
  48. package/dist/solution/BookingTicket/types.d.ts +2 -0
  49. package/dist/solution/BookingTicket/types.js +3 -0
  50. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  51. package/dist/solution/BookingTicket/utils/addProductDecision.js +326 -0
  52. package/dist/solution/ScanOrder/index.d.ts +9 -3
  53. package/dist/solution/ScanOrder/index.js +231 -128
  54. package/dist/solution/VenueBooking/index.d.ts +4 -2
  55. package/dist/solution/VenueBooking/index.js +103 -55
  56. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  57. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  58. package/lib/model/strategy/adapter/promotion/index.js +0 -49
  59. package/lib/modules/BookingContext/index.d.ts +37 -0
  60. package/lib/modules/BookingContext/index.js +297 -0
  61. package/lib/modules/BookingContext/types.d.ts +102 -0
  62. package/lib/modules/BookingContext/types.js +34 -0
  63. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  64. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +174 -0
  65. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  66. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +115 -0
  67. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +65 -0
  68. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +177 -0
  69. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  70. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  71. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  72. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  73. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  74. package/lib/modules/BookingContext/utils/index.js +43 -0
  75. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  76. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  77. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  78. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  79. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  80. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  81. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  82. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  83. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  84. package/lib/modules/BookingContext/utils/resources.js +377 -0
  85. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  86. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  87. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  88. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  89. package/lib/modules/Customer/index.js +8 -8
  90. package/lib/modules/Discount/index.js +5 -1
  91. package/lib/modules/Order/index.d.ts +17 -6
  92. package/lib/modules/Order/index.js +164 -68
  93. package/lib/modules/Order/types.d.ts +32 -12
  94. package/lib/modules/Order/utils.js +8 -6
  95. package/lib/modules/SalesSummary/index.js +4 -2
  96. package/lib/modules/index.d.ts +1 -0
  97. package/lib/modules/index.js +3 -1
  98. package/lib/solution/BaseSales/index.d.ts +38 -7
  99. package/lib/solution/BaseSales/index.js +304 -14
  100. package/lib/solution/BaseSales/types.d.ts +48 -1
  101. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  102. package/lib/solution/BaseSales/utils/quotationPrice.js +201 -0
  103. package/lib/solution/BookingByStep/index.d.ts +2 -2
  104. package/lib/solution/BookingTicket/index.d.ts +121 -1
  105. package/lib/solution/BookingTicket/index.js +207 -2
  106. package/lib/solution/BookingTicket/types.d.ts +2 -0
  107. package/lib/solution/BookingTicket/types.js +6 -0
  108. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +111 -0
  109. package/lib/solution/BookingTicket/utils/addProductDecision.js +300 -0
  110. package/lib/solution/ScanOrder/index.d.ts +9 -3
  111. package/lib/solution/ScanOrder/index.js +147 -66
  112. package/lib/solution/VenueBooking/index.d.ts +4 -2
  113. package/lib/solution/VenueBooking/index.js +50 -14
  114. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  115. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  116. package/package.json +1 -1
@@ -30,12 +30,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
30
30
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
31
31
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
32
32
  import { createBookingTicketModule } from "./types";
33
+ import { getProductExtend as getProductExtendUtil, getResourceByIds as getResourceByIdsUtil, getResourceErrors as getResourceErrorsUtil, derivePresetStartTimeFromDate } from "../../modules/BookingContext";
33
34
  import { BaseSalesImpl } from "../BaseSales";
34
35
  import Scan from "./utils/scan";
35
36
  import { formatOrderCustomerPatch } from "./utils/orderCustomer";
36
37
  import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./utils/scan/handleScan";
37
38
  import scanCache from "./utils/scan/scanCache";
38
39
  import { buildCartView } from "./utils/cartView";
40
+ import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
41
+ import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
42
+ import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
39
43
  import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
40
44
  export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
41
45
  _inherits(BookingTicketImpl, _BaseSalesImpl);
@@ -63,10 +67,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
63
67
  key: "getRegisteredModuleNames",
64
68
  value:
65
69
  /**
66
- * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer。
70
+ * 在 BaseSales 默认模块清单(products/order/salesSummary/schedule)基础上追加 customer + bookingContext
71
+ * bookingContext 是 SalesSdk 加车下沉所需的「预约 UI 上下文」(bookingConfig / resourcesOrigin / date)。
67
72
  */
68
73
  function getRegisteredModuleNames() {
69
- return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer']);
74
+ return [].concat(_toConsumableArray(_get(_getPrototypeOf(BookingTicketImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['customer', 'bookingContext']);
75
+ }
76
+ }, {
77
+ key: "getSubmitOrderSalesChannel",
78
+ value: function getSubmitOrderSalesChannel() {
79
+ return 'pos';
70
80
  }
71
81
 
72
82
  /**
@@ -304,6 +314,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
304
314
  customer_id,
305
315
  menu_list_ids,
306
316
  schedule_datetime,
317
+ bookingDate,
307
318
  _result,
308
319
  _args5 = arguments;
309
320
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -311,30 +322,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
311
322
  case 0:
312
323
  params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
313
324
  options = _args5.length > 1 ? _args5[1] : undefined;
314
- schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime;
315
- _context5.prev = 3;
316
- _context5.next = 6;
325
+ schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 与 products 格式化器对齐日历日(YYYY-MM-DD);勿写入 schedule_datetime 全串,
326
+ // 否则 requiresDetail 会把带时分秒的 date 传给弹窗,handleOpenProductModal 无法打开。
327
+ bookingDate = schedule_date || (schedule_datetime ? String(schedule_datetime).slice(0, 10) : '');
328
+ if (bookingDate) {
329
+ this.setBookingDate(bookingDate);
330
+ }
331
+ _context5.prev = 5;
332
+ _context5.next = 8;
317
333
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
318
334
  with_count: ['bundleGroup', 'optionGroup'],
319
335
  with_schedule: 1
320
336
  }, params), {}, {
321
337
  cacheId: this.cacheId
322
338
  }), options);
323
- case 6:
339
+ case 8:
324
340
  _result = _context5.sent;
325
341
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
326
342
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
327
343
  return _context5.abrupt("return", _result);
328
- case 12:
329
- _context5.prev = 12;
330
- _context5.t0 = _context5["catch"](3);
344
+ case 14:
345
+ _context5.prev = 14;
346
+ _context5.t0 = _context5["catch"](5);
331
347
  console.error('Failed to load products:', _context5.t0);
332
348
  throw _context5.t0;
333
- case 16:
349
+ case 18:
334
350
  case "end":
335
351
  return _context5.stop();
336
352
  }
337
- }, _callee5, this, [[3, 12]]);
353
+ }, _callee5, this, [[5, 14]]);
338
354
  }));
339
355
  function loadProducts() {
340
356
  return _loadProducts.apply(this, arguments);
@@ -692,7 +708,42 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
692
708
  this.core.effects.emit("".concat(this.name, ":onOrderCustomerChange"), null);
693
709
  }
694
710
 
695
- /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */
711
+ /**
712
+ * 重置 tempOrder,并同步清空下单客户运行态。
713
+ *
714
+ * OrderModule.restoreOrder 会重建空单(customer_id 已为 null),但不会:
715
+ * - emit BookingTicket `onOrderCustomerChange`
716
+ * - 重置 CustomerModule.selectedCustomer(老路 getActiveCustomer)
717
+ *
718
+ * 因此在 super.restoreOrder 之后显式清客户,保证 SalesSdk / ticketBooking 订阅方与 tempOrder 一致。
719
+ */
720
+ }, {
721
+ key: "restoreOrder",
722
+ value: (function () {
723
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
724
+ var _this$store$customer;
725
+ var tempOrder;
726
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
727
+ while (1) switch (_context11.prev = _context11.next) {
728
+ case 0:
729
+ _context11.next = 2;
730
+ return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
731
+ case 2:
732
+ tempOrder = _context11.sent;
733
+ this.clearOrderCustomer();
734
+ (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
735
+ return _context11.abrupt("return", tempOrder);
736
+ case 6:
737
+ case "end":
738
+ return _context11.stop();
739
+ }
740
+ }, _callee11, this);
741
+ }));
742
+ function restoreOrder() {
743
+ return _restoreOrder.apply(this, arguments);
744
+ }
745
+ return restoreOrder;
746
+ }() /** 内部:基于 OrderModule 当前状态构造一份 OrderCustomerChangePayload。 */)
696
747
  }, {
697
748
  key: "buildOrderCustomerPayload",
698
749
  value: function buildOrderCustomerPayload() {
@@ -744,27 +795,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
744
795
  }, {
745
796
  key: "changeCustomerPage",
746
797
  value: (function () {
747
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(page, pageSize) {
798
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(page, pageSize) {
748
799
  var _result3;
749
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
750
- while (1) switch (_context11.prev = _context11.next) {
800
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
801
+ while (1) switch (_context12.prev = _context12.next) {
751
802
  case 0:
752
- _context11.prev = 0;
753
- _context11.next = 3;
803
+ _context12.prev = 0;
804
+ _context12.next = 3;
754
805
  return this.store.customer.changeCustomerPage(page, pageSize);
755
806
  case 3:
756
- _result3 = _context11.sent;
757
- return _context11.abrupt("return", _result3);
807
+ _result3 = _context12.sent;
808
+ return _context12.abrupt("return", _result3);
758
809
  case 7:
759
- _context11.prev = 7;
760
- _context11.t0 = _context11["catch"](0);
761
- console.error('Failed to change customer page:', _context11.t0);
762
- throw _context11.t0;
810
+ _context12.prev = 7;
811
+ _context12.t0 = _context12["catch"](0);
812
+ console.error('Failed to change customer page:', _context12.t0);
813
+ throw _context12.t0;
763
814
  case 11:
764
815
  case "end":
765
- return _context11.stop();
816
+ return _context12.stop();
766
817
  }
767
- }, _callee11, this, [[0, 7]]);
818
+ }, _callee12, this, [[0, 7]]);
768
819
  }));
769
820
  function changeCustomerPage(_x8, _x9) {
770
821
  return _changeCustomerPage.apply(this, arguments);
@@ -779,28 +830,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
779
830
  }, {
780
831
  key: "loadMoreCustomers",
781
832
  value: (function () {
782
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
833
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
783
834
  var _result4;
784
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
785
- while (1) switch (_context12.prev = _context12.next) {
835
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
836
+ while (1) switch (_context13.prev = _context13.next) {
786
837
  case 0:
787
- _context12.prev = 0;
788
- _context12.next = 3;
838
+ _context13.prev = 0;
839
+ _context13.next = 3;
789
840
  return this.store.customer.loadMoreCustomers();
790
841
  case 3:
791
- _result4 = _context12.sent;
842
+ _result4 = _context13.sent;
792
843
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result4);
793
- return _context12.abrupt("return", _result4);
844
+ return _context13.abrupt("return", _result4);
794
845
  case 8:
795
- _context12.prev = 8;
796
- _context12.t0 = _context12["catch"](0);
797
- console.error('Failed to load more customers:', _context12.t0);
798
- throw _context12.t0;
846
+ _context13.prev = 8;
847
+ _context13.t0 = _context13["catch"](0);
848
+ console.error('Failed to load more customers:', _context13.t0);
849
+ throw _context13.t0;
799
850
  case 12:
800
851
  case "end":
801
- return _context12.stop();
852
+ return _context13.stop();
802
853
  }
803
- }, _callee12, this, [[0, 8]]);
854
+ }, _callee13, this, [[0, 8]]);
804
855
  }));
805
856
  function loadMoreCustomers() {
806
857
  return _loadMoreCustomers.apply(this, arguments);
@@ -816,31 +867,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
816
867
  }, {
817
868
  key: "resetAndLoadCustomers",
818
869
  value: (function () {
819
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
870
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
820
871
  var params,
821
872
  _result5,
822
- _args13 = arguments;
823
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
824
- while (1) switch (_context13.prev = _context13.next) {
873
+ _args14 = arguments;
874
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
875
+ while (1) switch (_context14.prev = _context14.next) {
825
876
  case 0:
826
- params = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
827
- _context13.prev = 1;
828
- _context13.next = 4;
877
+ params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
878
+ _context14.prev = 1;
879
+ _context14.next = 4;
829
880
  return this.store.customer.resetAndLoadCustomers(params);
830
881
  case 4:
831
- _result5 = _context13.sent;
882
+ _result5 = _context14.sent;
832
883
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result5);
833
- return _context13.abrupt("return", _result5);
884
+ return _context14.abrupt("return", _result5);
834
885
  case 9:
835
- _context13.prev = 9;
836
- _context13.t0 = _context13["catch"](1);
837
- console.error('Failed to reset and load customers:', _context13.t0);
838
- throw _context13.t0;
886
+ _context14.prev = 9;
887
+ _context14.t0 = _context14["catch"](1);
888
+ console.error('Failed to reset and load customers:', _context14.t0);
889
+ throw _context14.t0;
839
890
  case 13:
840
891
  case "end":
841
- return _context13.stop();
892
+ return _context14.stop();
842
893
  }
843
- }, _callee13, this, [[1, 9]]);
894
+ }, _callee14, this, [[1, 9]]);
844
895
  }));
845
896
  function resetAndLoadCustomers() {
846
897
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1002,15 +1053,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1002
1053
  }, {
1003
1054
  key: "setOtherParams",
1004
1055
  value: (function () {
1005
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
1056
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1006
1057
  var _ref2,
1007
1058
  _ref2$cover,
1008
1059
  cover,
1009
- _args14 = arguments;
1010
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1011
- while (1) switch (_context14.prev = _context14.next) {
1060
+ _args15 = arguments;
1061
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1062
+ while (1) switch (_context15.prev = _context15.next) {
1012
1063
  case 0:
1013
- _ref2 = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {}, _ref2$cover = _ref2.cover, cover = _ref2$cover === void 0 ? false : _ref2$cover;
1064
+ _ref2 = _args15.length > 1 && _args15[1] !== undefined ? _args15[1] : {}, _ref2$cover = _ref2.cover, cover = _ref2$cover === void 0 ? false : _ref2$cover;
1014
1065
  if (cover) {
1015
1066
  this.otherParams = params;
1016
1067
  } else {
@@ -1018,9 +1069,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1018
1069
  }
1019
1070
  case 2:
1020
1071
  case "end":
1021
- return _context14.stop();
1072
+ return _context15.stop();
1022
1073
  }
1023
- }, _callee14, this);
1074
+ }, _callee15, this);
1024
1075
  }));
1025
1076
  function setOtherParams(_x10) {
1026
1077
  return _setOtherParams.apply(this, arguments);
@@ -1035,21 +1086,299 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1035
1086
  }, {
1036
1087
  key: "getOtherParams",
1037
1088
  value: (function () {
1038
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1039
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1040
- while (1) switch (_context15.prev = _context15.next) {
1089
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1090
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1091
+ while (1) switch (_context16.prev = _context16.next) {
1041
1092
  case 0:
1042
- return _context15.abrupt("return", this.otherParams);
1093
+ return _context16.abrupt("return", this.otherParams);
1043
1094
  case 1:
1044
1095
  case "end":
1045
- return _context15.stop();
1096
+ return _context16.stop();
1046
1097
  }
1047
- }, _callee15, this);
1098
+ }, _callee16, this);
1048
1099
  }));
1049
1100
  function getOtherParams() {
1050
1101
  return _getOtherParams.apply(this, arguments);
1051
1102
  }
1052
1103
  return getOtherParams;
1104
+ }() // ─── BookingContext API(透传给 BookingContextModule) ──────────────────────
1105
+ // SalesSdkProvider 挂载时默认调 initBookingContext;也可由 UI 显式 set* 灌入已有数据。
1106
+ /** 拉取 board config 并写入 BookingContext。 */
1107
+ )
1108
+ }, {
1109
+ key: "loadBookingConfig",
1110
+ value: function loadBookingConfig(params) {
1111
+ return this.store.bookingContext.loadBookingConfig(params);
1112
+ }
1113
+
1114
+ /** 拉取资源全集并写入 BookingContext。 */
1115
+ }, {
1116
+ key: "loadBookingResources",
1117
+ value: function loadBookingResources(params) {
1118
+ return this.store.bookingContext.loadResources(params);
1119
+ }
1120
+
1121
+ /** 初始化 BookingContext(date + config + resources)。 */
1122
+ }, {
1123
+ key: "initBookingContext",
1124
+ value: function initBookingContext(params) {
1125
+ return this.store.bookingContext.initBookingContext(params);
1126
+ }
1127
+
1128
+ /** 当前 store 是否已具备与入参等价的 config / resources(无需再请求接口)。 */
1129
+ }, {
1130
+ key: "isBookingContextReady",
1131
+ value: function isBookingContextReady(params) {
1132
+ return this.store.bookingContext.isBookingContextReady(params);
1133
+ }
1134
+
1135
+ /** 写入 booking config(来源:`/core/board/management/config`)。 */
1136
+ }, {
1137
+ key: "setBookingConfig",
1138
+ value: function setBookingConfig(config) {
1139
+ this.store.bookingContext.setBookingConfig(config);
1140
+ }
1141
+
1142
+ /** 读取当前 booking config。 */
1143
+ }, {
1144
+ key: "getBookingConfig",
1145
+ value: function getBookingConfig() {
1146
+ return this.store.bookingContext.getBookingConfig();
1147
+ }
1148
+
1149
+ /** 写入资源全集(来源:`/form/schedule`),同步派生 resourcesOriginMap。 */
1150
+ }, {
1151
+ key: "setResources",
1152
+ value: function setResources(resources) {
1153
+ this.store.bookingContext.setResources(resources);
1154
+ }
1155
+
1156
+ /** 读取资源全集(浅克隆)。 */
1157
+ }, {
1158
+ key: "getResourcesOrigin",
1159
+ value: function getResourcesOrigin() {
1160
+ return this.store.bookingContext.getResourcesOrigin();
1161
+ }
1162
+
1163
+ /** 读取资源全集 map(id → resource)。 */
1164
+ }, {
1165
+ key: "getResourcesOriginMap",
1166
+ value: function getResourcesOriginMap() {
1167
+ return this.store.bookingContext.getResourcesOriginMap();
1168
+ }
1169
+
1170
+ /** 写入当前选择的日期;支持 dayjs / Date / string。 */
1171
+ }, {
1172
+ key: "setBookingDate",
1173
+ value: function setBookingDate(date) {
1174
+ this.store.bookingContext.setDate(date);
1175
+ }
1176
+
1177
+ /** 读取当前选择的日期(统一 string)。 */
1178
+ }, {
1179
+ key: "getBookingDate",
1180
+ value: function getBookingDate() {
1181
+ return this.store.bookingContext.getDate();
1182
+ }
1183
+
1184
+ /** 读取 BookingContext 完整 store(调试 / 测试 / 透传给 SDK 使用)。 */
1185
+ }, {
1186
+ key: "getBookingContextState",
1187
+ value: function getBookingContextState() {
1188
+ return this.store.bookingContext.getState();
1189
+ }
1190
+
1191
+ /** 清空 BookingContext(切租户 / destroy 场景)。 */
1192
+ }, {
1193
+ key: "clearBookingContext",
1194
+ value: function clearBookingContext() {
1195
+ this.store.bookingContext.clear();
1196
+ }
1197
+
1198
+ /**
1199
+ * 构造 BookingContext 计算上下文(供 getProductExtend / getResourceByIds 等读 API 复用)。
1200
+ */
1201
+ }, {
1202
+ key: "buildBookingCalcContext",
1203
+ value: function buildBookingCalcContext(extra) {
1204
+ var _extra$date, _extra$presetStartTim;
1205
+ var state = this.store.bookingContext.getState();
1206
+ var date = (_extra$date = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date !== void 0 ? _extra$date : state.date;
1207
+ return _objectSpread({
1208
+ bookingConfig: state.bookingConfig,
1209
+ resourcesOrigin: state.resourcesOrigin,
1210
+ resourcesOriginMap: state.resourcesOriginMap,
1211
+ date: date,
1212
+ presetStartTime: (_extra$presetStartTim = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim !== void 0 ? _extra$presetStartTim : derivePresetStartTimeFromDate(date)
1213
+ }, extra || {});
1214
+ }
1215
+
1216
+ /**
1217
+ * 取商品当前可选资源列表(透传 OS BookingContext utils#getResourceByIds)。
1218
+ * `extraResources` 用于把拖入未绑定的资源也展示出来。
1219
+ */
1220
+ }, {
1221
+ key: "getResourcesForProduct",
1222
+ value: function getResourcesForProduct(product, options) {
1223
+ var _ctx$bookingConfig;
1224
+ var ctx = this.buildBookingCalcContext();
1225
+ return getResourceByIdsUtil(ctx.resourcesOriginMap || {}, product, {
1226
+ resourceTab: (_ctx$bookingConfig = ctx.bookingConfig) === null || _ctx$bookingConfig === void 0 || (_ctx$bookingConfig = _ctx$bookingConfig.config) === null || _ctx$bookingConfig === void 0 ? void 0 : _ctx$bookingConfig.resource_tab,
1227
+ resourcesOrigin: ctx.resourcesOrigin,
1228
+ extraResources: (options === null || options === void 0 ? void 0 : options.extraResources) || []
1229
+ });
1230
+ }
1231
+
1232
+ /**
1233
+ * 拼装 cacheItem 的 _extend / _data(资源 / 容量 / timeObj),与 info2 `getProductExtend` 等价。
1234
+ */
1235
+ }, {
1236
+ key: "getProductExtend",
1237
+ value: function getProductExtend(cacheItem, extra) {
1238
+ return getProductExtendUtil({
1239
+ cacheItem: cacheItem,
1240
+ ctx: this.buildBookingCalcContext(extra)
1241
+ });
1242
+ }
1243
+
1244
+ /**
1245
+ * 取资源不可用原因列表(结构化 enum + params,i18n 文案由 UI 渲染)。
1246
+ */
1247
+ }, {
1248
+ key: "getResourceErrors",
1249
+ value: function getResourceErrors(resource, cacheItem) {
1250
+ return getResourceErrorsUtil(resource, cacheItem);
1251
+ }
1252
+
1253
+ // ─── addProduct 决策 / 转换 API(SDK 加车下沉所需) ─────────────────────────
1254
+ // 这一组方法是 SalesSdkCartContext.addProduct / confirmDetail 的 OS 后端。
1255
+ // 调用方传入 ProductData,OS 自取 bookingContext / customer / date 等上下文,
1256
+ // 输出 (a) autoClose 决策结果或 (b) `{ product, booking }` 协议入参。
1257
+
1258
+ /**
1259
+ * 拼装 addProductDecision 通用上下文(从 store 自取)。
1260
+ */
1261
+ }, {
1262
+ key: "buildAddProductCtx",
1263
+ value: function buildAddProductCtx(extra) {
1264
+ var _extra$date2, _ref3, _this$getOrderCustome, _this$getOrderCustome2, _this$store$order$get3, _extra$presetStartTim2;
1265
+ var bookingContextState = this.store.bookingContext.getState();
1266
+ var date = (_extra$date2 = extra === null || extra === void 0 ? void 0 : extra.date) !== null && _extra$date2 !== void 0 ? _extra$date2 : bookingContextState.date;
1267
+ var orderCustomerId = (_ref3 = (_this$getOrderCustome = (_this$getOrderCustome2 = this.getOrderCustomerSnapshot()) === null || _this$getOrderCustome2 === void 0 ? void 0 : _this$getOrderCustome2.id) !== null && _this$getOrderCustome !== void 0 ? _this$getOrderCustome : (_this$store$order$get3 = this.store.order.getTempOrder()) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.customer_id) !== null && _ref3 !== void 0 ? _ref3 : undefined;
1268
+ return _objectSpread({
1269
+ bookingConfig: bookingContextState.bookingConfig,
1270
+ resourcesOrigin: bookingContextState.resourcesOrigin,
1271
+ resourcesOriginMap: bookingContextState.resourcesOriginMap,
1272
+ date: date,
1273
+ presetStartTime: (_extra$presetStartTim2 = extra === null || extra === void 0 ? void 0 : extra.presetStartTime) !== null && _extra$presetStartTim2 !== void 0 ? _extra$presetStartTim2 : derivePresetStartTimeFromDate(date),
1274
+ customerId: orderCustomerId
1275
+ }, extra || {});
1276
+ }
1277
+
1278
+ /**
1279
+ * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
1280
+ * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
1281
+ */
1282
+ }, {
1283
+ key: "decideAddProduct",
1284
+ value: function decideAddProduct(item, options) {
1285
+ return decideAddProductUtil(item, this.buildAddProductCtx(options));
1286
+ }
1287
+
1288
+ /** 规格弹窗 callback 后的第二段决策。 */
1289
+ }, {
1290
+ key: "decideAfterDetail",
1291
+ value: function decideAfterDetail(cacheItem, options) {
1292
+ return decideAfterDetailUtil(cacheItem, this.buildAddProductCtx(options));
1293
+ }
1294
+
1295
+ /**
1296
+ * @deprecated 请用 `decideAddProduct`;`autoClose=true` 仅当 action=add。
1297
+ */
1298
+ }, {
1299
+ key: "decideAutoClose",
1300
+ value: function decideAutoClose(item, options) {
1301
+ return decideAutoCloseUtil(item, this.buildAddProductCtx(options));
1302
+ }
1303
+
1304
+ /** 替代 info2 `getIsEject`:商品是否需要弹窗(0/1)。 */
1305
+ }, {
1306
+ key: "getIsEject",
1307
+ value: function getIsEject(item) {
1308
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'select';
1309
+ return getIsEjectUtil(item, type);
1310
+ }
1311
+
1312
+ /** 仅 session 商品(无 variant/option/package)→ true。 */
1313
+ }, {
1314
+ key: "getIsOnlySession",
1315
+ value: function getIsOnlySession(item) {
1316
+ return getIsOnlySessionUtil(item);
1317
+ }
1318
+
1319
+ /**
1320
+ * 拼装 requiresDetail payload(给 SDK 直接 return 给 UI 用)。
1321
+ */
1322
+ }, {
1323
+ key: "buildRequiresDetailPayload",
1324
+ value: function buildRequiresDetailPayload(item, options) {
1325
+ return _buildRequiresDetailPayload(item, this.buildAddProductCtx(options));
1326
+ }
1327
+
1328
+ /**
1329
+ * 把 detail 弹窗回调结果(e, extension_type, detail)转换为 `(product, booking)` 入参。
1330
+ * 内部会先拼 cacheItem,再走 cacheItemToBookingInput 严格协议对齐。
1331
+ */
1332
+ }, {
1333
+ key: "transformDetailToProductAndBooking",
1334
+ value: function transformDetailToProductAndBooking(input) {
1335
+ var item = input.item,
1336
+ preparedCacheItem = input.cacheItem,
1337
+ detailResult = input.detailResult,
1338
+ options = input.options;
1339
+ var ctx = this.buildAddProductCtx(options);
1340
+ var cacheItem = preparedCacheItem || (detailResult ? buildCacheItemFromDetail(item, detailResult, ctx) : buildCacheItemFromCartDetail(item, ctx));
1341
+ return transformDetailToProductAndBookingUtil(cacheItem, ctx);
1342
+ }
1343
+
1344
+ /**
1345
+ * 从已加车的 order line + booking 反查资源编辑抽屉所需的 cacheItem。
1346
+ * 供 SalesSdk「编辑资源」等场景使用;字段语义与 buildCacheItemFromDetail 产出对齐。
1347
+ */
1348
+ }, {
1349
+ key: "buildCacheItemFromOrderLine",
1350
+ value: function buildCacheItemFromOrderLine(input) {
1351
+ return buildCacheItemFromOrderLineUtil(input);
1352
+ }
1353
+
1354
+ /**
1355
+ * 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
1356
+ */
1357
+ }, {
1358
+ key: "buildNormalProductCacheItemFromOrderLine",
1359
+ value: function buildNormalProductCacheItemFromOrderLine(input) {
1360
+ return buildNormalProductCacheItemFromOrderLineUtil(input);
1361
+ }
1362
+
1363
+ /** 文档别名:与 OrderModule.updateOrderProduct 一致。 */
1364
+ }, {
1365
+ key: "updateProductInOrder",
1366
+ value: (function () {
1367
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1368
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1369
+ while (1) switch (_context17.prev = _context17.next) {
1370
+ case 0:
1371
+ return _context17.abrupt("return", this.updateOrderProduct(params));
1372
+ case 1:
1373
+ case "end":
1374
+ return _context17.stop();
1375
+ }
1376
+ }, _callee17, this);
1377
+ }));
1378
+ function updateProductInOrder(_x11) {
1379
+ return _updateProductInOrder.apply(this, arguments);
1380
+ }
1381
+ return updateProductInOrder;
1053
1382
  }()
1054
1383
  /**
1055
1384
  * 销毁模块:先调用父类(销毁所有 store 内子模块 + emit destroy + super.destroy()),
@@ -1059,12 +1388,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1059
1388
  }, {
1060
1389
  key: "destroy",
1061
1390
  value: (function () {
1062
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1391
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1063
1392
  var _this$scan;
1064
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1065
- while (1) switch (_context16.prev = _context16.next) {
1393
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1394
+ while (1) switch (_context18.prev = _context18.next) {
1066
1395
  case 0:
1067
- _context16.next = 2;
1396
+ _context18.next = 2;
1068
1397
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
1069
1398
  case 2:
1070
1399
  try {
@@ -1075,9 +1404,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1075
1404
  scanCache.clear();
1076
1405
  case 4:
1077
1406
  case "end":
1078
- return _context16.stop();
1407
+ return _context18.stop();
1079
1408
  }
1080
- }, _callee16, this);
1409
+ }, _callee18, this);
1081
1410
  }));
1082
1411
  function destroy() {
1083
1412
  return _destroy.apply(this, arguments);
@@ -1,4 +1,5 @@
1
1
  import { ProductList, OrderModule } from '../../modules';
2
+ import { BookingContextModule } from '../../modules/BookingContext';
2
3
  import { CustomerModule } from '../../modules/Customer';
3
4
  import { SalesSummaryModule } from '../../modules/SalesSummary';
4
5
  import { ScheduleModule } from '../../modules/Schedule';
@@ -16,6 +17,7 @@ export interface BookingTicketState extends BaseSalesState {
16
17
  salesSummary: SalesSummaryModule;
17
18
  schedule: ScheduleModule;
18
19
  customer: CustomerModule;
20
+ bookingContext: BookingContextModule;
19
21
  }
20
22
  export declare function createBookingTicketModule<T extends keyof BookingTicketState>(moduleName: T, solutionName: string, name?: string, version?: string): BookingTicketState[T] | null;
21
23
  export declare enum BookingTicketHooks {
@@ -1,4 +1,5 @@
1
1
  import { ProductList, OrderModule } from "../../modules";
2
+ import { BookingContextModule } from "../../modules/BookingContext";
2
3
  import { CustomerModule } from "../../modules/Customer";
3
4
  import { SalesSummaryModule } from "../../modules/SalesSummary";
4
5
  import { ScheduleModule } from "../../modules/Schedule";
@@ -20,6 +21,8 @@ export function createBookingTicketModule(moduleName, solutionName, name, versio
20
21
  return new ScheduleModule("".concat(solutionName, "_").concat(name || moduleName), version);
21
22
  case 'customer':
22
23
  return new CustomerModule("".concat(solutionName, "_").concat(name || moduleName), version);
24
+ case 'bookingContext':
25
+ return new BookingContextModule("".concat(solutionName, "_").concat(name || moduleName), version);
23
26
  default:
24
27
  return null;
25
28
  }