@pisell/pisellos 2.1.137 → 2.1.139

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.
@@ -2508,7 +2508,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2508
2508
  key: "checkResourceAvailable",
2509
2509
  value: function () {
2510
2510
  var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
2511
- var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
2511
+ var _this$otherParams$bus, _this$otherParams10, _this$otherParams$cha, _this$otherParams11, _this$otherParams12, _this$otherParams12$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams13, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams14, businessCode, channel, openDataTarget, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
2512
2512
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2513
2513
  while (1) switch (_context36.prev = _context36.next) {
2514
2514
  case 0:
@@ -2516,25 +2516,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2516
2516
  resourceId: resourceId
2517
2517
  });
2518
2518
  _context36.prev = 1;
2519
- _context36.next = 4;
2520
- return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
2519
+ businessCode = String((_this$otherParams$bus = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2520
+ channel = String((_this$otherParams$cha = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2521
+ openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
2522
+ _context36.next = 7;
2523
+ return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
2521
2524
  scope: 'board',
2522
- target: 'dine_in+scan_to_order',
2525
+ target: openDataTarget,
2523
2526
  section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
2524
2527
  });
2525
- case 4:
2528
+ case 7:
2526
2529
  openData = _context36.sent;
2527
2530
  if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
2528
- _context36.next = 7;
2531
+ _context36.next = 10;
2529
2532
  break;
2530
2533
  }
2531
2534
  throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
2532
- case 7:
2535
+ case 10:
2533
2536
  dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
2534
2537
  this.otherParams.dineInConfig = dineInConfig;
2535
- _context36.next = 11;
2538
+ _context36.next = 14;
2536
2539
  return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
2537
- case 11:
2540
+ case 14:
2538
2541
  closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
2539
2542
  closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
2540
2543
  basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
@@ -2551,21 +2554,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2551
2554
  };
2552
2555
  }; // 1. 基础开关 basic.enable 关闭
2553
2556
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
2554
- _context36.next = 18;
2557
+ _context36.next = 21;
2555
2558
  break;
2556
2559
  }
2557
2560
  return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
2558
- case 18:
2561
+ case 21:
2559
2562
  if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
2560
- _context36.next = 21;
2563
+ _context36.next = 24;
2561
2564
  break;
2562
2565
  }
2563
2566
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
2564
- _context36.next = 21;
2567
+ _context36.next = 24;
2565
2568
  break;
2566
2569
  }
2567
2570
  return _context36.abrupt("return", makeShopClosed(pauseMessage));
2568
- case 21:
2571
+ case 24:
2569
2572
  // 3. 营业时间 operating_hours 闸门
2570
2573
  operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
2571
2574
  return Number(id);
@@ -2581,27 +2584,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2581
2584
  }
2582
2585
  }
2583
2586
  if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
2584
- _context36.next = 26;
2587
+ _context36.next = 29;
2585
2588
  break;
2586
2589
  }
2587
2590
  return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
2588
- case 26:
2591
+ case 29:
2589
2592
  // Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
2590
2593
  // (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
2591
2594
  tempOrder = this.ensureTempOrder();
2592
2595
  reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
2593
2596
  if (!(reservationLinkIds.length === 0)) {
2594
- _context36.next = 32;
2597
+ _context36.next = 35;
2595
2598
  break;
2596
2599
  }
2597
2600
  this.enabledReservationRuleProducts = [];
2598
- _context36.next = 43;
2601
+ _context36.next = 46;
2599
2602
  break;
2600
- case 32:
2603
+ case 35:
2601
2604
  tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
2602
2605
  delete tempOrder.metadata.table_occupancy_duration;
2603
2606
  reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
2604
- _context36.next = 37;
2607
+ _context36.next = 40;
2605
2608
  return reservationProductList.initialize(this.core, {
2606
2609
  store: {
2607
2610
  list: [],
@@ -2613,17 +2616,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2613
2616
  cacheId: this.cacheId
2614
2617
  })
2615
2618
  });
2616
- case 37:
2619
+ case 40:
2617
2620
  scheduleDate = dayjs().format('YYYY-MM-DD');
