@pisell/pisellos 0.0.556 → 0.0.558

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 (68) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +3 -0
  3. package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  4. package/dist/model/strategy/adapter/dataVariant/adapter.js +152 -0
  5. package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  6. package/dist/model/strategy/adapter/dataVariant/evaluator.js +755 -0
  7. package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  8. package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
  9. package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  10. package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
  11. package/dist/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  12. package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
  13. package/dist/model/strategy/adapter/index.d.ts +4 -0
  14. package/dist/model/strategy/adapter/index.js +5 -1
  15. package/dist/modules/Order/index.d.ts +1 -1
  16. package/dist/modules/Product/index.d.ts +1 -1
  17. package/dist/modules/ProductList/index.d.ts +2 -1
  18. package/dist/modules/ProductList/index.js +21 -11
  19. package/dist/solution/BookingByStep/index.d.ts +2 -2
  20. package/dist/solution/ScanOrder/index.d.ts +2 -1
  21. package/dist/solution/ScanOrder/index.js +137 -117
  22. package/dist/solution/ScanOrder/utils.d.ts +5 -0
  23. package/dist/solution/ScanOrder/utils.js +55 -23
  24. package/dist/solution/VenueBooking/index.d.ts +22 -3
  25. package/dist/solution/VenueBooking/index.js +259 -166
  26. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  27. package/dist/solution/VenueBooking/utils/dateSummary.js +12 -25
  28. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
  29. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -9
  30. package/dist/solution/VenueBooking/utils/smartPricing.d.ts +69 -0
  31. package/dist/solution/VenueBooking/utils/smartPricing.js +233 -0
  32. package/dist/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
  33. package/dist/solution/VenueBooking/utils/timeSlot.js +9 -4
  34. package/lib/index.d.ts +1 -0
  35. package/lib/index.js +3 -0
  36. package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +49 -0
  37. package/lib/model/strategy/adapter/dataVariant/adapter.js +139 -0
  38. package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +87 -0
  39. package/lib/model/strategy/adapter/dataVariant/evaluator.js +564 -0
  40. package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
  41. package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
  42. package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
  43. package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
  44. package/lib/model/strategy/adapter/dataVariant/type.d.ts +146 -0
  45. package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
  46. package/lib/model/strategy/adapter/index.d.ts +4 -0
  47. package/lib/model/strategy/adapter/index.js +13 -2
  48. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  49. package/lib/modules/Order/index.d.ts +1 -1
  50. package/lib/modules/Product/index.d.ts +1 -1
  51. package/lib/modules/ProductList/index.d.ts +2 -1
  52. package/lib/modules/ProductList/index.js +45 -40
  53. package/lib/solution/BookingByStep/index.d.ts +2 -2
  54. package/lib/solution/ScanOrder/index.d.ts +2 -1
  55. package/lib/solution/ScanOrder/index.js +29 -18
  56. package/lib/solution/ScanOrder/utils.d.ts +5 -0
  57. package/lib/solution/ScanOrder/utils.js +23 -0
  58. package/lib/solution/VenueBooking/index.d.ts +22 -3
  59. package/lib/solution/VenueBooking/index.js +151 -63
  60. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
  61. package/lib/solution/VenueBooking/utils/dateSummary.js +5 -10
  62. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -6
  63. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -4
  64. package/lib/solution/VenueBooking/utils/smartPricing.d.ts +69 -0
  65. package/lib/solution/VenueBooking/utils/smartPricing.js +180 -0
  66. package/lib/solution/VenueBooking/utils/timeSlot.d.ts +2 -0
  67. package/lib/solution/VenueBooking/utils/timeSlot.js +7 -3
  68. package/package.json +1 -1
@@ -45,6 +45,7 @@ import { extractResourceIds, buildResourceProductMap } from "./utils/resource";
45
45
  import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "./utils/timeSlot";
46
46
  import { buildDateRangeSummary } from "./utils/dateSummary";
47
47
  import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
48
+ import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
48
49
  import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
49
50
  import { OrderModule } from "../../modules/Order";
50
51
  import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
@@ -103,6 +104,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
103
104
  _defineProperty(_assertThisInitialized(_this), "loadAllProductsInFlight", null);
104
105
  _defineProperty(_assertThisInitialized(_this), "productsLoaded", false);
105
106
  _defineProperty(_assertThisInitialized(_this), "loadOpenDataConfigInFlight", null);
107
+ /** 按日期缓存 slot 智能定价 Map,避免同周重复 resolveProducts */
108
+ _defineProperty(_assertThisInitialized(_this), "slotPriceMapCache", new Map());
109
+ /** loadProducts 后缓存的全量商品(venue + addon),供分段算价复用 */
110
+ _defineProperty(_assertThisInitialized(_this), "smartPricingProductCatalog", []);
106
111
  return _this;
107
112
  }
