@pisell/pisellos 2.3.171 → 2.3.172
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/Order/index.d.ts +25 -3
- package/dist/modules/Order/index.js +1770 -1311
- package/dist/modules/Order/types.d.ts +7 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Payment/walletpass.js +32 -6
- package/dist/modules/ProductList/index.js +33 -12
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +29 -21
- package/dist/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.js +1511 -1325
- package/dist/solution/BookingTicket/index.js +200 -108
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +94 -58
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.js +69 -49
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Order/index.d.ts +25 -3
- package/lib/modules/Order/index.js +192 -38
- package/lib/modules/Order/types.d.ts +7 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Payment/walletpass.js +23 -1
- package/lib/modules/ProductList/index.js +15 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +6 -0
- package/lib/solution/BaseSales/index.d.ts +16 -1
- package/lib/solution/BaseSales/index.js +89 -9
- package/lib/solution/BookingTicket/index.js +38 -2
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +14 -3
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/package.json +1 -1
|
@@ -8,12 +8,13 @@ import dayjs from 'dayjs';
|
|
|
8
8
|
import { cacheItemToBookingInput, derivePresetStartTimeFromDate, getProductExtend, getIsAutoClose, isSessionProduct, isBookingProduct, applySessionTimesToExtend, hasActualResourceSelection, productNeedsResourceExtend } from "../../../modules/BookingContext";
|
|
9
9
|
import { transformBaseProductToOrderProduct } from "../../BaseSales/utils/transformBaseProductToOrderProduct";
|
|
10
10
|
import { buildProductSkuFromCacheItem } from "./weighingProductSku";
|
|
11
|
+
import { isSelfServicePlatform } from "../../../utils/platform";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
14
15
|
*
|
|
15
16
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
16
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
17
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
17
18
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
18
19
|
*/
|
|
19
20
|
|
|
@@ -30,11 +31,11 @@ function needsSpecDetailModal(item) {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
34
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
34
35
|
*/
|
|
35
36
|
function needsBookingEdit(cacheItem, ctx) {
|
|
36
37
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
37
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.channel)
|
|
38
|
+
if (isSelfServicePlatform(ctx === null || ctx === void 0 ? void 0 : ctx.channel)) return true;
|
|
38
39
|
var isAutoAllocationOn = (ctx === null || ctx === void 0 ? void 0 : ctx.isAutoAllocationOn) || function () {
|
|
39
40
|
return true;
|
|
40
41
|
};
|
|
@@ -210,7 +210,7 @@ export function applyGlobalScan(_x14, _x15, _x16) {
|
|
|
210
210
|
}
|
|
211
211
|
function _applyGlobalScan() {
|
|
212
212
|
_applyGlobalScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(host, formatted, bridge) {
|
|
213
|
-
var searchType, data, scanCode, formattedCustomerId, isCrossShopWallet, isWalletPassUnavailableAtStore, _getRealCustomerId, _bridge$onNotify5, currentCustomer, currentCustomerId, _customer, sourceCustomerId, _bridge$onNotify, _bridge$onNotify2, _customerId, _bridge$onNotify3, orderCustomer, switched, _bridge$onNotify4, _promotionResult$isAc, _bridge$onNotify6, snapshot, activeCustomer, bindWalletPassCustomer, trySelectWalletAsset, bindResult, walletSelection, promotionCustomerId, promotionResult, list, _bridge$onNotify12, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify13, _data$order_id, _data$business_code, orderId, _bridge$onNotify14;
|
|
213
|
+
var searchType, data, scanCode, formattedCustomerId, isCrossShopWallet, isWalletPassUnavailableAtStore, _getRealCustomerId, _bridge$onNotify5, currentCustomer, currentCustomerId, _customer, sourceCustomerId, _bridge$onNotify, _bridge$onNotify2, _customerId, _bridge$onNotify3, orderCustomer, switched, _bridge$onNotify4, _collectionPromotion$, _promotionResult$isAc, _bridge$onNotify6, snapshot, activeCustomer, bindWalletPassCustomer, trySelectWalletAsset, bindResult, collectionPromotion, walletSelection, promotionCustomerId, promotionResult, list, _bridge$onNotify12, addedCount, _iterator, _step, _item, outcome, _bridge$onNotify13, _data$order_id, _data$business_code, orderId, _bridge$onNotify14;
|
|
214
214
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
215
215
|
while (1) switch (_context6.prev = _context6.next) {
|
|
216
216
|
case 0:
|
|
@@ -321,7 +321,7 @@ function _applyGlobalScan() {
|
|
|
321
321
|
});
|
|
322
322
|
case 44:
|
|
323
323
|
if (!(searchType === 'walletPass')) {
|
|
324
|
-
_context6.next =
|
|
324
|
+
_context6.next = 93;
|
|
325
325
|
break;
|
|
326
326
|
}
|
|
327
327
|
if (!isWalletPassUnavailableAtStore) {
|
|
@@ -495,75 +495,111 @@ function _applyGlobalScan() {
|
|
|
495
495
|
return bindWalletPassCustomer();
|
|
496
496
|
case 54:
|
|
497
497
|
bindResult = _context6.sent;
|
|
498
|
-
|
|
498
|
+
if (!((bridge === null || bridge === void 0 ? void 0 : bridge.scanScope) === 'product-voucher-collection' && bridge.applyPromotionCode)) {
|
|
499
|
+
_context6.next = 61;
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
_context6.next = 58;
|
|
503
|
+
return bridge.applyPromotionCode(scanCode, getRealCustomerId(activeCustomer), {
|
|
504
|
+
suppressFailureNotification: true,
|
|
505
|
+
productVouchersOnly: true
|
|
506
|
+
});
|
|
507
|
+
case 58:
|
|
508
|
+
_context6.t2 = _context6.sent;
|
|
509
|
+
_context6.next = 62;
|
|
510
|
+
break;
|
|
511
|
+
case 61:
|
|
512
|
+
_context6.t2 = undefined;
|
|
513
|
+
case 62:
|
|
514
|
+
collectionPromotion = _context6.t2;
|
|
515
|
+
if (!((_collectionPromotion$ = collectionPromotion === null || collectionPromotion === void 0 ? void 0 : collectionPromotion.isAccepted) !== null && _collectionPromotion$ !== void 0 ? _collectionPromotion$ : collectionPromotion === null || collectionPromotion === void 0 ? void 0 : collectionPromotion.isAvailable)) {
|
|
516
|
+
_context6.next = 65;
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
return _context6.abrupt("return", {
|
|
520
|
+
status: 'success',
|
|
521
|
+
kind: 'promotion'
|
|
522
|
+
});
|
|
523
|
+
case 65:
|
|
524
|
+
_context6.next = 67;
|
|
499
525
|
return trySelectWalletAsset();
|
|
500
|
-
case
|
|
526
|
+
case 67:
|
|
501
527
|
walletSelection = _context6.sent;
|
|
502
528
|
if (!walletSelection) {
|
|
503
|
-
_context6.next =
|
|
529
|
+
_context6.next = 70;
|
|
504
530
|
break;
|
|
505
531
|
}
|
|
506
532
|
return _context6.abrupt("return", walletSelection);
|
|
507
|
-
case
|
|
533
|
+
case 70:
|
|
508
534
|
if (bridge !== null && bridge !== void 0 && bridge.applyPromotionCode) {
|
|
509
|
-
_context6.next =
|
|
535
|
+
_context6.next = 72;
|
|
510
536
|
break;
|
|
511
537
|
}
|
|
512
538
|
return _context6.abrupt("return", {
|
|
513
539
|
status: 'failed',
|
|
514
540
|
reason: 'no_bridge'
|
|
515
541
|
});
|
|
516
|
-
case
|
|
542
|
+
case 72:
|
|
517
543
|
promotionCustomerId = getRealCustomerId(activeCustomer);
|
|
544
|
+
if (!(collectionPromotion !== null && collectionPromotion !== void 0)) {
|
|
545
|
+
_context6.next = 77;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
_context6.t3 = collectionPromotion;
|
|
549
|
+
_context6.next = 87;
|
|
550
|
+
break;
|
|
551
|
+
case 77:
|
|
518
552
|
if (!bindResult.customerBound) {
|
|
519
|
-
_context6.next =
|
|
553
|
+
_context6.next = 83;
|
|
520
554
|
break;
|
|
521
555
|
}
|
|
522
|
-
_context6.next =
|
|
556
|
+
_context6.next = 80;
|
|
523
557
|
return bridge.applyPromotionCode(scanCode, promotionCustomerId, {
|
|
524
558
|
suppressFailureNotification: true
|
|
525
559
|
});
|
|
526
|
-
case
|
|
527
|
-
_context6.
|
|
528
|
-
_context6.next =
|
|
560
|
+
case 80:
|
|
561
|
+
_context6.t4 = _context6.sent;
|
|
562
|
+
_context6.next = 86;
|
|
529
563
|
break;
|
|
530
|
-
case
|
|
531
|
-
_context6.next =
|
|
564
|
+
case 83:
|
|
565
|
+
_context6.next = 85;
|
|
532
566
|
return bridge.applyPromotionCode(scanCode, promotionCustomerId);
|
|
533
|
-
case
|
|
534
|
-
_context6.
|
|
535
|
-
case
|
|
536
|
-
|
|
567
|
+
case 85:
|
|
568
|
+
_context6.t4 = _context6.sent;
|
|
569
|
+
case 86:
|
|
570
|
+
_context6.t3 = _context6.t4;
|
|
571
|
+
case 87:
|
|
572
|
+
promotionResult = _context6.t3;
|
|
537
573
|
if (!((_promotionResult$isAc = promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAccepted) !== null && _promotionResult$isAc !== void 0 ? _promotionResult$isAc : promotionResult === null || promotionResult === void 0 ? void 0 : promotionResult.isAvailable)) {
|
|
538
|
-
_context6.next =
|
|
574
|
+
_context6.next = 90;
|
|
539
575
|
break;
|
|
540
576
|
}
|
|
541
577
|
return _context6.abrupt("return", {
|
|
542
578
|
status: 'success',
|
|
543
579
|
kind: 'promotion'
|
|
544
580
|
});
|
|
545
|
-
case
|
|
581
|
+
case 90:
|
|
546
582
|
if (!bindResult.customerBound) {
|
|
547
|
-
_context6.next =
|
|
583
|
+
_context6.next = 92;
|
|
548
584
|
break;
|
|
549
585
|
}
|
|
550
586
|
return _context6.abrupt("return", {
|
|
551
587
|
status: 'success',
|
|
552
588
|
kind: 'customer'
|
|
553
589
|
});
|
|
554
|
-
case
|
|
590
|
+
case 92:
|
|
555
591
|
return _context6.abrupt("return", {
|
|
556
592
|
status: 'failed',
|
|
557
593
|
reason: 'invalid_data'
|
|
558
594
|
});
|
|
559
|
-
case
|
|
595
|
+
case 93:
|
|
560
596
|
if (!(searchType === 'product' || searchType === 'local_product')) {
|
|
561
|
-
_context6.next =
|
|
597
|
+
_context6.next = 126;
|
|
562
598
|
break;
|
|
563
599
|
}
|
|
564
600
|
list = data === null || data === void 0 ? void 0 : data.list;
|
|
565
601
|
if (!(!Array.isArray(list) || list.length === 0)) {
|
|
566
|
-
_context6.next =
|
|
602
|
+
_context6.next = 98;
|
|
567
603
|
break;
|
|
568
604
|
}
|
|
569
605
|
bridge === null || bridge === void 0 || (_bridge$onNotify12 = bridge.onNotify) === null || _bridge$onNotify12 === void 0 || _bridge$onNotify12.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -571,57 +607,57 @@ function _applyGlobalScan() {
|
|
|
571
607
|
status: 'failed',
|
|
572
608
|
reason: 'invalid_data'
|
|
573
609
|
});
|
|
574
|
-
case
|
|
610
|
+
case 98:
|
|
575
611
|
addedCount = 0;
|
|
576
612
|
_iterator = _createForOfIteratorHelper(list);
|
|
577
|
-
_context6.prev =
|
|
613
|
+
_context6.prev = 100;
|
|
578
614
|
_iterator.s();
|
|
579
|
-
case
|
|
615
|
+
case 102:
|
|
580
616
|
if ((_step = _iterator.n()).done) {
|
|
581
|
-
_context6.next =
|
|
617
|
+
_context6.next = 114;
|
|
582
618
|
break;
|
|
583
619
|
}
|
|
584
620
|
_item = _step.value;
|
|
585
|
-
_context6.next =
|
|
621
|
+
_context6.next = 106;
|
|
586
622
|
return processScannedProductItem(host, _item, scanCode, bridge);
|
|
587
|
-
case
|
|
623
|
+
case 106:
|
|
588
624
|
outcome = _context6.sent;
|
|
589
625
|
if (outcome === 'added') {
|
|
590
626
|
addedCount += 1;
|
|
591
627
|
}
|
|
592
628
|
if (!(outcome === 'cancelled')) {
|
|
593
|
-
_context6.next =
|
|
629
|
+
_context6.next = 110;
|
|
594
630
|
break;
|
|
595
631
|
}
|
|
596
632
|
return _context6.abrupt("return", {
|
|
597
633
|
status: 'cancelled'
|
|
598
634
|
});
|
|
599
|
-
case
|
|
635
|
+
case 110:
|
|
600
636
|
if (!(outcome === 'pending')) {
|
|
601
|
-
_context6.next =
|
|
637
|
+
_context6.next = 112;
|
|
602
638
|
break;
|
|
603
639
|
}
|
|
604
640
|
return _context6.abrupt("return", {
|
|
605
641
|
status: 'pending',
|
|
606
642
|
kind: 'requiresDetail'
|
|
607
643
|
});
|
|
608
|
-
case
|
|
609
|
-
_context6.next =
|
|
644
|
+
case 112:
|
|
645
|
+
_context6.next = 102;
|
|
610
646
|
break;
|
|
611
|
-
case
|
|
612
|
-
_context6.next =
|
|
647
|
+
case 114:
|
|
648
|
+
_context6.next = 119;
|
|
613
649
|
break;
|
|
614
|
-
case
|
|
615
|
-
_context6.prev =
|
|
616
|
-
_context6.
|
|
617
|
-
_iterator.e(_context6.
|
|
618
|
-
case
|
|
619
|
-
_context6.prev =
|
|
650
|
+
case 116:
|
|
651
|
+
_context6.prev = 116;
|
|
652
|
+
_context6.t5 = _context6["catch"](100);
|
|
653
|
+
_iterator.e(_context6.t5);
|
|
654
|
+
case 119:
|
|
655
|
+
_context6.prev = 119;
|
|
620
656
|
_iterator.f();
|
|
621
|
-
return _context6.finish(
|
|
622
|
-
case
|
|
657
|
+
return _context6.finish(119);
|
|
658
|
+
case 122:
|
|
623
659
|
if (!(addedCount > 0)) {
|
|
624
|
-
_context6.next =
|
|
660
|
+
_context6.next = 125;
|
|
625
661
|
break;
|
|
626
662
|
}
|
|
627
663
|
bridge === null || bridge === void 0 || (_bridge$onNotify13 = bridge.onNotify) === null || _bridge$onNotify13 === void 0 || _bridge$onNotify13.call(bridge, 'success');
|
|
@@ -632,19 +668,19 @@ function _applyGlobalScan() {
|
|
|
632
668
|
count: addedCount
|
|
633
669
|
}
|
|
634
670
|
});
|
|
635
|
-
case
|
|
671
|
+
case 125:
|
|
636
672
|
return _context6.abrupt("return", {
|
|
637
673
|
status: 'failed',
|
|
638
674
|
reason: 'no_bridge'
|
|
639
675
|
});
|
|
640
|
-
case
|
|
676
|
+
case 126:
|
|
641
677
|
if (!(searchType === 'order')) {
|
|
642
|
-
_context6.next =
|
|
678
|
+
_context6.next = 135;
|
|
643
679
|
break;
|
|
644
680
|
}
|
|
645
681
|
orderId = (_data$order_id = data === null || data === void 0 ? void 0 : data.order_id) !== null && _data$order_id !== void 0 ? _data$order_id : data === null || data === void 0 ? void 0 : data.id;
|
|
646
682
|
if (orderId) {
|
|
647
|
-
_context6.next =
|
|
683
|
+
_context6.next = 131;
|
|
648
684
|
break;
|
|
649
685
|
}
|
|
650
686
|
bridge === null || bridge === void 0 || (_bridge$onNotify14 = bridge.onNotify) === null || _bridge$onNotify14 === void 0 || _bridge$onNotify14.call(bridge, 'fail', 'pisell2.text.scan-global-failed');
|
|
@@ -652,16 +688,16 @@ function _applyGlobalScan() {
|
|
|
652
688
|
status: 'failed',
|
|
653
689
|
reason: 'invalid_data'
|
|
654
690
|
});
|
|
655
|
-
case
|
|
691
|
+
case 131:
|
|
656
692
|
if (bridge !== null && bridge !== void 0 && bridge.openOrder) {
|
|
657
|
-
_context6.next =
|
|
693
|
+
_context6.next = 133;
|
|
658
694
|
break;
|
|
659
695
|
}
|
|
660
696
|
return _context6.abrupt("return", {
|
|
661
697
|
status: 'pending',
|
|
662
698
|
kind: 'openOrder'
|
|
663
699
|
});
|
|
664
|
-
case
|
|
700
|
+
case 133:
|
|
665
701
|
bridge.openOrder({
|
|
666
702
|
order_id: Number(orderId),
|
|
667
703
|
business_code: (_data$business_code = data === null || data === void 0 ? void 0 : data.business_code) !== null && _data$business_code !== void 0 ? _data$business_code : host.getBusinessCode()
|
|
@@ -670,16 +706,16 @@ function _applyGlobalScan() {
|
|
|
670
706
|
status: 'pending',
|
|
671
707
|
kind: 'openOrder'
|
|
672
708
|
});
|
|
673
|
-
case
|
|
709
|
+
case 135:
|
|
674
710
|
return _context6.abrupt("return", {
|
|
675
711
|
status: 'failed',
|
|
676
712
|
reason: 'invalid_data'
|
|
677
713
|
});
|
|
678
|
-
case
|
|
714
|
+
case 136:
|
|
679
715
|
case "end":
|
|
680
716
|
return _context6.stop();
|
|
681
717
|
}
|
|
682
|
-
}, _callee6, null, [[10, 16], [30, 37], [
|
|
718
|
+
}, _callee6, null, [[10, 16], [30, 37], [100, 116, 119, 122]]);
|
|
683
719
|
}));
|
|
684
720
|
return _applyGlobalScan.apply(this, arguments);
|
|
685
721
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GlobalScanHandleResult, GlobalScanHostBridge } from '../../types';
|
|
2
|
+
import { type GlobalScanApplyHost } from './applyGlobalScan';
|
|
3
|
+
import type { GlobalScanFormattedResult } from './formatGlobalScan';
|
|
4
|
+
export interface ProductVoucherCollectionScanHost extends GlobalScanApplyHost {
|
|
5
|
+
waitForCustomerDiscounts(): Promise<void>;
|
|
6
|
+
loadCustomerDiscounts(): Promise<Record<string, any>[]>;
|
|
7
|
+
}
|
|
8
|
+
/** Collect voucher candidates after customer binding and coupon loading finish.
|
|
9
|
+
* Never expand a wristband's result to other orders of the same customer. */
|
|
10
|
+
export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
import { applyGlobalScan } from "./applyGlobalScan";
|
|
11
|
+
/** Collect voucher candidates after customer binding and coupon loading finish.
|
|
12
|
+
* Never expand a wristband's result to other orders of the same customer. */
|
|
13
|
+
export function applyProductVoucherCollectionScan(_x, _x2, _x3) {
|
|
14
|
+
return _applyProductVoucherCollectionScan.apply(this, arguments);
|
|
15
|
+
}
|
|
16
|
+
function _applyProductVoucherCollectionScan() {
|
|
17
|
+
_applyProductVoucherCollectionScan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(host, formatted, bridge) {
|
|
18
|
+
var assertCurrent, vouchers, result;
|
|
19
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
20
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
assertCurrent = function assertCurrent() {
|
|
23
|
+
var _bridge$isCurrent;
|
|
24
|
+
if (((_bridge$isCurrent = bridge.isCurrent) === null || _bridge$isCurrent === void 0 ? void 0 : _bridge$isCurrent.call(bridge)) === false) {
|
|
25
|
+
throw new DOMException('Scan session ended', 'AbortError');
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
vouchers = [];
|
|
29
|
+
assertCurrent();
|
|
30
|
+
_context2.next = 5;
|
|
31
|
+
return applyGlobalScan(_objectSpread(_objectSpread({}, host), {}, {
|
|
32
|
+
setOrderCustomer: function setOrderCustomer(customer) {
|
|
33
|
+
assertCurrent();
|
|
34
|
+
host.setOrderCustomer(customer);
|
|
35
|
+
},
|
|
36
|
+
addProductToOrder: function addProductToOrder(product, booking) {
|
|
37
|
+
assertCurrent();
|
|
38
|
+
return host.addProductToOrder(product, booking);
|
|
39
|
+
}
|
|
40
|
+
}), formatted, _objectSpread(_objectSpread({}, bridge), {}, {
|
|
41
|
+
applyPromotionCode: bridge.applyPromotionCode && ( /*#__PURE__*/function () {
|
|
42
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, customerId, options) {
|
|
43
|
+
var promotion;
|
|
44
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
_context.next = 2;
|
|
48
|
+
return host.waitForCustomerDiscounts();
|
|
49
|
+
case 2:
|
|
50
|
+
assertCurrent();
|
|
51
|
+
_context.next = 5;
|
|
52
|
+
return bridge.applyPromotionCode(code, customerId, _objectSpread(_objectSpread({}, options), {}, {
|
|
53
|
+
productVouchersOnly: true,
|
|
54
|
+
suppressFailureNotification: true
|
|
55
|
+
}));
|
|
56
|
+
case 5:
|
|
57
|
+
promotion = _context.sent;
|
|
58
|
+
assertCurrent();
|
|
59
|
+
// An empty successful search is different from a swallowed request error.
|
|
60
|
+
if (Array.isArray(promotion.scannedDiscountList)) {
|
|
61
|
+
_context.next = 9;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
throw new Error('Could not resolve scanned vouchers');
|
|
65
|
+
case 9:
|
|
66
|
+
vouchers = promotion.scannedDiscountList;
|
|
67
|
+
return _context.abrupt("return", promotion);
|
|
68
|
+
case 11:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee);
|
|
73
|
+
}));
|
|
74
|
+
return function (_x4, _x5, _x6) {
|
|
75
|
+
return _ref.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}())
|
|
78
|
+
}));
|
|
79
|
+
case 5:
|
|
80
|
+
result = _context2.sent;
|
|
81
|
+
assertCurrent();
|
|
82
|
+
if (!(formatted.searchType === 'wallet' && result.status === 'success')) {
|
|
83
|
+
_context2.next = 13;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
_context2.next = 10;
|
|
87
|
+
return host.loadCustomerDiscounts();
|
|
88
|
+
case 10:
|
|
89
|
+
vouchers = _context2.sent;
|
|
90
|
+
assertCurrent();
|
|
91
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
92
|
+
redemption: {
|
|
93
|
+
source: 'wallet',
|
|
94
|
+
vouchers: vouchers
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
case 13:
|
|
98
|
+
if (!(formatted.searchType === 'walletPass')) {
|
|
99
|
+
_context2.next = 15;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return _context2.abrupt("return", _objectSpread(_objectSpread({}, result), {}, {
|
|
103
|
+
redemption: {
|
|
104
|
+
source: 'scan',
|
|
105
|
+
vouchers: vouchers
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
case 15:
|
|
109
|
+
return _context2.abrupt("return", result);
|
|
110
|
+
case 16:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context2.stop();
|
|
113
|
+
}
|
|
114
|
+
}, _callee2);
|
|
115
|
+
}));
|
|
116
|
+
return _applyProductVoucherCollectionScan.apply(this, arguments);
|
|
117
|
+
}
|
|
@@ -10,6 +10,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
10
10
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
11
|
import { searchWalletPass, searchWallet, searchProduct, searchOrder } from "./cloudSearch";
|
|
12
12
|
import scanCache from "./scanCache";
|
|
13
|
+
import { isSelfServicePlatform } from "../../../../utils/platform";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Promise.any 的替代实现
|
|
@@ -161,7 +162,7 @@ export var handleGlobalScan = function handleGlobalScan(request, localSearch, ch
|
|
|
161
162
|
if (value.startsWith('WL')) {
|
|
162
163
|
requestList = [searchWallet(request, value)];
|
|
163
164
|
} else {
|
|
164
|
-
requestList = [].concat(_toConsumableArray(channel
|
|
165
|
+
requestList = [].concat(_toConsumableArray(isSelfServicePlatform(channel) ? [] : [searchOrder(request, value)]), [searchWalletPass(request, value), searchWallet(request, value), searchProduct(request, value)]);
|
|
165
166
|
}
|
|
166
167
|
return requestList;
|
|
167
168
|
};
|
|
@@ -156,7 +156,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
156
156
|
/** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
|
|
157
157
|
ensureLocalOrderNumbersForCheckout(): Promise<void>;
|
|
158
158
|
/**
|
|
159
|
-
* PC/H5
|
|
159
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
160
160
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
161
161
|
*/
|
|
162
162
|
protected shouldUseCheckoutSyncTask(): boolean;
|