2618
2621
  scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
2619
- _context36.next = 41;
2622
+ _context36.next = 44;
2620
2623
  return reservationProductList.loadProducts({
2621
2624
  product_ids: reservationLinkIds,
2622
2625
  schedule_date: scheduleDate,
2623
2626
  schedule_datetime: scheduleDatetime,
2624
2627
  cacheId: this.cacheId
2625
2628
  });
2626
- case 41:
2629
+ case 44:
2627
2630
  loaded = _context36.sent;
2628
2631
  if (Array.isArray(loaded)) {
2629
2632
  this.enabledReservationRuleProducts = loaded;
@@ -2648,10 +2651,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2648
2651
  }
2649
2652
  });
2650
2653
  }
2651
- case 43:
2652
- _context36.next = 45;
2654
+ case 46:
2655
+ _context36.next = 48;
2653
2656
  return this.fetchResourceOccupyDetailByResourceId(resourceId);
2654
- case 45:
2657
+ case 48:
2655
2658
  occupyDetail = _context36.sent;
2656
2659
  // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2657
2660
  // 计算当前桌台的 resourceSelectType(single/multiple/capacity)
@@ -2685,30 +2688,30 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2685
2688
  } : {}), this.store.resource.requestPaxMax !== undefined ? {
2686
2689
  requestPaxMax: this.store.resource.requestPaxMax
2687
2690
  } : {});
2688
- tempOrder.relation_id = resourceId || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.relation_id);
2691
+ tempOrder.relation_id = resourceId || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.relation_id);
2689
2692
  tempOrder.table_form_id = resourceState.tableFormId;
2690
2693
  tempOrder.resource_id = resourceId;
2691
2694
  (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
2692
2695
 
2693
2696
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
2694
2697
  if (!(availabilityInfo.mode === 'idle')) {
2695
- _context36.next = 60;
2698
+ _context36.next = 63;
2696
2699
  break;
2697
2700
  }
2698
- _context36.next = 60;
2701
+ _context36.next = 63;
2699
2702
  return this.addNewOrder();
2700
- case 60:
2703
+ case 63:
2701
2704
  // 如果是加单模式,tempOrder 里 需要记录 lastOrderId,提交的时候走加单接口
2702
2705
  if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
2703
2706
  tempOrder.order_id = resourceState.lastOrderId;
2704
2707
  }
2705
2708
  if (!tempOrder.order_id) {
2706
- _context36.next = 69;
2709
+ _context36.next = 72;
2707
2710
  break;
2708
2711
  }
2709
- _context36.next = 64;
2712
+ _context36.next = 67;
2710
2713
  return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
2711
- case 64:
2714
+ case 67:
2712
2715
  res = _context36.sent;
2713
2716
  // 找到下单的时候输入的 entryPaxNumber
2714
2717
  entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
@@ -2716,12 +2719,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2716
2719
  return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
2717
2720
  })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
2718
2721
  if (!entryPaxNumber) {
2719
- _context36.next = 69;
2722
+ _context36.next = 72;
2720
2723
  break;
2721
2724
  }
2722
- _context36.next = 69;
2725
+ _context36.next = 72;
2723
2726
  return this.setEntryPaxNumber(entryPaxNumber);
2724
- case 69:
2727
+ case 72:
2725
2728
  lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
2726
2729
  historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
2727
2730
  if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
@@ -2733,13 +2736,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2733
2736
  } : {}));
2734
2737
  return acc;
2735
2738
  }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
2736
- _context36.next = 73;
2739
+ _context36.next = 76;
2737
2740
  return this.setItemRuleRuntimeConfig({
2738
- serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
2741
+ serviceType: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2739
2742
  submissionIndex: hasOrderId ? 1 : 0,
2740
2743
  historicalItems: historicalItems
2741
2744
  });
2742
- case 73:
2745
+ case 76:
2743
2746
  // operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
2744
2747
  // 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
2745
2748
  if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
@@ -2761,18 +2764,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2761
2764
  isFull: resourceState.isFull
2762
2765
  });
2763
2766
  return _context36.abrupt("return", availabilityInfo);