108
113
  _createClass(VenueBookingImpl, [{
@@ -496,43 +501,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
496
501
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
497
502
  while (1) switch (_context5.prev = _context5.next) {
498
503
  case 0:
504
+ _this3.clearSlotPriceMapCache();
505
+ _this3.recalculateOrderPricesFromSmartPricing();
506
+ // 刷新 holder 表单数据
499
507
  if (!_this3.store.holder) {
500
- _context5.next = 3;
508
+ _context5.next = 5;
501
509
  break;
502
510
  }
503
- _context5.next = 3;
511
+ _context5.next = 5;
504
512
  return _this3.store.holder.refreshAllFormRecords({
505
513
  customer_id: params.customerId,
506
514
  useCache: false
507
515
  });
508
- case 3:
516
+ case 5:
509
517
  if (!_this3.store.quotation) {
510
- _context5.next = 6;
518
+ _context5.next = 8;
511
519
  break;
512
520
  }
513
- _context5.next = 6;
521
+ _context5.next = 8;
514
522
  return _this3.store.quotation.loadQuotations({
515
523
  channel: (_this3$otherParams = _this3.otherParams) === null || _this3$otherParams === void 0 ? void 0 : _this3$otherParams.channel
516
524
  });
517
- case 6:
518
- _this3.recalculateOrderPricesFromQuotation();
519
- _context5.next = 9;
525
+ case 8:
526
+ _context5.next = 10;
520
527
  return _this3.store.order.loadDiscountConfig({
521
528
  customerId: params.customerId
522
529
  });
523
- case 9:
524
- _context5.next = 11;
530
+ case 10:
531
+ _context5.next = 12;
525
532
  return _this3.store.order.recalculateSummary({
526
533
  createIfMissing: true
527
534
  });
528
- case 11:
535
+ case 12:
529
536
  _this3.store.order.persistTempOrder();
530
- _context5.next = 14;
537
+ _context5.next = 15;
531
538
  return _this3.refreshItemRuleQuantityLimits();
532
- case 14:
533
- _context5.next = 16;
539
+ case 15:
540
+ _context5.next = 17;
534
541
  return _this3.refreshCartValidationPassed();
535
- case 16:
542
+ case 17:
536
543
  case "end":
537
544
  return _context5.stop();
538
545
  }
@@ -597,8 +604,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
597
604
  holderModule,
598
605
  _this$store$order,
599
606
  _this$store$order2,
600
- _this$store$quotation,
601
- _this$otherParams9,
602
607
  _args7 = arguments;
603
608
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
604
609
  while (1) switch (_context7.prev = _context7.next) {
@@ -769,34 +774,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
769
774
  return this.loadRuntimeConfigs();
770
775
  case 60:
771
776
  if (!this.store.schedule) {
772
- _context7.next = 65;
777
+ _context7.next = 63;
773
778
  break;
774
779
  }
775
780
  _context7.next = 63;
776
781
  return this.store.schedule.loadAllSchedule();
777
782
  case 63:
778
- this.injectScheduleResolverToQuotation();
779
- (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
780
- channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel
781
- });
782
- case 65:
783
- _context7.next = 67;
783
+ _context7.next = 65;
784
784
  return this.refreshItemRuleQuantityLimits();
785
- case 67:
785
+ case 65:
786
786
  this.store.status = 'ready';
787
787
  console.log('[VenueBooking] 初始化完成');
788
- _context7.next = 71;
788
+ _context7.next = 69;
789
789
  return this.core.effects.emit(VenueBookingHooks.onInited, {
790
790
  status: this.store.status
791
791
  });
792
- case 71:
792
+ case 69:
793
793
  this.logMethodSuccess('initialize', {
794
794
  status: this.store.status
795
795
  });
796
- _context7.next = 81;
796
+ _context7.next = 79;
797
797
  break;
798
- case 74:
799
- _context7.prev = 74;
798
+ case 72:
799
+ _context7.prev = 72;
800
800
  _context7.t0 = _context7["catch"](54);
801
801
  this.store.status = 'error';
802
802
  this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
@@ -805,11 +805,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
805
805
  status: this.store.status
806
806
  });
807
807
  throw _context7.t0;
808
- case 81:
808
+ case 79:
809
809
  case "end":
810
810
  return _context7.stop();
811
811
  }
812
- }, _callee7, this, [[54, 74]]);
812
+ }, _callee7, this, [[54, 72]]);
813
813
  }));
814
814
  function initialize(_x6) {
815
815
  return _initialize.apply(this, arguments);
@@ -950,6 +950,96 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
950
950
  };
951
951
  }
952
952
 
