@pisell/pisellos 2.1.124 → 2.1.126

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 (29) hide show
  1. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
  2. package/dist/model/strategy/adapter/itemRule/adapter.js +46 -6
  3. package/dist/model/strategy/adapter/itemRule/type.d.ts +11 -1
  4. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  5. package/dist/modules/Order/index.js +2 -2
  6. package/dist/modules/Schedule/utils.d.ts +1 -1
  7. package/dist/solution/BookingByStep/index.d.ts +2 -2
  8. package/dist/solution/ScanOrder/index.js +36 -12
  9. package/dist/solution/ScanOrder/utils.d.ts +1 -0
  10. package/dist/solution/ScanOrder/utils.js +5 -0
  11. package/dist/solution/VenueBooking/index.d.ts +4 -0
  12. package/dist/solution/VenueBooking/index.js +193 -106
  13. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  14. package/dist/solution/VenueBooking/utils/dateSummary.js +6 -4
  15. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +8 -0
  16. package/lib/model/strategy/adapter/itemRule/adapter.js +31 -0
  17. package/lib/model/strategy/adapter/itemRule/type.d.ts +11 -1
  18. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  19. package/lib/modules/Order/index.js +2 -2
  20. package/lib/modules/Schedule/utils.d.ts +1 -1
  21. package/lib/solution/BookingByStep/index.d.ts +2 -2
  22. package/lib/solution/ScanOrder/index.js +22 -3
  23. package/lib/solution/ScanOrder/utils.d.ts +1 -0
  24. package/lib/solution/ScanOrder/utils.js +5 -0
  25. package/lib/solution/VenueBooking/index.d.ts +4 -0
  26. package/lib/solution/VenueBooking/index.js +79 -10
  27. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  28. package/lib/solution/VenueBooking/utils/dateSummary.js +13 -4
  29. package/package.json +1 -1
@@ -35,6 +35,7 @@ import { createModule } from "../BookingByStep/types";
35
35
  import { ProductList } from "../../modules/ProductList";
36
36
  import { DateModule } from "../../modules/Date";
37
37
  import { ScheduleModule } from "../../modules/Schedule";
38
+ import { calcMinTimeMaxTimeBySchedules } from "../../modules/Schedule/utils";
38
39
  import { QuotationModule } from "../../modules/Quotation";
39
40
  import { OpenDataModule } from "../../modules/OpenData";
40
41
  import { AccountHooks } from "../../modules/Account/types";
@@ -87,6 +88,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
87
88
  _defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
88
89
  _defineProperty(_assertThisInitialized(_this), "window", void 0);
89
90
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
91
+ _defineProperty(_assertThisInitialized(_this), "baseSlotConfig", _objectSpread({}, DEFAULT_SLOT_CONFIG));
90
92
  _defineProperty(_assertThisInitialized(_this), "itemRuleEvaluator", new ItemRuleEvaluator());
91
93
  _defineProperty(_assertThisInitialized(_this), "itemRuleConfigs", []);
92
94
  _defineProperty(_assertThisInitialized(_this), "itemRuleConfigsPromise", null);
@@ -445,6 +447,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
445
447
  openDataModule,
446
448
  _this$store$order,
447
449
  _this$store$order2,
450
+ _this$store$quotation,
451
+ _this$otherParams6,
448
452
  _args6 = arguments;
