@pisell/pisellos 0.10.6 → 0.10.8
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/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Order/index.d.ts +14 -6
- package/dist/modules/Order/index.js +373 -246
- package/dist/modules/Order/types.d.ts +26 -3
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
- package/dist/modules/Rules/index.js +125 -52
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +810 -729
- package/dist/server/modules/order/index.d.ts +1 -0
- package/dist/server/modules/order/index.js +9 -2
- package/dist/server/modules/order/types.d.ts +1 -1
- package/dist/solution/BaseSales/index.d.ts +15 -5
- package/dist/solution/BaseSales/index.js +211 -159
- package/dist/solution/BaseSales/utils/cartPromotion.js +26 -3
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/dist/solution/BaseSales/utils.js +31 -20
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.js +19 -22
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/utils.js +31 -20
- package/dist/solution/UnifiedBookingSales/index.d.ts +16 -4
- package/dist/solution/UnifiedBookingSales/index.js +113 -48
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Order/index.d.ts +14 -6
- package/lib/modules/Order/index.js +192 -52
- package/lib/modules/Order/types.d.ts +26 -3
- package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
- package/lib/modules/Rules/index.js +100 -20
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/server/index.d.ts +6 -0
- package/lib/server/index.js +51 -0
- package/lib/server/modules/order/index.d.ts +1 -0
- package/lib/server/modules/order/index.js +9 -3
- package/lib/server/modules/order/types.d.ts +1 -1
- package/lib/solution/BaseSales/index.d.ts +15 -5
- package/lib/solution/BaseSales/index.js +64 -16
- package/lib/solution/BaseSales/utils/cartPromotion.js +26 -2
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BaseSales/utils.js +29 -18
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +6 -9
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/utils.js +29 -18
- package/lib/solution/UnifiedBookingSales/index.d.ts +16 -4
- package/lib/solution/UnifiedBookingSales/index.js +80 -26
- package/package.json +1 -1
|
@@ -40,6 +40,9 @@ import { BookingTicket } from "../BookingTicket";
|
|
|
40
40
|
export * from "./types";
|
|
41
41
|
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
42
42
|
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
43
|
+
function isRecord(value) {
|
|
44
|
+
return !!value && _typeof(value) === 'object' && !Array.isArray(value);
|
|
45
|
+
}
|
|
43
46
|
function pickLocalizedText(value) {
|
|
44
47
|
if (!value) return undefined;
|
|
45
48
|
if (typeof value === 'string') return value;
|
|
@@ -520,10 +523,17 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
520
523
|
return _this;
|
|
521
524
|
}
|
|
522
525
|
_createClass(UnifiedBookingSalesImpl, [{
|
|
526
|
+
key: "getSubmitOrderSalesChannel",
|
|
527
|
+
value: function getSubmitOrderSalesChannel() {
|
|
528
|
+
var _this$otherParams$cha, _this$otherParams;
|
|
529
|
+
var channel = String((_this$otherParams$cha = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
530
|
+
return channel || _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getSubmitOrderSalesChannel", this).call(this);
|
|
531
|
+
}
|
|
532
|
+
}, {
|
|
523
533
|
key: "isSessionStoragePersistEnabled",
|
|
524
534
|
value: function isSessionStoragePersistEnabled() {
|
|
525
|
-
var _this$
|
|
526
|
-
return Boolean(this.cacheId && ((_this$
|
|
535
|
+
var _this$otherParams2;
|
|
536
|
+
return Boolean(this.cacheId && ((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.enableSessionStoragePersist) === true);
|
|
527
537
|
}
|
|
528
538
|
}, {
|
|
529
539
|
key: "shouldUseSessionStorageForSubModule",
|
|
@@ -531,6 +541,60 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
531
541
|
return this.isSessionStoragePersistEnabled() && moduleName === 'order';
|
|
532
542
|
}
|
|
533
543
|
|
|
544
|
+
/**
|
|
545
|
+
* 读取与当前 cacheId 同分桶的 Solution 会话状态。
|
|
546
|
+
* 该状态独立于 otherParams,适合页面皮肤保存短生命周期 UI 状态。
|
|
547
|
+
*/
|
|
548
|
+
}, {
|
|
549
|
+
key: "getSessionStateValue",
|
|
550
|
+
value: function getSessionStateValue(key) {
|
|
551
|
+
if (!key || !this.isSessionStoragePersistEnabled()) return undefined;
|
|
552
|
+
var cacheData = this.readSessionCacheData();
|
|
553
|
+
var solutionCache = cacheData === null || cacheData === void 0 ? void 0 : cacheData[this.name];
|
|
554
|
+
if (!isRecord(solutionCache) || !isRecord(solutionCache.sessionState)) {
|
|
555
|
+
return undefined;
|
|
556
|
+
}
|
|
557
|
+
return solutionCache.sessionState[key];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* 写入与当前 cacheId 同分桶的 Solution 会话状态。
|
|
562
|
+
* value 为 undefined 时删除该 key;存储失败不阻断业务流程。
|
|
563
|
+
*/
|
|
564
|
+
}, {
|
|
565
|
+
key: "setSessionStateValue",
|
|
566
|
+
value: function setSessionStateValue(key, value) {
|
|
567
|
+
if (!key || !this.isSessionStoragePersistEnabled()) return;
|
|
568
|
+
var cacheData = this.readSessionCacheData();
|
|
569
|
+
var solutionCache = cacheData === null || cacheData === void 0 ? void 0 : cacheData[this.name];
|
|
570
|
+
var currentSessionState = isRecord(solutionCache) && isRecord(solutionCache.sessionState) ? solutionCache.sessionState : {};
|
|
571
|
+
var nextSessionState = _objectSpread({}, currentSessionState);
|
|
572
|
+
if (value === undefined) {
|
|
573
|
+
delete nextSessionState[key];
|
|
574
|
+
} else {
|
|
575
|
+
nextSessionState[key] = value;
|
|
576
|
+
}
|
|
577
|
+
this.checkSaveCache({
|
|
578
|
+
cacheId: this.cacheId,
|
|
579
|
+
fatherModule: this.name,
|
|
580
|
+
store: {
|
|
581
|
+
sessionState: nextSessionState
|
|
582
|
+
},
|
|
583
|
+
cacheKey: ['sessionState']
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* 清除当前 cacheId 的可恢复订单快照,同时保留 Solution UI sessionState。
|
|
589
|
+
* 用于支付跳转等终态场景,避免浏览器返回时恢复已提交订单。
|
|
590
|
+
*/
|
|
591
|
+
}, {
|
|
592
|
+
key: "clearSessionStorageOrderSnapshot",
|
|
593
|
+
value: function clearSessionStorageOrderSnapshot() {
|
|
594
|
+
var _this$store$order, _this$store$order$cle;
|
|
595
|
+
(_this$store$order = this.store.order) === null || _this$store$order === void 0 || (_this$store$order$cle = _this$store$order.clearSessionStoragePersistedTempOrder) === null || _this$store$order$cle === void 0 || _this$store$order$cle.call(_this$store$order);
|
|
596
|
+
}
|
|
597
|
+
|
|
534
598
|
/**
|
|
535
599
|
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
536
600
|
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
@@ -538,8 +602,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
538
602
|
}, {
|
|
539
603
|
key: "shouldUseCheckoutSyncTask",
|
|
540
604
|
value: function shouldUseCheckoutSyncTask() {
|
|
541
|
-
var _this$
|
|
542
|
-
var configured = (_this$
|
|
605
|
+
var _this$otherParams3;
|
|
606
|
+
var configured = (_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.checkoutSyncTaskEnabled;
|
|
543
607
|
return typeof configured === 'boolean' ? configured : false;
|
|
544
608
|
}
|
|
545
609
|
|
|
@@ -569,12 +633,12 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
569
633
|
key: "addNewOrder",
|
|
570
634
|
value: function () {
|
|
571
635
|
var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
572
|
-
var _this$store$
|
|
573
|
-
var sessionRecord, tempOrder, _this$store$
|
|
636
|
+
var _this$store$order2, _this$store$order2$co, _this$store$order4;
|
|
637
|
+
var sessionRecord, tempOrder, _this$store$order3, didSyncAuthenticatedCustomer;
|
|
574
638
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
575
639
|
while (1) switch (_context.prev = _context.next) {
|
|
576
640
|
case 0:
|
|
577
|
-
sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$
|
|
641
|
+
sessionRecord = this.isSessionStoragePersistEnabled() ? (_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || (_this$store$order2$co = _this$store$order2.consumeSessionStorageRestore) === null || _this$store$order2$co === void 0 ? void 0 : _this$store$order2$co.call(_this$store$order2) : null;
|
|
578
642
|
if (!sessionRecord) {
|
|
579
643
|
_context.next = 4;
|
|
580
644
|
break;
|
|
@@ -590,7 +654,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
590
654
|
case 6:
|
|
591
655
|
tempOrder = _context.sent;
|
|
592
656
|
if (sessionRecord) {
|
|
593
|
-
(_this$store$
|
|
657
|
+
(_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || _this$store$order3.persistTempOrder();
|
|
594
658
|
}
|
|
595
659
|
if (!this.isAuthenticatedCustomerUserPlatform()) {
|
|
596
660
|
_context.next = 23;
|
|
@@ -633,7 +697,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
633
697
|
_context.t1 = _context["catch"](24);
|
|
634
698
|
console.warn('[UnifiedBookingSales] Failed to refresh cached customer discounts after addNewOrder', _context.t1);
|
|
635
699
|
case 32:
|
|
636
|
-
return _context.abrupt("return", ((_this$store$
|
|
700
|
+
return _context.abrupt("return", ((_this$store$order4 = this.store.order) === null || _this$store$order4 === void 0 ? void 0 : _this$store$order4.getTempOrder()) || tempOrder);
|
|
637
701
|
case 33:
|
|
638
702
|
case "end":
|
|
639
703
|
return _context.stop();
|
|
@@ -697,15 +761,15 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
697
761
|
}, {
|
|
698
762
|
key: "isAuthenticatedCustomerUserPlatform",
|
|
699
763
|
value: function isAuthenticatedCustomerUserPlatform() {
|
|
700
|
-
var _this$
|
|
701
|
-
var platform = String(((_this$
|
|
764
|
+
var _this$otherParams4;
|
|
765
|
+
var platform = String(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.platform) || '').toLowerCase();
|
|
702
766
|
return platform === 'pc' || platform === 'h5';
|
|
703
767
|
}
|
|
704
768
|
}, {
|
|
705
769
|
key: "resolveDiscountOrderIdentity",
|
|
706
770
|
value: function resolveDiscountOrderIdentity(tempOrder) {
|
|
707
|
-
var _this$store$
|
|
708
|
-
return (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this$store$
|
|
771
|
+
var _this$store$order5, _this$store$order5$ge;
|
|
772
|
+
return (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.order_id) || ((_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || (_this$store$order5$ge = _this$store$order5.getOrderIdentity) === null || _this$store$order5$ge === void 0 || (_this$store$order5$ge = _this$store$order5$ge.call(_this$store$order5)) === null || _this$store$order5$ge === void 0 ? void 0 : _this$store$order5$ge.orderId) || null;
|
|
709
773
|
}
|
|
710
774
|
}, {
|
|
711
775
|
key: "resolveDiscountAction",
|
|
@@ -717,16 +781,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
717
781
|
key: "resetCachedCustomerDiscountState",
|
|
718
782
|
value: function () {
|
|
719
783
|
var _resetCachedCustomerDiscountState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
720
|
-
var _this$store$
|
|
784
|
+
var _this$store$order6, _this$store$order6$cl, _this$store$customer2, _this$store$customer3, _this$store$order7, _discountModule$getOr, _discountModule$getDi, _discountModule$setOr, _discountModule$setDi, _this$store$order8, _this$store$order8$ap, _this$store$order9, _this$store$order9$re, _this$store$order10, _this$store$order10$p;
|
|
721
785
|
var orderStore, discountModule, filteredOriginalDiscounts, filteredCurrentDiscounts;
|
|
722
786
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
723
787
|
while (1) switch (_context3.prev = _context3.next) {
|
|
724
788
|
case 0:
|
|
725
|
-
(_this$store$
|
|
789
|
+
(_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 || (_this$store$order6$cl = _this$store$order6.clearOrderCustomer) === null || _this$store$order6$cl === void 0 || _this$store$order6$cl.call(_this$store$order6);
|
|
726
790
|
(_this$store$customer2 = this.store.customer) === null || _this$store$customer2 === void 0 || (_this$store$customer3 = _this$store$customer2.setSelectedCustomer) === null || _this$store$customer3 === void 0 || _this$store$customer3.call(_this$store$customer2, null);
|
|
727
791
|
this.discountConfigCacheKey = null;
|
|
728
792
|
this.hasManualDiscountSelection = false;
|
|
729
|
-
orderStore = ((_this$store$
|
|
793
|
+
orderStore = ((_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 ? void 0 : _this$store$order7.store) || {};
|
|
730
794
|
discountModule = orderStore.discount;
|
|
731
795
|
filteredOriginalDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || []);
|
|
732
796
|
filteredCurrentDiscounts = filterCustomerBoundDiscounts((discountModule === null || discountModule === void 0 || (_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || []);
|
|
@@ -736,13 +800,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
736
800
|
_context3.next = 12;
|
|
737
801
|
return discountModule === null || discountModule === void 0 || (_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, filteredCurrentDiscounts);
|
|
738
802
|
case 12:
|
|
739
|
-
(_this$store$
|
|
803
|
+
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || (_this$store$order8$ap = _this$store$order8.applyDiscount) === null || _this$store$order8$ap === void 0 || _this$store$order8$ap.call(_this$store$order8);
|
|
740
804
|
_context3.next = 15;
|
|
741
|
-
return (_this$store$
|
|
805
|
+
return (_this$store$order9 = this.store.order) === null || _this$store$order9 === void 0 || (_this$store$order9$re = _this$store$order9.recalculateSummary) === null || _this$store$order9$re === void 0 ? void 0 : _this$store$order9$re.call(_this$store$order9, {
|
|
742
806
|
createIfMissing: true
|
|
743
807
|
});
|
|
744
808
|
case 15:
|
|
745
|
-
(_this$store$
|
|
809
|
+
(_this$store$order10 = this.store.order) === null || _this$store$order10 === void 0 || (_this$store$order10$p = _this$store$order10.persistTempOrder) === null || _this$store$order10$p === void 0 || _this$store$order10$p.call(_this$store$order10);
|
|
746
810
|
case 16:
|
|
747
811
|
case "end":
|
|
748
812
|
return _context3.stop();
|
|
@@ -877,13 +941,13 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
877
941
|
key: "getOpenData",
|
|
878
942
|
value: function () {
|
|
879
943
|
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
880
|
-
var _this$
|
|
944
|
+
var _this$otherParams5, _this$otherParams6, _this$store$openData;
|
|
881
945
|
var businessCode, channel, target, cachedData;
|
|
882
946
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
883
947
|
while (1) switch (_context6.prev = _context6.next) {
|
|
884
948
|
case 0:
|
|
885
|
-
businessCode = String(((_this$
|
|
886
|
-
channel = String(((_this$
|
|
949
|
+
businessCode = String(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.businessCode) || '').trim();
|
|
950
|
+
channel = String(((_this$otherParams6 = this.otherParams) === null || _this$otherParams6 === void 0 ? void 0 : _this$otherParams6.channel) || '').trim();
|
|
887
951
|
if (!(!businessCode || !channel)) {
|
|
888
952
|
_context6.next = 4;
|
|
889
953
|
break;
|
|
@@ -1135,32 +1199,33 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
1135
1199
|
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
1136
1200
|
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
1137
1201
|
*/
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1202
|
+
// getCart(): BookingTicketCartView {
|
|
1203
|
+
// const tempOrder = this.getTempOrder();
|
|
1204
|
+
// const salesDetail = this.getSalesOrder();
|
|
1205
|
+
// const items = tempOrder?.products || [];
|
|
1206
|
+
// const bookings = salesDetail?.bookings || tempOrder?.bookings || [];
|
|
1207
|
+
// return {
|
|
1208
|
+
// items,
|
|
1209
|
+
// bookings: bookings.map((booking: any) => {
|
|
1210
|
+
// const productUid = booking?.product_uid;
|
|
1211
|
+
// const product = productUid
|
|
1212
|
+
// ? items.find((item: any) => {
|
|
1213
|
+
// const uid = item?.metadata?.unique_identification_number || item?.unique_identification_number;
|
|
1214
|
+
// return String(uid || '') === String(productUid);
|
|
1215
|
+
// }) || null
|
|
1216
|
+
// : null;
|
|
1217
|
+
// return {
|
|
1218
|
+
// ...booking,
|
|
1219
|
+
// _extend: {
|
|
1220
|
+
// ...(booking?._extend || {}),
|
|
1221
|
+
// product,
|
|
1222
|
+
// addTimeProduct: [],
|
|
1223
|
+
// canAddTime: false,
|
|
1224
|
+
// },
|
|
1225
|
+
// };
|
|
1226
|
+
// }),
|
|
1227
|
+
// };
|
|
1228
|
+
// }
|
|
1164
1229
|
|
|
1165
1230
|
/**
|
|
1166
1231
|
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
|
|
34
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
35
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
36
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
37
|
-
default: () => import_adapter2.default
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
40
|
-
var import_evaluator = require("./evaluator");
|
|
41
|
-
var import_adapter = require("./adapter");
|
|
42
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
43
|
-
var import_examples = require("./examples");
|
|
44
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
-
0 && (module.exports = {
|
|
46
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
47
|
-
ITEM_REWARD_STRATEGY,
|
|
48
|
-
PromotionAdapter,
|
|
49
|
-
PromotionEvaluator,
|
|
50
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
51
|
-
});
|
|
@@ -149,7 +149,9 @@ function mapOrderBundleToOtherBundle(bundle) {
|
|
|
149
149
|
return bundle.map((item) => {
|
|
150
150
|
return {
|
|
151
151
|
...item,
|
|
152
|
-
|
|
152
|
+
// 后端历史订单可能没有 original_price;此时 price 是折前毛价,
|
|
153
|
+
// bundle_selling_price 已包含折扣,不能把它当成编辑时的新原价。
|
|
154
|
+
original_price: item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price
|
|
153
155
|
};
|
|
154
156
|
});
|
|
155
157
|
}
|
|
@@ -3,7 +3,7 @@ import { BaseModule } from '../BaseModule';
|
|
|
3
3
|
import { OrderModuleAPI, CommitOrderParams, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, CancelOrderParams, ChangeBookingStatusParams, CheckoutOrderParams } from './types';
|
|
4
4
|
import { CartItem } from '../Cart/types';
|
|
5
5
|
import { type SubmitPayloadEnhancer } from './utils';
|
|
6
|
-
import type { OrderAmountSnapshot, AddProductBookingInput, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions } from './types';
|
|
6
|
+
import type { OrderAmountSnapshot, AddProductBookingInput, AddProductToOrderOptions, OrderIdentitySnapshot, OrderPaymentSource, OrderSnapshot, OrderSyncState, SyncPaymentsToOrderParams, SyncPaymentsToOrderResult, SubmitSalesOrderParams, OrderProduct, OrderProductIdentity, OrderSummary, OrderTempOrder, OrderPaymentData, OrderPaymentUpdateOptions, OrderPaymentUpdateResult, SendCustomerPayLinkParams, UpdateTempOrderCustomerInput, OrderCustomerPatch, OrderCustomerView, ReplaceTempOrderOptions, OrderPromotionEvaluator, OrderGiftSelectResolver, OrderUnfulfilledPromotion, OrderLastGiftActions, RemoveProductsFromOrderOptions } from './types';
|
|
7
7
|
import type { ICustomer } from '../AccountList/types';
|
|
8
8
|
import type { Discount } from '../Discount/types';
|
|
9
9
|
import { UnavailableReason } from '../Rules/types';
|
|
@@ -156,6 +156,13 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
156
156
|
* sessionStorage 的 cacheId 分桶。写入失败由 BaseModule 静默降级。
|
|
157
157
|
*/
|
|
158
158
|
persistTempOrder(): void;
|
|
159
|
+
/**
|
|
160
|
+
* 终止当前模块实例的 sessionStorage 订单恢复会话。
|
|
161
|
+
*
|
|
162
|
+
* 支付跳转等终态场景需要同时删除当前 cacheId 的 tempOrder 快照,并关闭
|
|
163
|
+
* 本实例后续异步任务的再次写入;新模块实例初始化时会按 otherParams 重新启用。
|
|
164
|
+
*/
|
|
165
|
+
clearSessionStoragePersistedTempOrder(): void;
|
|
159
166
|
consumeSessionStorageRestore(): Record<string, any> | null;
|
|
160
167
|
notifyTempOrderChanged(): void;
|
|
161
168
|
private createDefaultTempOrderInstance;
|
|
@@ -237,6 +244,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
237
244
|
private sanitizeOrderProductForTempOrder;
|
|
238
245
|
private sanitizeTempOrderProducts;
|
|
239
246
|
private ensureExtend;
|
|
247
|
+
private repairDuplicateProductLineIdentities;
|
|
240
248
|
private captureProductRuntime;
|
|
241
249
|
private createLinkedProductAndBooking;
|
|
242
250
|
/**
|
|
@@ -395,7 +403,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
395
403
|
* await order.addProductToOrder({ product_id: 1, num: 3 }, { start_time: '10:00' });
|
|
396
404
|
* // → tempOrder.products 新增 3 行,每行 num=1,bookings 3 条
|
|
397
405
|
*/
|
|
398
|
-
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput): Promise<OrderProduct[]>;
|
|
406
|
+
addProductToOrder(product: Partial<OrderProduct> & OrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<OrderProduct[]>;
|
|
399
407
|
/**
|
|
400
408
|
* 批量添加商品行,所有行追加完成后只触发一次促销、折扣、summary 重算与持久化。
|
|
401
409
|
*
|
|
@@ -433,8 +441,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
433
441
|
* @example
|
|
434
442
|
* await order.removeProductsFromOrder([identityA, identityB]);
|
|
435
443
|
*/
|
|
436
|
-
removeProductsFromOrder(identities: OrderProductIdentity[]): Promise<OrderProduct[]>;
|
|
437
|
-
removeProductFromOrder(identity: OrderProductIdentity): Promise<OrderProduct[]>;
|
|
444
|
+
removeProductsFromOrder(identities: OrderProductIdentity[], options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
445
|
+
removeProductFromOrder(identity: OrderProductIdentity, options?: RemoveProductsFromOrderOptions): Promise<OrderProduct[]>;
|
|
438
446
|
/**
|
|
439
447
|
* 仅清空购物车行(products / bookings),不重置整单。
|
|
440
448
|
* 用于「仅清空商品」;客户、备注、支付等协议字段保持不变。
|
|
@@ -497,7 +505,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
497
505
|
generateIdempotencyToken(): string;
|
|
498
506
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
499
507
|
createOrder(params: CommitOrderParams['query']): {
|
|
500
|
-
type: "
|
|
508
|
+
type: "appointment_booking" | "virtual";
|
|
501
509
|
platform: string;
|
|
502
510
|
sales_channel: string;
|
|
503
511
|
order_sales_channel: string;
|
|
@@ -574,4 +582,4 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
574
582
|
getOrderInfo(order_id: number): Promise<any>;
|
|
575
583
|
getVouchers(): any[];
|
|
576
584
|
}
|
|
577
|
-
export type { UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|
|
585
|
+
export type { AddProductToOrderOptions, RemoveProductsFromOrderOptions, UpdateOrderBookingParams, UpdateOrderProductParams, UpdateOrderProductQuantityParams, } from './types';
|