953
+ /** 清除 slot 价格分段缓存(商品重载 / 登录后 customerId 变化时调用) */
954
+ }, {
955
+ key: "clearSlotPriceMapCache",
956
+ value: function clearSlotPriceMapCache() {
957
+ this.slotPriceMapCache.clear();
958
+ }
959
+
960
+ /** 读取当前登录 customerId */
961
+ }, {
962
+ key: "resolveCustomerIdForSmartPricing",
963
+ value: function resolveCustomerIdForSmartPricing() {
964
+ try {
965
+ var _this$core4, _userPlugin$get;
966
+ var userPlugin = (_this$core4 = this.core) === null || _this$core4 === void 0 ? void 0 : _this$core4.getPlugin('user');
967
+ var customerId = Number(userPlugin === null || userPlugin === void 0 || (_userPlugin$get = userPlugin.get) === null || _userPlugin$get === void 0 || (_userPlugin$get = _userPlugin$get.call(userPlugin)) === null || _userPlugin$get === void 0 ? void 0 : _userPlugin$get.id);
968
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
969
+ } catch (_unused3) {
970
+ return undefined;
971
+ }
972
+ }
973
+
974
+ /** 读取 schedule 全量列表,供智能定价 schedule_match 使用 */
975
+ }, {
976
+ key: "getScheduleListForSmartPricing",
977
+ value: function getScheduleListForSmartPricing() {
978
+ var _store;
979
+ var scheduleModule = this.store.schedule;
980
+ var list = scheduleModule === null || scheduleModule === void 0 || (_store = scheduleModule.store) === null || _store === void 0 ? void 0 : _store.scheduleList;
981
+ return Array.isArray(list) ? list : [];
982
+ }
983
+
984
+ /** 构建智能定价上下文,对齐 OS Server buildProductFormatterContext */
985
+ }, {
986
+ key: "buildSmartPricingContext",
987
+ value: function buildSmartPricingContext(customerId) {
988
+ var _this$core5, _this$otherParams9, _this$otherParams10, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _this$otherParams15;
989
+ var evaluator = (_this$core5 = this.core) === null || _this$core5 === void 0 || (_this$core5 = _this$core5.context) === null || _this$core5 === void 0 ? void 0 : _this$core5.dataVariantEvaluator;
990
+ return {
991
+ evaluator: evaluator,
992
+ scheduleList: this.getScheduleListForSmartPricing(),
993
+ menuList: ((_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.menuList) || ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.openData) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.menuList) || [],
994
+ customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
995
+ channel: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel,
996
+ businessCode: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
997
+ orderType: ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.orderType) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type),
998
+ strategy_context: (_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.strategy_context
999
+ };
1000
+ }
1001
+
1002
+ /** venue + addon 全量商品,供智能定价评估 */
1003
+ }, {
1004
+ key: "getAllProductsForSmartPricing",
1005
+ value: function getAllProductsForSmartPricing() {
1006
+ if (this.smartPricingProductCatalog.length) {
1007
+ return this.smartPricingProductCatalog;
1008
+ }
1009
+ var venueList = this.getVenueProducts();
1010
+ var addonList = this.getAddonProductsList();
1011
+ return [].concat(_toConsumableArray(venueList), _toConsumableArray(addonList));
1012
+ }
1013
+ }, {
1014
+ key: "getSlotPriceMapCacheKey",
1015
+ value: function getSlotPriceMapCacheKey(date, context) {
1016
+ var _context$customerId, _context$channel, _context$businessCode;
1017
+ return [date, (_context$customerId = context.customerId) !== null && _context$customerId !== void 0 ? _context$customerId : '', (_context$channel = context.channel) !== null && _context$channel !== void 0 ? _context$channel : '', (_context$businessCode = context.businessCode) !== null && _context$businessCode !== void 0 ? _context$businessCode : ''].join('|');
1018
+ }
1019
+
1020
+ /**
1021
+ * 按 schedule 分段构建 slot 价格 Map,带实例级缓存。
1022
+ */
1023
+ }, {
1024
+ key: "buildSlotPriceMapForDate",
1025
+ value: function buildSlotPriceMapForDate(date, config, productIds) {
1026
+ var context = this.buildSmartPricingContext();
1027
+ var cacheKey = this.getSlotPriceMapCacheKey(date, context);
1028
+ var cached = this.slotPriceMapCache.get(cacheKey);
1029
+ if (cached) return cached;
1030
+ var timeLabels = generateTimeLabels(config);
1031
+ var slotPriceMap = buildSlotPriceMapByScheduleSegments({
1032
+ products: this.getAllProductsForSmartPricing(),
1033
+ productIds: productIds,
1034
+ date: date,
1035
+ timeLabels: timeLabels,
1036
+ config: config,
1037
+ context: context
1038
+ });
1039
+ this.slotPriceMapCache.set(cacheKey, slotPriceMap);
1040
+ return slotPriceMap;
1041
+ }
1042
+
953
1043
  // ─── 场地商品 & 附加商品 ───
954
1044
  }, {
955
1045
  key: "loadAllProducts",
@@ -984,7 +1074,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
984
1074
  key: "_doLoadAllProducts",
985
1075
  value: function () {
986
1076
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
987
- var _this$otherParams10, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
1077
+ var _this$otherParams16, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore, _this$store$order3, _this$store$order3$ge, products;
988
1078
  return _regeneratorRuntime().wrap(function _callee12$(_context12) {
989
1079
  while (1) switch (_context12.prev = _context12.next) {
990
1080
  case 0:
@@ -1005,7 +1095,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1005
1095
  _context12.next = 8;
1006
1096
  return this.loadOpenDataConfig();
1007
1097
  case 8:
1008
- associatedMenus = ((_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10 = _this$otherParams10.openData) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10['menu.associated_menus']) || [];
1098
+ associatedMenus = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16['menu.associated_menus']) || [];
1009
1099
  if (associatedMenus.length) {
1010
1100
  _context12.next = 12;
1011
1101
  break;
@@ -1021,11 +1111,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1021
1111
  menu_list_ids: menuListIds,
1022
1112
  cacheId: this.cacheId,
1023
1113
  schedule_date: dayjs().format('YYYY-MM-DD'),
1024
- schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
1114
+ schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
1115
+ with_extra: ['dataVariants']
1025
1116
  });
1026
1117
  case 15:
1027
1118
  allProducts = _context12.sent;
1028
1119
  list = Array.isArray(allProducts) ? allProducts : [];
1120
+ list = formatProductsWithDataVariant(list, this.buildSmartPricingContext(), dayjs().format('YYYY-MM-DD HH:mm:ss'));
1121
+ this.smartPricingProductCatalog = list.slice();
1122
+ this.clearSlotPriceMapCache();
1029
1123
  venueList = list.filter(function (p) {
1030
1124
  return p.duration != null;
1031
1125
  });
@@ -1043,13 +1137,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1043
1137
 
1044
1138
  // 加载 holder 表单
1045
1139
  if (!this.store.order) {
1046
- _context12.next = 27;
1140
+ _context12.next = 30;
1047
1141
  break;
1048
1142
  }
1049
1143
  products = ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getOrderProducts) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3)) || [];
