@pisell/pisellos 2.3.123 → 2.3.124
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/walletPass/evaluator.d.ts +2 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.js +4 -2
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +58 -19
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +24 -12
- package/dist/modules/Customer/index.js +6 -3
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/availability.d.ts +7 -0
- package/dist/modules/Discount/availability.js +49 -0
- package/dist/modules/Discount/entitlementPass.d.ts +34 -0
- package/dist/modules/Discount/entitlementPass.js +147 -0
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +37 -151
- package/dist/modules/Discount/types.d.ts +36 -5
- package/dist/modules/Order/index.d.ts +7 -1
- package/dist/modules/Order/index.js +437 -229
- package/dist/modules/Order/utils/orderCollectionIdentity.js +16 -12
- package/dist/modules/Order/utils.d.ts +1 -1
- package/dist/modules/Order/utils.js +101 -60
- package/dist/modules/Payment/types.d.ts +21 -1
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Payment/walletpass.d.ts +1 -1
- package/dist/modules/Payment/walletpass.js +80 -47
- package/dist/modules/Rules/index.d.ts +2 -2
- package/dist/modules/Rules/index.js +480 -186
- package/dist/modules/Rules/types.d.ts +4 -0
- package/dist/server/modules/order/types.d.ts +2 -0
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +5 -2
- package/dist/solution/BaseSales/types.d.ts +2 -2
- package/dist/solution/BaseSales/utils/cartPromotion.js +141 -126
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +1 -2
- package/dist/solution/BookingTicket/index.js +60 -63
- package/dist/solution/BookingTicket/types.d.ts +5 -1
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +338 -147
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +19 -6
- package/dist/solution/ShopDiscount/index.d.ts +2 -0
- package/dist/solution/ShopDiscount/index.js +99 -42
- package/dist/solution/ShopDiscount/utils.d.ts +4 -2
- package/dist/solution/ShopDiscount/utils.js +43 -23
- package/dist/solution/UnifiedBookingSales/index.js +2 -2
- package/lib/model/strategy/adapter/walletPass/evaluator.d.ts +2 -0
- package/lib/model/strategy/adapter/walletPass/evaluator.js +2 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +35 -6
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +13 -6
- package/lib/modules/Customer/index.js +5 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/availability.d.ts +7 -0
- package/lib/modules/Discount/availability.js +43 -0
- package/lib/modules/Discount/entitlementPass.d.ts +34 -0
- package/lib/modules/Discount/entitlementPass.js +141 -0
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +23 -129
- package/lib/modules/Discount/types.d.ts +36 -5
- package/lib/modules/Order/index.d.ts +7 -1
- package/lib/modules/Order/index.js +213 -40
- package/lib/modules/Order/utils/orderCollectionIdentity.js +14 -11
- package/lib/modules/Order/utils.d.ts +1 -1
- package/lib/modules/Order/utils.js +39 -3
- package/lib/modules/Payment/types.d.ts +21 -1
- package/lib/modules/Payment/types.js +1 -0
- package/lib/modules/Payment/walletpass.d.ts +1 -1
- package/lib/modules/Payment/walletpass.js +29 -9
- package/lib/modules/Rules/index.d.ts +2 -2
- package/lib/modules/Rules/index.js +357 -110
- package/lib/modules/Rules/types.d.ts +4 -0
- package/lib/server/modules/order/types.d.ts +2 -0
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +5 -2
- package/lib/solution/BaseSales/types.d.ts +2 -2
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -4
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +1 -2
- package/lib/solution/BookingTicket/index.js +36 -33
- package/lib/solution/BookingTicket/types.d.ts +5 -1
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +174 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +8 -4
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +6 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +11 -3
- package/lib/solution/ShopDiscount/index.d.ts +2 -0
- package/lib/solution/ShopDiscount/index.js +55 -9
- package/lib/solution/ShopDiscount/utils.d.ts +4 -2
- package/lib/solution/ShopDiscount/utils.js +42 -25
- package/lib/solution/UnifiedBookingSales/index.js +2 -2
- package/package.json +1 -1
|
@@ -182,6 +182,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
182
182
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshCustomerId", null);
|
|
183
183
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerDiscountRefreshTarget", null);
|
|
184
184
|
_defineProperty(_assertThisInitialized(_this), "orderCustomerPromotionRefreshInFlight", null);
|
|
185
|
+
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
185
186
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
186
187
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
187
188
|
_defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
|
|
@@ -756,31 +757,43 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
756
757
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
757
758
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
758
759
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
759
|
-
_context10.next =
|
|
760
|
+
_context10.next = 18;
|
|
760
761
|
break;
|
|
761
762
|
}
|
|
762
|
-
_context10.
|
|
763
|
+
_context10.prev = 10;
|
|
764
|
+
_context10.next = 13;
|
|
763
765
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
764
|
-
case
|
|
766
|
+
case 13:
|
|
767
|
+
_context10.next = 18;
|
|
768
|
+
break;
|
|
769
|
+
case 15:
|
|
770
|
+
_context10.prev = 15;
|
|
771
|
+
_context10.t0 = _context10["catch"](10);
|
|
772
|
+
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
773
|
+
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
774
|
+
customerId: extractedCustomerId,
|
|
775
|
+
error: _context10.t0
|
|
776
|
+
});
|
|
777
|
+
case 18:
|
|
765
778
|
if (!raw.isAvailable) {
|
|
766
|
-
_context10.next =
|
|
779
|
+
_context10.next = 25;
|
|
767
780
|
break;
|
|
768
781
|
}
|
|
769
|
-
_context10.next =
|
|
782
|
+
_context10.next = 21;
|
|
770
783
|
return this.store.order.recalculateSummary({
|
|
771
784
|
createIfMissing: true
|
|
772
785
|
});
|
|
773
|
-
case
|
|
786
|
+
case 21:
|
|
774
787
|
this.store.order.persistTempOrder();
|
|
775
788
|
tempOrder = this.store.order.ensureTempOrder();
|
|
776
|
-
_context10.next =
|
|
789
|
+
_context10.next = 25;
|
|
777
790
|
return this.effectsEmit('onDiscountApplied', {
|
|
778
791
|
productList: tempOrder.products || [],
|
|
779
792
|
discountList: this.store.order.getDiscountList(),
|
|
780
793
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
781
794
|
tempOrder: tempOrder
|
|
782
795
|
});
|
|
783
|
-
case
|
|
796
|
+
case 25:
|
|
784
797
|
return _context10.abrupt("return", _objectSpread(_objectSpread({
|
|
785
798
|
isAvailable: raw.isAvailable
|
|
786
799
|
}, raw.isAccepted !== undefined ? {
|
|
@@ -790,11 +803,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
790
803
|
unavailableReason: raw.unavailableReason,
|
|
791
804
|
scannedDiscountList: raw.scannedDiscountList
|
|
792
805
|
}));
|
|
793
|
-
case
|
|
806
|
+
case 26:
|
|
794
807
|
case "end":
|
|
795
808
|
return _context10.stop();
|
|
796
809
|
}
|
|
797
|
-
}, _callee10, this);
|
|
810
|
+
}, _callee10, this, [[10, 15]]);
|
|
798
811
|
}));
|
|
799
812
|
function scanPromotionCode(_x4, _x5) {
|
|
800
813
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -876,54 +889,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
876
889
|
key: "resolveCustomerById",
|
|
877
890
|
value: function () {
|
|
878
891
|
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
|
|
879
|
-
var
|
|
880
|
-
var
|
|
892
|
+
var _this2 = this;
|
|
893
|
+
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
881
894
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
882
895
|
while (1) switch (_context12.prev = _context12.next) {
|
|
883
896
|
case 0:
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
_context12.next = 5;
|
|
897
|
+
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
898
|
+
numericCustomerId = Number(rawCustomerId);
|
|
899
|
+
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
900
|
+
_context12.next = 4;
|
|
889
901
|
break;
|
|
890
902
|
}
|
|
891
|
-
return _context12.abrupt("return",
|
|
892
|
-
case
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
num: 1
|
|
898
|
-
});
|
|
899
|
-
case 7:
|
|
900
|
-
result = _context12.sent;
|
|
901
|
-
remoteCustomer = this.findCustomerById((result === null || result === void 0 ? void 0 : result.list) || [], customerId) || (result === null || result === void 0 || (_result$list = result.list) === null || _result$list === void 0 ? void 0 : _result$list[0]) || null;
|
|
902
|
-
if (!remoteCustomer) {
|
|
903
|
-
_context12.next = 11;
|
|
903
|
+
return _context12.abrupt("return", null);
|
|
904
|
+
case 4:
|
|
905
|
+
normalizedCustomerId = String(numericCustomerId);
|
|
906
|
+
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
907
|
+
if (!existingRequest) {
|
|
908
|
+
_context12.next = 8;
|
|
904
909
|
break;
|
|
905
910
|
}
|
|
906
|
-
return _context12.abrupt("return",
|
|
907
|
-
case
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
911
|
+
return _context12.abrupt("return", existingRequest);
|
|
912
|
+
case 8:
|
|
913
|
+
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
914
|
+
with_franchisor_data: 1,
|
|
915
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord']
|
|
916
|
+
}).then(function (result) {
|
|
917
|
+
var customer = result === null || result === void 0 ? void 0 : result.data;
|
|
918
|
+
var resolvedCustomerId = Number(customer && _typeof(customer) === 'object' && !Array.isArray(customer) ? _this2.getRawCustomerId(customer) : NaN);
|
|
919
|
+
if ((result === null || result === void 0 ? void 0 : result.status) !== true || (result === null || result === void 0 ? void 0 : result.code) !== 200 || !customer || _typeof(customer) !== 'object' || Array.isArray(customer) || !Number.isInteger(resolvedCustomerId) || resolvedCustomerId <= 1) {
|
|
920
|
+
var error = new Error((result === null || result === void 0 ? void 0 : result.message) || 'Customer resolve failed');
|
|
921
|
+
error.code = result === null || result === void 0 ? void 0 : result.code;
|
|
922
|
+
throw error;
|
|
923
|
+
}
|
|
924
|
+
return _this2.normalizeCustomer(customer);
|
|
925
|
+
}).finally(function () {
|
|
926
|
+
if (_this2.customerResolveRequests.get(normalizedCustomerId) === request) {
|
|
927
|
+
_this2.customerResolveRequests.delete(normalizedCustomerId);
|
|
928
|
+
}
|
|
920
929
|
});
|
|
921
|
-
|
|
922
|
-
|
|
930
|
+
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
931
|
+
return _context12.abrupt("return", request);
|
|
932
|
+
case 11:
|
|
923
933
|
case "end":
|
|
924
934
|
return _context12.stop();
|
|
925
935
|
}
|
|
926
|
-
}, _callee12, this
|
|
936
|
+
}, _callee12, this);
|
|
927
937
|
}));
|
|
928
938
|
function resolveCustomerById(_x7) {
|
|
929
939
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -935,17 +945,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
935
945
|
value: function resolveCustomerByDiscountCustomerId(customerId) {
|
|
936
946
|
return this.resolveCustomerById(customerId);
|
|
937
947
|
}
|
|
938
|
-
}, {
|
|
939
|
-
key: "findCustomerById",
|
|
940
|
-
value: function findCustomerById() {
|
|
941
|
-
var _this2 = this;
|
|
942
|
-
var customers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
943
|
-
var customerId = arguments.length > 1 ? arguments[1] : undefined;
|
|
944
|
-
return customers.find(function (customer) {
|
|
945
|
-
var rawId = _this2.getRawCustomerId(customer);
|
|
946
|
-
return rawId !== null && String(rawId) === String(customerId);
|
|
947
|
-
}) || null;
|
|
948
|
-
}
|
|
949
948
|
}, {
|
|
950
949
|
key: "normalizeCustomer",
|
|
951
950
|
value: function normalizeCustomer(customer) {
|
|
@@ -968,11 +967,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
968
967
|
var raw = customer;
|
|
969
968
|
return (_ref9 = (_ref10 = (_customer$id = customer.id) !== null && _customer$id !== void 0 ? _customer$id : raw.customer_id) !== null && _ref10 !== void 0 ? _ref10 : raw.customerId) !== null && _ref9 !== void 0 ? _ref9 : null;
|
|
970
969
|
}
|
|
971
|
-
}, {
|
|
972
|
-
key: "hasUsableCustomerDetails",
|
|
973
|
-
value: function hasUsableCustomerDetails(customer) {
|
|
974
|
-
return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
|
|
975
|
-
}
|
|
976
970
|
|
|
977
971
|
/**
|
|
978
972
|
* 更新当前预约的 appointment_status。
|
|
@@ -2716,6 +2710,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2716
2710
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2717
2711
|
return _this7.getOrderCustomerSnapshot();
|
|
2718
2712
|
},
|
|
2713
|
+
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
2714
|
+
return _this7.resolveCustomerById(customerId);
|
|
2715
|
+
},
|
|
2719
2716
|
getBusinessCode: function getBusinessCode() {
|
|
2720
2717
|
var _this7$otherParams;
|
|
2721
2718
|
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
@@ -230,12 +230,16 @@ export interface GlobalScanHostBridge {
|
|
|
230
230
|
/**
|
|
231
231
|
* walk-in 扫 walletPass:直接核销优惠码(对齐 SaleDetail Voucher.handleApplyCode / cart.scanCode)。
|
|
232
232
|
*/
|
|
233
|
-
applyPromotionCode?: (code: string, customerId?: number
|
|
233
|
+
applyPromotionCode?: (code: string, customerId?: number, options?: {
|
|
234
|
+
suppressFailureNotification?: boolean;
|
|
235
|
+
}) => Promise<{
|
|
234
236
|
isAvailable?: boolean;
|
|
235
237
|
isAccepted?: boolean;
|
|
236
238
|
type?: string;
|
|
237
239
|
unavailableReason?: string;
|
|
238
240
|
}>;
|
|
241
|
+
/** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
|
|
242
|
+
requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
|
|
239
243
|
onNotify?: (type: 'success' | 'fail' | 'info', messageKey?: string) => void;
|
|
240
244
|
refresh?: () => void;
|
|
241
245
|
}
|
|
@@ -5,6 +5,7 @@ import { GlobalScanFormattedResult } from './formatGlobalScan';
|
|
|
5
5
|
export interface GlobalScanApplyHost {
|
|
6
6
|
setOrderCustomer(customer: ICustomer | null): void;
|
|
7
7
|
getOrderCustomerSnapshot(): ICustomer | null;
|
|
8
|
+
resolveCustomerById?(customerId: string | number): Promise<ICustomer | null>;
|
|
8
9
|
getBusinessCode(): string | undefined;
|
|
9
10
|
buildAddProductCtx(extra?: Record<string, any>): Record<string, any>;
|
|
10
11
|
decideAddProduct(item: any, options?: Record<string, any>): AddProductDecision;
|
|
@@ -26,6 +27,7 @@ export interface GlobalScanApplyHost {
|
|
|
26
27
|
addProductToOrder(product: any, booking?: any): Promise<any>;
|
|
27
28
|
refreshWalletAssets?(params?: {
|
|
28
29
|
preserveSelection?: boolean;
|
|
30
|
+
retainSearchResultCodes?: string[];
|
|
29
31
|
}): Promise<any>;
|
|
30
32
|
scanWalletAsset?(code: string): Promise<{
|
|
31
33
|
type: 'walletCode' | 'normalCode';
|