449
453
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
450
454
  while (1) switch (_context6.prev = _context6.next) {
@@ -458,7 +462,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
458
462
  this.store.status = 'initializing';
459
463
  this.store.error = null;
460
464
  this.store.rawResourceData = [];
461
- this.store.slotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
465
+ this.baseSlotConfig = _objectSpread(_objectSpread({}, DEFAULT_SLOT_CONFIG), ((_options$otherParams2 = options.otherParams) === null || _options$otherParams2 === void 0 ? void 0 : _options$otherParams2.slotConfig) || {});
466
+ this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
462
467
  this.otherParams = options.otherParams || {};
463
468
  this.cacheId = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.cacheId;
464
469
  this.itemRuleRuntimeConfig = ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.venueBookingItemRule) || ((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.itemRule) || {};
@@ -473,19 +478,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
473
478
  this.window = core.getPlugin('window');
474
479
  this.request = core.getPlugin('request');
475
480
  if (this.window) {
476
- _context6.next = 23;
481
+ _context6.next = 24;
477
482
  break;
478
483
  }
479
484
  this.logMethodError('initialize', 'window plugin missing');
480
485
  throw new Error('venueBooking解决方案需要 window 插件支持');
481
- case 23:
486
+ case 24:
482
487
  if (this.request) {
483
- _context6.next = 26;
488
+ _context6.next = 27;
484
489
  break;
485
490
  }
486
491
  this.logMethodError('initialize', 'request plugin missing');
487
492
  throw new Error('venueBooking解决方案需要 request 插件支持');
488
- case 26:
493
+ case 27:
489
494
  // 注册基础模块(order, salesSummary, products, logger)
490
495
  baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
491
496
  baseModules.forEach(function (step) {
@@ -579,43 +584,46 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
579
584
  }
580
585
  this.registerCustomerLoginListeners();
581
586
  console.log('[VenueBooking] 初始化开始');
582
- _context6.prev = 49;
583
- _context6.next = 52;
587
+ _context6.prev = 50;
588
+ _context6.next = 53;
584
589
  return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
585
590
  createIfMissing: false
586
591
  });
587
- case 52:
592
+ case 53:
588
593
  (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
589
- _context6.next = 55;
594
+ _context6.next = 56;
590
595
  return this.loadRuntimeConfigs();
591
- case 55:
596
+ case 56:
592
597
  if (!this.store.schedule) {
593
- _context6.next = 59;
598
+ _context6.next = 61;
594
599
  break;
595
600
  }
596
- _context6.next = 58;
601
+ _context6.next = 59;
597
602
  return this.store.schedule.loadAllSchedule();
598
- case 58:
599
- this.injectScheduleResolverToQuotation();
600
603
  case 59:
601
- _context6.next = 61;
602
- return this.refreshItemRuleQuantityLimits();
604
+ this.injectScheduleResolverToQuotation();
605
+ (_this$store$quotation = this.store.quotation) === null || _this$store$quotation === void 0 || _this$store$quotation.loadQuotations({
606
+ channel: (_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel
607
+ });
603
608
  case 61:
609
+ _context6.next = 63;
610
+ return this.refreshItemRuleQuantityLimits();
611
+ case 63:
604
612
  this.store.status = 'ready';
605
613
  console.log('[VenueBooking] 初始化完成');
606
- _context6.next = 65;
614
+ _context6.next = 67;
607
615
  return this.core.effects.emit(VenueBookingHooks.onInited, {
608
616
  status: this.store.status
609
617
  });
610
- case 65:
618
+ case 67:
611
619
  this.logMethodSuccess('initialize', {
612
620
  status: this.store.status
613
621
  });
614
- _context6.next = 75;
622
+ _context6.next = 77;
615
623
  break;
616
- case 68:
617
- _context6.prev = 68;
618
- _context6.t0 = _context6["catch"](49);
624
+ case 70:
625
+ _context6.prev = 70;
626
+ _context6.t0 = _context6["catch"](50);
619
627
  this.store.status = 'error';
620
628
  this.store.error = _context6.t0 instanceof Error ? _context6.t0.message : '初始化失败';
621
629
  console.error('[VenueBooking] 初始化失败', _context6.t0);
@@ -623,11 +631,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
623
631
  status: this.store.status
624
632
  });
625
633
  throw _context6.t0;
626
- case 75:
634
+ case 77:
627
635
  case "end":
628
636
  return _context6.stop();
629
637
  }
630
- }, _callee6, this, [[49, 68]]);
638
+ }, _callee6, this, [[50, 70]]);
631
639
  }));
