@pisell/pisellos 2.1.164 → 2.1.166

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.
@@ -1,9 +0,0 @@
1
- // 导出评估器
2
- export { PromotionEvaluator } from "./evaluator";
3
-
4
- // 导出适配器
5
- export { PromotionAdapter } from "./adapter";
6
- export { default } from "./adapter";
7
-
8
- // 导出策略配置示例常量
9
- export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
313
+ weekNum: 0 | 1 | 5 | 4 | 2 | 3 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
329
329
  count: number;
330
330
  left: number;
331
331
  summaryCount: number;
332
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
332
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
333
333
  }[];
334
334
  /**
335
335
  * 找到多个资源的公共可用时间段
@@ -205,6 +205,11 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
205
205
  getOrderProducts(): ScanOrderOrderProduct[];
206
206
  getSummary(): Promise<import("./types").ScanOrderSummary>;
207
207
  submitOrder<T = any>(): Promise<T>;
208
+ /**
209
+ * 0 元订单免费领取(非定金场景)
210
+ * 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
211
+ */
212
+ submitFreeOrder(id: string | number): Promise<any>;
208
213
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
209
214
  updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
210
215
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
@@ -2517,21 +2517,68 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2517
2517
  }
2518
2518
  return submitOrder;
2519
2519
  }()
2520
+ /**
2521
+ * 0 元订单免费领取(非定金场景)
2522
+ * 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
2523
+ */
2524
+ }, {
2525
+ key: "submitFreeOrder",
2526
+ value: (function () {
2527
+ var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(id) {
2528
+ var res;
2529
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2530
+ while (1) switch (_context25.prev = _context25.next) {
2531
+ case 0:
2532
+ this.logMethodStart('submitFreeOrder', {
2533
+ id: id
2534
+ });
2535
+ _context25.prev = 1;
2536
+ if (id) {
2537
+ _context25.next = 4;
2538
+ break;
2539
+ }
2540
+ throw new Error('订单 ID 不能为空');
2541
+ case 4:
2542
+ _context25.next = 6;
2543
+ return this.request.post("/pay/order/free-pay/".concat(id));
2544
+ case 6:
2545
+ res = _context25.sent;
2546
+ this.logMethodSuccess('submitFreeOrder', {
2547
+ id: id,
2548
+ status: res === null || res === void 0 ? void 0 : res.status
2549
+ });
2550
+ return _context25.abrupt("return", res);
2551
+ case 11:
2552
+ _context25.prev = 11;
2553
+ _context25.t0 = _context25["catch"](1);
2554
+ this.logMethodError('submitFreeOrder', _context25.t0);
2555
+ throw _context25.t0;
2556
+ case 15:
2557
+ case "end":
2558
+ return _context25.stop();
2559
+ }
2560
+ }, _callee25, this, [[1, 11]]);
2561
+ }));
2562
+ function submitFreeOrder(_x16) {
2563
+ return _submitFreeOrder.apply(this, arguments);
2564
+ }
2565
+ return submitFreeOrder;
2566
+ }())
2520
2567
  }, {
2521
2568
  key: "addProductToOrder",
2522
2569
  value: function () {
2523
- var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(product) {
2570
+ var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(product) {
2524
2571
  var _product$metadata3, _product$metadata4, smartPrice, products;
2525
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
2526
- while (1) switch (_context25.prev = _context25.next) {
2572
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2573
+ while (1) switch (_context26.prev = _context26.next) {
2527
2574
  case 0:
2528
2575
  this.logMethodStart('addProductToOrder', {
2529
2576
  product_id: product.product_id,
2530
2577
  product_variant_id: product.product_variant_id
2531
2578
  });
2532
- _context25.prev = 1;
2579
+ _context26.prev = 1;
2533
2580
  if (this.store.order) {
2534
- _context25.next = 4;
2581
+ _context26.next = 4;
2535
2582
  break;
2536
2583
  }
2537
2584
  throw new Error('order 模块未初始化');
@@ -2549,32 +2596,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2549
2596
  } else if (product.selling_price != null && !((_product$metadata4 = product.metadata) !== null && _product$metadata4 !== void 0 && _product$metadata4.venue_booking)) {
2550
2597
  product.original_price = product.selling_price;
2551
2598
  }
2552
- _context25.next = 7;
2599
+ _context26.next = 7;
2553
2600
  return this.store.order.addProductToOrder(product);
2554
2601
  case 7:
2555
- products = _context25.sent;
2556
- _context25.next = 10;
2602
+ products = _context26.sent;
2603
+ _context26.next = 10;
2557
2604
  return this.refreshItemRuleQuantityLimits();
2558
2605
  case 10:
2559
- _context25.next = 12;
2606
+ _context26.next = 12;
2560
2607
  return this.refreshCartValidationPassed();
2561
2608
  case 12:
2562
2609
  this.logMethodSuccess('addProductToOrder', {
2563
2610
  productCount: products.length
2564
2611
  });
2565
- return _context25.abrupt("return", products);
2612
+ return _context26.abrupt("return", products);
2566
2613
  case 16:
2567
- _context25.prev = 16;
2568
- _context25.t0 = _context25["catch"](1);
2569
- this.logMethodError('addProductToOrder', _context25.t0);
2570
- throw _context25.t0;
2614
+ _context26.prev = 16;
2615
+ _context26.t0 = _context26["catch"](1);
2616
+ this.logMethodError('addProductToOrder', _context26.t0);
2617
+ throw _context26.t0;
2571
2618
  case 20:
2572
2619
  case "end":
2573
- return _context25.stop();
2620
+ return _context26.stop();
2574
2621
  }
2575
- }, _callee25, this, [[1, 16]]);
2622
+ }, _callee26, this, [[1, 16]]);
2576
2623
  }));