1050
- _context12.next = 27;
1144
+ _context12.next = 30;
1051
1145
  return this.preloadHolderForms(products);
1052
- case 27:
1146
+ case 30:
1053
1147
  this.productsLoaded = true;
1054
1148
  this.logMethodSuccess('loadAllProducts', {
1055
1149
  total: list.length,
@@ -1061,16 +1155,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1061
1155
  venueProducts: venueList,
1062
1156
  addonProducts: addonList
1063
1157
  });
1064
- case 32:
1065
- _context12.prev = 32;
1158
+ case 35:
1159
+ _context12.prev = 35;
1066
1160
  _context12.t0 = _context12["catch"](1);
1067
1161
  this.logMethodError('loadAllProducts', _context12.t0);
1068
1162
  throw _context12.t0;
1069
- case 36:
1163
+ case 39:
1070
1164
  case "end":
1071
1165
  return _context12.stop();
1072
1166
  }
1073
- }, _callee12, this, [[1, 32]]);
1167
+ }, _callee12, this, [[1, 35]]);
1074
1168
  }));
1075
1169
  function _doLoadAllProducts() {
1076
1170
  return _doLoadAllProducts2.apply(this, arguments);
@@ -1389,9 +1483,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1389
1483
  config: this.baseSlotConfig,
1390
1484
  rawResources: this.store.rawResourceData,
1391
1485
  resourceProductMap: this.resourceProductMap,
1392
- quotationModule: this.store.quotation,
1393
1486
  resolveConfig: function resolveConfig(date) {
1394
1487
  return _this6.resolveSlotConfigForDate(date);
1488
+ },
1489
+ buildSlotPriceMap: function buildSlotPriceMap(date, config, productIds) {
1490
+ return _this6.buildSlotPriceMapForDate(date, config, productIds);
1395
1491
  }
1396
1492
  });
1397
1493
  }
@@ -1399,26 +1495,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1399
1495
  key: "getTimeSlotGrid",
1400
1496
  value: function getTimeSlotGrid(date) {
1401
1497
  var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1402
- var quotationPriceMap;
1403
- if (this.store.quotation) {
1404
- var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1405
- return m.productId;
1406
- })));
1407
- var timeLabels = generateTimeLabels(resolvedSlotConfig);
1408
- var timePoints = timeLabels.map(function (label) {
1409
- return "".concat(date, " ").concat(label);
1410
- });
1411
- quotationPriceMap = this.store.quotation.buildProductPriceMap({
1412
- productIds: productIds,
1413
- timePoints: timePoints
1414
- });
1415
- }
1498
+ var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).flat().map(function (m) {
1499
+ return m.productId;
1500
+ })));
1501
+ var slotPriceMap = productIds.length ? this.buildSlotPriceMapForDate(date, resolvedSlotConfig, productIds) : undefined;
1416
1502
  return buildTimeSlotGrid({
1417
1503
  date: date,
1418
1504
  config: resolvedSlotConfig,
1419
1505
  rawResources: this.store.rawResourceData,
1420
1506
  resourceProductMap: this.resourceProductMap,
1421
- quotationPriceMap: quotationPriceMap
1507
+ slotPriceMap: slotPriceMap
1422
1508
  });
1423
1509
  }
1424
1510
 
@@ -1855,8 +1941,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1855
1941
  booking_uid: bookingUuid,
1856
1942
  price_breakdown: buildPriceBreakdown({
1857
1943
  group: group,
1858
- productId: mapping.productId,
1859
- quotation: this.store.quotation
1944
+ productId: mapping.productId
1860
1945
  })
1861
1946
  },