632
640
  function initialize(_x5) {
633
641
  return _initialize.apply(this, arguments);
@@ -802,7 +810,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
802
810
  key: "_doLoadAllProducts",
803
811
  value: function () {
804
812
  var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
805
- var _this$otherParams6, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
813
+ var _this$otherParams7, _this$store$venueProd, associatedMenus, menuListIds, allProducts, list, venueList, addonList, venueStore;
806
814
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
807
815
  while (1) switch (_context11.prev = _context11.next) {
808
816
  case 0:
@@ -820,7 +828,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
820
828
  }
821
829
  throw new Error('addonProducts 模块未初始化');
822
830
  case 6:
823
- associatedMenus = ((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 || (_this$otherParams6 = _this$otherParams6.openData) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6['menu.associated_menus']) || [];
831
+ associatedMenus = ((_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 || (_this$otherParams7 = _this$otherParams7.openData) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7['menu.associated_menus']) || [];
824
832
  if (associatedMenus.length) {
825
833
  _context11.next = 9;
826
834
  break;
@@ -1089,27 +1097,105 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1089
1097
  }
1090
1098
  return fetchResourceAvailability;
1091
1099
  }() // ─── 日期概览 & 时间槽矩阵(纯计算,不发请求) ───
1100
+ }, {
1101
+ key: "getOperatingHoursScheduleIds",
1102
+ value: function getOperatingHoursScheduleIds() {
1103
+ var _this$store$openData, _this$store$openData$;
1104
+ var openData = this.otherParams.openData || ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 || (_this$store$openData$ = _this$store$openData.getOpenData) === null || _this$store$openData$ === void 0 ? void 0 : _this$store$openData$.call(_this$store$openData)) || null;
1105
+ var rawIds = openData === null || openData === void 0 ? void 0 : openData['availability.operating_hours'];
1106
+ if (!Array.isArray(rawIds)) return [];
1107
+ return _toConsumableArray(new Set(rawIds.map(function (id) {
1108
+ return Number(id);
1109
+ }).filter(function (id) {
1110
+ return Number.isFinite(id) && id > 0;
1111
+ }).map(function (id) {
1112
+ return Math.floor(id);
1113
+ })));
1114
+ }
1115
+ }, {
1116
+ key: "resolveSlotConfigForDate",
1117
+ value: function resolveSlotConfigForDate(date) {
1118
+ var nextSlotConfig = _objectSpread({}, this.baseSlotConfig);
1119
+ if (!date || !this.store.schedule) return nextSlotConfig;
1120
+ var operatingHoursScheduleIds = this.getOperatingHoursScheduleIds();
1121
+ if (!operatingHoursScheduleIds.length) return nextSlotConfig;
1122
+ var scheduleList = this.store.schedule.getScheduleListByIds(operatingHoursScheduleIds);
1123
+ if (!scheduleList.length) return nextSlotConfig;
1124
+ var timeRangeMap = calcMinTimeMaxTimeBySchedules(scheduleList, undefined, date);
1125
+ var earliestStart = null;
1126
+ var latestEnd = null;
1127
+ var _iterator3 = _createForOfIteratorHelper(scheduleList),
1128
+ _step3;
1129
+ try {
1130
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1131
+ var _timeRangeMap$schedul;
1132
+ var schedule = _step3.value;
1133
+ var dateRangeList = (timeRangeMap === null || timeRangeMap === void 0 || (_timeRangeMap$schedul = timeRangeMap[schedule.id]) === null || _timeRangeMap$schedul === void 0 ? void 0 : _timeRangeMap$schedul.dateRangeFormat) || [];
1134
+ var _iterator4 = _createForOfIteratorHelper(dateRangeList),
1135
+ _step4;
1136
+ try {
1137
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1138
+ var range = _step4.value;
1139
+ var start = dayjs(range === null || range === void 0 ? void 0 : range.start);
1140
+ var end = dayjs(range === null || range === void 0 ? void 0 : range.end);
1141
+ if (!start.isValid() || !end.isValid()) continue;
1142
+ if (!earliestStart || start.isBefore(earliestStart)) {
1143
+ earliestStart = start;
1144
+ }
1145
+ if (!latestEnd || end.isAfter(latestEnd)) {
1146
+ latestEnd = end;
1147
+ }
1148
+ }
1149
+ } catch (err) {
1150
+ _iterator4.e(err);
1151
+ } finally {
1152
+ _iterator4.f();
1153
+ }
1154
+ }
1155
+ } catch (err) {
1156
+ _iterator3.e(err);
1157
+ } finally {
1158
+ _iterator3.f();
1159
+ }
1160
+ if (!earliestStart || !latestEnd) return nextSlotConfig;
1161
+ return _objectSpread(_objectSpread({}, nextSlotConfig), {}, {
1162
+ businessStartTime: earliestStart.format('HH:mm'),
1163
+ businessEndTime: latestEnd.format('HH:mm')
1164
+ });
1165
+ }
1166
+ }, {
1167
+ key: "syncOperatingHoursToSlotConfig",
1168
+ value: function syncOperatingHoursToSlotConfig(date) {
1169
+ var resolvedSlotConfig = this.resolveSlotConfigForDate(date);
1170
+ this.store.slotConfig = resolvedSlotConfig;
1171
+ return resolvedSlotConfig;
1172
+ }
1092
1173
  }, {
1093
1174
  key: "getDateRangeSummary",
1094
1175
  value: function getDateRangeSummary(params) {
1176
+ var _this6 = this;
1095
1177
  return buildDateRangeSummary({
1096
1178
  startDate: params.startDate,
1097
1179
  endDate: params.endDate,
1098
- config: this.store.slotConfig,
1180
+ config: this.baseSlotConfig,
1099
1181
  rawResources: this.store.rawResourceData,
1100
1182
  resourceProductMap: this.resourceProductMap,
1101
- quotationModule: this.store.quotation
1183
+ quotationModule: this.store.quotation,
1184
+ resolveConfig: function resolveConfig(date) {
1185
+ return _this6.resolveSlotConfigForDate(date);
1186
+ }
1102
1187
  });
1103
1188
  }
1104
1189
  }, {
1105
1190
  key: "getTimeSlotGrid",
1106
1191
  value: function getTimeSlotGrid(date) {
1192
+ var resolvedSlotConfig = this.syncOperatingHoursToSlotConfig(date);
1107
1193
  var quotationPriceMap;
1108
1194
  if (this.store.quotation) {
1109
1195
  var productIds = _toConsumableArray(new Set(_toConsumableArray(this.resourceProductMap.values()).map(function (m) {
1110
1196
  return m.productId;
1111
1197
  })));
1112
- var timeLabels = generateTimeLabels(this.store.slotConfig);
1198
+ var timeLabels = generateTimeLabels(resolvedSlotConfig);
1113
1199
  var timePoints = timeLabels.map(function (label) {
1114
1200
  return "".concat(date, " ").concat(label);
1115
1201
  });
@@ -1120,7 +1206,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1120
1206
  }
1121
1207
  return buildTimeSlotGrid({
1122
1208
  date: date,
1123
- config: this.store.slotConfig,
1209
+ config: resolvedSlotConfig,
1124
1210
  rawResources: this.store.rawResourceData,
1125
1211
  resourceProductMap: this.resourceProductMap,
1126
1212
  quotationPriceMap: quotationPriceMap
@@ -1217,17 +1303,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1217
1303
  });
1218
1304
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1219
1305
  var slots = [];
1220
- var _iterator3 = _createForOfIteratorHelper(venueProducts),
1221
- _step3;
1306
+ var _iterator5 = _createForOfIteratorHelper(venueProducts),
1307
+ _step5;
1222
1308
  try {
1223
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1224
- var product = _step3.value;
1309
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1310
+ var product = _step5.value;
1225
1311
  slots.push.apply(slots, _toConsumableArray(expandMergedSlotToIndividual(product, slotDuration)));
1226
1312
  }
1227
1313
  } catch (err) {
1228
- _iterator3.e(err);
1314
+ _iterator5.e(err);
1229
1315
  } finally {
1230
- _iterator3.f();
1316
+ _iterator5.f();
1231
1317
  }
1232
1318
  return slots.sort(function (a, b) {
1233
1319
  return a.startTime.localeCompare(b.startTime);
@@ -1260,12 +1346,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1260
1346
  return (_p$metadata3 = p.metadata) === null || _p$metadata3 === void 0 ? void 0 : _p$metadata3.venue_booking;
1261
1347
  });
1262
1348
  var slotDuration = this.store.slotConfig.slotDurationMinutes;
1263
- var _iterator4 = _createForOfIteratorHelper(venueProducts),
1264
- _step4;
1349
+ var _iterator6 = _createForOfIteratorHelper(venueProducts),
1350
+ _step6;
1265
1351
  try {
1266
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1352
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1267
1353
  var _product$metadata;
1268
- var product = _step4.value;
1354
+ var product = _step6.value;
1269
1355
  var resourceId = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.resource_id;
1270
1356
  if (resourceId == null) continue;
1271
1357
  var existing = result.get(resourceId) || [];
@@ -1273,25 +1359,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1273
1359
  result.set(resourceId, existing);
1274
1360
  }
1275
1361
  } catch (err) {
1276
- _iterator4.e(err);
1362
+ _iterator6.e(err);
1277
1363
  } finally {
1278
- _iterator4.f();
1364
+ _iterator6.f();
1279
1365
  }