2577
- function addProductToOrder(_x16) {
2624
+ function addProductToOrder(_x17) {
2578
2625
  return _addProductToOrder.apply(this, arguments);
2579
2626
  }
2580
2627
  return addProductToOrder;
@@ -2582,48 +2629,48 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2582
2629
  }, {
2583
2630
  key: "updateProductInOrder",
2584
2631
  value: function () {
2585
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(params) {
2632
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params) {
2586
2633
  var products;
2587
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
2588
- while (1) switch (_context26.prev = _context26.next) {
2634
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2635
+ while (1) switch (_context27.prev = _context27.next) {
2589
2636
  case 0:
2590
2637
  this.logMethodStart('updateProductInOrder', {
2591
2638
  product_id: params.product_id,
2592
2639
  product_variant_id: params.product_variant_id
2593
2640
  });
2594
- _context26.prev = 1;
2641
+ _context27.prev = 1;
2595
2642
  if (this.store.order) {
2596
- _context26.next = 4;
2643
+ _context27.next = 4;
2597
2644
  break;
2598
2645
  }
2599
2646
  throw new Error('order 模块未初始化');
2600
2647
  case 4:
2601
- _context26.next = 6;
2648
+ _context27.next = 6;
2602
2649
  return this.store.order.updateProductInOrder(params);
2603
2650
  case 6:
2604
- products = _context26.sent;
2605
- _context26.next = 9;
2651
+ products = _context27.sent;
2652
+ _context27.next = 9;
2606
2653
  return this.refreshItemRuleQuantityLimits();
2607
2654
  case 9:
2608
- _context26.next = 11;
2655
+ _context27.next = 11;
2609
2656
  return this.refreshCartValidationPassed();
2610
2657
  case 11:
2611
2658
  this.logMethodSuccess('updateProductInOrder', {
2612
2659
  productCount: products.length
2613
2660
  });
2614
- return _context26.abrupt("return", products);
2661
+ return _context27.abrupt("return", products);
2615
2662
  case 15:
2616
- _context26.prev = 15;
2617
- _context26.t0 = _context26["catch"](1);
2618
- this.logMethodError('updateProductInOrder', _context26.t0);
2619
- throw _context26.t0;
2663
+ _context27.prev = 15;
2664
+ _context27.t0 = _context27["catch"](1);
2665
+ this.logMethodError('updateProductInOrder', _context27.t0);
2666
+ throw _context27.t0;
2620
2667
  case 19:
2621
2668
  case "end":
2622
- return _context26.stop();
2669
+ return _context27.stop();
2623
2670
  }
2624
- }, _callee26, this, [[1, 15]]);
2671
+ }, _callee27, this, [[1, 15]]);
2625
2672
  }));
2626
- function updateProductInOrder(_x17) {
2673
+ function updateProductInOrder(_x18) {
2627
2674
  return _updateProductInOrder.apply(this, arguments);
2628
2675
  }
2629
2676
  return updateProductInOrder;
@@ -2631,66 +2678,66 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2631
2678
  }, {
2632
2679
  key: "removeProductFromOrder",
2633
2680
  value: function () {
2634
- var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
2681
+ var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(identity) {
2635
2682
  var _this$store$order$get3, _this$store$order7, _this$store$order$ens, _this$store$order8, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator16, _step16, _product$metadata5, _product$metadata6, product, beforeBookingCount, _this$store$order$per, _this$store$order9;
2636
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
2637
- while (1) switch (_context27.prev = _context27.next) {
2683
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2684
+ while (1) switch (_context28.prev = _context28.next) {
2638
2685
  case 0:
2639
2686
  this.logMethodStart('removeProductFromOrder', {
2640
2687
  product_id: identity.product_id,
2641
2688
  product_variant_id: identity.product_variant_id
2642
2689
  });
2643
- _context27.prev = 1;
2690
+ _context28.prev = 1;
2644
2691
  if (this.store.order) {
2645
- _context27.next = 4;
2692
+ _context28.next = 4;
2646
2693
  break;
2647
2694
  }
2648
2695
  throw new Error('order 模块未初始化');
2649
2696
  case 4:
2650
2697
  tempOrder = ((_this$store$order$get3 = (_this$store$order7 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order7)) || ((_this$store$order$ens = (_this$store$order8 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order8));
2651
- _context27.next = 7;
2698
+ _context28.next = 7;
2652
2699
  return this.store.order.removeProductFromOrder(identity);
2653
2700
  case 7:
2654
- products = _context27.sent;
2701
+ products = _context28.sent;
2655
2702
  if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
2656
- _context27.next = 33;
2703
+ _context28.next = 33;
2657
2704
  break;
2658
2705
  }
2659
2706
  venueProductUids = new Set();
2660
2707
  venueBookingUids = new Set();
2661
2708
  _iterator16 = _createForOfIteratorHelper(tempOrder.products || []);
2662
- _context27.prev = 12;
2709
+ _context28.prev = 12;
2663
2710
  _iterator16.s();
2664
2711
  case 14:
2665
2712
  if ((_step16 = _iterator16.n()).done) {
2666
- _context27.next = 22;
2713
+ _context28.next = 22;
2667
2714
  break;
2668
2715
  }
2669
2716
  product = _step16.value;
2670
2717
  if (product !== null && product !== void 0 && (_product$metadata5 = product.metadata) !== null && _product$metadata5 !== void 0 && _product$metadata5.venue_booking) {
2671
- _context27.next = 18;
2718
+ _context28.next = 18;
2672
2719
  break;
2673
2720
  }
2674
- return _context27.abrupt("continue", 20);
2721
+ return _context28.abrupt("continue", 20);
2675
2722
  case 18:
2676
2723
  if (product.identity_key) venueProductUids.add(String(product.identity_key));
2677
2724
  if ((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.booking_uid) {
2678
2725
  venueBookingUids.add(String(product.metadata.booking_uid));
2679
2726
  }
2680
2727
  case 20:
2681
- _context27.next = 14;
2728
+ _context28.next = 14;
2682
2729
  break;
2683
2730
  case 22:
2684
- _context27.next = 27;
2731
+ _context28.next = 27;
2685
2732
  break;
2686
2733
  case 24:
2687
- _context27.prev = 24;
2688
- _context27.t0 = _context27["catch"](12);
2689
- _iterator16.e(_context27.t0);
2734
+ _context28.prev = 24;
2735
+ _context28.t0 = _context28["catch"](12);
2736
+ _iterator16.e(_context28.t0);
2690
2737
  case 27:
2691
- _context27.prev = 27;
2738
+ _context28.prev = 27;
2692
2739
  _iterator16.f();
2693
- return _context27.finish(27);
2740
+ return _context28.finish(27);
2694
2741
  case 30:
2695
2742
  beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
2696
2743
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
@@ -2707,28 +2754,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2707
2754
  (_this$store$order$per = (_this$store$order9 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order9);
2708
2755
  }
2709
2756
  case 33:
2710
- _context27.next = 35;
2757
+ _context28.next = 35;
2711
2758
  return this.refreshItemRuleQuantityLimits();
2712
2759
  case 35:
2713
- _context27.next = 37;
2760
+ _context28.next = 37;
2714
2761
  return this.refreshCartValidationPassed();
2715
2762
  case 37:
2716
2763
  this.logMethodSuccess('removeProductFromOrder', {
2717
2764
  productCount: products.length
2718
2765
  });
2719
- return _context27.abrupt("return", products);
2766
+ return _context28.abrupt("return", products);
2720
2767
  case 41:
2721
- _context27.prev = 41;
2722
- _context27.t1 = _context27["catch"](1);
2723
- this.logMethodError('removeProductFromOrder', _context27.t1);
2724
- throw _context27.t1;
2768
+ _context28.prev = 41;
2769
+ _context28.t1 = _context28["catch"](1);
2770
+ this.logMethodError('removeProductFromOrder', _context28.t1);
2771
+ throw _context28.t1;
2725
2772
  case 45:
2726
2773
  case "end":
2727
- return _context27.stop();
2774
+ return _context28.stop();
2728
2775
  }
2729
- }, _callee27, this, [[1, 41], [12, 24, 27, 30]]);
2776
+ }, _callee28, this, [[1, 41], [12, 24, 27, 30]]);
2730
2777
  }));
