@pisell/pisellos 0.10.3 → 0.10.4

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.
@@ -498,15 +498,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
498
498
  return _this;
499
499
  }
500
500
  _createClass(UnifiedBookingSalesImpl, [{
501
- key: "shouldUseCheckoutSyncTask",
502
- value:
501
+ key: "isSessionStoragePersistEnabled",
502
+ value: function isSessionStoragePersistEnabled() {
503
+ var _this$otherParams;
504
+ return Boolean(this.cacheId && ((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.enableSessionStoragePersist) === true);
505
+ }
506
+ }, {
507
+ key: "shouldUseSessionStorageForSubModule",
508
+ value: function shouldUseSessionStorageForSubModule(moduleName) {
509
+ return this.isSessionStoragePersistEnabled() && moduleName === 'order';
510
+ }
511
+
503
512
  /**
504
513
  * Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
505
514
  * 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
506
515
  */
507
- function shouldUseCheckoutSyncTask() {
508
- var _this$otherParams;
509
- var configured = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.checkoutSyncTaskEnabled;
516
+ }, {
517
+ key: "shouldUseCheckoutSyncTask",
518
+ value: function shouldUseCheckoutSyncTask() {
519
+ var _this$otherParams2;
520
+ var configured = (_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.checkoutSyncTaskEnabled;
510
521
  return typeof configured === 'boolean' ? configured : false;
511
522
  }
512
523
 
@@ -532,7 +543,64 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
532
543
  }
533
544
  return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "createSubModule", this).call(this, moduleName);
534
545
  }
535
-
546
+ }, {
547
+ key: "addNewOrder",
548
+ value: function () {
549
+ var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
550
+ var _this$store$order, _this$store$order$con, _this$store$order2, _tempOrder$customer, _tempOrder$_extend, _tempOrder$_extend2, _this$store$order3;
551
+ var sessionRecord, tempOrder, customerId;
552
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
553
+ while (1) switch (_context.prev = _context.next) {
554
+ case 0:
555
+ sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$con = _this$store$order.consumeSessionStorageRestore) === null || _this$store$order$con === void 0 ? void 0 : _this$store$order$con.call(_this$store$order) : null;
556
+ if (sessionRecord) {
557
+ _context.next = 3;
558
+ break;
559
+ }
560
+ return _context.abrupt("return", _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "addNewOrder", this).call(this));
561
+ case 3:
562
+ _context.next = 5;
563
+ return this.loadSalesDetail({
564
+ preloadedSalesDetail: sessionRecord,
565
+ hydrateSource: 'sessionStorage'
566
+ });
567
+ case 5:
568
+ _context.next = 7;
569
+ return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "addNewOrder", this).call(this);
570
+ case 7:
571
+ tempOrder = _context.sent;
572
+ (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
573
+ customerId = Number(tempOrder.customer_id || ((_tempOrder$customer = tempOrder.customer) === null || _tempOrder$customer === void 0 ? void 0 : _tempOrder$customer.id) || ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.customerSnapshot) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.id) || ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.customerSnapshot) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2.customer_id) || 0);
574
+ if (!(customerId > 1)) {
575
+ _context.next = 19;
576
+ break;
577
+ }
578
+ _context.prev = 11;
579
+ _context.next = 14;
580
+ return this.loadDiscountConfig({
581
+ customerId: customerId,
582
+ action: tempOrder.order_id ? 'edit' : 'create'
583
+ });
584
+ case 14:
585
+ _context.next = 19;
586
+ break;
587
+ case 16:
588
+ _context.prev = 16;
589
+ _context.t0 = _context["catch"](11);
590
+ console.warn('[UnifiedBookingSales] Failed to refresh discounts after session restore', _context.t0);
591
+ case 19:
592
+ return _context.abrupt("return", ((_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder()) || tempOrder);
593
+ case 20:
594
+ case "end":
595
+ return _context.stop();
596
+ }
597
+ }, _callee, this, [[11, 16]]);
598
+ }));
599
+ function addNewOrder() {
600
+ return _addNewOrder.apply(this, arguments);
601
+ }
602
+ return addNewOrder;
603
+ }()
536
604
  /**
537
605
  * Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
538
606
  * business/channel target so a reused solution instance cannot leak another entry's menus.
@@ -540,13 +608,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
540
608
  }, {
541
609
  key: "loadOpenData",
542
610
  value: (function () {
543
- var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
611
+ var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
544
612
  var businessCode, channel, target, cachedData, lastFetchedAt, openData;
545
- return _regeneratorRuntime().wrap(function _callee$(_context) {
546
- while (1) switch (_context.prev = _context.next) {
613
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
614
+ while (1) switch (_context2.prev = _context2.next) {
547
615
  case 0:
548
616
  if (this.store.openData) {
549
- _context.next = 2;
617
+ _context2.next = 2;
550
618
  break;
551
619
  }
552
620
  throw new Error('[UnifiedBookingSales] openData 模块未初始化');
@@ -554,7 +622,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
554
622
  businessCode = String(params.businessCode || '').trim();
555
623
  channel = String(params.channel || '').trim();
556
624
  if (!(!businessCode || !channel)) {
557
- _context.next = 6;
625
+ _context2.next = 6;
558
626
  break;
559
627
  }
560
628
  throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
@@ -563,28 +631,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
563
631
  cachedData = this.store.openData.getOpenData();
564
632
  lastFetchedAt = this.store.openData.getLastFetchedAt();
565
633
  if (!(!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
566
- _context.next = 11;
634
+ _context2.next = 11;
567
635
  break;
568
636
  }
569
- return _context.abrupt("return", cachedData);
637
+ return _context2.abrupt("return", cachedData);
570
638
  case 11:
571
639
  if (!this.loadOpenDataInFlight) {
572
- _context.next = 19;
640
+ _context2.next = 19;
573
641
  break;
574
642
  }
575
643
  if (!(this.loadOpenDataInFlightTarget === target)) {
576
- _context.next = 16;
644
+ _context2.next = 16;
577
645
  break;
578
646
  }
579
- _context.next = 15;
647
+ _context2.next = 15;
580
648
  return this.loadOpenDataInFlight;
581
649
  case 15:
582
- return _context.abrupt("return", _context.sent);
650
+ return _context2.abrupt("return", _context2.sent);
583
651
  case 16:
584
- _context.next = 18;
652
+ _context2.next = 18;
585
653
  return this.loadOpenDataInFlight;
586
654
  case 18:
587
- return _context.abrupt("return", this.loadOpenData(params));
655
+ return _context2.abrupt("return", this.loadOpenData(params));
588
656
  case 19:
589
657
  this.loadOpenDataInFlightTarget = target;
590
658
  this.loadOpenDataInFlight = this.store.openData.fetchOpenData({
@@ -592,26 +660,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
592
660
  target: target,
593
661
  section_code: [].concat(OPEN_DATA_SECTION_CODES)
594
662
  });
595
- _context.prev = 21;
596
- _context.next = 24;
663
+ _context2.prev = 21;
664
+ _context2.next = 24;
597
665
  return this.loadOpenDataInFlight;
598
666
  case 24:
599
- openData = _context.sent;
667
+ openData = _context2.sent;
600
668
  this.openDataTarget = target;
601
669
  this.otherParams.openData = openData;
602
670
  this.otherParams.businessCode = businessCode;
603
671
  this.otherParams.channel = channel;
604
- return _context.abrupt("return", openData);
672
+ return _context2.abrupt("return", openData);
605
673
  case 30:
606
- _context.prev = 30;
674
+ _context2.prev = 30;
607
675
  this.loadOpenDataInFlight = null;
608
676
  this.loadOpenDataInFlightTarget = null;
609
- return _context.finish(30);
677
+ return _context2.finish(30);
610
678
  case 34:
611
679
  case "end":
612
- return _context.stop();
680
+ return _context2.stop();
613
681
  }
614
- }, _callee, this, [[21,, 30, 34]]);
682
+ }, _callee2, this, [[21,, 30, 34]]);
615
683
  }));
616
684
  function loadOpenData(_x) {
617
685
  return _loadOpenData.apply(this, arguments);
@@ -621,37 +689,37 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
621
689
  }, {
622
690
  key: "getOpenData",
623
691
  value: function () {
624
- var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
625
- var _this$otherParams2, _this$otherParams3, _this$store$openData;
692
+ var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
693
+ var _this$otherParams3, _this$otherParams4, _this$store$openData;
626
694
  var businessCode, channel, target, cachedData;
627
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
628
- while (1) switch (_context2.prev = _context2.next) {
695
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
696
+ while (1) switch (_context3.prev = _context3.next) {
629
697
  case 0:
630
- businessCode = String(((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) || '').trim();
631
- channel = String(((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) || '').trim();
698
+ businessCode = String(((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.businessCode) || '').trim();
699
+ channel = String(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.channel) || '').trim();
632
700
  if (!(!businessCode || !channel)) {
633
- _context2.next = 4;
701
+ _context3.next = 4;
634
702
  break;
635
703
  }
636
- return _context2.abrupt("return", null);
704
+ return _context3.abrupt("return", null);
637
705
  case 4:
638
706
  target = "".concat(businessCode, "+").concat(channel);
639
707
  cachedData = ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData()) || null;
640
708
  if (!(cachedData && this.openDataTarget === target)) {
641
- _context2.next = 8;
709
+ _context3.next = 8;
642
710
  break;
643
711
  }
644
- return _context2.abrupt("return", cachedData);
712
+ return _context3.abrupt("return", cachedData);
645
713
  case 8:
646
- return _context2.abrupt("return", this.loadOpenData({
714
+ return _context3.abrupt("return", this.loadOpenData({
647
715
  businessCode: businessCode,
648
716
  channel: channel
649
717
  }));
650
718
  case 9:
651
719
  case "end":
652
- return _context2.stop();
720
+ return _context3.stop();
653
721
  }
654
- }, _callee2, this);
722
+ }, _callee3, this);
655
723
  }));
656
724
  function getOpenData() {
657
725
  return _getOpenData.apply(this, arguments);
@@ -665,27 +733,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
665
733
  }, {
666
734
  key: "loadProducts",
667
735
  value: (function () {
668
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
736
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
669
737
  var params,
670
738
  options,
671
739
  schedule_date,
672
740
  schedule_datetime,
673
741
  result,
674
- _args3 = arguments;
675
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
676
- while (1) switch (_context3.prev = _context3.next) {
742
+ _args4 = arguments;
743
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
744
+ while (1) switch (_context4.prev = _context4.next) {
677
745
  case 0:
678
- params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
679
- options = _args3.length > 1 ? _args3[1] : undefined;
746
+ params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
747
+ options = _args4.length > 1 ? _args4[1] : undefined;
680
748
  if (this.store.products) {
681
- _context3.next = 4;
749
+ _context4.next = 4;
682
750
  break;
683
751
  }
684
752
  throw new Error('[UnifiedBookingSales] products 模块未初始化');
685
753
  case 4:
686
754
  schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
687
755
  schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
688
- _context3.next = 8;
756
+ _context4.next = 8;
689
757
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
690
758
  with_count: ['bundleGroup', 'optionGroup'],
691
759
  with_schedule: 1
@@ -695,17 +763,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
695
763
  cacheId: this.cacheId
696
764
  }), options);
697
765
  case 8:
698
- result = _context3.sent;
766
+ result = _context4.sent;
699
767
  this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
700
- _context3.next = 12;
768
+ _context4.next = 12;
701
769
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
702
770
  case 12:
703
- return _context3.abrupt("return", result);
771
+ return _context4.abrupt("return", result);
704
772
  case 13:
705
773
  case "end":
706
- return _context3.stop();
774
+ return _context4.stop();
707
775
  }
708
- }, _callee3, this);
776
+ }, _callee4, this);
709
777
  }));
710
778
  function loadProducts() {
711
779
  return _loadProducts.apply(this, arguments);
@@ -715,22 +783,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
715
783
  }, {
716
784
  key: "loadScheduleAvailableDate",
717
785
  value: (function () {
718
- var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
719
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
720
- while (1) switch (_context4.prev = _context4.next) {
786
+ var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
787
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
788
+ while (1) switch (_context5.prev = _context5.next) {
721
789
  case 0:
722
790
  if (this.store.schedule) {
723
- _context4.next = 2;
791
+ _context5.next = 2;
724
792
  break;
725
793
  }
726
794
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
727
795
  case 2:
728
- return _context4.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
796
+ return _context5.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
729
797
  case 3:
730
798
  case "end":
731
- return _context4.stop();
799
+ return _context5.stop();
732
800
  }
733
- }, _callee4, this);
801
+ }, _callee5, this);
734
802
  }));
735
803
  function loadScheduleAvailableDate(_x2) {
736
804
  return _loadScheduleAvailableDate.apply(this, arguments);
@@ -746,15 +814,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
746
814
  }, {
747
815
  key: "loadProductsByScheduleDate",
748
816
  value: (function () {
749
- var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
817
+ var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
750
818
  var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
751
819
  var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
752
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
753
- while (1) switch (_context5.prev = _context5.next) {
820
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
821
+ while (1) switch (_context6.prev = _context6.next) {
754
822
  case 0:
755
823
  date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
756
824
  if (this.store.schedule) {
757
- _context5.next = 3;
825
+ _context6.next = 3;
758
826
  break;
759
827
  }
760
828
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
@@ -765,10 +833,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
765
833
  });
766
834
  hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
767
835
  if (!(!hasCachedDate && !hasOtherProducts)) {
768
- _context5.next = 9;
836
+ _context6.next = 9;
769
837
  break;
770
838
  }
771
- _context5.next = 9;
839
+ _context6.next = 9;
772
840
  return this.loadScheduleAvailableDate({
773
841
  startDate: date,
774
842
  endDate: date,
@@ -788,45 +856,45 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
788
856
  return !productIdFilter || productIdFilter.has(String(id));
789
857
  });
790
858
  if (availableProductIds.length) {
791
- _context5.next = 17;
859
+ _context6.next = 17;
792
860
  break;
793
861
  }
794
862
  this.unifiedProductCatalog = [];
795
- _context5.next = 16;
863
+ _context6.next = 16;
796
864
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
797
865
  case 16:
798
- return _context5.abrupt("return", []);
866
+ return _context6.abrupt("return", []);
799
867
  case 17:
800
- _context5.next = 19;
868
+ _context6.next = 19;
801
869
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
802
870
  product_ids: availableProductIds,
803
871
  schedule_date: date
804
872
  }));
805
873
  case 19:
806
- products = _context5.sent;
874
+ products = _context6.sent;
807
875
  if (!(products.length || availableProductIds.length <= 1)) {
808
- _context5.next = 22;
876
+ _context6.next = 22;
809
877
  break;
810
878
  }
811
- return _context5.abrupt("return", products);
879
+ return _context6.abrupt("return", products);
812
880
  case 22:
813
881
  fallbackProducts = [];
814
882
  _iterator = _createForOfIteratorHelper(availableProductIds);
815
- _context5.prev = 24;
883
+ _context6.prev = 24;
816
884
  _iterator.s();
817
885
  case 26:
818
886
  if ((_step = _iterator.n()).done) {
819
- _context5.next = 34;
887
+ _context6.next = 34;
820
888
  break;
821
889
  }
822
890
  productId = _step.value;
823
- _context5.next = 30;
891
+ _context6.next = 30;
824
892
  return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
825
893
  product_ids: [productId],
826
894
  schedule_date: date
827
895
  }));
828
896
  case 30:
829
- result = _context5.sent;
897
+ result = _context6.sent;
830
898
  result.forEach(function (product) {
831
899
  var _id;
832
900
  var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
@@ -838,30 +906,30 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
838
906
  }
839
907
  });
840
908
  case 32:
841
- _context5.next = 26;
909
+ _context6.next = 26;
842
910
  break;
843
911
  case 34:
844
- _context5.next = 39;
912
+ _context6.next = 39;
845
913
  break;
846
914
  case 36:
847
- _context5.prev = 36;
848
- _context5.t0 = _context5["catch"](24);
849
- _iterator.e(_context5.t0);
915
+ _context6.prev = 36;
916
+ _context6.t0 = _context6["catch"](24);
917
+ _iterator.e(_context6.t0);
850
918
  case 39:
851
- _context5.prev = 39;
919
+ _context6.prev = 39;
852
920
  _iterator.f();
853
- return _context5.finish(39);
921
+ return _context6.finish(39);
854
922
  case 42:
855
923
  this.unifiedProductCatalog = [].concat(fallbackProducts);
856
- _context5.next = 45;
924
+ _context6.next = 45;
857
925
  return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
858
926
  case 45:
859
- return _context5.abrupt("return", fallbackProducts);
927
+ return _context6.abrupt("return", fallbackProducts);
860
928
  case 46:
861
929
  case "end":
862
- return _context5.stop();
930
+ return _context6.stop();
863
931
  }
864
- }, _callee5, this, [[24, 36, 39, 42]]);
932
+ }, _callee6, this, [[24, 36, 39, 42]]);
865
933
  }));
866
934
  function loadProductsByScheduleDate(_x3) {
867
935
  return _loadProductsByScheduleDate.apply(this, arguments);
@@ -915,7 +983,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
915
983
  }, {
916
984
  key: "applyPlannerDiscounts",
917
985
  value: (function () {
918
- var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
986
+ var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
919
987
  var _params$customerId;
920
988
  var params,
921
989
  tempOrder,
@@ -932,24 +1000,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
932
1000
  discount,
933
1001
  discountId,
934
1002
  nextTempOrder,
935
- _args6 = arguments;
936
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
937
- while (1) switch (_context6.prev = _context6.next) {
1003
+ _args7 = arguments;
1004
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1005
+ while (1) switch (_context7.prev = _context7.next) {
938
1006
  case 0:
939
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
1007
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
940
1008
  tempOrder = this.getTempOrder();
941
1009
  requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
942
1010
  parsedCustomerId = Number(requestedCustomerId);
943
1011
  customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
944
- _context6.next = 7;
1012
+ _context7.next = 7;
945
1013
  return this.getSummary();
946
1014
  case 7:
947
- summaryBefore = _context6.sent;
1015
+ summaryBefore = _context7.sent;
948
1016
  if (customerId) {
949
- _context6.next = 10;
1017
+ _context7.next = 10;
950
1018
  break;
951
1019
  }
952
- return _context6.abrupt("return", buildPlannerDiscountResult({
1020
+ return _context7.abrupt("return", buildPlannerDiscountResult({
953
1021
  customerId: null,
954
1022
  discountList: this.getDiscountList(),
955
1023
  products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
@@ -958,7 +1026,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
958
1026
  status: 'no_customer'
959
1027
  }));
960
1028
  case 10:
961
- _context6.next = 12;
1029
+ _context7.next = 12;
962
1030
  return this.loadDiscountConfig({
963
1031
  customerId: customerId,
964
1032
  action: 'create'
@@ -970,7 +1038,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
970
1038
  return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
971
1039
  });
972
1040
  if (!preferredDiscount) {
973
- _context6.next = 40;
1041
+ _context7.next = 40;
974
1042
  break;
975
1043
  }
976
1044
  // A requested card is an explicit UI choice, not a best-effort preference. Clear prior
@@ -982,98 +1050,98 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
982
1050
  return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
983
1051
  });
984
1052
  _iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
985
- _context6.prev = 18;
1053
+ _context7.prev = 18;
986
1054
  _iterator2.s();
987
1055
  case 20:
988
1056
  if ((_step2 = _iterator2.n()).done) {
989
- _context6.next = 28;
1057
+ _context7.next = 28;
990
1058
  break;
991
1059
  }
992
1060
  discount = _step2.value;
993
1061
  discountId = Number(resolvePlannerDiscountId(discount));
994
1062
  if (!Number.isFinite(discountId)) {
995
- _context6.next = 26;
1063
+ _context7.next = 26;
996
1064
  break;
997
1065
  }
998
- _context6.next = 26;
1066
+ _context7.next = 26;
999
1067
  return this.setDiscountSelected({
1000
1068
  discountId: discountId,
1001
1069
  isSelected: false
1002
1070
  });
1003
1071
  case 26:
1004
- _context6.next = 20;
1072
+ _context7.next = 20;
1005
1073
  break;
1006
1074
  case 28:
1007
- _context6.next = 33;
1075
+ _context7.next = 33;
1008
1076
  break;
1009
1077
  case 30:
1010
- _context6.prev = 30;
1011
- _context6.t0 = _context6["catch"](18);
1012
- _iterator2.e(_context6.t0);
1078
+ _context7.prev = 30;
1079
+ _context7.t0 = _context7["catch"](18);
1080
+ _iterator2.e(_context7.t0);
1013
1081
  case 33:
1014
- _context6.prev = 33;
1082
+ _context7.prev = 33;
1015
1083
  _iterator2.f();
1016
- return _context6.finish(33);
1084
+ return _context7.finish(33);
1017
1085
  case 36:
1018
- _context6.next = 38;
1086
+ _context7.next = 38;
1019
1087
  return this.setDiscountSelected({
1020
1088
  discountId: Number(preferredId),
1021
1089
  isSelected: true
1022
1090
  });
1023
1091
  case 38:
1024
- _context6.next = 49;
1092
+ _context7.next = 49;
1025
1093
  break;
1026
1094
  case 40:
1027
1095
  if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
1028
- _context6.next = 46;
1096
+ _context7.next = 46;
1029
1097
  break;
1030
1098
  }
1031
1099
  if (!(params.applyBestDiscount !== false)) {
1032
- _context6.next = 44;
1100
+ _context7.next = 44;
1033
1101
  break;
1034
1102
  }
1035
- _context6.next = 44;
1103
+ _context7.next = 44;
1036
1104
  return this.bestDiscount();
1037
1105
  case 44:
1038
- _context6.next = 49;
1106
+ _context7.next = 49;
1039
1107
  break;
1040
1108
  case 46:
1041
1109
  if (!(params.applyBestDiscount !== false)) {
1042
- _context6.next = 49;
1110
+ _context7.next = 49;
1043
1111
  break;
1044
1112
  }
1045
- _context6.next = 49;
1113
+ _context7.next = 49;
1046
1114
  return this.bestDiscount();
1047
1115
  case 49:
1048
1116
  nextTempOrder = this.getTempOrder();
1049
- _context6.t1 = buildPlannerDiscountResult;
1050
- _context6.t2 = customerId;
1051
- _context6.t3 = this.getDiscountList();
1052
- _context6.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
1053
- _context6.t5 = summaryBefore;
1054
- _context6.next = 57;
1117
+ _context7.t1 = buildPlannerDiscountResult;
1118
+ _context7.t2 = customerId;
1119
+ _context7.t3 = this.getDiscountList();
1120
+ _context7.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
1121
+ _context7.t5 = summaryBefore;
1122
+ _context7.next = 57;
1055
1123
  return this.getSummary();
1056
1124
  case 57:
1057
- _context6.t6 = _context6.sent;
1058
- _context6.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
1059
- _context6.t8 = preferredDiscountId;
1060
- _context6.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
1061
- _context6.t10 = {
1062
- customerId: _context6.t2,
1063
- discountList: _context6.t3,
1064
- products: _context6.t4,
1065
- summaryBefore: _context6.t5,
1066
- summaryAfter: _context6.t6,
1067
- status: _context6.t7,
1068
- preferredDiscountId: _context6.t8,
1069
- preferredDiscountFound: _context6.t9
1125
+ _context7.t6 = _context7.sent;
1126
+ _context7.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
1127
+ _context7.t8 = preferredDiscountId;
1128
+ _context7.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
1129
+ _context7.t10 = {
1130
+ customerId: _context7.t2,
1131
+ discountList: _context7.t3,
1132
+ products: _context7.t4,
1133
+ summaryBefore: _context7.t5,
1134
+ summaryAfter: _context7.t6,
1135
+ status: _context7.t7,
1136
+ preferredDiscountId: _context7.t8,
1137
+ preferredDiscountFound: _context7.t9
1070
1138
  };
1071
- return _context6.abrupt("return", (0, _context6.t1)(_context6.t10));
1139
+ return _context7.abrupt("return", (0, _context7.t1)(_context7.t10));
1072
1140
  case 63:
1073
1141
  case "end":
1074
- return _context6.stop();
1142
+ return _context7.stop();
1075
1143
  }
1076
- }, _callee6, this, [[18, 30, 33, 36]]);
1144
+ }, _callee7, this, [[18, 30, 33, 36]]);
1077
1145
  }));
1078
1146
  function applyPlannerDiscounts() {
1079
1147
  return _applyPlannerDiscounts.apply(this, arguments);
@@ -1115,27 +1183,27 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1115
1183
  }, {
1116
1184
  key: "removeExistingStagedLines",
1117
1185
  value: (function () {
1118
- var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ownershipKey) {
1186
+ var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ownershipKey) {
1119
1187
  var _this$getTempOrder;
1120
1188
  var existingLines;
1121
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1122
- while (1) switch (_context7.prev = _context7.next) {
1189
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1190
+ while (1) switch (_context8.prev = _context8.next) {
1123
1191
  case 0:
1124
1192
  existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
1125
1193
  var _product$metadata3;
1126
1194
  return (product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[ownershipKey]) === true;
1127
1195
  });
1128
1196
  if (!(existingLines.length > 0)) {
1129
- _context7.next = 4;
1197
+ _context8.next = 4;
1130
1198
  break;
1131
1199
  }
1132
- _context7.next = 4;
1200
+ _context8.next = 4;
1133
1201
  return this.removeProductsFromOrder(existingLines.map(buildPlannerLineIdentity));
1134
1202
  case 4:
1135
1203
  case "end":
1136
- return _context7.stop();
1204
+ return _context8.stop();
1137
1205
  }
1138
- }, _callee7, this);
1206
+ }, _callee8, this);
1139
1207
  }));
1140
1208
  function removeExistingStagedLines(_x4) {
1141
1209
  return _removeExistingStagedLines.apply(this, arguments);
@@ -1145,25 +1213,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1145
1213
  }, {
1146
1214
  key: "stageProducts",
1147
1215
  value: function () {
1148
- var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, ownershipKey) {
1216
+ var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, ownershipKey) {
1149
1217
  var _params$rawProducts;
1150
1218
  var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
1151
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1152
- while (1) switch (_context8.prev = _context8.next) {
1219
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1220
+ while (1) switch (_context9.prev = _context9.next) {
1153
1221
  case 0:
1154
1222
  productIds = params.productIds || [];
1155
1223
  if (productIds.length) {
1156
- _context8.next = 3;
1224
+ _context9.next = 3;
1157
1225
  break;
1158
1226
  }
1159
- return _context8.abrupt("return", this.getTempOrder());
1227
+ return _context9.abrupt("return", this.getTempOrder());
1160
1228
  case 3:
1161
1229
  if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
1162
- _context8.next = 7;
1230
+ _context9.next = 7;
1163
1231
  break;
1164
1232
  }
1165
1233
  this.unifiedProductCatalog = params.rawProducts;
1166
- _context8.next = 12;
1234
+ _context9.next = 12;
1167
1235
  break;
1168
1236
  case 7:
1169
1237
  existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
@@ -1174,15 +1242,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1174
1242
  return !existingIds.has(String(id));
1175
1243
  });
1176
1244
  if (!(missingIds.length || params.productLoadParams)) {
1177
- _context8.next = 12;
1245
+ _context9.next = 12;
1178
1246
  break;
1179
1247
  }
1180
- _context8.next = 12;
1248
+ _context9.next = 12;
1181
1249
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
1182
1250
  product_ids: productIds.map(Number).filter(Number.isFinite)
1183
1251
  }));
1184
1252
  case 12:
1185
- _context8.next = 14;
1253
+ _context9.next = 14;
1186
1254
  return this.removeExistingStagedLines(ownershipKey);
1187
1255
  case 14:
1188
1256
  productIdSet = new Set(productIds.map(function (id) {
@@ -1195,28 +1263,28 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1195
1263
  _i = 0, _arr = selectedProducts;
1196
1264
  case 17:
1197
1265
  if (!(_i < _arr.length)) {
1198
- _context8.next = 26;
1266
+ _context9.next = 26;
1199
1267
  break;
1200
1268
  }
1201
1269
  sourceProduct = _arr[_i];
1202
1270
  productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
1203
1271
  if (!productInput) {
1204
- _context8.next = 23;
1272
+ _context9.next = 23;
1205
1273
  break;
1206
1274
  }
1207
- _context8.next = 23;
1275
+ _context9.next = 23;
1208
1276
  return this.addProductToOrder(productInput);
1209
1277
  case 23:
1210
1278
  _i++;
1211
- _context8.next = 17;
1279
+ _context9.next = 17;
1212
1280
  break;
1213
1281
  case 26:
1214
- return _context8.abrupt("return", this.getTempOrder());
1282
+ return _context9.abrupt("return", this.getTempOrder());
1215
1283
  case 27:
1216
1284
  case "end":
1217
- return _context8.stop();
1285
+ return _context9.stop();
1218
1286
  }
1219
- }, _callee8, this);
1287
+ }, _callee9, this);
1220
1288
  }));
1221
1289
  function stageProducts(_x5, _x6) {
1222
1290
  return _stageProducts.apply(this, arguments);
@@ -1230,16 +1298,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1230
1298
  }, {
1231
1299
  key: "stagePlannerProducts",
1232
1300
  value: (function () {
1233
- var _stagePlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
1234
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1235
- while (1) switch (_context9.prev = _context9.next) {
1301
+ var _stagePlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1302
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1303
+ while (1) switch (_context10.prev = _context10.next) {
1236
1304
  case 0:
1237
- return _context9.abrupt("return", this.stageProducts(params, 'unified_booking_sales'));
1305
+ return _context10.abrupt("return", this.stageProducts(params, 'unified_booking_sales'));
1238
1306
  case 1:
1239
1307
  case "end":
1240
- return _context9.stop();
1308
+ return _context10.stop();
1241
1309
  }
1242
- }, _callee9, this);
1310
+ }, _callee10, this);
1243
1311
  }));
1244
1312
  function stagePlannerProducts(_x7) {
1245
1313
  return _stagePlannerProducts.apply(this, arguments);
@@ -1254,16 +1322,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1254
1322
  }, {
1255
1323
  key: "stageRetailProducts",
1256
1324
  value: (function () {
1257
- var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
1258
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1259
- while (1) switch (_context10.prev = _context10.next) {
1325
+ var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
1326
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1327
+ while (1) switch (_context11.prev = _context11.next) {
1260
1328
  case 0:
1261
- return _context10.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
1329
+ return _context11.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
1262
1330
  case 1:
1263
1331
  case "end":
1264
- return _context10.stop();
1332
+ return _context11.stop();
1265
1333
  }
1266
- }, _callee10, this);
1334
+ }, _callee11, this);
1267
1335
  }));
1268
1336
  function stageRetailProducts(_x8) {
1269
1337
  return _stageRetailProducts.apply(this, arguments);
@@ -1279,15 +1347,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1279
1347
  }, {
1280
1348
  key: "addRetailProduct",
1281
1349
  value: (function () {
1282
- var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
1350
+ var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
1283
1351
  var _params$quantity, _ref18, _params$productId, _params$product, _params$product2;
1284
1352
  var quantity, productId, sourceProduct, products, orderProduct;
1285
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1286
- while (1) switch (_context11.prev = _context11.next) {
1353
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1354
+ while (1) switch (_context12.prev = _context12.next) {
1287
1355
  case 0:
1288
1356
  quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
1289
1357
  if (!(!Number.isFinite(quantity) || quantity <= 0)) {
1290
- _context11.next = 3;
1358
+ _context12.next = 3;
1291
1359
  break;
1292
1360
  }
1293
1361
  throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
@@ -1301,22 +1369,22 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1301
1369
  });
1302
1370
  }
1303
1371
  if (!(!sourceProduct && productId !== undefined && productId !== null)) {
1304
- _context11.next = 11;
1372
+ _context12.next = 11;
1305
1373
  break;
1306
1374
  }
1307
- _context11.next = 9;
1375
+ _context12.next = 9;
1308
1376
  return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
1309
1377
  product_ids: [Number(productId)].filter(Number.isFinite)
1310
1378
  }));
1311
1379
  case 9:
1312
- products = _context11.sent;
1380
+ products = _context12.sent;
1313
1381
  sourceProduct = products.find(function (product) {
1314
1382
  var _product$id4;
1315
1383
  return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
1316
1384
  });
1317
1385
  case 11:
1318
1386
  if (sourceProduct) {
1319
- _context11.next = 13;
1387
+ _context12.next = 13;
1320
1388
  break;
1321
1389
  }
1322
1390
  throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
@@ -1325,17 +1393,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1325
1393
  quantity: quantity
1326
1394
  }), 'unified_booking_sales_retail');
1327
1395
  if (orderProduct) {
1328
- _context11.next = 16;
1396
+ _context12.next = 16;
1329
1397
  break;
1330
1398
  }
1331
1399
  throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
1332
1400
  case 16:
1333
- return _context11.abrupt("return", this.addProductToOrder(orderProduct));
1401
+ return _context12.abrupt("return", this.addProductToOrder(orderProduct));
1334
1402
  case 17:
1335
1403
  case "end":
1336
- return _context11.stop();
1404
+ return _context12.stop();
1337
1405
  }
1338
- }, _callee11, this);
1406
+ }, _callee12, this);
1339
1407
  }));
1340
1408
  function addRetailProduct(_x9) {
1341
1409
  return _addRetailProduct.apply(this, arguments);
@@ -1345,42 +1413,42 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1345
1413
  }, {
1346
1414
  key: "loadPlannerProducts",
1347
1415
  value: (function () {
1348
- var _loadPlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
1416
+ var _loadPlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
1349
1417
  var _params$context, _params$rawProducts2, _params$productLoadPa, _this$getProductCatal;
1350
1418
  var productIds, _params$productLoadPa2;
1351
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1352
- while (1) switch (_context12.prev = _context12.next) {
1419
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1420
+ while (1) switch (_context13.prev = _context13.next) {
1353
1421
  case 0:
1354
1422
  if (!((_params$context = params.context) !== null && _params$context !== void 0 && (_params$context = _params$context.products) !== null && _params$context !== void 0 && _params$context.length)) {
1355
- _context12.next = 2;
1423
+ _context13.next = 2;
1356
1424
  break;
1357
1425
  }
1358
- return _context12.abrupt("return", params.context.products);
1426
+ return _context13.abrupt("return", params.context.products);
1359
1427
  case 2:
1360
1428
  if (!((_params$rawProducts2 = params.rawProducts) !== null && _params$rawProducts2 !== void 0 && _params$rawProducts2.length)) {
1361
- _context12.next = 4;
1429
+ _context13.next = 4;
1362
1430
  break;
1363
1431
  }
1364
- return _context12.abrupt("return", params.rawProducts.map(normalizeProductForPlanner));
1432
+ return _context13.abrupt("return", params.rawProducts.map(normalizeProductForPlanner));
1365
1433
  case 4:
1366
1434
  productIds = params.productIds || ((_params$productLoadPa = params.productLoadParams) === null || _params$productLoadPa === void 0 ? void 0 : _params$productLoadPa.product_ids) || [];
1367
1435
  if (!(productIds.length > 0 || params.productLoadParams)) {
1368
- _context12.next = 8;
1436
+ _context13.next = 8;
1369
1437
  break;
1370
1438
  }
1371
- _context12.next = 8;
1439
+ _context13.next = 8;
1372
1440
  return this.loadProducts(_objectSpread(_objectSpread(_objectSpread({}, params.date ? {
1373
1441
  schedule_date: params.date
1374
1442
  } : {}), params.productLoadParams || {}), {}, {
1375
1443
  product_ids: productIds.length ? productIds.map(Number).filter(Number.isFinite) : (_params$productLoadPa2 = params.productLoadParams) === null || _params$productLoadPa2 === void 0 ? void 0 : _params$productLoadPa2.product_ids
1376
1444
  }));
1377
1445
  case 8:
1378
- return _context12.abrupt("return", (((_this$getProductCatal = this.getProductCatalog) === null || _this$getProductCatal === void 0 ? void 0 : _this$getProductCatal.call(this).products) || []).map(normalizeProductForPlanner));
1446
+ return _context13.abrupt("return", (((_this$getProductCatal = this.getProductCatalog) === null || _this$getProductCatal === void 0 ? void 0 : _this$getProductCatal.call(this).products) || []).map(normalizeProductForPlanner));
1379
1447
  case 9:
1380
1448
  case "end":
1381
- return _context12.stop();
1449
+ return _context13.stop();
1382
1450
  }
1383
- }, _callee12, this);
1451
+ }, _callee13, this);
1384
1452
  }));
1385
1453
  function loadPlannerProducts(_x10) {
1386
1454
  return _loadPlannerProducts.apply(this, arguments);
@@ -1390,32 +1458,32 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1390
1458
  }, {
1391
1459
  key: "ensurePlannerSchedulesLoaded",
1392
1460
  value: (function () {
1393
- var _ensurePlannerSchedulesLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1461
+ var _ensurePlannerSchedulesLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
1394
1462
  var _this$store$schedule$5, _this$store$schedule5, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7;
1395
1463
  var scheduleList;
1396
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1397
- while (1) switch (_context13.prev = _context13.next) {
1464
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1465
+ while (1) switch (_context14.prev = _context14.next) {
1398
1466
  case 0:
1399
1467
  if (this.store.schedule) {
1400
- _context13.next = 2;
1468
+ _context14.next = 2;
1401
1469
  break;
1402
1470
  }
1403
1471
  throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
1404
1472
  case 2:
1405
1473
  scheduleList = ((_this$store$schedule$5 = (_this$store$schedule5 = this.store.schedule).getScheduleList) === null || _this$store$schedule$5 === void 0 ? void 0 : _this$store$schedule$5.call(_this$store$schedule5)) || [];
1406
1474
  if (!(!((_this$store$schedule$6 = (_this$store$schedule6 = this.store.schedule).isScheduleListLoaded) !== null && _this$store$schedule$6 !== void 0 && _this$store$schedule$6.call(_this$store$schedule6)) || scheduleList.length === 0)) {
1407
- _context13.next = 6;
1475
+ _context14.next = 6;
1408
1476
  break;
1409
1477
  }
1410
- _context13.next = 6;
1478
+ _context14.next = 6;
1411
1479
  return this.store.schedule.loadAllSchedule();
1412
1480
  case 6:
1413
- return _context13.abrupt("return", ((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getScheduleList) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || []);
1481
+ return _context14.abrupt("return", ((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getScheduleList) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || []);
1414
1482
  case 7:
1415
1483
  case "end":
1416
- return _context13.stop();
1484
+ return _context14.stop();
1417
1485
  }
1418
- }, _callee13, this);
1486
+ }, _callee14, this);
1419
1487
  }));
1420
1488
  function ensurePlannerSchedulesLoaded() {
1421
1489
  return _ensurePlannerSchedulesLoaded.apply(this, arguments);
@@ -1430,33 +1498,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1430
1498
  }, {
1431
1499
  key: "ensurePlannerSchedulesForResources",
1432
1500
  value: (function () {
1433
- var _ensurePlannerSchedulesForResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(rawResources) {
1501
+ var _ensurePlannerSchedulesForResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(rawResources) {
1434
1502
  var scheduleList, scheduleIds, _this$store$schedule$8, _this$store$schedule8;
1435
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1436
- while (1) switch (_context14.prev = _context14.next) {
1503
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1504
+ while (1) switch (_context15.prev = _context15.next) {
1437
1505
  case 0:
1438
- _context14.next = 2;
1506
+ _context15.next = 2;
1439
1507
  return this.ensurePlannerSchedulesLoaded();
1440
1508
  case 2:
1441
- scheduleList = _context14.sent;
1509
+ scheduleList = _context15.sent;
1442
1510
  scheduleIds = collectRawScheduleIds(rawResources);
1443
1511
  if (scheduleListHasIds(scheduleList, scheduleIds)) {
1444
- _context14.next = 8;
1512
+ _context15.next = 8;
1445
1513
  break;
1446
1514
  }
1447
- _context14.next = 7;
1515
+ _context15.next = 7;
1448
1516
  return this.store.schedule.loadAllSchedule({
1449
1517
  useCache: false
1450
1518
  });
1451
1519
  case 7:
1452
1520
  scheduleList = ((_this$store$schedule$8 = (_this$store$schedule8 = this.store.schedule).getScheduleList) === null || _this$store$schedule$8 === void 0 ? void 0 : _this$store$schedule$8.call(_this$store$schedule8)) || [];
1453
1521
  case 8:
1454
- return _context14.abrupt("return", scheduleList);
1522
+ return _context15.abrupt("return", scheduleList);
1455
1523
  case 9:
1456
1524
  case "end":
1457
- return _context14.stop();
1525
+ return _context15.stop();
1458
1526
  }
1459
- }, _callee14, this);
1527
+ }, _callee15, this);
1460
1528
  }));
1461
1529
  function ensurePlannerSchedulesForResources(_x11) {
1462
1530
  return _ensurePlannerSchedulesForResources.apply(this, arguments);
@@ -1472,12 +1540,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1472
1540
  }, {
1473
1541
  key: "fetchPlannerResourcesV2",
1474
1542
  value: (function () {
1475
- var _fetchPlannerResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
1543
+ var _fetchPlannerResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1476
1544
  var response, data;
1477
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1478
- while (1) switch (_context15.prev = _context15.next) {
1545
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1546
+ while (1) switch (_context16.prev = _context16.next) {
1479
1547
  case 0:
1480
- _context15.next = 2;
1548
+ _context16.next = 2;
1481
1549
  return this.request.get('/schedule/resource/list/v2', {
1482
1550
  start_date: params.dateRange.start,
1483
1551
  end_date: params.dateRange.end,
@@ -1487,26 +1555,26 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1487
1555
  useCache: false
1488
1556
  });
1489
1557
  case 2:
1490
- response = _context15.sent;
1558
+ response = _context16.sent;
1491
1559
  data = response === null || response === void 0 ? void 0 : response.data;
1492
1560
  if (!Array.isArray(data)) {
1493
- _context15.next = 6;
1561
+ _context16.next = 6;
1494
1562
  break;
1495
1563
  }
1496
- return _context15.abrupt("return", data);
1564
+ return _context16.abrupt("return", data);
1497
1565
  case 6:
1498
1566
  if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
1499
- _context15.next = 8;
1567
+ _context16.next = 8;
1500
1568
  break;
1501
1569
  }
1502
- return _context15.abrupt("return", data.list);
1570
+ return _context16.abrupt("return", data.list);
1503
1571
  case 8:
1504
- return _context15.abrupt("return", []);
1572
+ return _context16.abrupt("return", []);
1505
1573
  case 9:
1506
1574
  case "end":
1507
- return _context15.stop();
1575
+ return _context16.stop();
1508
1576
  }
1509
- }, _callee15, this);
1577
+ }, _callee16, this);
1510
1578
  }));
1511
1579
  function fetchPlannerResourcesV2(_x12) {
1512
1580
  return _fetchPlannerResourcesV.apply(this, arguments);
@@ -1521,7 +1589,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1521
1589
  }, {
1522
1590
  key: "loadPlannerResources",
1523
1591
  value: (function () {
1524
- var _loadPlannerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
1592
+ var _loadPlannerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(params) {
1525
1593
  var _params$context2, _params$rawResources, _params$context5;
1526
1594
  var products,
1527
1595
  _params$context3,
@@ -1530,25 +1598,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1530
1598
  rawResources,
1531
1599
  scheduleList,
1532
1600
  materialized,
1533
- _args16 = arguments;
1534
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1535
- while (1) switch (_context16.prev = _context16.next) {
1601
+ _args17 = arguments;
1602
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1603
+ while (1) switch (_context17.prev = _context17.next) {
1536
1604
  case 0:
1537
- products = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
1605
+ products = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : [];
1538
1606
  if (!((_params$context2 = params.context) !== null && _params$context2 !== void 0 && (_params$context2 = _params$context2.resources) !== null && _params$context2 !== void 0 && _params$context2.length)) {
1539
- _context16.next = 3;
1607
+ _context17.next = 3;
1540
1608
  break;
1541
1609
  }
1542
- return _context16.abrupt("return", {
1610
+ return _context17.abrupt("return", {
1543
1611
  resources: params.context.resources,
1544
1612
  externalEvents: params.context.externalEvents || []
1545
1613
  });
1546
1614
  case 3:
1547
1615
  if (!((_params$rawResources = params.rawResources) !== null && _params$rawResources !== void 0 && _params$rawResources.length)) {
1548
- _context16.next = 5;
1616
+ _context17.next = 5;
1549
1617
  break;
1550
1618
  }
1551
- return _context16.abrupt("return", {
1619
+ return _context17.abrupt("return", {
1552
1620
  resources: params.rawResources.map(normalizeResource).filter(function (resource) {
1553
1621
  return resource !== null;
1554
1622
  }),
@@ -1557,39 +1625,39 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1557
1625
  case 5:
1558
1626
  resourceIds = collectPlannerResourceIds(products, params.resourceIds || []);
1559
1627
  if (!(!params.useResourceDateApi || !params.dateRange || resourceIds.length === 0)) {
1560
- _context16.next = 8;
1628
+ _context17.next = 8;
1561
1629
  break;
1562
1630
  }
1563
- return _context16.abrupt("return", {
1631
+ return _context17.abrupt("return", {
1564
1632
  resources: [],
1565
1633
  externalEvents: ((_params$context4 = params.context) === null || _params$context4 === void 0 ? void 0 : _params$context4.externalEvents) || []
1566
1634
  });
1567
1635
  case 8:
1568
- _context16.next = 10;
1636
+ _context17.next = 10;
1569
1637
  return this.fetchPlannerResourcesV2({
1570
1638
  dateRange: params.dateRange,
1571
1639
  resourceIds: resourceIds
1572
1640
  });
1573
1641
  case 10:
1574
- rawResources = _context16.sent;
1575
- _context16.next = 13;
1642
+ rawResources = _context17.sent;
1643
+ _context17.next = 13;
1576
1644
  return this.ensurePlannerSchedulesForResources(rawResources);
1577
1645
  case 13:
1578
- scheduleList = _context16.sent;
1646
+ scheduleList = _context17.sent;
1579
1647
  materialized = buildPlannerResourcesFromV2({
1580
1648
  rawResources: rawResources,
1581
1649
  scheduleList: scheduleList,
1582
1650
  dateRange: params.dateRange
1583
1651
  });
1584
- return _context16.abrupt("return", {
1652
+ return _context17.abrupt("return", {
1585
1653
  resources: materialized.resources,
1586
1654
  externalEvents: [].concat(_toConsumableArray(((_params$context5 = params.context) === null || _params$context5 === void 0 ? void 0 : _params$context5.externalEvents) || []), _toConsumableArray(materialized.externalEvents))
1587
1655
  });
1588
1656
  case 16:
1589
1657
  case "end":
1590
- return _context16.stop();
1658
+ return _context17.stop();
1591
1659
  }
1592
- }, _callee16, this);
1660
+ }, _callee17, this);
1593
1661
  }));
1594
1662
  function loadPlannerResources(_x13) {
1595
1663
  return _loadPlannerResources.apply(this, arguments);
@@ -1604,25 +1672,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1604
1672
  }, {
1605
1673
  key: "loadPlannerContext",
1606
1674
  value: (function () {
1607
- var _loadPlannerContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1675
+ var _loadPlannerContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1608
1676
  var params,
1609
1677
  products,
1610
1678
  plannerResources,
1611
1679
  context,
1612
1680
  snapshot,
1613
- _args17 = arguments;
1614
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1615
- while (1) switch (_context17.prev = _context17.next) {
1681
+ _args18 = arguments;
1682
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1683
+ while (1) switch (_context18.prev = _context18.next) {
1616
1684
  case 0:
1617
- params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
1618
- _context17.next = 3;
1685
+ params = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1686
+ _context18.next = 3;
1619
1687
  return this.loadPlannerProducts(params);
1620
1688
  case 3:
1621
- products = _context17.sent;
1622
- _context17.next = 6;
1689
+ products = _context18.sent;
1690
+ _context18.next = 6;
1623
1691
  return this.loadPlannerResources(params, products);
1624
1692
  case 6:
1625
- plannerResources = _context17.sent;
1693
+ plannerResources = _context18.sent;
1626
1694
  context = _objectSpread(_objectSpread({}, params.context || {}), {}, {
1627
1695
  products: products,
1628
1696
  resources: plannerResources.resources,
@@ -1637,15 +1705,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1637
1705
  endTime: params.endTime,
1638
1706
  resourceIds: params.resourceIds || []
1639
1707
  });
1640
- _context17.next = 12;
1708
+ _context18.next = 12;
1641
1709
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onPlannerContextLoaded), snapshot);
1642
1710
  case 12:
1643
- return _context17.abrupt("return", this.getPlanner().getSnapshot());
1711
+ return _context18.abrupt("return", this.getPlanner().getSnapshot());
1644
1712
  case 13:
1645
1713
  case "end":
1646
- return _context17.stop();
1714
+ return _context18.stop();
1647
1715
  }
1648
- }, _callee17, this);
1716
+ }, _callee18, this);
1649
1717
  }));
1650
1718
  function loadPlannerContext() {
1651
1719
  return _loadPlannerContext.apply(this, arguments);
@@ -1655,19 +1723,19 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1655
1723
  }, {
1656
1724
  key: "queryPlannerAvailability",
1657
1725
  value: (function () {
1658
- var _queryPlannerAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1726
+ var _queryPlannerAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1659
1727
  var query,
1660
- _args18 = arguments;
1661
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1662
- while (1) switch (_context18.prev = _context18.next) {
1728
+ _args19 = arguments;
1729
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1730
+ while (1) switch (_context19.prev = _context19.next) {
1663
1731
  case 0:
1664
- query = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
1665
- return _context18.abrupt("return", this.getPlanner().queryAvailability(query));
1732
+ query = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1733
+ return _context19.abrupt("return", this.getPlanner().queryAvailability(query));
1666
1734
  case 2:
1667
1735
  case "end":
1668
- return _context18.stop();
1736
+ return _context19.stop();
1669
1737
  }
1670
- }, _callee18, this);
1738
+ }, _callee19, this);
1671
1739
  }));
1672
1740
  function queryPlannerAvailability() {
1673
1741
  return _queryPlannerAvailability.apply(this, arguments);
@@ -1695,24 +1763,24 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1695
1763
  }, {
1696
1764
  key: "autoAssignPlanner",
1697
1765
  value: (function () {
1698
- var _autoAssignPlanner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1766
+ var _autoAssignPlanner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1699
1767
  var query,
1700
1768
  result,
1701
- _args19 = arguments;
1702
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1703
- while (1) switch (_context19.prev = _context19.next) {
1769
+ _args20 = arguments;
1770
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1771
+ while (1) switch (_context20.prev = _context20.next) {
1704
1772
  case 0:
1705
- query = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1773
+ query = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1706
1774
  result = this.getPlanner().autoAssign(query);
1707
1775
  if (result.conflicts.length) {
1708
1776
  console.warn('[UnifiedBookingSales] autoAssignPlanner 存在未分配项', result.conflicts);
1709
1777
  }
1710
- return _context19.abrupt("return", this.getPlanner().getSnapshot());
1778
+ return _context20.abrupt("return", this.getPlanner().getSnapshot());
1711
1779
  case 4:
1712
1780
  case "end":
1713
- return _context19.stop();
1781
+ return _context20.stop();
1714
1782
  }
1715
- }, _callee19, this);
1783
+ }, _callee20, this);
1716
1784
  }));
1717
1785
  function autoAssignPlanner() {
1718
1786
  return _autoAssignPlanner.apply(this, arguments);
@@ -1739,7 +1807,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1739
1807
  }, {
1740
1808
  key: "commitPlannerSelection",
1741
1809
  value: (function () {
1742
- var _commitPlannerSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1810
+ var _commitPlannerSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1743
1811
  var params,
1744
1812
  snapshot,
1745
1813
  assignments,
@@ -1754,11 +1822,11 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1754
1822
  productInput,
1755
1823
  submitResult,
1756
1824
  result,
1757
- _args20 = arguments;
1758
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1759
- while (1) switch (_context20.prev = _context20.next) {
1825
+ _args21 = arguments;
1826
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1827
+ while (1) switch (_context21.prev = _context21.next) {
1760
1828
  case 0:
1761
- params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1829
+ params = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
1762
1830
  if (params.selection) {
1763
1831
  this.setPlannerSelection(params.selection);
1764
1832
  }
@@ -1770,10 +1838,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1770
1838
  snapshot = this.getPlannerSnapshot();
1771
1839
  assignments = snapshot.selection.assignments || [];
1772
1840
  if (!(assignments.length === 0)) {
1773
- _context20.next = 7;
1841
+ _context21.next = 7;
1774
1842
  break;
1775
1843
  }
1776
- return _context20.abrupt("return", {
1844
+ return _context21.abrupt("return", {
1777
1845
  tempOrder: this.getTempOrder(),
1778
1846
  assignments: assignments,
1779
1847
  validation: {
@@ -1787,10 +1855,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1787
1855
  case 7:
1788
1856
  validation = this.validatePlannerSelection();
1789
1857
  if (validation.ok) {
1790
- _context20.next = 10;
1858
+ _context21.next = 10;
1791
1859
  break;
1792
1860
  }
1793
- return _context20.abrupt("return", {
1861
+ return _context21.abrupt("return", {
1794
1862
  tempOrder: this.getTempOrder(),
1795
1863
  assignments: assignments,
1796
1864
  validation: validation
@@ -1799,7 +1867,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1799
1867
  productsById = new Map(snapshot.context.products.map(function (product) {
1800
1868
  return [String(product.id), product];
1801
1869
  }));
1802
- _context20.next = 13;
1870
+ _context21.next = 13;
1803
1871
  return this.removeExistingStagedLines('unified_booking_sales');
1804
1872
  case 13:
1805
1873
  assignmentGroups = new Map();
@@ -1808,20 +1876,20 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1808
1876
  assignmentGroups.set(key, [].concat(_toConsumableArray(assignmentGroups.get(key) || []), [assignment]));
1809
1877
  });
1810
1878
  _iterator3 = _createForOfIteratorHelper(assignmentGroups.values());
1811
- _context20.prev = 16;
1879
+ _context21.prev = 16;
1812
1880
  _iterator3.s();
1813
1881
  case 18:
1814
1882
  if ((_step3 = _iterator3.n()).done) {
1815
- _context20.next = 31;
1883
+ _context21.next = 31;
1816
1884
  break;
1817
1885
  }
1818
1886
  groupAssignments = _step3.value;
1819
1887
  product = productsById.get(String(groupAssignments[0].productId));
1820
1888
  if (product) {
1821
- _context20.next = 23;
1889
+ _context21.next = 23;
1822
1890
  break;
1823
1891
  }
1824
- return _context20.abrupt("continue", 29);
1892
+ return _context21.abrupt("continue", 29);
1825
1893
  case 23:
1826
1894
  sourceProduct = product.raw || {
1827
1895
  id: product.id,
@@ -1830,39 +1898,39 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1830
1898
  };
1831
1899
  productInput = this.buildUnifiedOrderProduct(sourceProduct, 'unified_booking_sales', product);
1832
1900
  if (productInput) {
1833
- _context20.next = 27;
1901
+ _context21.next = 27;
1834
1902
  break;
1835
1903
  }
1836
- return _context20.abrupt("continue", 29);
1904
+ return _context21.abrupt("continue", 29);
1837
1905
  case 27:
1838
- _context20.next = 29;
1906
+ _context21.next = 29;
1839
1907
  return this.addProductToOrder(productInput, buildBookingFromAssignments({
1840
1908
  assignments: groupAssignments,
1841
1909
  product: product
1842
1910
  }));
1843
1911
  case 29:
1844
- _context20.next = 18;
1912
+ _context21.next = 18;
1845
1913
  break;
1846
1914
  case 31:
1847
- _context20.next = 36;
1915
+ _context21.next = 36;
1848
1916
  break;
1849
1917
  case 33:
1850
- _context20.prev = 33;
1851
- _context20.t0 = _context20["catch"](16);
1852
- _iterator3.e(_context20.t0);
1918
+ _context21.prev = 33;
1919
+ _context21.t0 = _context21["catch"](16);
1920
+ _iterator3.e(_context21.t0);
1853
1921
  case 36:
1854
- _context20.prev = 36;
1922
+ _context21.prev = 36;
1855
1923
  _iterator3.f();
1856
- return _context20.finish(36);
1924
+ return _context21.finish(36);
1857
1925
  case 39:
1858
1926
  if (!params.submitAfterCommit) {
1859
- _context20.next = 43;
1927
+ _context21.next = 43;
1860
1928
  break;
1861
1929
  }
1862
- _context20.next = 42;
1930
+ _context21.next = 42;
1863
1931
  return this.submitSalesOrder();
1864
1932
  case 42:
1865
- submitResult = _context20.sent;
1933
+ submitResult = _context21.sent;
1866
1934
  case 43:
1867
1935
  result = {
1868
1936
  tempOrder: this.getTempOrder(),
@@ -1870,15 +1938,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
1870
1938
  validation: validation,
1871
1939
  submitResult: submitResult
1872
1940
  };
1873
- _context20.next = 46;
1941
+ _context21.next = 46;
1874
1942
  return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onPlannerCommitted), result);
1875
1943
  case 46:
1876
- return _context20.abrupt("return", result);
1944
+ return _context21.abrupt("return", result);
1877
1945
  case 47:
1878
1946
  case "end":
1879
- return _context20.stop();
1947
+ return _context21.stop();
1880
1948
  }
1881
- }, _callee20, this, [[16, 33, 36, 39]]);
1949
+ }, _callee21, this, [[16, 33, 36, 39]]);
1882
1950
  }));
1883
1951
  function commitPlannerSelection() {
1884
1952
  return _commitPlannerSelection.apply(this, arguments);