1280
- var _iterator5 = _createForOfIteratorHelper(result),
1281
- _step5;
1366
+ var _iterator7 = _createForOfIteratorHelper(result),
1367
+ _step7;
1282
1368
  try {
1283
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1284
- var _step5$value = _slicedToArray(_step5.value, 2),
1285
- key = _step5$value[0],
1286
- slots = _step5$value[1];
1369
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1370
+ var _step7$value = _slicedToArray(_step7.value, 2),
1371
+ key = _step7$value[0],
1372
+ slots = _step7$value[1];
1287
1373
  result.set(key, slots.sort(function (a, b) {
1288
1374
  return a.startTime.localeCompare(b.startTime);
1289
1375
  }));
1290
1376
  }
1291
1377
  } catch (err) {
1292
- _iterator5.e(err);
1378
+ _iterator7.e(err);
1293
1379
  } finally {
1294
- _iterator5.f();
1380
+ _iterator7.f();
1295
1381
  }
1296
1382
  return result;
1297
1383
  }
@@ -1454,7 +1540,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1454
1540
  }, {
1455
1541
  key: "setSlotConfig",
1456
1542
  value: function setSlotConfig(config) {
1457
- this.store.slotConfig = _objectSpread(_objectSpread({}, this.store.slotConfig), config);
1543
+ this.baseSlotConfig = _objectSpread(_objectSpread({}, this.baseSlotConfig), config);
1544
+ this.store.slotConfig = _objectSpread({}, this.baseSlotConfig);
1458
1545
  }
1459
1546
  }, {
1460
1547
  key: "getSlotConfig",
@@ -1504,10 +1591,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1504
1591
  }, {
1505
1592
  key: "injectScheduleResolverToQuotation",
1506
1593
  value: function injectScheduleResolverToQuotation() {
1507
- var _this6 = this;
1594
+ var _this7 = this;
1508
1595
  if (this.store.quotation && this.store.schedule) {
1509
1596
  this.store.quotation.setScheduleResolver(function (id) {
1510
- return _this6.store.schedule.getScheduleListByIds([id])[0];
1597
+ return _this7.store.schedule.getScheduleListByIds([id])[0];
1511
1598
  });
1512
1599
  }
1513
1600
  }
@@ -1585,25 +1672,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1585
1672
  key: "recalculateOrderPricesFromQuotation",
1586
1673
  value: function recalculateOrderPricesFromQuotation() {
1587
1674
  var _tempOrder$products,
1588
- _this7 = this;
1675
+ _this8 = this;
1589
1676
  if (!this.store.order || !this.store.quotation) return;
1590
1677
  var tempOrder = this.store.order.getTempOrder();
1591
1678
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$products = tempOrder.products) !== null && _tempOrder$products !== void 0 && _tempOrder$products.length)) return;
1592
1679
  var now = dayjs().format('YYYY-MM-DD HH:mm:ss');