2731
- function removeProductFromOrder(_x18) {
2778
+ function removeProductFromOrder(_x19) {
2732
2779
  return _removeProductFromOrder.apply(this, arguments);
2733
2780
  }
2734
2781
  return removeProductFromOrder;
@@ -2736,27 +2783,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2736
2783
  }, {
2737
2784
  key: "getProductList",
2738
2785
  value: function () {
2739
- var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
2786
+ var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2740
2787
  var result;
2741
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
2742
- while (1) switch (_context28.prev = _context28.next) {
2788
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2789
+ while (1) switch (_context29.prev = _context29.next) {
2743
2790
  case 0:
2744
2791
  if (!this.productsLoaded) {
2745
- _context28.next = 2;
2792
+ _context29.next = 2;
2746
2793
  break;
2747
2794
  }
2748
- return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2795
+ return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
2749
2796
  case 2:
2750
- _context28.next = 4;
2797
+ _context29.next = 4;
2751
2798
  return this.loadAllProducts();
2752
2799
  case 4:
2753
- result = _context28.sent;
2754
- return _context28.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2800
+ result = _context29.sent;
2801
+ return _context29.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
2755
2802
  case 6:
2756
2803
  case "end":
2757
- return _context28.stop();
2804
+ return _context29.stop();
2758
2805
  }
2759
- }, _callee28, this);
2806
+ }, _callee29, this);
2760
2807
  }));
2761
2808
  function getProductList() {
2762
2809
  return _getProductList.apply(this, arguments);
@@ -2766,13 +2813,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2766
2813
  }, {
2767
2814
  key: "loadOpenDataConfig",
2768
2815
  value: function () {
2769
- var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2816
+ var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2770
2817
  var lastFetchedAt, cachedData, openDataConfig;
2771
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2772
- while (1) switch (_context29.prev = _context29.next) {
2818
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2819
+ while (1) switch (_context30.prev = _context30.next) {
2773
2820
  case 0:
2774
2821
  if (this.store.openData) {
2775
- _context29.next = 2;
2822
+ _context30.next = 2;
2776
2823
  break;
2777
2824
  }
2778
2825
  throw new Error('openData 模块未初始化');
@@ -2780,42 +2827,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2780
2827
  lastFetchedAt = this.store.openData.getLastFetchedAt();
2781
2828
  cachedData = this.store.openData.getOpenData();
2782
2829
  if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
2783
- _context29.next = 7;
2830
+ _context30.next = 7;
2784
2831
  break;
2785
2832
  }
2786
2833
  this.otherParams.openData = cachedData;
2787
- return _context29.abrupt("return", cachedData);
2834
+ return _context30.abrupt("return", cachedData);
2788
2835
  case 7:
2789
2836
  if (!this.loadOpenDataConfigInFlight) {
2790
- _context29.next = 11;
2837
+ _context30.next = 11;
2791
2838
  break;
2792
2839
  }
2793
- _context29.next = 10;
2840
+ _context30.next = 10;
2794
2841
  return this.loadOpenDataConfigInFlight;
2795
2842
  case 10:
2796
- return _context29.abrupt("return", _context29.sent);
2843
+ return _context30.abrupt("return", _context30.sent);
2797
2844
  case 11:
2798
2845
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2799
2846
  scope: 'board',
2800
2847
  target: 'venue_booking+online_store',
2801
2848
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2802
2849
  });
2803
- _context29.prev = 12;
2804
- _context29.next = 15;
2850
+ _context30.prev = 12;
2851
+ _context30.next = 15;
2805
2852
  return this.loadOpenDataConfigInFlight;
2806
2853
  case 15:
2807
- openDataConfig = _context29.sent;
2854
+ openDataConfig = _context30.sent;
2808
2855
  this.otherParams.openData = openDataConfig;
2809
- return _context29.abrupt("return", openDataConfig);
2856
+ return _context30.abrupt("return", openDataConfig);
2810
2857
  case 18:
2811
- _context29.prev = 18;
2858
+ _context30.prev = 18;
2812
2859
  this.loadOpenDataConfigInFlight = null;
2813
- return _context29.finish(18);
2860
+ return _context30.finish(18);
2814
2861
  case 21:
2815
2862
  case "end":
2816
- return _context29.stop();
2863
+ return _context30.stop();
2817
2864
  }
2818
- }, _callee29, this, [[12,, 18, 21]]);
2865
+ }, _callee30, this, [[12,, 18, 21]]);
2819
2866
  }));
2820
2867
  function loadOpenDataConfig() {
2821
2868
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2825,29 +2872,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2825
2872
  }, {
2826
2873
  key: "loadRuntimeConfigs",
2827
2874
  value: function () {
2828
- var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
2875
+ var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
2829
2876
  var itemRuleConfigs;
2830
- return _regeneratorRuntime().wrap(function _callee30$(_context30) {
2831
- while (1) switch (_context30.prev = _context30.next) {
2877
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2878
+ while (1) switch (_context31.prev = _context31.next) {
2832
2879
  case 0:
2833
- _context30.next = 2;
2880
+ _context31.next = 2;
2834
2881
  return this.loadOpenDataConfig();
2835
2882
  case 2:
2836
- _context30.next = 4;
2883
+ _context31.next = 4;
2837
2884
  return this.ensureItemRuleConfigsLoaded();
2838
2885
  case 4:
2839
- itemRuleConfigs = _context30.sent;
2886
+ itemRuleConfigs = _context31.sent;
2840
2887
  this.logMethodSuccess('loadRuntimeConfigs', {
2841
2888
  itemRuleCount: itemRuleConfigs.length
2842
2889
  });
2843
- return _context30.abrupt("return", {
2890
+ return _context31.abrupt("return", {
2844
2891
  itemRuleConfigs: itemRuleConfigs
2845
2892
  });
2846
2893
  case 7:
2847
2894
  case "end":
2848
- return _context30.stop();
2895
+ return _context31.stop();
2849
2896
  }
2850
- }, _callee30, this);
2897
+ }, _callee31, this);
2851
2898
  }));