2764
- case 78:
2765
- _context36.prev = 78;
2767
+ case 81:
2768
+ _context36.prev = 81;
2766
2769
  _context36.t0 = _context36["catch"](1);
2767
2770
  this.logMethodError('checkResourceAvailable', _context36.t0.message, {
2768
2771
  resourceId: resourceId
2769
2772
  });
2770
2773
  throw _context36.t0;
2771
- case 82:
2774
+ case 85:
2772
2775
  case "end":
2773
2776
  return _context36.stop();
2774
2777
  }
2775
- }, _callee36, this, [[1, 78]]);
2778
+ }, _callee36, this, [[1, 81]]);
2776
2779
  }));
2777
2780
  function checkResourceAvailable(_x18, _x19) {
2778
2781
  return _checkResourceAvailable.apply(this, arguments);
@@ -2815,14 +2818,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2815
2818
  key: "getProductList",
2816
2819
  value: function () {
2817
2820
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2818
- var _this$otherParams13;
2821
+ var _this$otherParams15;
2819
2822
  var menu_list_ids, _this$store$products, res, formattedRes;
2820
2823
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2821
2824
  while (1) switch (_context38.prev = _context38.next) {
2822
2825
  case 0:
2823
2826
  this.logMethodStart('getProductList');
2824
2827
  // 可以直接通过配置里的 menu 读取
2825
- menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
2828
+ menu_list_ids = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 || (_this$otherParams15 = _this$otherParams15.dineInConfig) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15['menu.associated_menus'].map(function (n) {
2826
2829
  return Number(n.value);
2827
2830
  })) || [];
2828
2831
  _context38.prev = 2;
@@ -3025,9 +3028,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3025
3028
  }, {
3026
3029
  key: "getFulfillmentModes",
3027
3030
  value: function getFulfillmentModes() {
3028
- var _this$otherParams14;
3031
+ var _this$otherParams16;
3029
3032
  this.logMethodStart('getFulfillmentModes');
3030
- var dineInConfig = ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig) || {};
3033
+ var dineInConfig = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.dineInConfig) || {};
3031
3034
  var result = {
3032
3035
  enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
3033
3036
  enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
@@ -3041,9 +3044,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3041
3044
  }, {
3042
3045
  key: "checkManualPickupRef",
3043
3046
  value: function checkManualPickupRef() {
3044
- var _this$otherParams15;
3047
+ var _this$otherParams17;
3045
3048
  this.logMethodStart('checkManualPickupRef');
3046
- var dineInConfig = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.dineInConfig) || {};
3049
+ var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
3047
3050
  var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
3048
3051
  var manualInputType = dineInConfig['fulfillment.manual_input_type'];
3049
3052
  var enabled = refMode === 'manual_input';
@@ -828,24 +828,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
828
828
  }
829
829
  throw new Error('addonProducts 模块未初始化');
830
830
  case 6:
831
+ _context11.next = 8;
832
+ return this.loadOpenDataConfig();
833
+ case 8:
831
834
  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']) || [];
832
835
  if (associatedMenus.length) {
833
- _context11.next = 9;
836
+ _context11.next = 11;
834
837
  break;
835
838
  }
836
839
  throw new Error('未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置');
837
- case 9:
840
+ case 11:
838
841
  menuListIds = associatedMenus.map(function (n) {
839
842
  return Number(n.value);
840
843
  });
841
- _context11.next = 12;
844
+ _context11.next = 14;
842
845
  return this.store.venueProducts.loadProducts({
843
846
  menu_list_ids: menuListIds,
844
847
  cacheId: this.cacheId,
845
848
  schedule_date: dayjs().format('YYYY-MM-DD'),
846
849
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
847
850
  });
848
- case 12:
851
+ case 14:
849
852
  allProducts = _context11.sent;
850
853
  list = Array.isArray(allProducts) ? allProducts : [];
851
854
  venueList = list.filter(function (p) {
@@ -873,16 +876,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
873
876
  venueProducts: venueList,
874
877
  addonProducts: addonList
875
878
  });
876
- case 25:
877
- _context11.prev = 25;
879
+ case 27:
880
+ _context11.prev = 27;
878
881
  _context11.t0 = _context11["catch"](1);
879
882
  this.logMethodError('loadAllProducts', _context11.t0);
880
883
  throw _context11.t0;
881
- case 29:
884
+ case 31:
882
885
  case "end":
883
886
  return _context11.stop();
884
887
  }