1862
1947
  _origin: {
@@ -1996,36 +2081,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1996
2081
  _context19.next = 6;
1997
2082
  return this.store.schedule.loadAllSchedule();
1998
2083
  case 6:
1999
- this.injectScheduleResolverToQuotation();
2000
2084
  this.logMethodSuccess('loadSchedules');
2001
- _context19.next = 14;
2085
+ _context19.next = 13;
2002
2086
  break;
2003
- case 10:
2004
- _context19.prev = 10;
2087
+ case 9:
2088
+ _context19.prev = 9;
2005
2089
  _context19.t0 = _context19["catch"](1);
2006
2090
  this.logMethodError('loadSchedules', _context19.t0);
2007
2091
  throw _context19.t0;
2008
- case 14:
2092
+ case 13:
2009
2093
  case "end":
2010
2094
  return _context19.stop();
2011
2095
  }
2012
- }, _callee19, this, [[1, 10]]);
2096
+ }, _callee19, this, [[1, 9]]);
2013
2097
  }));
2014
2098
  function loadSchedules() {
2015
2099
  return _loadSchedules.apply(this, arguments);
2016
2100
  }
2017
2101
  return loadSchedules;
2018
2102
  }()
2019
- }, {
2020
- key: "injectScheduleResolverToQuotation",
2021
- value: function injectScheduleResolverToQuotation() {
2022
- var _this9 = this;
2023
- if (this.store.quotation && this.store.schedule) {
2024
- this.store.quotation.setScheduleResolver(function (id) {
2025
- return _this9.store.schedule.getScheduleListByIds([id])[0];
2026
- });
2027
- }
2028
- }
2029
2103
  }, {
2030
2104
  key: "getScheduleListByIds",
2031
2105
  value: function getScheduleListByIds(ids) {
@@ -2097,14 +2171,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2097
2171
  return onCustomerLogin;
2098
2172
  }()
2099
2173
  }, {
2100
- key: "recalculateOrderPricesFromQuotation",
2101
- value: function recalculateOrderPricesFromQuotation() {
2174
+ key: "recalculateOrderPricesFromSmartPricing",
2175
+ value: function recalculateOrderPricesFromSmartPricing() {
2102
2176
  var _tempOrder$products,
2103
- _this10 = this;
2104
- if (!this.store.order || !this.store.quotation) return;
2177
+ _this9 = this;
2178
+ if (!this.store.order) return;
2105
2179
  var tempOrder = this.store.order.getTempOrder();
2106
2180
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
2107
2181
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
2182
+ var catalog = this.getAllProductsForSmartPricing();
2183
+ var context = this.buildSmartPricingContext();
2108
2184
  var _iterator13 = _createForOfIteratorHelper(tempOrder.products),
2109
2185
  _step13;
2110
2186
  try {
@@ -2112,21 +2188,40 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2112
2188
  var _product$metadata2;
2113
2189
  var product = _step13.value;
2114
2190
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
2115
- var mappings = _this10.resourceProductMap.get(product.metadata.resource_id);
2191
+ var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
2116
2192
  if (!mappings || !mappings.length) return 0; // continue
2117
2193
  var mapping = mappings.find(function (m) {
2118
2194
  return Number(m.productId) === Number(product.product_id);
2119
2195
  }) || mappings[0];
2120
2196
  if (!mapping) return 0; // continue
2121
- var slots = expandMergedSlotToIndividual(product, _this10.store.slotConfig.slotDurationMinutes);
2197
+ var slots = expandMergedSlotToIndividual(product, _this9.store.slotConfig.slotDurationMinutes);
2198
+ var uniqueDates = _toConsumableArray(new Set(slots.map(function (slot) {
2199
+ return dayjs(slot.startTime).format('YYYY-MM-DD');
2200
+ })));
2201
+ var slotPriceMaps = new Map();
2202
+ var _iterator14 = _createForOfIteratorHelper(uniqueDates),
2203
+ _step14;
2204
+ try {
2205
+ for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2206
+ var slotDate = _step14.value;
2207
+ slotPriceMaps.set(slotDate, _this9.buildSlotPriceMapForDate(slotDate, _this9.store.slotConfig, [mapping.productId]));
2208
+ }
2209
+ } catch (err) {
2210
+ _iterator14.e(err);
2211
+ } finally {
2212
+ _iterator14.f();
2213
+ }
2122
2214
  var updatedSlots = slots.map(function (slot) {
2123
- var _getPriceForProduct;
2215
+ var slotDate = dayjs(slot.startTime).format('YYYY-MM-DD');
2216
+ var slotPriceMap = slotPriceMaps.get(slotDate);
2124
2217
  return _objectSpread(_objectSpread({}, slot), {}, {
2125
2218
  productId: mapping.productId,
2126
- price: (_getPriceForProduct = _this10.store.quotation.getPriceForProduct({
2219
+ price: slotPriceMap ? getSlotPriceFromMap({
2220
+ slotPriceMap: slotPriceMap,
2127
2221
  productId: mapping.productId,
2128
- datetime: slot.startTime
2129
- })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
2222
+ slotStartTime: slot.startTime,
2223
+ fallbackPrice: mapping.price
2224
+ }) : mapping.price
2130
2225
  });
2131
2226
  });
2132
2227
  var merged = mergeConsecutiveSlots(updatedSlots);
@@ -2135,21 +2230,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2135
2230
  product.original_price = merged[0].totalPrice;
2136
2231
  product.metadata.price_breakdown = buildPriceBreakdown({
2137
2232
  group: merged[0],
2138
- productId: mapping.productId,
2139
- quotation: _this10.store.quotation
2233
+ productId: mapping.productId
2140
2234
  });
2141
2235
  }
2142
2236
  } else if (product.product_id != null) {
2143
- var _product$product_vari;
2144
- var quotationPrice = _this10.store.quotation.getPriceForProduct({
2145
- productId: product.product_id,
2146
- variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
2147
- datetime: now
2148
- });
2149
- if (quotationPrice !== null) {
2150
- product.selling_price = quotationPrice;
2151
- product.original_price = quotationPrice;
2152
- }
2237
+ var smartPrice = getPriceForProductAtDatetime({
2238
+ products: catalog,
2239
+ context: context,
2240
+ productId: Number(product.product_id),
2241
+ datetime: now,
2242
+ fallbackPrice: product.selling_price
2243
+ });
2244
+ product.selling_price = smartPrice;
2245
+ product.original_price = smartPrice;
2153
2246
  }
2154
2247
  },
2155
2248
  _ret;
@@ -2228,7 +2321,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2228
2321
  key: "setDiscountSelected",
2229
2322
  value: (function () {
2230
2323
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
2231
- var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator14, _step14, d, selectedResourceIds, _iterator15, _step15, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2324
+ var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator15, _step15, d, selectedResourceIds, _iterator16, _step16, _product$_origin, _product$metadata$sou, _product$metadata3, _product$metadata4, _product$original_pri, product, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
2232
2325
  return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2233
2326
  while (1) switch (_context22.prev = _context22.next) {
2234
2327
  case 0:
@@ -2288,18 +2381,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2288
2381
  }).map(function (d) {
2289
2382
  return d.id;
2290
2383
  }));
2291
- _iterator14 = _createForOfIteratorHelper(nextDiscountList);
2384
+ _iterator15 = _createForOfIteratorHelper(nextDiscountList);
2292
2385
  try {
2293
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
2294
- d = _step14.value;
2386
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
2387
+ d = _step15.value;
2295
2388
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
2296
2389
  d.isSelected = false;
2297
2390
  }
2298
2391
  }