2852
2899
  function loadRuntimeConfigs() {
2853
2900
  return _loadRuntimeConfigs.apply(this, arguments);
@@ -2857,22 +2904,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2857
2904
  }, {
2858
2905
  key: "fetchItemRuleConfigsByModelIds",
2859
2906
  value: function () {
2860
- var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(strategyModelIds) {
2907
+ var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(strategyModelIds) {
2861
2908
  var result, configs;
2862
- return _regeneratorRuntime().wrap(function _callee31$(_context31) {
2863
- while (1) switch (_context31.prev = _context31.next) {
2909
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2910
+ while (1) switch (_context32.prev = _context32.next) {
2864
2911
  case 0:
2865
2912
  this.logMethodStart('fetchItemRuleConfigsByModelIds', {
2866
2913
  strategyModelIds: strategyModelIds
2867
2914
  });
2868
2915
  if (strategyModelIds.length) {
2869
- _context31.next = 3;
2916
+ _context32.next = 3;
2870
2917
  break;
2871
2918
  }
2872
- return _context31.abrupt("return", []);
2919
+ return _context32.abrupt("return", []);
2873
2920
  case 3:
2874
- _context31.prev = 3;
2875
- _context31.next = 6;
2921
+ _context32.prev = 3;
2922
+ _context32.next = 6;
2876
2923
  return this.request.get('/promotion', {
2877
2924
  skip: 1,
2878
2925
  num: 99,
@@ -2880,7 +2927,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2880
2927
  ids: strategyModelIds
2881
2928
  });
2882
2929
  case 6:
2883
- result = _context31.sent;
2930
+ result = _context32.sent;
2884
2931
  configs = [];
2885
2932
  if (result.code === 200) {
2886
2933
  configs = result.data.list.map(function (item) {
@@ -2891,21 +2938,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2891
2938
  strategyModelIds: strategyModelIds,
2892
2939
  strategyCount: configs.length
2893
2940
  });
2894
- return _context31.abrupt("return", configs);
2941
+ return _context32.abrupt("return", configs);
2895
2942
  case 13:
2896
- _context31.prev = 13;
2897
- _context31.t0 = _context31["catch"](3);
2898
- this.logMethodError('fetchItemRuleConfigsByModelIds', _context31.t0, {
2943
+ _context32.prev = 13;
2944
+ _context32.t0 = _context32["catch"](3);
2945
+ this.logMethodError('fetchItemRuleConfigsByModelIds', _context32.t0, {
2899
2946
  strategyModelIds: strategyModelIds
2900
2947
  });
2901
- return _context31.abrupt("return", []);
2948
+ return _context32.abrupt("return", []);
2902
2949
  case 17:
2903
2950
  case "end":
2904
- return _context31.stop();
2951
+ return _context32.stop();
2905
2952
  }
2906
- }, _callee31, this, [[3, 13]]);
2953
+ }, _callee32, this, [[3, 13]]);
2907
2954
  }));
2908
- function fetchItemRuleConfigsByModelIds(_x19) {
2955
+ function fetchItemRuleConfigsByModelIds(_x20) {
2909
2956
  return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
2910
2957
  }
2911
2958
  return fetchItemRuleConfigsByModelIds;
@@ -2913,22 +2960,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2913
2960
  }, {
2914
2961
  key: "buildPrefillProductSourceMap",
2915
2962
  value: function () {
2916
- var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
2963
+ var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
2917
2964
  var sourceMap, productList, visited, collectFromValue;
2918
- return _regeneratorRuntime().wrap(function _callee32$(_context32) {
2919
- while (1) switch (_context32.prev = _context32.next) {
2965
+ return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2966
+ while (1) switch (_context33.prev = _context33.next) {
2920
2967
  case 0:
2921
2968
  sourceMap = new Map();
2922
- _context32.prev = 1;
2923
- _context32.next = 4;
2969
+ _context33.prev = 1;
2970
+ _context33.next = 4;
2924
2971
  return this.getProductList();
2925
2972
  case 4:
2926
- productList = _context32.sent;
2973
+ productList = _context33.sent;
2927
2974
  if (Array.isArray(productList)) {
2928
- _context32.next = 7;
2975
+ _context33.next = 7;
2929
2976
  break;
2930
2977
  }
2931
- return _context32.abrupt("return", sourceMap);
2978
+ return _context33.abrupt("return", sourceMap);
2932
2979
  case 7:
2933
2980
  visited = new Set();
2934
2981
  collectFromValue = function collectFromValue(value) {
@@ -2967,19 +3014,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2967
3014
  }
2968
3015
  };
2969
3016
  collectFromValue(productList);
2970
- _context32.next = 15;
3017
+ _context33.next = 15;
2971
3018
  break;
2972
3019
  case 12:
2973
- _context32.prev = 12;
2974
- _context32.t0 = _context32["catch"](1);
2975
- this.logMethodError('buildPrefillProductSourceMap', _context32.t0);
3020
+ _context33.prev = 12;
3021
+ _context33.t0 = _context33["catch"](1);
3022
+ this.logMethodError('buildPrefillProductSourceMap', _context33.t0);
2976
3023
  case 15:
2977
- return _context32.abrupt("return", sourceMap);
3024
+ return _context33.abrupt("return", sourceMap);
2978
3025
  case 16:
2979
3026
  case "end":
2980
- return _context32.stop();
3027
+ return _context33.stop();
2981
3028
  }
2982
- }, _callee32, this, [[1, 12]]);
3029
+ }, _callee33, this, [[1, 12]]);
2983
3030
  }));