1593
- var _iterator6 = _createForOfIteratorHelper(tempOrder.products),
1594
- _step6;
1680
+ var _iterator8 = _createForOfIteratorHelper(tempOrder.products),
1681
+ _step8;
1595
1682
  try {
1596
1683
  var _loop = function _loop() {
1597
1684
  var _product$metadata2;
1598
- var product = _step6.value;
1685
+ var product = _step8.value;
1599
1686
  if ((_product$metadata2 = product.metadata) !== null && _product$metadata2 !== void 0 && _product$metadata2.venue_booking) {
1600
- var mapping = _this7.resourceProductMap.get(product.metadata.resource_id);
1687
+ var mapping = _this8.resourceProductMap.get(product.metadata.resource_id);
1601
1688
  if (!mapping) return 1; // continue
1602
- var slots = expandMergedSlotToIndividual(product, _this7.store.slotConfig.slotDurationMinutes);
1689
+ var slots = expandMergedSlotToIndividual(product, _this8.store.slotConfig.slotDurationMinutes);
1603
1690
  var updatedSlots = slots.map(function (slot) {
1604
1691
  var _getPriceForProduct;
1605
1692
  return _objectSpread(_objectSpread({}, slot), {}, {
1606
- price: (_getPriceForProduct = _this7.store.quotation.getPriceForProduct({
1693
+ price: (_getPriceForProduct = _this8.store.quotation.getPriceForProduct({
1607
1694
  productId: mapping.productId,
1608
1695
  datetime: slot.startTime
1609
1696
  })) !== null && _getPriceForProduct !== void 0 ? _getPriceForProduct : mapping.price
@@ -1616,12 +1703,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1616
1703
  product.metadata.price_breakdown = buildPriceBreakdown({
1617
1704
  group: merged[0],
1618
1705
  productId: mapping.productId,
1619
- quotation: _this7.store.quotation
1706
+ quotation: _this8.store.quotation
1620
1707
  });
1621
1708
  }
1622
1709
  } else if (product.product_id != null) {
1623
1710
  var _product$product_vari;
1624
- var quotationPrice = _this7.store.quotation.getPriceForProduct({
1711
+ var quotationPrice = _this8.store.quotation.getPriceForProduct({
1625
1712
  productId: product.product_id,
1626
1713
  variantId: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : undefined,
1627
1714
  datetime: now
@@ -1632,13 +1719,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1632
1719
  }
1633
1720
  }
1634
1721
  };
1635
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1722
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
1636
1723
  if (_loop()) continue;
1637
1724
  }
1638
1725
  } catch (err) {
1639
- _iterator6.e(err);
1726
+ _iterator8.e(err);
1640
1727
  } finally {
1641
- _iterator6.f();
1728
+ _iterator8.f();
1642
1729
  }
1643
1730
  }
1644
1731
  }, {
@@ -1706,7 +1793,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1706
1793
  key: "setDiscountSelected",
1707
1794
  value: (function () {
1708
1795
  var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1709
- 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, _iterator7, _step7, d, selectedResourceIds, _iterator8, _step8, _product$discount_lis, product, before, totalDiscountAmount, newPaymentPrice, paymentStr, afterApplyTarget, finalSummary, finalProduct, finalTarget;
1796
+ 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, _iterator9, _step9, d, selectedResourceIds, _iterator10, _step10, _product$discount_lis, product, before, totalDiscountAmount, newPaymentPrice, paymentStr, afterApplyTarget, finalSummary, finalProduct, finalTarget;
1710
1797
  return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1711
1798
  while (1) switch (_context21.prev = _context21.next) {
1712
1799
  case 0:
@@ -1766,18 +1853,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1766
1853
  }).map(function (d) {
1767
1854
  return d.id;
1768
1855
  }));
1769
- _iterator7 = _createForOfIteratorHelper(nextDiscountList);
1856
+ _iterator9 = _createForOfIteratorHelper(nextDiscountList);
1770
1857
  try {
1771
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1772
- d = _step7.value;
1858
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1859
+ d = _step9.value;
1773
1860
  if (d.isSelected && !beforeSelectedIds.has(d.id)) {
1774
1861
  d.isSelected = false;
1775
1862
  }
1776
1863
  }
1777
1864
  } catch (err) {
1778
- _iterator7.e(err);
1865
+ _iterator9.e(err);
1779
1866
  } finally {
1780
- _iterator7.f();
1867
+ _iterator9.f();
1781
1868
  }
1782
1869
  }
1783
1870
  }
@@ -1787,15 +1874,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1787
1874
  }).map(function (d) {
1788
1875
  return d.id;
1789
1876
  }));
1790
- _iterator8 = _createForOfIteratorHelper(tempOrder.products);
1877
+ _iterator10 = _createForOfIteratorHelper(tempOrder.products);
1791
1878
  _context21.prev = 19;
1792
- _iterator8.s();
1879
+ _iterator10.s();
1793
1880
  case 21:
1794
- if ((_step8 = _iterator8.n()).done) {
1881
+ if ((_step10 = _iterator10.n()).done) {
1795
1882
  _context21.next = 30;
1796
1883
  break;
1797
1884
  }
1798
- product = _step8.value;
1885
+ product = _step10.value;
1799
1886
  if ((_product$discount_lis = product.discount_list) !== null && _product$discount_lis !== void 0 && _product$discount_lis.length) {
1800
1887
  _context21.next = 25;
1801
1888
  break;
@@ -1828,10 +1915,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1828
1915
  case 32:
1829
1916
  _context21.prev = 32;
1830
1917
  _context21.t0 = _context21["catch"](19);
1831
- _iterator8.e(_context21.t0);
1918
+ _iterator10.e(_context21.t0);
1832
1919
  case 35:
1833
1920
  _context21.prev = 35;
1834
- _iterator8.f();
1921
+ _iterator10.f();
1835
1922
  return _context21.finish(35);
1836
1923
  case 38:
1837
1924
  OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
@@ -1963,7 +2050,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1963
2050
  key: "submitOrder",
1964
2051
  value: function () {
1965
2052
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1966
- var _this$otherParams7, _this$otherParams8, _this$otherParams9, _this$otherParams10, _tempOrder$products2, result, tempOrder;
2053
+ var _this$otherParams8, _this$otherParams9, _this$otherParams10, _this$otherParams11, _tempOrder$products2, result, tempOrder;
1967
2054
  return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1968
2055
  while (1) switch (_context24.prev = _context24.next) {
1969
2056
  case 0:
@@ -1981,10 +2068,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
1981
2068
  _context24.next = 8;
1982
2069
  return this.store.order.submitTempOrder({
1983
2070
  cacheId: this.cacheId,
1984
- platform: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.platform,
1985
- businessCode: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.businessCode,
1986
- channel: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.channel,
1987
- type: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.type
2071
+ platform: (_this$otherParams8 = this.otherParams) === null || _this$otherParams8 === void 0 ? void 0 : _this$otherParams8.platform,
2072
+ businessCode: (_this$otherParams9 = this.otherParams) === null || _this$otherParams9 === void 0 ? void 0 : _this$otherParams9.businessCode,
2073
+ channel: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.channel,
2074
+ type: (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.type
1988
2075
  });
1989
2076
  case 8:
1990
2077
  result = _context24.sent;
@@ -2204,7 +2291,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2204
2291
  key: "loadOpenDataConfig",
2205
2292
  value: function () {
2206
2293
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2207
- var _this8 = this;
2294
+ var _this9 = this;
2208
2295
  var lastFetchedAt, cachedData;
2209
2296
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2210
2297
  while (1) switch (_context29.prev = _context29.next) {
@@ -2235,10 +2322,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2235
2322
  target: 'venue_booking+online_store',
2236
2323
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2237
2324
  }).then(function (openDataConfig) {
2238
- _this8.otherParams.openData = openDataConfig;
2325
+ _this9.otherParams.openData = openDataConfig;
2239
2326
  return openDataConfig;
2240
2327
  }).finally(function () {
2241
- _this8.loadOpenDataConfigInFlight = null;
2328
+ _this9.loadOpenDataConfigInFlight = null;
2242
2329
  });
2243
2330
  return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2244
2331
  case 11:
@@ -2367,17 +2454,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2367
2454
  if (visited.has(value)) return;
2368
2455
  visited.add(value);
2369
2456
  if (Array.isArray(value)) {
2370
- var _iterator9 = _createForOfIteratorHelper(value),
2371
- _step9;
2457
+ var _iterator11 = _createForOfIteratorHelper(value),
2458
+ _step11;
2372
2459
  try {
2373
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
2374
- var item = _step9.value;
2460
+ for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
2461
+ var item = _step11.value;
2375
2462
  collectFromValue(item);
2376
2463
  }
2377
2464
  } catch (err) {
2378
- _iterator9.e(err);
2465
+ _iterator11.e(err);
2379
2466
  } finally {
2380
- _iterator9.f();
2467
+ _iterator11.f();
2381
2468
  }
2382
2469
  return;
2383
2470
  }
@@ -2425,7 +2512,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2425
2512
  key: "ensureItemRuleConfigsLoaded",
2426
2513
  value: function () {
2427
2514
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2428
- var _this9 = this;
2515
+ var _this10 = this;
2429
2516
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2430
2517
  while (1) switch (_context34.prev = _context34.next) {
2431
2518
  case 0:
@@ -2446,19 +2533,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2446
2533
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2447
2534
  while (1) switch (_context33.prev = _context33.next) {
2448
2535
  case 0:
2449
- runtimeConfig = _this9.getItemRuleRuntimeConfig();
2536
+ runtimeConfig = _this10.getItemRuleRuntimeConfig();
2450
2537
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2451
2538
  if (!(staticConfigs.length > 0)) {
2452
2539
  _context33.next = 6;
2453
2540
  break;
2454
2541
  }
2455
- _this9.itemRuleConfigs = staticConfigs;
2456
- _this9.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2457
- return _context33.abrupt("return", _this9.itemRuleConfigs);
2542
+ _this10.itemRuleConfigs = staticConfigs;
2543
+ _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2544
+ return _context33.abrupt("return", _this10.itemRuleConfigs);
2458
2545
  case 6:
2459
- _this9.itemRuleConfigs = [];
2460
- _this9.itemRuleEvaluator.setStrategyConfigs([]);
2461
- return _context33.abrupt("return", _this9.itemRuleConfigs);
2546
+ _this10.itemRuleConfigs = [];
2547
+ _this10.itemRuleEvaluator.setStrategyConfigs([]);
2548
+ return _context33.abrupt("return", _this10.itemRuleConfigs);
2462
2549
  case 9:
2463
2550
  case "end":
2464
2551
  return _context33.stop();
@@ -2532,7 +2619,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2532
2619
  key: "applyPrefillByItemRule",
2533
2620
  value: function () {
2534
2621
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
2535
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator10, _step10, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _ref5, _sourceItem$original_, _ref6, _sourceItem$payment_p, sellingPrice, originalPrice, paymentPrice, targetProduct, existedQuantity, delta, nextProduct;
2622
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator12, _step12, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _ref5, _sourceItem$original_, _ref6, _sourceItem$payment_p, sellingPrice, originalPrice, paymentPrice, targetProduct, existedQuantity, delta, nextProduct;
2536
2623
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2537
2624
  while (1) switch (_context36.prev = _context36.next) {
2538
2625
  case 0:
@@ -2577,15 +2664,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2577
2664
  productSourceMap = _context36.sent;
2578
2665
  tempOrder = this.ensureTempOrder();
2579
2666
  hasChanges = false;
2580
- _iterator10 = _createForOfIteratorHelper(prefillItems);
2667
+ _iterator12 = _createForOfIteratorHelper(prefillItems);
2581
2668
  _context36.prev = 20;
2582
- _iterator10.s();
2669
+ _iterator12.s();
2583
2670
  case 22:
2584
- if ((_step10 = _iterator10.n()).done) {
2671
+ if ((_step12 = _iterator12.n()).done) {
2585
2672
  _context36.next = 47;
2586
2673
  break;
2587
2674
  }
2588
- prefillItem = _step10.value;
2675
+ prefillItem = _step12.value;
2589
2676
  productId = Number(prefillItem.product_id);
2590
2677
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
2591
2678
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -2657,10 +2744,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2657
2744
  case 49:
2658
2745
  _context36.prev = 49;
2659
2746
  _context36.t0 = _context36["catch"](20);
2660
- _iterator10.e(_context36.t0);
2747
+ _iterator12.e(_context36.t0);
2661
2748
  case 52:
2662
2749
  _context36.prev = 52;
2663
- _iterator10.f();
2750
+ _iterator12.f();
2664
2751
  return _context36.finish(52);
2665
2752
  case 55:
2666
2753
  if (!hasChanges) {
@@ -7,4 +7,5 @@ export declare function buildDateRangeSummary(params: {
7
7
  rawResources: VenueResourceRawData[];
8
8
  resourceProductMap: Map<number | string, ResourceProductMapping>;
9
9
  quotationModule?: QuotationModule;
10
+ resolveConfig?: (date: string) => VenueBookingSlotConfig;
10
11
  }): VenueDateSummaryItem[];