@pisell/pisellos 0.10.40 → 0.10.41
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 +0 -9
- package/dist/modules/Customer/index.js +4 -2
- package/dist/modules/Customer/types.d.ts +2 -0
- 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/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +2 -1
- package/dist/solution/BookingByStep/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.d.ts +1 -2
- package/dist/solution/BookingTicket/index.js +60 -63
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +266 -150
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +5 -3
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +8 -4
- package/lib/modules/Customer/index.js +4 -1
- package/lib/modules/Customer/types.d.ts +2 -0
- 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/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +2 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.d.ts +1 -2
- package/lib/solution/BookingTicket/index.js +36 -33
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +2 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +127 -42
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +5 -3
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +7 -3
- package/package.json +1 -1
|
@@ -184,6 +184,7 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
184
184
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
185
185
|
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
186
186
|
_defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
|
|
187
|
+
_defineProperty(_assertThisInitialized(_this), "customerResolveRequests", new Map());
|
|
187
188
|
return _this;
|
|
188
189
|
}
|
|
189
190
|
_createClass(BookingTicketImpl, [{
|
|
@@ -755,31 +756,43 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
755
756
|
hasOrderCustomer = Boolean(this.store.order.getOrderCustomer());
|
|
756
757
|
isUserPlatform = USER_PLATFORM.includes(this.otherParams.platform); // 缺 Holder 等场景 isAvailable=false,但仍需把 Pass 归属客户带入订单,供 Holder 弹窗使用。
|
|
757
758
|
if (!(!hasOrderCustomer && extractedCustomerId && !isUserPlatform)) {
|
|
758
|
-
_context10.next =
|
|
759
|
+
_context10.next = 18;
|
|
759
760
|
break;
|
|
760
761
|
}
|
|
761
|
-
_context10.
|
|
762
|
+
_context10.prev = 10;
|
|
763
|
+
_context10.next = 13;
|
|
762
764
|
return this.hydrateOrderCustomerFromScanDiscounts(scannedList);
|
|
763
|
-
case
|
|
765
|
+
case 13:
|
|
766
|
+
_context10.next = 18;
|
|
767
|
+
break;
|
|
768
|
+
case 15:
|
|
769
|
+
_context10.prev = 15;
|
|
770
|
+
_context10.t0 = _context10["catch"](10);
|
|
771
|
+
// 客户映射失败不能阻断原有 Pass 的可用性、展示或优惠处理。
|
|
772
|
+
console.warn('[BookingTicket] scan discount customer resolve failed', {
|
|
773
|
+
customerId: extractedCustomerId,
|
|
774
|
+
error: _context10.t0
|
|
775
|
+
});
|
|
776
|
+
case 18:
|
|
764
777
|
if (!raw.isAvailable) {
|
|
765
|
-
_context10.next =
|
|
778
|
+
_context10.next = 25;
|
|
766
779
|
break;
|
|
767
780
|
}
|
|
768
|
-
_context10.next =
|
|
781
|
+
_context10.next = 21;
|
|
769
782
|
return this.store.order.recalculateSummary({
|
|
770
783
|
createIfMissing: true
|
|
771
784
|
});
|
|
772
|
-
case
|
|
785
|
+
case 21:
|
|
773
786
|
this.store.order.persistTempOrder();
|
|
774
787
|
tempOrder = this.store.order.ensureTempOrder();
|
|
775
|
-
_context10.next =
|
|
788
|
+
_context10.next = 25;
|
|
776
789
|
return this.effectsEmit('onDiscountApplied', {
|
|
777
790
|
productList: tempOrder.products || [],
|
|
778
791
|
discountList: this.store.order.getDiscountList(),
|
|
779
792
|
selectedDiscountList: tempOrder.discount_list || [],
|
|
780
793
|
tempOrder: tempOrder
|
|
781
794
|
});
|
|
782
|
-
case
|
|
795
|
+
case 25:
|
|
783
796
|
return _context10.abrupt("return", _objectSpread(_objectSpread({
|
|
784
797
|
isAvailable: raw.isAvailable
|
|
785
798
|
}, raw.isAccepted !== undefined ? {
|
|
@@ -789,11 +802,11 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
789
802
|
unavailableReason: raw.unavailableReason,
|
|
790
803
|
scannedDiscountList: raw.scannedDiscountList
|
|
791
804
|
}));
|
|
792
|
-
case
|
|
805
|
+
case 26:
|
|
793
806
|
case "end":
|
|
794
807
|
return _context10.stop();
|
|
795
808
|
}
|
|
796
|
-
}, _callee10, this);
|
|
809
|
+
}, _callee10, this, [[10, 15]]);
|
|
797
810
|
}));
|
|
798
811
|
function scanPromotionCode(_x4, _x5) {
|
|
799
812
|
return _scanPromotionCode.apply(this, arguments);
|
|
@@ -875,54 +888,51 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
875
888
|
key: "resolveCustomerById",
|
|
876
889
|
value: function () {
|
|
877
890
|
var _resolveCustomerById = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(customerId) {
|
|
878
|
-
var
|
|
879
|
-
var
|
|
891
|
+
var _this2 = this;
|
|
892
|
+
var rawCustomerId, numericCustomerId, normalizedCustomerId, existingRequest, request;
|
|
880
893
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
881
894
|
while (1) switch (_context12.prev = _context12.next) {
|
|
882
895
|
case 0:
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
_context12.next = 5;
|
|
896
|
+
rawCustomerId = String(customerId !== null && customerId !== void 0 ? customerId : '').trim();
|
|
897
|
+
numericCustomerId = Number(rawCustomerId);
|
|
898
|
+
if (!(!rawCustomerId || !Number.isInteger(numericCustomerId) || numericCustomerId <= 1)) {
|
|
899
|
+
_context12.next = 4;
|
|
888
900
|
break;
|
|
889
901
|
}
|
|
890
|
-
return _context12.abrupt("return",
|
|
891
|
-
case
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
num: 1
|
|
897
|
-
});
|
|
898
|
-
case 7:
|
|
899
|
-
result = _context12.sent;
|
|
900
|
-
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;
|
|
901
|
-
if (!remoteCustomer) {
|
|
902
|
-
_context12.next = 11;
|
|
902
|
+
return _context12.abrupt("return", null);
|
|
903
|
+
case 4:
|
|
904
|
+
normalizedCustomerId = String(numericCustomerId);
|
|
905
|
+
existingRequest = this.customerResolveRequests.get(normalizedCustomerId);
|
|
906
|
+
if (!existingRequest) {
|
|
907
|
+
_context12.next = 8;
|
|
903
908
|
break;
|
|
904
909
|
}
|
|
905
|
-
return _context12.abrupt("return",
|
|
906
|
-
case
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
910
|
+
return _context12.abrupt("return", existingRequest);
|
|
911
|
+
case 8:
|
|
912
|
+
request = this.request.post("/customer/resolve/".concat(encodeURIComponent(normalizedCustomerId)), {
|
|
913
|
+
with_franchisor_data: 1,
|
|
914
|
+
with: ['latestWalletDetail.wallet', 'contactsInfo', 'formRecord']
|
|
915
|
+
}).then(function (result) {
|
|
916
|
+
var customer = result === null || result === void 0 ? void 0 : result.data;
|
|
917
|
+
var resolvedCustomerId = Number(customer && _typeof(customer) === 'object' && !Array.isArray(customer) ? _this2.getRawCustomerId(customer) : NaN);
|
|
918
|
+
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) {
|
|
919
|
+
var error = new Error((result === null || result === void 0 ? void 0 : result.message) || 'Customer resolve failed');
|
|
920
|
+
error.code = result === null || result === void 0 ? void 0 : result.code;
|
|
921
|
+
throw error;
|
|
922
|
+
}
|
|
923
|
+
return _this2.normalizeCustomer(customer);
|
|
924
|
+
}).finally(function () {
|
|
925
|
+
if (_this2.customerResolveRequests.get(normalizedCustomerId) === request) {
|
|
926
|
+
_this2.customerResolveRequests.delete(normalizedCustomerId);
|
|
927
|
+
}
|
|
919
928
|
});
|
|
920
|
-
|
|
921
|
-
|
|
929
|
+
this.customerResolveRequests.set(normalizedCustomerId, request);
|
|
930
|
+
return _context12.abrupt("return", request);
|
|
931
|
+
case 11:
|
|
922
932
|
case "end":
|
|
923
933
|
return _context12.stop();
|
|
924
934
|
}
|
|
925
|
-
}, _callee12, this
|
|
935
|
+
}, _callee12, this);
|
|
926
936
|
}));
|
|
927
937
|
function resolveCustomerById(_x7) {
|
|
928
938
|
return _resolveCustomerById.apply(this, arguments);
|
|
@@ -934,17 +944,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
934
944
|
value: function resolveCustomerByDiscountCustomerId(customerId) {
|
|
935
945
|
return this.resolveCustomerById(customerId);
|
|
936
946
|
}
|
|
937
|
-
}, {
|
|
938
|
-
key: "findCustomerById",
|
|
939
|
-
value: function findCustomerById() {
|
|
940
|
-
var _this2 = this;
|
|
941
|
-
var customers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
942
|
-
var customerId = arguments.length > 1 ? arguments[1] : undefined;
|
|
943
|
-
return customers.find(function (customer) {
|
|
944
|
-
var rawId = _this2.getRawCustomerId(customer);
|
|
945
|
-
return rawId !== null && String(rawId) === String(customerId);
|
|
946
|
-
}) || null;
|
|
947
|
-
}
|
|
948
947
|
}, {
|
|
949
948
|
key: "normalizeCustomer",
|
|
950
949
|
value: function normalizeCustomer(customer) {
|
|
@@ -967,11 +966,6 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
967
966
|
var raw = customer;
|
|
968
967
|
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;
|
|
969
968
|
}
|
|
970
|
-
}, {
|
|
971
|
-
key: "hasUsableCustomerDetails",
|
|
972
|
-
value: function hasUsableCustomerDetails(customer) {
|
|
973
|
-
return !!(customer.name || customer.phone || customer.email || customer.display_name || customer.customer_name);
|
|
974
|
-
}
|
|
975
969
|
|
|
976
970
|
/**
|
|
977
971
|
* 更新当前预约的 appointment_status。
|
|
@@ -2695,6 +2689,9 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2695
2689
|
getOrderCustomerSnapshot: function getOrderCustomerSnapshot() {
|
|
2696
2690
|
return _this7.getOrderCustomerSnapshot();
|
|
2697
2691
|
},
|
|
2692
|
+
resolveCustomerById: function resolveCustomerById(customerId) {
|
|
2693
|
+
return _this7.resolveCustomerById(customerId);
|
|
2694
|
+
},
|
|
2698
2695
|
getBusinessCode: function getBusinessCode() {
|
|
2699
2696
|
var _this7$otherParams;
|
|
2700
2697
|
return (_this7$otherParams = _this7.otherParams) === null || _this7$otherParams === void 0 ? void 0 : _this7$otherParams.businessCode;
|
|
@@ -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';
|