2984
3031
  function buildPrefillProductSourceMap() {
2985
3032
  return _buildPrefillProductSourceMap.apply(this, arguments);
@@ -2994,56 +3041,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2994
3041
  }, {
2995
3042
  key: "ensureItemRuleConfigsLoaded",
2996
3043
  value: function () {
2997
- var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3044
+ var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
2998
3045
  var _this10 = this;
2999
- return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3000
- while (1) switch (_context34.prev = _context34.next) {
3046
+ return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3047
+ while (1) switch (_context35.prev = _context35.next) {
3001
3048
  case 0:
3002
3049
  if (!(this.itemRuleConfigs.length > 0)) {
3003
- _context34.next = 2;
3050
+ _context35.next = 2;
3004
3051
  break;
3005
3052
  }
3006
- return _context34.abrupt("return", this.itemRuleConfigs);
3053
+ return _context35.abrupt("return", this.itemRuleConfigs);
3007
3054
  case 2:
3008
3055
  if (!this.itemRuleConfigsPromise) {
3009
- _context34.next = 4;
3056
+ _context35.next = 4;
3010
3057
  break;
3011
3058
  }
3012
- return _context34.abrupt("return", this.itemRuleConfigsPromise);
3059
+ return _context35.abrupt("return", this.itemRuleConfigsPromise);
3013
3060
  case 4:
3014
- this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
3061
+ this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
3015
3062
  var runtimeConfig, staticConfigs;
3016
- return _regeneratorRuntime().wrap(function _callee33$(_context33) {
3017
- while (1) switch (_context33.prev = _context33.next) {
3063
+ return _regeneratorRuntime().wrap(function _callee34$(_context34) {
3064
+ while (1) switch (_context34.prev = _context34.next) {
3018
3065
  case 0:
3019
3066
  runtimeConfig = _this10.getItemRuleRuntimeConfig();
3020
3067
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
3021
3068
  if (!(staticConfigs.length > 0)) {
3022
- _context33.next = 6;
3069
+ _context34.next = 6;
3023
3070
  break;
3024
3071
  }
3025
3072
  _this10.itemRuleConfigs = staticConfigs;
3026
3073
  _this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
3027
- return _context33.abrupt("return", _this10.itemRuleConfigs);
3074
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3028
3075
  case 6:
3029
3076
  _this10.itemRuleConfigs = [];
3030
3077
  _this10.itemRuleEvaluator.setStrategyConfigs([]);
3031
- return _context33.abrupt("return", _this10.itemRuleConfigs);
3078
+ return _context34.abrupt("return", _this10.itemRuleConfigs);
3032
3079
  case 9:
3033
3080
  case "end":
3034
- return _context33.stop();
3081
+ return _context34.stop();
3035
3082
  }
3036
- }, _callee33);
3083
+ }, _callee34);
3037
3084
  }))();
3038
- _context34.next = 7;
3085
+ _context35.next = 7;
3039
3086
  return this.itemRuleConfigsPromise;
3040
3087
  case 7:
3041
- return _context34.abrupt("return", _context34.sent);
3088
+ return _context35.abrupt("return", _context35.sent);
3042
3089
  case 8:
3043
3090
  case "end":
3044
- return _context34.stop();
3091
+ return _context35.stop();
3045
3092
  }
3046
- }, _callee34, this);
3093
+ }, _callee35, this);
3047
3094
  }));
3048
3095
  function ensureItemRuleConfigsLoaded() {
3049
3096
  return _ensureItemRuleConfigsLoaded.apply(this, arguments);
@@ -3053,22 +3100,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3053
3100
  }, {
3054
3101
  key: "refreshItemRuleQuantityLimits",
3055
3102
  value: function () {
3056
- var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
3103
+ var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3057
3104
  var strategyConfigs, businessData, limits;
3058
- return _regeneratorRuntime().wrap(function _callee35$(_context35) {
3059
- while (1) switch (_context35.prev = _context35.next) {
3105
+ return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3106
+ while (1) switch (_context36.prev = _context36.next) {
3060
3107
  case 0:
3061
- _context35.prev = 0;
3062
- _context35.next = 3;
3108
+ _context36.prev = 0;
3109
+ _context36.next = 3;
3063
3110
  return this.ensureItemRuleConfigsLoaded();
3064
3111
  case 3:
3065
- strategyConfigs = _context35.sent;
3112
+ strategyConfigs = _context36.sent;
3066
3113
  if (strategyConfigs.length) {
3067
- _context35.next = 7;
3114
+ _context36.next = 7;
3068
3115
  break;
3069
3116
  }
3070
3117
  this.store.itemRuleQuantityLimits = [];
3071
- return _context35.abrupt("return", []);
3118
+ return _context36.abrupt("return", []);
3072
3119
  case 7:
3073
3120
  businessData = buildItemRuleBusinessData({
3074
3121
  tempOrder: this.ensureTempOrder(),
@@ -3080,18 +3127,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3080
3127
  this.logMethodSuccess('refreshItemRuleQuantityLimits', {
3081
3128
  limitCount: limits.length
3082
3129
  });
3083
- return _context35.abrupt("return", limits);
3130
+ return _context36.abrupt("return", limits);
3084
3131
  case 14:
3085
- _context35.prev = 14;
3086
- _context35.t0 = _context35["catch"](0);
3132
+ _context36.prev = 14;
3133
+ _context36.t0 = _context36["catch"](0);
3087
3134
  this.store.itemRuleQuantityLimits = [];
3088
- this.logMethodError('refreshItemRuleQuantityLimits', _context35.t0);
3089
- return _context35.abrupt("return", []);
3135
+ this.logMethodError('refreshItemRuleQuantityLimits', _context36.t0);
3136
+ return _context36.abrupt("return", []);
3090
3137
  case 19:
3091
3138
  case "end":
3092
- return _context35.stop();
3139
+ return _context36.stop();
3093
3140
  }
3094
- }, _callee35, this, [[0, 14]]);
3141
+ }, _callee36, this, [[0, 14]]);
3095
3142
  }));