885
- }, _callee11, this, [[1, 25]]);
888
+ }, _callee11, this, [[1, 27]]);
886
889
  }));
887
890
  function _doLoadAllProducts() {
888
891
  return _doLoadAllProducts2.apply(this, arguments);
@@ -2593,8 +2596,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2593
2596
  key: "loadOpenDataConfig",
2594
2597
  value: function () {
2595
2598
  var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
2596
- var _this11 = this;
2597
- var lastFetchedAt, cachedData;
2599
+ var lastFetchedAt, cachedData, openDataConfig;
2598
2600
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
2599
2601
  while (1) switch (_context29.prev = _context29.next) {
2600
2602
  case 0:
@@ -2614,27 +2616,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2614
2616
  return _context29.abrupt("return", cachedData);
2615
2617
  case 7:
2616
2618
  if (!this.loadOpenDataConfigInFlight) {
2617
- _context29.next = 9;
2619
+ _context29.next = 11;
2618
2620
  break;
2619
2621
  }
2620
- return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2621
- case 9:
2622
+ _context29.next = 10;
2623
+ return this.loadOpenDataConfigInFlight;
2624
+ case 10:
2625
+ return _context29.abrupt("return", _context29.sent);
2626
+ case 11:
2622
2627
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
2623
2628
  scope: 'board',
2624
2629
  target: 'venue_booking+online_store',
2625
2630
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
2626
- }).then(function (openDataConfig) {
2627
- _this11.otherParams.openData = openDataConfig;
2628
- return openDataConfig;
2629
- }).finally(function () {
2630
- _this11.loadOpenDataConfigInFlight = null;
2631
2631
  });
2632
- return _context29.abrupt("return", this.loadOpenDataConfigInFlight);
2633
- case 11:
2632
+ _context29.prev = 12;
2633
+ _context29.next = 15;
2634
+ return this.loadOpenDataConfigInFlight;
2635
+ case 15:
2636
+ openDataConfig = _context29.sent;
2637
+ this.otherParams.openData = openDataConfig;
2638
+ return _context29.abrupt("return", openDataConfig);
2639
+ case 18:
2640
+ _context29.prev = 18;
2641
+ this.loadOpenDataConfigInFlight = null;
2642
+ return _context29.finish(18);
2643
+ case 21:
2634
2644
  case "end":
2635
2645
  return _context29.stop();
2636
2646
  }
2637
- }, _callee29, this);
2647
+ }, _callee29, this, [[12,, 18, 21]]);
2638
2648
  }));
