@pisell/pisellos 2.1.138 → 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.
@@ -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();
@@ -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.138",
4
+ "version": "2.1.139",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",