3096
3143
  function refreshItemRuleQuantityLimits() {
3097
3144
  return _refreshItemRuleQuantityLimits.apply(this, arguments);
@@ -3101,32 +3148,32 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3101
3148
  }, {
3102
3149
  key: "applyPrefillByItemRule",
3103
3150
  value: function () {
3104
- var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
3151
+ var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3105
3152
  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;
3106
- return _regeneratorRuntime().wrap(function _callee36$(_context36) {
3107
- while (1) switch (_context36.prev = _context36.next) {
3153
+ return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3154
+ while (1) switch (_context37.prev = _context37.next) {
3108
3155
  case 0:
3109
3156
  if (!this.itemRulePrefillApplied) {
3110
- _context36.next = 2;
3157
+ _context37.next = 2;
3111
3158
  break;
3112
3159
  }
3113
- return _context36.abrupt("return");
3160
+ return _context37.abrupt("return");
3114
3161
  case 2:
3115
3162
  if (this.store.order) {
3116
- _context36.next = 4;
3163
+ _context37.next = 4;
3117
3164
  break;
3118
3165
  }
3119
- return _context36.abrupt("return");
3166
+ return _context37.abrupt("return");
3120
3167
  case 4:
3121
- _context36.next = 6;
3168
+ _context37.next = 6;
3122
3169
  return this.ensureItemRuleConfigsLoaded();
3123
3170
  case 6:
3124
- strategyConfigs = _context36.sent;
3171
+ strategyConfigs = _context37.sent;
3125
3172
  if (strategyConfigs.length) {
3126
- _context36.next = 9;
3173
+ _context37.next = 9;
3127
3174
  break;
3128
3175
  }
3129
- return _context36.abrupt("return");
3176
+ return _context37.abrupt("return");
3130
3177
  case 9:
3131
3178
  businessData = buildItemRuleBusinessData({
3132
3179
  tempOrder: this.ensureTempOrder(),
@@ -3135,24 +3182,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3135
3182
  });
3136
3183
  prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
3137
3184
  if (prefillItems.length) {
3138
- _context36.next = 14;
3185
+ _context37.next = 14;
3139
3186
  break;
3140
3187
  }
3141
3188
  this.itemRulePrefillApplied = true;
3142
- return _context36.abrupt("return");
3189
+ return _context37.abrupt("return");
3143
3190
  case 14:
3144
- _context36.next = 16;
3191
+ _context37.next = 16;
3145
3192
  return this.buildPrefillProductSourceMap();
3146
3193
  case 16:
3147
- productSourceMap = _context36.sent;
3194
+ productSourceMap = _context37.sent;
3148
3195
  tempOrder = this.ensureTempOrder();
3149
3196
  hasChanges = false;
3150
3197
  _iterator18 = _createForOfIteratorHelper(prefillItems);
3151
- _context36.prev = 20;
3198
+ _context37.prev = 20;
3152
3199
  _iterator18.s();
3153
3200
  case 22:
3154
3201
  if ((_step18 = _iterator18.n()).done) {
3155
- _context36.next = 45;
3202
+ _context37.next = 45;
3156
3203
  break;
3157
3204
  }
3158
3205
  prefillItem = _step18.value;
@@ -3160,16 +3207,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3160
3207
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
3161
3208
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
3162
3209
  if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
3163
- _context36.next = 29;
3210
+ _context37.next = 29;
3164
3211
  break;
3165
3212
  }
3166
- return _context36.abrupt("continue", 43);
3213
+ return _context37.abrupt("continue", 43);
3167
3214
  case 29:
3168
3215
  if (!Number.isNaN(productVariantId)) {
3169
- _context36.next = 31;
3216
+ _context37.next = 31;
3170
3217
  break;
3171
3218
  }
3172
- return _context36.abrupt("continue", 43);
3219
+ return _context37.abrupt("continue", 43);
3173
3220
  case 31:
3174
3221
  sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
3175
3222
  productIndex = getProductIdentityIndex(tempOrder.products, {
@@ -3177,7 +3224,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3177
3224
  product_variant_id: productVariantId
3178
3225
  });
3179
3226
  if (!(productIndex === -1)) {
3180
- _context36.next = 38;
3227
+ _context37.next = 38;
3181
3228
  break;
3182
3229
  }
3183
3230
  sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
@@ -3197,7 +3244,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3197
3244
  })
3198
3245
  }));
3199
3246
  hasChanges = true;
3200
- return _context36.abrupt("continue", 43);
3247
+ return _context37.abrupt("continue", 43);
3201
3248
  case 38:
3202
3249
  targetProduct = tempOrder.products[productIndex];
3203
3250
  existedQuantity = toNonNegativeInt(targetProduct.num);
@@ -3216,34 +3263,34 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3216
3263
  hasChanges = true;
3217
3264
  }
3218
3265
  case 43:
3219
- _context36.next = 22;
3266
+ _context37.next = 22;
3220
3267
  break;
3221
3268
  case 45:
3222
- _context36.next = 50;
3269
+ _context37.next = 50;
3223
3270
  break;
3224
3271
  case 47:
3225
- _context36.prev = 47;
3226
- _context36.t0 = _context36["catch"](20);
3227
- _iterator18.e(_context36.t0);
3272
+ _context37.prev = 47;
3273
+ _context37.t0 = _context37["catch"](20);
3274
+ _iterator18.e(_context37.t0);
3228
3275
  case 50:
3229
- _context36.prev = 50;
3276
+ _context37.prev = 50;
3230
3277
  _iterator18.f();
3231
- return _context36.finish(50);
3278
+ return _context37.finish(50);
3232
3279
  case 53:
3233
3280
  if (!hasChanges) {
3234
- _context36.next = 58;
3281
+ _context37.next = 58;
3235
3282
  break;
3236
3283
  }
3237
3284
  // Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
3238
3285
  this.store.order.applyDiscount();
3239
- _context36.next = 57;
3286
+ _context37.next = 57;
3240
3287
  return this.store.order.recalculateSummary({
3241
3288
  createIfMissing: true
3242
3289
  });
3243
3290
  case 57:
3244
3291
  this.store.order.persistTempOrder();
3245
3292
  case 58:
3246
- _context36.next = 60;
3293
+ _context37.next = 60;
3247
3294
  return this.refreshItemRuleQuantityLimits();
3248
3295
  case 60:
3249
3296
  this.itemRulePrefillApplied = true;
@@ -3253,9 +3300,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3253
3300
  });
3254
3301
  case 62:
3255
3302
  case "end":
3256
- return _context36.stop();
3303
+ return _context37.stop();
3257
3304
  }
3258
- }, _callee36, this, [[20, 47, 50, 53]]);
3305
+ }, _callee37, this, [[20, 47, 50, 53]]);
3259
3306
  }));
3260
3307
  function applyPrefillByItemRule() {
3261
3308
  return _applyPrefillByItemRule.apply(this, arguments);
@@ -3265,24 +3312,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3265
3312
  }, {
3266
3313
  key: "applyItemRulePrefill",
3267
3314
  value: function () {
3268
- var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
3269
- return _regeneratorRuntime().wrap(function _callee37$(_context37) {
3270
- while (1) switch (_context37.prev = _context37.next) {
3315
+ var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3316
+ return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3317
+ while (1) switch (_context38.prev = _context38.next) {
3271
3318
  case 0:
3272
3319
  this.logMethodStart('applyItemRulePrefill');
3273
- _context37.next = 3;
3320
+ _context38.next = 3;
3274
3321
  return this.applyPrefillByItemRule();
3275
3322
  case 3:
3276
- _context37.next = 5;
3323
+ _context38.next = 5;
3277
3324
  return this.refreshItemRuleQuantityLimits();
3278
3325
  case 5:
3279
- _context37.next = 7;
3326
+ _context38.next = 7;
3280
3327
  return this.refreshCartValidationPassed();
3281
3328
  case 7:
3282
3329
  case "end":
3283
- return _context37.stop();
3330
+ return _context38.stop();
3284
3331
  }
3285
- }, _callee37, this);
3332
+ }, _callee38, this);
3286
3333
  }));