2639
2649
  function loadOpenDataConfig() {
2640
2650
  return _loadOpenDataConfig.apply(this, arguments);
@@ -2814,7 +2824,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2814
2824
  key: "ensureItemRuleConfigsLoaded",
2815
2825
  value: function () {
2816
2826
  var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
2817
- var _this12 = this;
2827
+ var _this11 = this;
2818
2828
  return _regeneratorRuntime().wrap(function _callee34$(_context34) {
2819
2829
  while (1) switch (_context34.prev = _context34.next) {
2820
2830
  case 0:
@@ -2835,19 +2845,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
2835
2845
  return _regeneratorRuntime().wrap(function _callee33$(_context33) {
2836
2846
  while (1) switch (_context33.prev = _context33.next) {
2837
2847
  case 0:
2838
- runtimeConfig = _this12.getItemRuleRuntimeConfig();
2848
+ runtimeConfig = _this11.getItemRuleRuntimeConfig();
2839
2849
  staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
2840
2850
  if (!(staticConfigs.length > 0)) {
2841
2851
  _context33.next = 6;
2842
2852
  break;
2843
2853
  }
2844
- _this12.itemRuleConfigs = staticConfigs;
2845
- _this12.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2846
- return _context33.abrupt("return", _this12.itemRuleConfigs);
2854
+ _this11.itemRuleConfigs = staticConfigs;
2855
+ _this11.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
2856
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
2847
2857
  case 6:
2848
- _this12.itemRuleConfigs = [];
2849
- _this12.itemRuleEvaluator.setStrategyConfigs([]);
2850
- return _context33.abrupt("return", _this12.itemRuleConfigs);
2858
+ _this11.itemRuleConfigs = [];
2859
+ _this11.itemRuleEvaluator.setStrategyConfigs([]);
2860
+ return _context33.abrupt("return", _this11.itemRuleConfigs);
2851
2861
  case 9:
2852
2862
  case "end":
2853
2863
  return _context33.stop();
@@ -1457,14 +1457,17 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1457
1457
  // 通过 resource_id + 店铺配置
1458
1458
  // hasOrderId 表示 url 上是否有 orderid,如果是的话,后续的流程会走加单
1459
1459
  async checkResourceAvailable(resourceId, hasOrderId) {
1460
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1460
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1461
1461
  this.logMethodStart("checkResourceAvailable", {
1462
1462
  resourceId
1463
1463
  });
1464
1464
  try {
1465
- const openData = await ((_b = (_a = this.otherParams) == null ? void 0 : _a.getOpenData) == null ? void 0 : _b.call(_a, {
1465
+ const businessCode = String(((_a = this.otherParams) == null ? void 0 : _a.businessCode) ?? "").trim();
1466
+ const channel = String(((_b = this.otherParams) == null ? void 0 : _b.channel) ?? "").trim();
1467
+ const openDataTarget = businessCode && channel ? `${businessCode}+${channel}` : "dine_in+scan_to_order";
1468
+ const openData = await ((_d = (_c = this.otherParams) == null ? void 0 : _c.getOpenData) == null ? void 0 : _d.call(_c, {
1466
1469
  scope: "board",
1467
- target: "dine_in+scan_to_order",
1470
+ target: openDataTarget,
1468
1471
  section_code: ["basic", "fulfillment", "reservation", "sale", "menu", "availability", "workflow"]
1469
1472
  }));
1470
1473
  if ((openData == null ? void 0 : openData.status) === false) {
@@ -1591,16 +1594,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1591
1594
  table_form_id: resourceState.tableFormId,
1592
1595
  deskmate_valid: resourceState.deskmate_valid,
1593
1596
  table_form_record: resourceState.table_form_record,
1594
- policy: (_c = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _c.policy,
1595
- partyroom_booking: (_d = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _d.partyroom_booking,
1597
+ policy: (_e = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _e.policy,
1598
+ partyroom_booking: (_f = occupyDetail == null ? void 0 : occupyDetail.form_record) == null ? void 0 : _f.partyroom_booking,
1596
1599
  ...this.store.resource.requestEntryPax !== void 0 ? { requestEntryPax: this.store.resource.requestEntryPax } : {},
1597
1600
  ...this.store.resource.requestPaxMin !== void 0 ? { requestPaxMin: this.store.resource.requestPaxMin } : {},
1598
1601
  ...this.store.resource.requestPaxMax !== void 0 ? { requestPaxMax: this.store.resource.requestPaxMax } : {}
1599
1602
  };
1600
- tempOrder.relation_id = resourceId || ((_e = this.otherParams) == null ? void 0 : _e.relation_id);
1603
+ tempOrder.relation_id = resourceId || ((_g = this.otherParams) == null ? void 0 : _g.relation_id);
1601
1604
  tempOrder.table_form_id = resourceState.tableFormId;
1602
1605
  tempOrder.resource_id = resourceId;
1603
- (_f = this.store.order) == null ? void 0 : _f.persistTempOrder();
1606
+ (_h = this.store.order) == null ? void 0 : _h.persistTempOrder();
1604
1607
  if (availabilityInfo.mode === "idle") {
1605
1608
  await this.addNewOrder();
1606
1609
  }
@@ -1608,16 +1611,16 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1608
1611
  tempOrder.order_id = resourceState.lastOrderId;
1609
1612
  }
1610
1613
  if (tempOrder.order_id) {
1611
- const res = await ((_g = this.store.order) == null ? void 0 : _g.getOrderInfoByRemote(tempOrder.order_id));
1612
- const entryPaxNumber = (_k = (_j = (_i = (_h = res == null ? void 0 : res.data) == null ? void 0 : _h.bookings) == null ? void 0 : _i.find((p) => {
1614
+ const res = await ((_i = this.store.order) == null ? void 0 : _i.getOrderInfoByRemote(tempOrder.order_id));
1615
+ const entryPaxNumber = (_m = (_l = (_k = (_j = res == null ? void 0 : res.data) == null ? void 0 : _j.bookings) == null ? void 0 : _k.find((p) => {
1613
1616
  var _a2;
1614
1617
  return (_a2 = p.metadata) == null ? void 0 : _a2.collect_pax;
1615
- })) == null ? void 0 : _j.metadata) == null ? void 0 : _k.collect_pax;
1618
+ })) == null ? void 0 : _l.metadata) == null ? void 0 : _m.collect_pax;
1616
1619
  if (entryPaxNumber) {
1617
1620
  await this.setEntryPaxNumber(entryPaxNumber);
1618
1621
  }
1619
1622
  }
1620
- const lastOrderInfo = (_m = (_l = this.store.order) == null ? void 0 : _l.getLastOrderInfo) == null ? void 0 : _m.call(_l);
1623
+ const lastOrderInfo = (_o = (_n = this.store.order) == null ? void 0 : _n.getLastOrderInfo) == null ? void 0 : _o.call(_n);
1621
1624
  const historicalItems = hasOrderId && Array.isArray(lastOrderInfo == null ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce((acc, p) => {
1622
1625
  if (typeof (p == null ? void 0 : p.product_id) !== "number")
1623
1626
  return acc;
@@ -1629,7 +1632,7 @@ var _ScanOrderImpl = class extends import_BaseModule.BaseModule {
1629
1632
  return acc;
1630
1633
  }, []) : [];
1631
1634
  await this.setItemRuleRuntimeConfig({
1632
- serviceType: (_n = this.otherParams) == null ? void 0 : _n.businessCode,
1635
+ serviceType: (_p = this.otherParams) == null ? void 0 : _p.businessCode,
1633
1636
  submissionIndex: hasOrderId ? 1 : 0,
1634
1637
  historicalItems
1635
1638
  });
@@ -523,6 +523,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
523
523
  throw new Error("venueProducts 模块未初始化");
524
524
  if (!this.store.addonProducts)
525
525
  throw new Error("addonProducts 模块未初始化");
526
+ await this.loadOpenDataConfig();
526
527
  const associatedMenus = ((_b = (_a = this.otherParams) == null ? void 0 : _a.openData) == null ? void 0 : _b["menu.associated_menus"]) || [];
527
528
  if (!associatedMenus.length) {
528
529
  throw new Error("未获取到餐牌配置(menu.associated_menus),请检查 OpenData 配置");
@@ -1529,18 +1530,19 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
1529
1530
  return cachedData;
1530
1531
  }
1531
1532
  if (this.loadOpenDataConfigInFlight)
1532
- return this.loadOpenDataConfigInFlight;
1533
+ return await this.loadOpenDataConfigInFlight;
1533
1534
  this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
1534
1535
  scope: "board",
1535
1536
  target: "venue_booking+online_store",
1536
1537
  section_code: [...OPEN_DATA_SECTION_CODES]
1537
- }).then((openDataConfig) => {
1538
+ });
1539
+ try {
1540
+ const openDataConfig = await this.loadOpenDataConfigInFlight;
1538
1541
  this.otherParams.openData = openDataConfig;
1539
1542
  return openDataConfig;
1540
- }).finally(() => {
1543
+ } finally {
1541
1544
  this.loadOpenDataConfigInFlight = null;
1542
- });
1543
- return this.loadOpenDataConfigInFlight;
1545
+ }
1544
1546
  }
1545
1547
  async loadRuntimeConfigs() {
1546
1548
  await this.loadOpenDataConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.1.137",
4
+ "version": "2.1.139",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",