2299
2392
  } catch (err) {
2300
- _iterator14.e(err);
2393
+ _iterator15.e(err);
2301
2394
  } finally {
2302
- _iterator14.f();
2395
+ _iterator15.f();
2303
2396
  }
2304
2397
  }
2305
2398
  }
@@ -2312,15 +2405,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2312
2405
  // 都以 original_price - Σ (当前选中 discount_list.amount) 重算 selling_price。
2313
2406
  // 目的:避免 unselect 后 selling_price 残留、reselect 时把残留价带进下一轮 Rules 造成双折扣。
2314
2407
  // 手动改价商品(_origin.isManualDiscount=true)不参与券流程归一化,保留手工价。
2315
- _iterator15 = _createForOfIteratorHelper(tempOrder.products);
2408
+ _iterator16 = _createForOfIteratorHelper(tempOrder.products);
2316
2409
  _context22.prev = 19;
2317
- _iterator15.s();
2410
+ _iterator16.s();
2318
2411
  case 21:
2319
- if ((_step15 = _iterator15.n()).done) {
2412
+ if ((_step16 = _iterator16.n()).done) {
2320
2413
  _context22.next = 35;
2321
2414
  break;
2322
2415
  }
2323
- product = _step15.value;
2416
+ product = _step16.value;
2324
2417
  if (!((_product$_origin = product._origin) !== null && _product$_origin !== void 0 && _product$_origin.isManualDiscount)) {
2325
2418
  _context22.next = 25;
2326
2419
  break;
@@ -2360,10 +2453,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2360
2453
  case 37:
2361
2454
  _context22.prev = 37;
2362
2455
  _context22.t0 = _context22["catch"](19);
2363
- _iterator15.e(_context22.t0);
2456
+ _iterator16.e(_context22.t0);
2364
2457
  case 40:
2365
2458
  _context22.prev = 40;
2366
- _iterator15.f();
2459
+ _iterator16.f();
2367
2460
  return _context22.finish(40);
2368
2461
  case 43:
2369
2462
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
@@ -2495,7 +2588,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2495
2588
  key: "submitOrder",
2496
2589
  value: function () {
2497
2590
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
2498
- var _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14, _tempOrder$products2, result, tempOrder;
2591
+ var _this$otherParams17, _this$otherParams18, _this$otherParams19, _this$otherParams20, _tempOrder$products2, result, tempOrder;
2499
2592
  return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2500
2593
  while (1) switch (_context25.prev = _context25.next) {
2501
2594
  case 0:
@@ -2513,10 +2606,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2513
2606
  _context25.next = 8;
2514
2607
  return this.store.order.submitTempOrder({
2515
2608
  cacheId: this.cacheId,
2516
- platform: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.platform,
2517
- businessCode: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
2518
- channel: (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.channel,
2519
- type: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.type
2609
+ platform: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.platform,
2610
+ businessCode: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
2611
+ channel: (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.channel,
2612
+ type: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type
2520
2613
  });
2521
2614
  case 8:
2522
2615
  result = _context25.sent;
@@ -2545,7 +2638,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2545
2638
  key: "addProductToOrder",
2546
2639
  value: function () {
2547
2640
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2548
- var _product$metadata5, _product$product_vari2, quotationPrice, products;
2641
+ var _product$metadata5, _product$metadata6, smartPrice, products;
2549
2642
  return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2550
2643
  while (1) switch (_context26.prev = _context26.next) {
2551
2644
  case 0:
@@ -2560,18 +2653,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2560
2653
  }
2561
2654
  throw new Error('order 模块未初始化');
2562
2655
  case 4:
2563
- if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && this.store.quotation && product.product_id != null) {
2564
- quotationPrice = this.store.quotation.getPriceForProduct({
2565
- productId: product.product_id,
2566
- variantId: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : undefined,
2567
- datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2656
+ if (!((_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) && product.product_id != null) {
2657
+ smartPrice = getPriceForProductAtDatetime({
2658
+ products: this.getAllProductsForSmartPricing(),
2659
+ context: this.buildSmartPricingContext(),
2660
+ productId: Number(product.product_id),
2661
+ datetime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
2662
+ fallbackPrice: product.selling_price
2568
2663
  });
2569
- if (quotationPrice !== null) {
2570
- product.selling_price = quotationPrice;
2571
- product.original_price = quotationPrice;
2572
- } else if (product.selling_price != null) {
2573
- product.original_price = product.selling_price;
2574
- }
2664
+ product.selling_price = smartPrice;
2665
+ product.original_price = smartPrice;
2666
+ } else if (product.selling_price != null && !((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking)) {
2667
+ product.original_price = product.selling_price;
2575
2668
  }
2576
2669
  _context26.next = 7;
2577
2670
  return this.store.order.addProductToOrder(product);
@@ -2656,7 +2749,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2656
2749
  key: "removeProductFromOrder",
2657
2750
  value: function () {
2658
2751
  var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2659
- var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2752
+ var _this$store$order$get3, _this$store$order8, _this$store$order$ens, _this$store$order9, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$metadata7, _product$metadata8, product, beforeBookingCount, _this$store$order$per, _this$store$order10;
2660
2753
  return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2661
2754
  while (1) switch (_context28.prev = _context28.next) {
2662
2755
  case 0:
@@ -2682,23 +2775,23 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2682
2775
  }
2683
2776
  venueProductUids = new Set();
2684
2777
  venueBookingUids = new Set();
2685
- _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2778
+ _iterator17 = _createForOfIteratorHelper(tempOrder.products || []);
2686
2779
  _context28.prev = 12;
2687
- _iterator16.s();
2780
+ _iterator17.s();
2688
2781
  case 14:
2689
- if ((_step16 = _iterator16.n()).done) {
2782
+ if ((_step17 = _iterator17.n()).done) {
2690
2783
  _context28.next = 22;
2691
2784
  break;
2692
2785
  }
2693
- product = _step16.value;
2694
- if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
2786
+ product = _step17.value;
2787
+ if (product !== null && product !== void 0 && (_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking) {
2695
2788
  _context28.next = 18;
2696
2789
  break;
2697
2790
  }
2698
2791
  return _context28.abrupt("continue", 20);
2699
2792
  case 18:
2700
2793
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2701
- if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
2794
+ if ((_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.booking_uid) {
2702
2795
  venueBookingUids.add(String(product.metadata.booking_uid));
2703
2796
  }
2704
2797
  case 20:
@@ -2710,10 +2803,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2710
2803
  case 24:
2711
2804
  _context28.prev = 24;
2712
2805
  _context28.t0 = _context28["catch"](12);
2713
- _iterator16.e(_context28.t0);
2806
+ _iterator17.e(_context28.t0);
2714
2807
  case 27:
2715
2808
  _context28.prev = 27;
2716
- _iterator16.f();
2809
+ _iterator17.f();
2717
2810
  return _context28.finish(27);
2718
2811
  case 30:
2719
2812
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
@@ -2961,17 +3054,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2961
3054
  if (visited.has(value)) return;
2962
3055
  visited.add(value);
2963
3056
  if (Array.isArray(value)) {
2964
- var _iterator17 = _createForOfIteratorHelper(value),
2965
- _step17;
3057
+ var _iterator18 = _createForOfIteratorHelper(value),
3058
+ _step18;
2966
3059
  try {
2967
- for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
2968
- var item = _step17.value;
3060
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
3061
+ var item = _step18.value;
2969
3062
  collectFromValue(item);
2970
3063
  }
2971
3064
  } catch (err) {
2972
- _iterator17.e(err);
3065
+ _iterator18.e(err);
2973
3066
  } finally {
2974
- _iterator17.f();
3067
+ _iterator18.f();
2975
3068
  }
2976
3069
  return;
2977
3070
  }
@@ -3019,7 +3112,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3019
3112
  key: "ensureItemRuleConfigsLoaded",
3020
3113
  value: function () {
3021
3114
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3022
- var _this11 = this;
3115
+ var _this10 = this;
3023
3116
  return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3024
3117
  while (1) switch (_context35.prev = _context35.next) {
3025
3118
  case 0:
@@ -3040,19 +3133,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3040
3133
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3041
3134
  while (1) switch (_context34.prev = _context34.next) {
3042
3135
  case 0:
3043
- runtimeConfig = _this11.getItemRuleRuntimeConfig();
3136
+ runtimeConfig = _this10.getItemRuleRuntimeConfig();
3044
3137
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3045
3138
  if (!(staticConfigs.length > 0)) {
3046
3139
  _context34.next = 6;
3047
3140
  break;
3048
3141
  }
3049
- _this11.itemRuleConfigs = staticConfigs;
3050
- _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3051
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3142
+ _this10.itemRuleConfigs = staticConfigs;
3143
+ _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3144
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3052
3145
  case 6:
3053
- _this11.itemRuleConfigs = [];
3054
- _this11.itemRuleEvaluator.setStrategyConfigs([]);
3055
- return _context34.abrupt("return", _this11.itemRuleConfigs);
3146
+ _this10.itemRuleConfigs = [];
3147
+ _this10.itemRuleEvaluator.setStrategyConfigs([]);
3148
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3056
3149
  case 9:
3057
3150
  case "end":
3058
3151
  return _context34.stop();
@@ -3126,7 +3219,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3126
3219
  key: "applyPrefillByItemRule",
3127
3220
  value: function () {
3128
3221
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3129
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator18, _step18, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3222
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
3130
3223
  return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3131
3224
  while (1) switch (_context37.prev = _context37.next) {
3132
3225
  case 0:
@@ -3171,15 +3264,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3171
3264
  productSourceMap = _context37.sent;
3172
3265
  tempOrder = this.ensureTempOrder();
3173
3266
  hasChanges = false;
3174
- _iterator18 = _createForOfIteratorHelper(prefillItems);
3267
+ _iterator19 = _createForOfIteratorHelper(prefillItems);
3175
3268
  _context37.prev = 20;
3176
- _iterator18.s();
3269
+ _iterator19.s();
3177
3270
  case 22:
3178
- if ((_step18 = _iterator18.n()).done) {
3271
+ if ((_step19 = _iterator19.n()).done) {
3179
3272
  _context37.next = 45;
3180
3273
  break;
3181
3274
  }
3182
- prefillItem = _step18.value;
3275
+ prefillItem = _step19.value;
3183
3276
  productId = Number(prefillItem.product_id);
3184
3277
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3185
3278
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -3248,10 +3341,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3248
3341
  case 47:
3249
3342
  _context37.prev = 47;
3250
3343
  _context37.t0 = _context37["catch"](20);
3251
- _iterator18.e(_context37.t0);
3344
+ _iterator19.e(_context37.t0);
3252
3345
  case 50:
3253
3346
  _context37.prev = 50;
3254
- _iterator18.f();
3347
+ _iterator19.f();
3255
3348
  return _context37.finish(50);
3256
3349
  case 53:
3257
3350
  if (!hasChanges) {
@@ -3513,7 +3606,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3513
3606
  var raw = this.window.sessionStorage.getItem(key) || '{}';
3514
3607
  var parsed = JSON.parse(raw);
3515
3608
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
3516
- } catch (_unused4) {
3609
+ } catch (_unused5) {
3517
3610
  return {};
3518
3611
  }
3519
3612
  }
@@ -3563,22 +3656,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3563
3656
  if (booking) {
3564
3657
  booking.holder = holder;
3565
3658
  }
3566
- var _iterator19 = _createForOfIteratorHelper(tempOrder.products),
3567
- _step19;
3659
+ var _iterator20 = _createForOfIteratorHelper(tempOrder.products),
3660
+ _step20;
3568
3661
  try {
3569
- for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
3570
- var _product$metadata$boo, _product$metadata8, _product$_origin2;
3571
- var product = _step19.value;
3572
- var productBookingUid = (_product$metadata$boo = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
3662
+ for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
3663
+ var _product$metadata$boo, _product$metadata9, _product$_origin2;
3664
+ var product = _step20.value;
3665
+ var productBookingUid = (_product$metadata$boo = (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid) !== null && _product$metadata$boo !== void 0 ? _product$metadata$boo : (_product$_origin2 = product._origin) === null || _product$_origin2 === void 0 || (_product$_origin2 = _product$_origin2.product) === null || _product$_origin2 === void 0 ? void 0 : _product$_origin2.bookingUuid;
3573
3666
  if (String(productBookingUid) !== String(bookingUid)) continue;
3574
3667
  var origin = product._origin && _typeof(product._origin) === 'object' ? product._origin : {};
3575
3668
  origin.holder = holder;
3576
3669
  product._origin = origin;
3577
3670
  }
3578
3671
  } catch (err) {
3579
- _iterator19.e(err);
3672
+ _iterator20.e(err);
3580
3673
  } finally {
3581
- _iterator19.f();
3674
+ _iterator20.f();
3582
3675
  }
3583
3676
  this.store.order.notifyTempOrderChanged();
3584
3677
  }