3287
3334
  function applyItemRulePrefill() {
3288
3335
  return _applyItemRulePrefill.apply(this, arguments);
@@ -3292,20 +3339,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3292
3339
  }, {
3293
3340
  key: "evaluateCartValidationByItemRule",
3294
3341
  value: function () {
3295
- var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
3342
+ var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3296
3343
  var strategyConfigs, businessData;
3297
- return _regeneratorRuntime().wrap(function _callee38$(_context38) {
3298
- while (1) switch (_context38.prev = _context38.next) {
3344
+ return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3345
+ while (1) switch (_context39.prev = _context39.next) {
3299
3346
  case 0:
3300
- _context38.next = 2;
3347
+ _context39.next = 2;
3301
3348
  return this.ensureItemRuleConfigsLoaded();
3302
3349
  case 2:
3303
- strategyConfigs = _context38.sent;
3350
+ strategyConfigs = _context39.sent;
3304
3351
  if (strategyConfigs.length) {
3305
- _context38.next = 5;
3352
+ _context39.next = 5;
3306
3353
  break;
3307
3354
  }
3308
- return _context38.abrupt("return", {
3355
+ return _context39.abrupt("return", {
3309
3356
  passed: true,
3310
3357
  failures: []
3311
3358
  });
@@ -3315,12 +3362,12 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3315
3362
  runtimeConfig: this.getItemRuleRuntimeConfig(),
3316
3363
  itemRuleConfigs: this.itemRuleConfigs
3317
3364
  });
3318
- return _context38.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3365
+ return _context39.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
3319
3366
  case 7:
3320
3367
  case "end":
3321
- return _context38.stop();
3368
+ return _context39.stop();
3322
3369
  }
3323
- }, _callee38, this);
3370
+ }, _callee39, this);
3324
3371
  }));
3325
3372
  function evaluateCartValidationByItemRule() {
3326
3373
  return _evaluateCartValidationByItemRule.apply(this, arguments);
@@ -3330,20 +3377,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3330
3377
  }, {
3331
3378
  key: "validateBeforeSubmitByItemRule",
3332
3379
  value: function () {
3333
- var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
3380
+ var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3334
3381
  var validationResult, firstFailure, errorMessage, error;
3335
- return _regeneratorRuntime().wrap(function _callee39$(_context39) {
3336
- while (1) switch (_context39.prev = _context39.next) {
3382
+ return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3383
+ while (1) switch (_context40.prev = _context40.next) {
3337
3384
  case 0:
3338
- _context39.next = 2;
3385
+ _context40.next = 2;
3339
3386
  return this.evaluateCartValidationByItemRule();
3340
3387
  case 2:
3341
- validationResult = _context39.sent;
3388
+ validationResult = _context40.sent;
3342
3389
  if (!validationResult.passed) {
3343
- _context39.next = 5;
3390
+ _context40.next = 5;
3344
3391
  break;
3345
3392
  }
3346
- return _context39.abrupt("return");
3393
+ return _context40.abrupt("return");
3347
3394
  case 5:
3348
3395
  firstFailure = validationResult.failures[0];
3349
3396
  errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
@@ -3352,9 +3399,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3352
3399
  throw error;
3353
3400
  case 10:
3354
3401
  case "end":
3355
- return _context39.stop();
3402
+ return _context40.stop();
3356
3403
  }
3357
- }, _callee39, this);
3404
+ }, _callee40, this);
3358
3405
  }));
3359
3406
  function validateBeforeSubmitByItemRule() {
3360
3407
  return _validateBeforeSubmitByItemRule.apply(this, arguments);
@@ -3364,10 +3411,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3364
3411
  }, {
3365
3412
  key: "refreshCartValidationPassed",
3366
3413
  value: function () {
3367
- var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
3414
+ var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3368
3415
  var previous, nextState, validationResult, changed;
3369
- return _regeneratorRuntime().wrap(function _callee40$(_context40) {
3370
- while (1) switch (_context40.prev = _context40.next) {
3416
+ return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3417
+ while (1) switch (_context41.prev = _context41.next) {
3371
3418
  case 0:
3372
3419
  previous = this.store.cartValidation || {
3373
3420
  passed: null,
@@ -3377,20 +3424,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3377
3424
  passed: null,
3378
3425
  failures: []
3379
3426
  };
3380
- _context40.prev = 2;
3381
- _context40.next = 5;
3427
+ _context41.prev = 2;
3428
+ _context41.next = 5;
3382
3429
  return this.evaluateCartValidationByItemRule();
3383
3430
  case 5:
3384
- validationResult = _context40.sent;
3431
+ validationResult = _context41.sent;
3385
3432
  nextState = {
3386
3433
  passed: validationResult.passed,
3387
3434
  failures: validationResult.failures || []
3388
3435
  };
3389
- _context40.next = 12;
3436
+ _context41.next = 12;
3390
3437
  break;
3391
3438
  case 9:
3392
- _context40.prev = 9;
3393
- _context40.t0 = _context40["catch"](2);
3439
+ _context41.prev = 9;
3440
+ _context41.t0 = _context41["catch"](2);
3394
3441
  nextState = {
3395
3442
  passed: false,
3396
3443
  failures: []
@@ -3399,21 +3446,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3399
3446
  this.store.cartValidation = nextState;
3400
3447
  changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
3401
3448
  if (!changed) {
3402
- _context40.next = 17;
3449
+ _context41.next = 17;
3403
3450
  break;
3404
3451
  }
3405
- _context40.next = 17;
3452
+ _context41.next = 17;
3406
3453
  return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
3407
3454
  cartValidation: nextState,
3408
3455
  cartValidationPassed: nextState.passed
3409
3456
  });
3410
3457
  case 17:
3411
- return _context40.abrupt("return", nextState.passed);
3458
+ return _context41.abrupt("return", nextState.passed);
3412
3459
  case 18:
3413
3460
  case "end":
3414
- return _context40.stop();
3461
+ return _context41.stop();
3415
3462
  }
3416
- }, _callee40, this, [[2, 9]]);
3463
+ }, _callee41, this, [[2, 9]]);
3417
3464
  }));
