@pisell/pisellos 2.2.199 → 2.2.200

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.
@@ -44,7 +44,7 @@ import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDe
44
44
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
45
45
  import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
46
46
  import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
47
- import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
47
+ import { applyBookingsStatus, applyChildBookingStatus, resolveScheduleId, resolveStatusAfterTransition, restoreBookingsStatus, restoreChildBookingStatus } from "./utils/bookingStatus";
48
48
  function withProductOptionString(cacheItem) {
49
49
  var _cacheItem$_extend;
50
50
  var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
@@ -461,6 +461,101 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
461
461
  }
462
462
  return setBookingStatus;
463
463
  }()
464
+ /**
465
+ * 子预约状态机转移(POST /schedule/booking-transition/{schedule_event_id})。
466
+ *
467
+ * 与 `setBookingStatus`(父预约 PUT appointment-status)不同,本方法按子预约
468
+ * `schedule_event_id` 调用状态转移接口,body 为 `{ action }`。
469
+ *
470
+ * 流程:能解析出目标状态时先乐观更新对应子预约的 `appointment_status`,
471
+ * 再调 POST;成功后强制刷新销售详情;失败则回滚该子预约本地状态并抛错。
472
+ * `reschedule` 暂未启用状态矩阵,跳过乐观更新仅调接口。
473
+ *
474
+ * @param params.schedule_event_id 子预约 schedule_event_id
475
+ * @param params.action 转移动作:confirm | reject | arrive | start | complete | cancel | no_show | reschedule
476
+ * @returns 接口返回的 data
477
+ *
478
+ * @example
479
+ * await bookingTicket.transitionChildBooking({
480
+ * schedule_event_id: 301,
481
+ * action: 'confirm',
482
+ * });
483
+ */
484
+ )
485
+ }, {
486
+ key: "transitionChildBooking",
487
+ value: (function () {
488
+ var _transitionChildBooking = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(params) {
489
+ var _this$store$order2, _this$store$order2$ge;
490
+ var schedule_event_id, action, tempOrder, orderId, bookings, targetStatus, previous, _data2, res;
491
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
492
+ while (1) switch (_context7.prev = _context7.next) {
493
+ case 0:
494
+ schedule_event_id = params.schedule_event_id, action = params.action;
495
+ if (!(schedule_event_id === undefined || schedule_event_id === null || schedule_event_id === '')) {
496
+ _context7.next = 3;
497
+ break;
498
+ }
499
+ throw new Error('transitionChildBooking: schedule_event_id 不能为空');
500
+ case 3:
501
+ if (action) {
502
+ _context7.next = 5;
503
+ break;
504
+ }
505
+ throw new Error('transitionChildBooking: action 不能为空');
506
+ case 5:
507
+ tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
508
+ if (tempOrder) {
509
+ _context7.next = 8;
510
+ break;
511
+ }
512
+ throw new Error('transitionChildBooking: tempOrder 未加载');
513
+ case 8:
514
+ orderId = tempOrder.order_id;
515
+ if (!(orderId === undefined || orderId === null)) {
516
+ _context7.next = 11;
517
+ break;
518
+ }
519
+ throw new Error('transitionChildBooking: tempOrder.order_id 缺失');
520
+ case 11:
521
+ bookings = Array.isArray(tempOrder.bookings) ? tempOrder.bookings : [];
522
+ targetStatus = resolveStatusAfterTransition(action);
523
+ previous = targetStatus !== null ? applyChildBookingStatus(bookings, schedule_event_id, targetStatus) : undefined;
524
+ _context7.prev = 14;
525
+ _context7.next = 17;
526
+ return this.request.post("/schedule/booking-transition/".concat(schedule_event_id), {
527
+ action: action
528
+ });
529
+ case 17:
530
+ res = _context7.sent;
531
+ _context7.next = 20;
532
+ return this.refreshSalesDetail();
533
+ case 20:
534
+ this.core.effects.emit("".concat(this.name, ":onChildBookingStatusChange"), {
535
+ orderId: orderId,
536
+ schedule_event_id: schedule_event_id,
537
+ action: action,
538
+ status: targetStatus
539
+ });
540
+ return _context7.abrupt("return", (_data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _data2 !== void 0 ? _data2 : res);
541
+ case 24:
542
+ _context7.prev = 24;
543
+ _context7.t0 = _context7["catch"](14);
544
+ if (previous !== undefined) {
545
+ restoreChildBookingStatus(bookings, schedule_event_id, previous);
546
+ }
547
+ throw _context7.t0;
548
+ case 28:
549
+ case "end":
550
+ return _context7.stop();
551
+ }
552
+ }, _callee7, this, [[14, 24]]);
553
+ }));
554
+ function transitionChildBooking(_x8) {
555
+ return _transitionChildBooking.apply(this, arguments);
556
+ }
557
+ return transitionChildBooking;
558
+ }()
464
559
  /**
465
560
  * 基于当前 tempOrder.order_id 强制从远端重新拉取销售详情。
466
561
  *
@@ -475,35 +570,35 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
475
570
  }, {
476
571
  key: "refreshSalesDetail",
477
572
  value: (function () {
478
- var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
479
- var _this$store$order2, _this$store$order2$ge;
573
+ var _refreshSalesDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
574
+ var _this$store$order3, _this$store$order3$ge;
480
575
  var tempOrder, orderId;
481
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
482
- while (1) switch (_context7.prev = _context7.next) {
576
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
577
+ while (1) switch (_context8.prev = _context8.next) {
483
578
  case 0:
484
- tempOrder = (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$ge = _this$store$order2.getTempOrder) === null || _this$store$order2$ge === void 0 ? void 0 : _this$store$order2$ge.call(_this$store$order2);
579
+ tempOrder = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getTempOrder) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
485
580
  if (tempOrder) {
486
- _context7.next = 3;
581
+ _context8.next = 3;
487
582
  break;
488
583
  }
489
584
  throw new Error('refreshSalesDetail: tempOrder 未加载');
490
585
  case 3:
491
586
  orderId = tempOrder.order_id;
492
587
  if (!(orderId === undefined || orderId === null)) {
493
- _context7.next = 6;
588
+ _context8.next = 6;
494
589
  break;
495
590
  }
496
591
  throw new Error('refreshSalesDetail: tempOrder.order_id 缺失');
497
592
  case 6:
498
- return _context7.abrupt("return", this.loadSalesDetail({
593
+ return _context8.abrupt("return", this.loadSalesDetail({
499
594
  orderId: Number(orderId),
500
595
  forceRemote: true
501
596
  }));
502
597
  case 7:
503
598
  case "end":
504
- return _context7.stop();
599
+ return _context8.stop();
505
600
  }
506
- }, _callee7, this);
601
+ }, _callee8, this);
507
602
  }));
508
603
  function refreshSalesDetail() {
509
604
  return _refreshSalesDetail.apply(this, arguments);
@@ -519,7 +614,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
519
614
  }, {
520
615
  key: "loadProducts",
521
616
  value: (function () {
522
- var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
617
+ var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
523
618
  var params,
524
619
  options,
525
620
  schedule_date,
@@ -528,20 +623,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
528
623
  schedule_datetime,
529
624
  bookingDate,
530
625
  _result,
531
- _args8 = arguments;
532
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
533
- while (1) switch (_context8.prev = _context8.next) {
626
+ _args9 = arguments;
627
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
628
+ while (1) switch (_context9.prev = _context9.next) {
534
629
  case 0:
535
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
536
- options = _args8.length > 1 ? _args8[1] : undefined;
630
+ params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
631
+ options = _args9.length > 1 ? _args9[1] : undefined;
537
632
  schedule_date = params.schedule_date, customer_id = params.customer_id, menu_list_ids = params.menu_list_ids, schedule_datetime = params.schedule_datetime; // 优先写入 schedule_datetime(含时分),供加购 presetStartTime 与 TimeBar 对齐;
538
633
  // requiresDetail 弹窗仍通过 formatBookingDateForUI 只取日历日 YYYY-MM-DD。
539
634
  bookingDate = schedule_datetime || schedule_date || '';
540
635
  if (bookingDate) {
541
636
  this.setBookingDate(bookingDate);
542
637
  }
543
- _context8.prev = 5;
544
- _context8.next = 8;
638
+ _context9.prev = 5;
639
+ _context9.next = 8;
545
640
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
546
641
  with_count: ['bundleGroup', 'optionGroup'],
547
642
  with_schedule: 1
@@ -549,20 +644,20 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
549
644
  cacheId: this.cacheId
550
645
  }), options);
551
646
  case 8:
552
- _result = _context8.sent;
647
+ _result = _context9.sent;
553
648
  this.productCatalog = Array.isArray(_result) ? _toConsumableArray(_result) : [];
554
649
  this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), _result);
555
- return _context8.abrupt("return", _result);
650
+ return _context9.abrupt("return", _result);
556
651
  case 14:
557
- _context8.prev = 14;
558
- _context8.t0 = _context8["catch"](5);
559
- console.error('Failed to load products:', _context8.t0);
560
- throw _context8.t0;
652
+ _context9.prev = 14;
653
+ _context9.t0 = _context9["catch"](5);
654
+ console.error('Failed to load products:', _context9.t0);
655
+ throw _context9.t0;
561
656
  case 18:
562
657
  case "end":
563
- return _context8.stop();
658
+ return _context9.stop();
564
659
  }
565
- }, _callee8, this, [[5, 14]]);
660
+ }, _callee9, this, [[5, 14]]);
566
661
  }));
567
662
  function loadProducts() {
568
663
  return _loadProducts.apply(this, arguments);
@@ -587,14 +682,14 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
587
682
  }, {
588
683
  key: "queryProductDetail",
589
684
  value: (function () {
590
- var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, options) {
685
+ var _queryProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params, options) {
591
686
  var product_id, queryParams, _result2, list;
592
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
593
- while (1) switch (_context9.prev = _context9.next) {
687
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
688
+ while (1) switch (_context10.prev = _context10.next) {
594
689
  case 0:
595
690
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded2);
596
- _context9.prev = 1;
597
- _context9.next = 4;
691
+ _context10.prev = 1;
692
+ _context10.next = 4;
598
693
  return this.store.products.loadProducts(_objectSpread(_objectSpread({
599
694
  with_count: ['bundleGroup', 'optionGroup'],
600
695
  with_schedule: 1
@@ -603,23 +698,23 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
603
698
  cacheId: this.cacheId
604
699
  }), options);
605
700
  case 4:
606
- _result2 = _context9.sent;
701
+ _result2 = _context10.sent;
607
702
  list = Array.isArray(_result2) ? _result2 : [];
608
- return _context9.abrupt("return", list.find(function (product) {
703
+ return _context10.abrupt("return", list.find(function (product) {
609
704
  return Number(product.id) === Number(product_id);
610
705
  }));
611
706
  case 9:
612
- _context9.prev = 9;
613
- _context9.t0 = _context9["catch"](1);
614
- console.error('Failed to query product detail:', _context9.t0);
615
- throw _context9.t0;
707
+ _context10.prev = 9;
708
+ _context10.t0 = _context10["catch"](1);
709
+ console.error('Failed to query product detail:', _context10.t0);
710
+ throw _context10.t0;
616
711
  case 13:
617
712
  case "end":
618
- return _context9.stop();
713
+ return _context10.stop();
619
714
  }
620
- }, _callee9, this, [[1, 9]]);
715
+ }, _callee10, this, [[1, 9]]);
621
716
  }));
622
- function queryProductDetail(_x8, _x9) {
717
+ function queryProductDetail(_x9, _x10) {
623
718
  return _queryProductDetail.apply(this, arguments);
624
719
  }
625
720
  return queryProductDetail;
@@ -632,28 +727,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
632
727
  }, {
633
728
  key: "loadProductDetail",
634
729
  value: (function () {
635
- var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params, options) {
730
+ var _loadProductDetail = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params, options) {
636
731
  var product_id, queryParams, products;
637
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
638
- while (1) switch (_context10.prev = _context10.next) {
732
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
733
+ while (1) switch (_context11.prev = _context11.next) {
639
734
  case 0:
640
735
  product_id = params.product_id, queryParams = _objectWithoutProperties(params, _excluded3);
641
- _context10.next = 3;
736
+ _context11.next = 3;
642
737
  return this.loadProducts(_objectSpread(_objectSpread({}, queryParams), {}, {
643
738
  product_ids: [product_id]
644
739
  }), options);
645
740
  case 3:
646
- products = _context10.sent;
647
- return _context10.abrupt("return", products.find(function (product) {
741
+ products = _context11.sent;
742
+ return _context11.abrupt("return", products.find(function (product) {
648
743
  return Number(product.id) === Number(product_id);
649
744
  }));
650
745
  case 5:
651
746
  case "end":
652
- return _context10.stop();
747
+ return _context11.stop();
653
748
  }
654
- }, _callee10, this);
749
+ }, _callee11, this);
655
750
  }));
656
- function loadProductDetail(_x10, _x11) {
751
+ function loadProductDetail(_x11, _x12) {
657
752
  return _loadProductDetail.apply(this, arguments);
658
753
  }
659
754
  return loadProductDetail;
@@ -686,16 +781,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
686
781
  }, {
687
782
  key: "getProducts",
688
783
  value: (function () {
689
- var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
690
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
691
- while (1) switch (_context11.prev = _context11.next) {
784
+ var _getProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
785
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
786
+ while (1) switch (_context12.prev = _context12.next) {
692
787
  case 0:
693
- return _context11.abrupt("return", this.store.products.getProducts());
788
+ return _context12.abrupt("return", this.store.products.getProducts());
694
789
  case 1:
695
790
  case "end":
696
- return _context11.stop();
791
+ return _context12.stop();
697
792
  }
698
- }, _callee11, this);
793
+ }, _callee12, this);
699
794
  }));
700
795
  function getProducts() {
701
796
  return _getProducts.apply(this, arguments);
@@ -725,8 +820,8 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
725
820
  }, {
726
821
  key: "getCart",
727
822
  value: function getCart() {
728
- var _this$store$order$get2, _this$store$order3, _salesDetail$bookings;
729
- var tempOrder = (_this$store$order$get2 = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 ? void 0 : _this$store$order3.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
823
+ var _this$store$order$get2, _this$store$order4, _salesDetail$bookings;
824
+ var tempOrder = (_this$store$order$get2 = (_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) !== null && _this$store$order$get2 !== void 0 ? _this$store$order$get2 : null;
730
825
  var salesDetail = this.getSalesOrder();
731
826
  var bookings = (_salesDetail$bookings = salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) !== null && _salesDetail$bookings !== void 0 ? _salesDetail$bookings : (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
732
827
  return buildCartView((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [], bookings);
@@ -748,18 +843,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
748
843
  }, {
749
844
  key: "getProductByIds",
750
845
  value: (function () {
751
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(ids) {
752
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
753
- while (1) switch (_context12.prev = _context12.next) {
846
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
847
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
848
+ while (1) switch (_context13.prev = _context13.next) {
754
849
  case 0:
755
- return _context12.abrupt("return", this.store.products.getProductByIds(ids));
850
+ return _context13.abrupt("return", this.store.products.getProductByIds(ids));
756
851
  case 1:
757
852
  case "end":
758
- return _context12.stop();
853
+ return _context13.stop();
759
854
  }
760
- }, _callee12, this);
855
+ }, _callee13, this);
761
856
  }));
762
- function getProductByIds(_x12) {
857
+ function getProductByIds(_x13) {
763
858
  return _getProductByIds.apply(this, arguments);
764
859
  }
765
860
  return getProductByIds;
@@ -773,27 +868,27 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
773
868
  }, {
774
869
  key: "getScheduleTimePoints",
775
870
  value: (function () {
776
- var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(params) {
871
+ var _getScheduleTimePoints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(params) {
777
872
  var result;
778
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
779
- while (1) switch (_context13.prev = _context13.next) {
873
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
874
+ while (1) switch (_context14.prev = _context14.next) {
780
875
  case 0:
781
- _context13.next = 2;
876
+ _context14.next = 2;
782
877
  return this.request.post('/menu/schedule-time-points', {
783
878
  menu_list_ids: params.menu_list_ids
784
879
  }, {
785
880
  osServer: true
786
881
  });
787
882
  case 2:
788
- result = _context13.sent;
789
- return _context13.abrupt("return", result.data || []);
883
+ result = _context14.sent;
884
+ return _context14.abrupt("return", result.data || []);
790
885
  case 4:
791
886
  case "end":
792
- return _context13.stop();
887
+ return _context14.stop();
793
888
  }
794
- }, _callee13, this);
889
+ }, _callee14, this);
795
890
  }));
796
- function getScheduleTimePoints(_x13) {
891
+ function getScheduleTimePoints(_x14) {
797
892
  return _getScheduleTimePoints.apply(this, arguments);
798
893
  }
799
894
  return getScheduleTimePoints;
@@ -807,30 +902,30 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
807
902
  }, {
808
903
  key: "getCustomerList",
809
904
  value: (function () {
810
- var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
905
+ var _getCustomerList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
811
906
  var params,
812
907
  _result3,
813
- _args14 = arguments;
814
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
815
- while (1) switch (_context14.prev = _context14.next) {
908
+ _args15 = arguments;
909
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
910
+ while (1) switch (_context15.prev = _context15.next) {
816
911
  case 0:
817
- params = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
818
- _context14.prev = 1;
819
- _context14.next = 4;
912
+ params = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
913
+ _context15.prev = 1;
914
+ _context15.next = 4;
820
915
  return this.store.customer.getCustomerList(params);
821
916
  case 4:
822
- _result3 = _context14.sent;
823
- return _context14.abrupt("return", _result3);
917
+ _result3 = _context15.sent;
918
+ return _context15.abrupt("return", _result3);
824
919
  case 8:
825
- _context14.prev = 8;
826
- _context14.t0 = _context14["catch"](1);
827
- console.error('Failed to get customer list:', _context14.t0);
828
- throw _context14.t0;
920
+ _context15.prev = 8;
921
+ _context15.t0 = _context15["catch"](1);
922
+ console.error('Failed to get customer list:', _context15.t0);
923
+ throw _context15.t0;
829
924
  case 12:
830
925
  case "end":
831
- return _context14.stop();
926
+ return _context15.stop();
832
927
  }
833
- }, _callee14, this, [[1, 8]]);
928
+ }, _callee15, this, [[1, 8]]);
834
929
  }));
835
930
  function getCustomerList() {
836
931
  return _getCustomerList.apply(this, arguments);
@@ -1028,24 +1123,24 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1028
1123
  }, {
1029
1124
  key: "restoreOrder",
1030
1125
  value: (function () {
1031
- var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
1126
+ var _restoreOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1032
1127
  var _this$store$customer;
1033
1128
  var tempOrder;
1034
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1035
- while (1) switch (_context15.prev = _context15.next) {
1129
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1130
+ while (1) switch (_context16.prev = _context16.next) {
1036
1131
  case 0:
1037
- _context15.next = 2;
1132
+ _context16.next = 2;
1038
1133
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "restoreOrder", this).call(this);
1039
1134
  case 2:
1040
- tempOrder = _context15.sent;
1135
+ tempOrder = _context16.sent;
1041
1136
  this.clearOrderCustomer();
1042
1137
  (_this$store$customer = this.store.customer) === null || _this$store$customer === void 0 || _this$store$customer.setSelectedCustomer(null);
1043
- return _context15.abrupt("return", tempOrder);
1138
+ return _context16.abrupt("return", tempOrder);
1044
1139
  case 6:
1045
1140
  case "end":
1046
- return _context15.stop();
1141
+ return _context16.stop();
1047
1142
  }
1048
- }, _callee15, this);
1143
+ }, _callee16, this);
1049
1144
  }));
1050
1145
  function restoreOrder() {
1051
1146
  return _restoreOrder.apply(this, arguments);
@@ -1071,36 +1166,36 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1071
1166
  return;
1072
1167
  }
1073
1168
  var previousRefresh = this.orderCustomerDiscountRefreshInFlight;
1074
- var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
1169
+ var refreshTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
1075
1170
  var currentCustomer;
1076
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1077
- while (1) switch (_context16.prev = _context16.next) {
1171
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1172
+ while (1) switch (_context17.prev = _context17.next) {
1078
1173
  case 0:
1079
1174
  if (!previousRefresh) {
1080
- _context16.next = 3;
1175
+ _context17.next = 3;
1081
1176
  break;
1082
1177
  }
1083
- _context16.next = 3;
1178
+ _context17.next = 3;
1084
1179
  return previousRefresh.catch(function () {
1085
1180
  return undefined;
1086
1181
  });
1087
1182
  case 3:
1088
1183
  currentCustomer = _this4.store.order.getOrderCustomer();
1089
1184
  if (!(!currentCustomer || Number(currentCustomer.customer_id) !== customerId)) {
1090
- _context16.next = 6;
1185
+ _context17.next = 6;
1091
1186
  break;
1092
1187
  }
1093
- return _context16.abrupt("return");
1188
+ return _context17.abrupt("return");
1094
1189
  case 6:
1095
- _context16.next = 8;
1190
+ _context17.next = 8;
1096
1191
  return _this4.loadDiscountConfig({
1097
1192
  customerId: customerId
1098
1193
  });
1099
1194
  case 8:
1100
1195
  case "end":
1101
- return _context16.stop();
1196
+ return _context17.stop();
1102
1197
  }
1103
- }, _callee16);
1198
+ }, _callee17);
1104
1199
  }))();
1105
1200
  this.orderCustomerDiscountRefreshInFlight = refreshTask;
1106
1201
  this.orderCustomerDiscountRefreshCustomerId = customerId;
@@ -1153,29 +1248,29 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1153
1248
  }, {
1154
1249
  key: "changeCustomerPage",
1155
1250
  value: (function () {
1156
- var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(page, pageSize) {
1251
+ var _changeCustomerPage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(page, pageSize) {
1157
1252
  var _result4;
1158
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1159
- while (1) switch (_context17.prev = _context17.next) {
1253
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1254
+ while (1) switch (_context18.prev = _context18.next) {
1160
1255
  case 0:
1161
- _context17.prev = 0;
1162
- _context17.next = 3;
1256
+ _context18.prev = 0;
1257
+ _context18.next = 3;
1163
1258
  return this.store.customer.changeCustomerPage(page, pageSize);
1164
1259
  case 3:
1165
- _result4 = _context17.sent;
1166
- return _context17.abrupt("return", _result4);
1260
+ _result4 = _context18.sent;
1261
+ return _context18.abrupt("return", _result4);
1167
1262
  case 7:
1168
- _context17.prev = 7;
1169
- _context17.t0 = _context17["catch"](0);
1170
- console.error('Failed to change customer page:', _context17.t0);
1171
- throw _context17.t0;
1263
+ _context18.prev = 7;
1264
+ _context18.t0 = _context18["catch"](0);
1265
+ console.error('Failed to change customer page:', _context18.t0);
1266
+ throw _context18.t0;
1172
1267
  case 11:
1173
1268
  case "end":
1174
- return _context17.stop();
1269
+ return _context18.stop();
1175
1270
  }
1176
- }, _callee17, this, [[0, 7]]);
1271
+ }, _callee18, this, [[0, 7]]);
1177
1272
  }));
1178
- function changeCustomerPage(_x14, _x15) {
1273
+ function changeCustomerPage(_x15, _x16) {
1179
1274
  return _changeCustomerPage.apply(this, arguments);
1180
1275
  }
1181
1276
  return changeCustomerPage;
@@ -1188,28 +1283,28 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1188
1283
  }, {
1189
1284
  key: "loadMoreCustomers",
1190
1285
  value: (function () {
1191
- var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
1286
+ var _loadMoreCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1192
1287
  var _result5;
1193
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
1194
- while (1) switch (_context18.prev = _context18.next) {
1288
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1289
+ while (1) switch (_context19.prev = _context19.next) {
1195
1290
  case 0:
1196
- _context18.prev = 0;
1197
- _context18.next = 3;
1291
+ _context19.prev = 0;
1292
+ _context19.next = 3;
1198
1293
  return this.store.customer.loadMoreCustomers();
1199
1294
  case 3:
1200
- _result5 = _context18.sent;
1295
+ _result5 = _context19.sent;
1201
1296
  this.core.effects.emit("".concat(this.name, ":onCustomerListUpdate"), _result5);
1202
- return _context18.abrupt("return", _result5);
1297
+ return _context19.abrupt("return", _result5);
1203
1298
  case 8:
1204
- _context18.prev = 8;
1205
- _context18.t0 = _context18["catch"](0);
1206
- console.error('Failed to load more customers:', _context18.t0);
1207
- throw _context18.t0;
1299
+ _context19.prev = 8;
1300
+ _context19.t0 = _context19["catch"](0);
1301
+ console.error('Failed to load more customers:', _context19.t0);
1302
+ throw _context19.t0;
1208
1303
  case 12:
1209
1304
  case "end":
1210
- return _context18.stop();
1305
+ return _context19.stop();
1211
1306
  }
1212
- }, _callee18, this, [[0, 8]]);
1307
+ }, _callee19, this, [[0, 8]]);
1213
1308
  }));
1214
1309
  function loadMoreCustomers() {
1215
1310
  return _loadMoreCustomers.apply(this, arguments);
@@ -1225,31 +1320,31 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1225
1320
  }, {
1226
1321
  key: "resetAndLoadCustomers",
1227
1322
  value: (function () {
1228
- var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
1323
+ var _resetAndLoadCustomers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
1229
1324
  var params,
1230
1325
  _result6,
1231
- _args19 = arguments;
1232
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1233
- while (1) switch (_context19.prev = _context19.next) {
1326
+ _args20 = arguments;
1327
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1328
+ while (1) switch (_context20.prev = _context20.next) {
1234
1329
  case 0:
1235
- params = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
1236
- _context19.prev = 1;
1237
- _context19.next = 4;
1330
+ params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
1331
+ _context20.prev = 1;
1332
+ _context20.next = 4;
1238
1333
  return this.store.customer.resetAndLoadCustomers(params);
1239
1334
  case 4:
1240
- _result6 = _context19.sent;
1335
+ _result6 = _context20.sent;
1241
1336
  this.core.effects.emit("".concat(this.name, ":onCustomerListReset"), _result6);
1242
- return _context19.abrupt("return", _result6);
1337
+ return _context20.abrupt("return", _result6);
1243
1338
  case 9:
1244
- _context19.prev = 9;
1245
- _context19.t0 = _context19["catch"](1);
1246
- console.error('Failed to reset and load customers:', _context19.t0);
1247
- throw _context19.t0;
1339
+ _context20.prev = 9;
1340
+ _context20.t0 = _context20["catch"](1);
1341
+ console.error('Failed to reset and load customers:', _context20.t0);
1342
+ throw _context20.t0;
1248
1343
  case 13:
1249
1344
  case "end":
1250
- return _context19.stop();
1345
+ return _context20.stop();
1251
1346
  }
1252
- }, _callee19, this, [[1, 9]]);
1347
+ }, _callee20, this, [[1, 9]]);
1253
1348
  }));
1254
1349
  function resetAndLoadCustomers() {
1255
1350
  return _resetAndLoadCustomers.apply(this, arguments);
@@ -1411,15 +1506,15 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1411
1506
  }, {
1412
1507
  key: "setOtherParams",
1413
1508
  value: (function () {
1414
- var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(params) {
1509
+ var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(params) {
1415
1510
  var _ref10,
1416
1511
  _ref10$cover,
1417
1512
  cover,
1418
- _args20 = arguments;
1419
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
1420
- while (1) switch (_context20.prev = _context20.next) {
1513
+ _args21 = arguments;
1514
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1515
+ while (1) switch (_context21.prev = _context21.next) {
1421
1516
  case 0:
1422
- _ref10 = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
1517
+ _ref10 = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {}, _ref10$cover = _ref10.cover, cover = _ref10$cover === void 0 ? false : _ref10$cover;
1423
1518
  if (cover) {
1424
1519
  this.otherParams = params;
1425
1520
  } else {
@@ -1427,11 +1522,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1427
1522
  }
1428
1523
  case 2:
1429
1524
  case "end":
1430
- return _context20.stop();
1525
+ return _context21.stop();
1431
1526
  }
1432
- }, _callee20, this);
1527
+ }, _callee21, this);
1433
1528
  }));
1434
- function setOtherParams(_x16) {
1529
+ function setOtherParams(_x17) {
1435
1530
  return _setOtherParams.apply(this, arguments);
1436
1531
  }
1437
1532
  return setOtherParams;
@@ -1444,16 +1539,16 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1444
1539
  }, {
1445
1540
  key: "getOtherParams",
1446
1541
  value: (function () {
1447
- var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
1448
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
1449
- while (1) switch (_context21.prev = _context21.next) {
1542
+ var _getOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
1543
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1544
+ while (1) switch (_context22.prev = _context22.next) {
1450
1545
  case 0:
1451
- return _context21.abrupt("return", this.otherParams);
1546
+ return _context22.abrupt("return", this.otherParams);
1452
1547
  case 1:
1453
1548
  case "end":
1454
- return _context21.stop();
1549
+ return _context22.stop();
1455
1550
  }
1456
- }, _callee21, this);
1551
+ }, _callee22, this);
1457
1552
  }));
1458
1553
  function getOtherParams() {
1459
1554
  return _getOtherParams.apply(this, arguments);
@@ -1724,18 +1819,18 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1724
1819
  }, {
1725
1820
  key: "updateProductInOrder",
1726
1821
  value: (function () {
1727
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
1728
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
1729
- while (1) switch (_context22.prev = _context22.next) {
1822
+ var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(params) {
1823
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1824
+ while (1) switch (_context23.prev = _context23.next) {
1730
1825
  case 0:
1731
- return _context22.abrupt("return", this.updateOrderProduct(params));
1826
+ return _context23.abrupt("return", this.updateOrderProduct(params));
1732
1827
  case 1:
1733
1828
  case "end":
1734
- return _context22.stop();
1829
+ return _context23.stop();
1735
1830
  }
1736
- }, _callee22, this);
1831
+ }, _callee23, this);
1737
1832
  }));
1738
- function updateProductInOrder(_x17) {
1833
+ function updateProductInOrder(_x18) {
1739
1834
  return _updateProductInOrder.apply(this, arguments);
1740
1835
  }
1741
1836
  return updateProductInOrder;
@@ -1757,47 +1852,47 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1757
1852
  }, {
1758
1853
  key: "handleGlobalScanCode",
1759
1854
  value: (function () {
1760
- var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(code, bridge) {
1855
+ var _handleGlobalScanCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(code, bridge) {
1761
1856
  var _this6 = this;
1762
1857
  var trimmed, _bridge$onNotify, _bridge$refresh, localSearch, scanCallback, raw, formatted, _bridge$onNotify2, _result7, _bridge$onNotify3;
1763
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
1764
- while (1) switch (_context23.prev = _context23.next) {
1858
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1859
+ while (1) switch (_context24.prev = _context24.next) {
1765
1860
  case 0:
1766
1861
  trimmed = typeof code === 'string' ? code.trim() : '';
1767
1862
  if (trimmed) {
1768
- _context23.next = 4;
1863
+ _context24.next = 4;
1769
1864
  break;
1770
1865
  }
1771
1866
  bridge === null || bridge === void 0 || (_bridge$onNotify = bridge.onNotify) === null || _bridge$onNotify === void 0 || _bridge$onNotify.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1772
- return _context23.abrupt("return", {
1867
+ return _context24.abrupt("return", {
1773
1868
  status: 'failed',
1774
1869
  reason: 'empty_code'
1775
1870
  });
1776
1871
  case 4:
1777
- _context23.prev = 4;
1872
+ _context24.prev = 4;
1778
1873
  localSearch = function localSearch(v) {
1779
1874
  return _this6.store.products.findProductsByCodeOrBarcode(v);
1780
1875
  };
1781
1876
  scanCallback = handleGlobalScan(this.request, localSearch);
1782
- _context23.next = 9;
1877
+ _context24.next = 9;
1783
1878
  return scanCallback({
1784
1879
  type: 'nativeScanner',
1785
1880
  value: trimmed
1786
1881
  });
1787
1882
  case 9:
1788
- raw = _context23.sent;
1883
+ raw = _context24.sent;
1789
1884
  formatted = formatGlobalScanResult(raw, trimmed);
1790
1885
  if (formatted) {
1791
- _context23.next = 14;
1886
+ _context24.next = 14;
1792
1887
  break;
1793
1888
  }
1794
1889
  bridge === null || bridge === void 0 || (_bridge$onNotify2 = bridge.onNotify) === null || _bridge$onNotify2 === void 0 || _bridge$onNotify2.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1795
- return _context23.abrupt("return", {
1890
+ return _context24.abrupt("return", {
1796
1891
  status: 'failed',
1797
1892
  reason: 'not_found'
1798
1893
  });
1799
1894
  case 14:
1800
- _context23.next = 16;
1895
+ _context24.next = 16;
1801
1896
  return applyGlobalScan({
1802
1897
  setOrderCustomer: function setOrderCustomer(customer) {
1803
1898
  return _this6.setOrderCustomer(customer);
@@ -1826,25 +1921,25 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1826
1921
  }
1827
1922
  }, formatted, bridge);
1828
1923
  case 16:
1829
- _result7 = _context23.sent;
1924
+ _result7 = _context24.sent;
1830
1925
  bridge === null || bridge === void 0 || (_bridge$refresh = bridge.refresh) === null || _bridge$refresh === void 0 || _bridge$refresh.call(bridge);
1831
- return _context23.abrupt("return", _result7);
1926
+ return _context24.abrupt("return", _result7);
1832
1927
  case 21:
1833
- _context23.prev = 21;
1834
- _context23.t0 = _context23["catch"](4);
1835
- console.error('[BookingTicket] handleGlobalScanCode failed', _context23.t0);
1928
+ _context24.prev = 21;
1929
+ _context24.t0 = _context24["catch"](4);
1930
+ console.error('[BookingTicket] handleGlobalScanCode failed', _context24.t0);
1836
1931
  bridge === null || bridge === void 0 || (_bridge$onNotify3 = bridge.onNotify) === null || _bridge$onNotify3 === void 0 || _bridge$onNotify3.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
1837
- return _context23.abrupt("return", {
1932
+ return _context24.abrupt("return", {
1838
1933
  status: 'failed',
1839
1934
  reason: 'not_found'
1840
1935
  });
1841
1936
  case 26:
1842
1937
  case "end":
1843
- return _context23.stop();
1938
+ return _context24.stop();
1844
1939
  }
1845
- }, _callee23, this, [[4, 21]]);
1940
+ }, _callee24, this, [[4, 21]]);
1846
1941
  }));
1847
- function handleGlobalScanCode(_x18, _x19) {
1942
+ function handleGlobalScanCode(_x19, _x20) {
1848
1943
  return _handleGlobalScanCode.apply(this, arguments);
1849
1944
  }
1850
1945
  return handleGlobalScanCode;
@@ -1857,12 +1952,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1857
1952
  }, {
1858
1953
  key: "destroy",
1859
1954
  value: (function () {
1860
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
1955
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
1861
1956
  var _this$scan;
1862
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
1863
- while (1) switch (_context24.prev = _context24.next) {
1957
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
1958
+ while (1) switch (_context25.prev = _context25.next) {
1864
1959
  case 0:
1865
- _context24.next = 2;
1960
+ _context25.next = 2;
1866
1961
  return _get(_getPrototypeOf(BookingTicketImpl.prototype), "destroy", this).call(this);
1867
1962
  case 2:
1868
1963
  try {
@@ -1873,9 +1968,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1873
1968
  scanCache.clear();
1874
1969
  case 4:
1875
1970
  case "end":
1876
- return _context24.stop();
1971
+ return _context25.stop();
1877
1972
  }
1878
- }, _callee24, this);
1973
+ }, _callee25, this);
1879
1974
  }));
1880
1975
  function destroy() {
1881
1976
  return _destroy.apply(this, arguments);