3418
3465
  function refreshCartValidationPassed() {
3419
3466
  return _refreshCartValidationPassed.apply(this, arguments);
@@ -3423,14 +3470,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3423
3470
  }, {
3424
3471
  key: "setItemRuleRuntimeConfig",
3425
3472
  value: function () {
3426
- var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
3473
+ var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3427
3474
  var _this$itemRuleRuntime, _this$itemRuleRuntime2;
3428
3475
  var config,
3429
- _args41 = arguments;
3430
- return _regeneratorRuntime().wrap(function _callee41$(_context41) {
3431
- while (1) switch (_context41.prev = _context41.next) {
3476
+ _args42 = arguments;
3477
+ return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3478
+ while (1) switch (_context42.prev = _context42.next) {
3432
3479
  case 0:
3433
- config = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
3480
+ config = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
3434
3481
  this.logMethodStart('setItemRuleRuntimeConfig');
3435
3482
  this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
3436
3483
  pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
@@ -3442,10 +3489,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3442
3489
  this.itemRuleEvaluator.setStrategyConfigs([]);
3443
3490
  }
3444
3491
  this.itemRulePrefillApplied = false;
3445
- _context41.next = 7;
3492
+ _context42.next = 7;
3446
3493
  return this.refreshItemRuleQuantityLimits();
3447
3494
  case 7:
3448
- _context41.next = 9;
3495
+ _context42.next = 9;
3449
3496
  return this.refreshCartValidationPassed();
3450
3497
  case 9:
3451
3498
  this.logMethodSuccess('setItemRuleRuntimeConfig', {
@@ -3453,9 +3500,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3453
3500
  });
3454
3501
  case 10:
3455
3502
  case "end":
3456
- return _context41.stop();
3503
+ return _context42.stop();
3457
3504
  }
3458
- }, _callee41, this);
3505
+ }, _callee42, this);
3459
3506
  }));
3460
3507
  function setItemRuleRuntimeConfig() {
3461
3508
  return _setItemRuleRuntimeConfig.apply(this, arguments);
@@ -3544,25 +3591,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3544
3591
  }, {
3545
3592
  key: "checkOpenDataAvailability",
3546
3593
  value: function () {
3547
- var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
3548
- return _regeneratorRuntime().wrap(function _callee42$(_context42) {
3549
- while (1) switch (_context42.prev = _context42.next) {
3594
+ var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
3595
+ return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3596
+ while (1) switch (_context43.prev = _context43.next) {
3550
3597
  case 0:
3551
3598
  if (this.store.openData) {
3552
- _context42.next = 2;
3599
+ _context43.next = 2;
3553
3600
  break;
3554
3601
  }
3555
3602
  throw new Error('openData 模块未初始化');
3556
3603
  case 2:
3557
- _context42.next = 4;
3604
+ _context43.next = 4;
3558
3605
  return this.loadOpenDataConfig();
3559
3606
  case 4:
3560
- return _context42.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3607
+ return _context43.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
3561
3608
  case 5:
3562
3609
  case "end":
3563
- return _context42.stop();
3610
+ return _context43.stop();
3564
3611
  }
3565
- }, _callee42, this);
3612
+ }, _callee43, this);
3566
3613
  }));
3567
3614
  function checkOpenDataAvailability() {
3568
3615
  return _checkOpenDataAvailability.apply(this, arguments);
@@ -3572,15 +3619,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3572
3619
  }, {
3573
3620
  key: "setOtherParams",
3574
3621
  value: function () {
3575
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
3622
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
3576
3623
  var _ref5,
3577
3624
  _ref5$cover,
3578
3625
  cover,
3579
- _args43 = arguments;
3580
- return _regeneratorRuntime().wrap(function _callee43$(_context43) {
3581
- while (1) switch (_context43.prev = _context43.next) {
3626
+ _args44 = arguments;
3627
+ return _regeneratorRuntime().wrap(function _callee44$(_context44) {
3628
+ while (1) switch (_context44.prev = _context44.next) {
3582
3629
  case 0:
3583
- _ref5 = _args43.length > 1 && _args43[1] !== undefined ? _args43[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3630
+ _ref5 = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {}, _ref5$cover = _ref5.cover, cover = _ref5$cover === void 0 ? false : _ref5$cover;
3584
3631
  if (cover) {
3585
3632
  this.otherParams = params;
3586
3633
  } else {
@@ -3588,11 +3635,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
3588
3635
  }
3589
3636
  case 2:
3590
3637
  case "end":
3591
- return _context43.stop();
3638
+ return _context44.stop();
3592
3639
  }
3593
- }, _callee43, this);
3640
+ }, _callee44, this);
3594
3641
  }));
3595
- function setOtherParams(_x20) {
3642
+ function setOtherParams(_x21) {
3596
3643
  return _setOtherParams.apply(this, arguments);
3597
3644
  }
3598
3645
  return setOtherParams;
@@ -310,7 +310,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
310
310
  date: string;
311
311
  status: string;
312
312
  week: string;
313
- weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
313
+ weekNum: 0 | 1 | 5 | 4 | 2 | 3 | 6;
314
314
  }[]>;
315
315
  submitTimeSlot(timeSlots: TimeSliceItem): void;
316
316
  private getScheduleDataByIds;
@@ -329,7 +329,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
329
329
  count: number;
330
330
  left: number;
331
331
  summaryCount: number;
332
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
332
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
333
333
  }[];
334
334
  /**
335
335
  * 找到多个资源的公共可用时间段
@@ -205,6 +205,11 @@ export declare class VenueBookingImpl extends BaseModule implements Module {
205
205
  getOrderProducts(): ScanOrderOrderProduct[];
206
206
  getSummary(): Promise<import("./types").ScanOrderSummary>;
207
207
  submitOrder<T = any>(): Promise<T>;
208
+ /**
209
+ * 0 元订单免费领取(非定金场景)
210
+ * 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
211
+ */
212
+ submitFreeOrder(id: string | number): Promise<any>;
208
213
  addProductToOrder(product: Partial<ScanOrderOrderProduct> & ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
209
214
  updateProductInOrder(params: UpdateProductInOrderParams): Promise<ScanOrderOrderProduct[]>;
210
215
  removeProductFromOrder(identity: ScanOrderOrderProductIdentity): Promise<ScanOrderOrderProduct[]>;
@@ -1582,6 +1582,24 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1582
1582
  throw error;
1583
1583
  }
1584
1584
  }
1585
+ /**
1586
+ * 0 元订单免费领取(非定金场景)
1587
+ * 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
1588
+ */
1589
+ async submitFreeOrder(id) {
1590
+ this.logMethodStart("submitFreeOrder", { id });
1591
+ try {
1592
+ if (!id) {
1593
+ throw new Error("订单 ID 不能为空");
1594
+ }
1595
+ const res = await this.request.post(`/pay/order/free-pay/${id}`);
1596
+ this.logMethodSuccess("submitFreeOrder", { id, status: res == null ? void 0 : res.status });
1597
+ return res;
1598
+ } catch (error) {
1599
+ this.logMethodError("submitFreeOrder", error);
1600
+ throw error;
1601
+ }
1602
+ }
1585
1603
  async addProductToOrder(product) {
1586
1604
  var _a, _b;
1587
1605
  this.logMethodStart("addProductToOrder", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.164",
4
+ "version": "2.1.166",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",