@pisell/pisellos 2.3.48 → 2.3.49

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.
@@ -397,12 +397,18 @@ export interface WalletAssetsState {
397
397
  export interface WalletAssetsSnapshot {
398
398
  state: WalletAssetsState;
399
399
  searchResults: SearchIdentificationCodeItem[];
400
+ /** 已搜索但尚未满足订单条件、等待首次可用后自动选中的 Wallet Asset code。 */
401
+ pendingAutoSelectSearchCodes?: string[];
400
402
  walletParams: WalletDeductionRecommendParams | null;
401
403
  calculationContext: {
402
404
  orderTotalAmount: number;
403
405
  products: any[];
404
406
  };
405
407
  }
408
+ export interface WalletAssetsBehaviorOptions {
409
+ /** 搜索到 Wallet Asset 后,当前或后续首次可用时是否自动选中。 */
410
+ autoSelectAfterSearch?: boolean;
411
+ }
406
412
  export interface RefreshWalletAssetsOptions {
407
413
  /** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
408
414
  preserveSelection?: boolean;
@@ -472,6 +478,8 @@ export interface WalletPassPayment {
472
478
  refreshWalletAssetsFromBusinessAsync: (businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions) => Promise<WalletAssetsState>;
473
479
  /** 获取共享钱包资产状态快照。 */
474
480
  getWalletAssetsState: () => WalletAssetsState;
481
+ /** 配置仅影响 Wallet Assets 的交互行为。 */
482
+ configureWalletAssetsBehavior: (options: WalletAssetsBehaviorOptions) => void;
475
483
  /** 导出供 Shared Checkout 跨运行时传递的 Wallet Assets 快照。 */
476
484
  exportWalletAssetsSnapshot: () => WalletAssetsSnapshot;
477
485
  /** 恢复 Shared Checkout 传回的 Wallet Assets 快照。 */
@@ -1,4 +1,4 @@
1
- import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, RefreshWalletAssetsOptions, SelectWalletAssetOptions, ScanWalletAssetResult } from './types';
1
+ import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, RefreshWalletAssetsOptions, SelectWalletAssetOptions, ScanWalletAssetResult } from './types';
2
2
  import type { PaymentModule } from './index';
3
3
  /**
4
4
  * 钱包支付实现
@@ -12,8 +12,11 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
12
12
  private walletInitData;
13
13
  private walletAssetsState;
14
14
  private walletAssetsRequestSequence;
15
+ private walletAssetsBehavior;
16
+ private pendingAutoSelectSearchCodes;
15
17
  private walletAssetsCalculationContext;
16
18
  constructor(paymentModule: PaymentModule);
19
+ configureWalletAssetsBehavior(options: WalletAssetsBehaviorOptions): void;
17
20
  /**
18
21
  * 发送事件的辅助方法
19
22
  * 支持使用WalletPassHooks或PaymentHooks
@@ -28,6 +31,9 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
28
31
  * 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
29
32
  */
30
33
  private syncSearchedWalletAssets;
34
+ private isPendingAutoSelectAsset;
35
+ private clearPendingAutoSelectForAsset;
36
+ private queuePendingAutoSelectForAssets;
31
37
  /**
32
38
  * 生成钱包API默认参数
33
39
  * 根据业务数据生成标准的钱包API参数,并存储在模块中
@@ -39,6 +39,12 @@ function matchesWalletAssetCode(asset, normalizedCode) {
39
39
  return String(identifier !== null && identifier !== void 0 ? identifier : '').trim() === normalizedCode;
40
40
  });
41
41
  }
42
+ function normalizeWalletAssetCode(code) {
43
+ return String(code !== null && code !== void 0 ? code : '').trim().toUpperCase();
44
+ }
45
+ function getWalletAssetCodeKeys(asset) {
46
+ return [asset === null || asset === void 0 ? void 0 : asset.code, asset === null || asset === void 0 ? void 0 : asset.encoded].map(normalizeWalletAssetCode).filter(Boolean);
47
+ }
42
48
  function isWalletAssetAvailable(asset) {
43
49
  if (!asset) return false;
44
50
  if (asset.unified_available_status !== undefined && Number(asset.unified_available_status) !== 1) {
@@ -102,18 +108,31 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
102
108
  _defineProperty(this, "walletInitData", null);
103
109
  _defineProperty(this, "walletAssetsState", createInitialWalletAssetsState());
104
110
  _defineProperty(this, "walletAssetsRequestSequence", 0);
111
+ _defineProperty(this, "walletAssetsBehavior", {
112
+ autoSelectAfterSearch: true
113
+ });
114
+ _defineProperty(this, "pendingAutoSelectSearchCodes", new Set());
105
115
  _defineProperty(this, "walletAssetsCalculationContext", {
106
116
  orderTotalAmount: 0,
107
117
  products: []
108
118
  });
109
119
  this.paymentModule = paymentModule;
110
120
  }
111
-
112
- /**
113
- * 发送事件的辅助方法
114
- * 支持使用WalletPassHooks或PaymentHooks
115
- */
116
121
  _createClass(WalletPassPaymentImpl, [{
122
+ key: "configureWalletAssetsBehavior",
123
+ value: function configureWalletAssetsBehavior(options) {
124
+ if (options.autoSelectAfterSearch === undefined) return;
125
+ this.walletAssetsBehavior.autoSelectAfterSearch = options.autoSelectAfterSearch;
126
+ if (!options.autoSelectAfterSearch) {
127
+ this.pendingAutoSelectSearchCodes.clear();
128
+ }
129
+ }
130
+
131
+ /**
132
+ * 发送事件的辅助方法
133
+ * 支持使用WalletPassHooks或PaymentHooks
134
+ */
135
+ }, {
117
136
  key: "emitEvent",
118
137
  value: function emitEvent(hook, data) {
119
138
  try {
@@ -250,6 +269,33 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
250
269
  }
251
270
  return mergeWalletAssets(cachedAssets, refreshedAssets);
252
271
  }
272
+ }, {
273
+ key: "isPendingAutoSelectAsset",
274
+ value: function isPendingAutoSelectAsset(asset) {
275
+ var _this = this;
276
+ return getWalletAssetCodeKeys(asset).some(function (code) {
277
+ return _this.pendingAutoSelectSearchCodes.has(code);
278
+ });
279
+ }
280
+ }, {
281
+ key: "clearPendingAutoSelectForAsset",
282
+ value: function clearPendingAutoSelectForAsset(asset) {
283
+ var _this2 = this;
284
+ getWalletAssetCodeKeys(asset).forEach(function (code) {
285
+ _this2.pendingAutoSelectSearchCodes.delete(code);
286
+ });
287
+ }
288
+ }, {
289
+ key: "queuePendingAutoSelectForAssets",
290
+ value: function queuePendingAutoSelectForAssets(assets) {
291
+ var _this3 = this;
292
+ if (!this.walletAssetsBehavior.autoSelectAfterSearch) return;
293
+ assets.forEach(function (asset) {
294
+ getWalletAssetCodeKeys(asset).forEach(function (code) {
295
+ _this3.pendingAutoSelectSearchCodes.add(code);
296
+ });
297
+ });
298
+ }
253
299
 
254
300
  /**
255
301
  * 生成钱包API默认参数
@@ -960,7 +1006,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
960
1006
  key: "refreshWalletAssetsFromBusinessAsync",
961
1007
  value: (function () {
962
1008
  var _refreshWalletAssetsFromBusinessAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(businessData) {
963
- var _businessData$product2;
1009
+ var _businessData$product2,
1010
+ _this4 = this;
964
1011
  var options,
965
1012
  requestSequence,
966
1013
  nextCustomerId,
@@ -971,6 +1018,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
971
1018
  committedItems,
972
1019
  selectedIds,
973
1020
  selectionSources,
1021
+ scanSelectedAssets,
974
1022
  restoredSearchedAssets,
975
1023
  searchedWalletAssetCodes,
976
1024
  useAggregateRecalculate,
@@ -984,6 +1032,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
984
1032
  items,
985
1033
  latestSelectedIds,
986
1034
  latestSelectionSources,
1035
+ pendingAutoSelectAssets,
1036
+ requestedKeySet,
1037
+ nextState,
1038
+ selectedKeySet,
1039
+ droppedScanSelectedAssets,
987
1040
  _args8 = arguments;
988
1041
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
989
1042
  while (1) switch (_context8.prev = _context8.next) {
@@ -1004,12 +1057,18 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1004
1057
  return committedKeys.has(getWalletAssetKey(item));
1005
1058
  });
1006
1059
  selectedIds = preserveSelection ? _toConsumableArray(this.walletAssetsState.selectedIds) : [];
1007
- selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {}; // aggregate-recalculate 不接受空商品列表。
1008
- // 清空购物车时保留扫码资产供后续加购恢复,但必须取消当前选择。
1060
+ selectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
1061
+ scanSelectedAssets = preserveSelection ? this.walletAssetsState.selectedItems.filter(function (asset) {
1062
+ var assetId = getWalletAssetId(asset);
1063
+ return assetId !== undefined && assetId !== null && selectionSources[String(assetId)] === 'scan';
1064
+ }) : []; // aggregate-recalculate 不接受空商品列表。
1065
+ // 清空购物车时保留扫码资产供后续加购恢复;只有手动 Remove/Clear
1066
+ // 会取消自动应用资格,商品变化导致的自动失效需要重新进入待选队列。
1009
1067
  if ((_businessData$product2 = businessData.products) !== null && _businessData$product2 !== void 0 && _businessData$product2.length) {
1010
- _context8.next = 20;
1068
+ _context8.next = 22;
1011
1069
  break;
1012
1070
  }
1071
+ this.queuePendingAutoSelectForAssets(scanSelectedAssets);
1013
1072
  this.generateWalletParams(businessData);
1014
1073
  restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map(function (item) {
1015
1074
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -1044,7 +1103,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1044
1103
  totalSelectedAmount: 0,
1045
1104
  error: null
1046
1105
  }));
1047
- case 20:
1106
+ case 22:
1048
1107
  this.publishWalletAssetsState({
1049
1108
  status: 'loading',
1050
1109
  customerId: nextCustomerId,
@@ -1055,40 +1114,40 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1055
1114
  totalSelectedAmount: preserveSelection ? this.walletAssetsState.totalSelectedAmount : 0,
1056
1115
  error: null
1057
1116
  });
1058
- _context8.prev = 21;
1117
+ _context8.prev = 23;
1059
1118
  searchedWalletAssetCodes = preserveSelection ? this.getSearchedWalletAssetCodes() : [];
1060
1119
  useAggregateRecalculate = preserveSelection && (selectedIds.length > 0 || searchedWalletAssetCodes.length > 0);
1061
1120
  if (!useAggregateRecalculate) {
1062
- _context8.next = 30;
1121
+ _context8.next = 32;
1063
1122
  break;
1064
1123
  }
1065
- _context8.next = 27;
1124
+ _context8.next = 29;
1066
1125
  return this.aggregateRecalculateWalletAssetsAsync(businessData, selectedIds);
1067
- case 27:
1126
+ case 29:
1068
1127
  _context8.t0 = _context8.sent;
1069
- _context8.next = 31;
1128
+ _context8.next = 33;
1070
1129
  break;
1071
- case 30:
1130
+ case 32:
1072
1131
  _context8.t0 = null;
1073
- case 31:
1132
+ case 33:
1074
1133
  aggregateResult = _context8.t0;
1075
1134
  _context8.t1 = aggregateResult;
1076
1135
  if (_context8.t1) {
1077
- _context8.next = 37;
1136
+ _context8.next = 39;
1078
1137
  break;
1079
1138
  }
1080
- _context8.next = 36;
1139
+ _context8.next = 38;
1081
1140
  return this.initializeWalletDataFromBusinessAsync(businessData);
1082
- case 36:
1141
+ case 38:
1083
1142
  _context8.t1 = _context8.sent;
1084
- case 37:
1143
+ case 39:
1085
1144
  result = _context8.t1;
1086
1145
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
1087
- _context8.next = 40;
1146
+ _context8.next = 42;
1088
1147
  break;
1089
1148
  }
1090
1149
  return _context8.abrupt("return", this.getWalletAssetsState());
1091
- case 40:
1150
+ case 42:
1092
1151
  this.walletAssetsCalculationContext = {
1093
1152
  orderTotalAmount: Number(businessData.order_wait_pay_amount || 0),
1094
1153
  products: result.products || businessData.products || []
@@ -1111,11 +1170,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1111
1170
  }
1112
1171
  searchedWalletAssets = preserveSelection ? this.syncSearchedWalletAssets([].concat(_toConsumableArray(result.transformList || []), _toConsumableArray(result.noApplicableVoucher || []))) : [];
1113
1172
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
1114
- _context8.next = 46;
1173
+ _context8.next = 48;
1115
1174
  break;
1116
1175
  }
1117
1176
  return _context8.abrupt("return", this.getWalletAssetsState());
1118
- case 46:
1177
+ case 48:
1119
1178
  recommendedKeys = new Set((result.walletRecommendList || []).map(function (asset) {
1120
1179
  return getWalletAssetKey(asset);
1121
1180
  }));
@@ -1126,16 +1185,47 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1126
1185
  });
1127
1186
  latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
1128
1187
  latestSelectionSources = preserveSelection ? _objectSpread({}, this.walletAssetsState.selectionSources) : {};
1129
- return _context8.abrupt("return", this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources));
1130
- case 53:
1131
- _context8.prev = 53;
1132
- _context8.t2 = _context8["catch"](21);
1188
+ pendingAutoSelectAssets = this.walletAssetsBehavior.autoSelectAfterSearch ? items.filter(function (asset) {
1189
+ return _this4.isPendingAutoSelectAsset(asset) && isWalletAssetAvailable(asset);
1190
+ }) : [];
1191
+ requestedKeySet = new Set(latestSelectedIds.map(function (id) {
1192
+ return String(id);
1193
+ }));
1194
+ pendingAutoSelectAssets.forEach(function (asset) {
1195
+ var assetId = getWalletAssetId(asset);
1196
+ if (assetId === undefined || assetId === null) return;
1197
+ var assetKey = String(assetId);
1198
+ if (!requestedKeySet.has(assetKey)) {
1199
+ requestedKeySet.add(assetKey);
1200
+ latestSelectedIds.push(assetId);
1201
+ }
1202
+ latestSelectionSources[assetKey] = 'scan';
1203
+ });
1204
+ nextState = this.recalculateWalletAssets(items, latestSelectedIds, latestSelectionSources);
1205
+ selectedKeySet = new Set(nextState.selectedIds.map(function (id) {
1206
+ return String(id);
1207
+ }));
1208
+ pendingAutoSelectAssets.forEach(function (asset) {
1209
+ var assetId = getWalletAssetId(asset);
1210
+ if (assetId !== undefined && assetId !== null && selectedKeySet.has(String(assetId))) {
1211
+ _this4.clearPendingAutoSelectForAsset(asset);
1212
+ }
1213
+ });
1214
+ droppedScanSelectedAssets = scanSelectedAssets.filter(function (asset) {
1215
+ var assetId = getWalletAssetId(asset);
1216
+ return assetId !== undefined && assetId !== null && !selectedKeySet.has(String(assetId));
1217
+ });
1218
+ this.queuePendingAutoSelectForAssets(droppedScanSelectedAssets);
1219
+ return _context8.abrupt("return", nextState);
1220
+ case 63:
1221
+ _context8.prev = 63;
1222
+ _context8.t2 = _context8["catch"](23);
1133
1223
  if (!(requestSequence !== this.walletAssetsRequestSequence)) {
1134
- _context8.next = 57;
1224
+ _context8.next = 67;
1135
1225
  break;
1136
1226
  }
1137
1227
  return _context8.abrupt("return", this.getWalletAssetsState());
1138
- case 57:
1228
+ case 67:
1139
1229
  this.paymentModule.logError('[WalletPass] 刷新共享钱包资产失败,保留刷新前状态', _context8.t2, {
1140
1230
  customer_id: businessData.customer_id,
1141
1231
  selected_ids: selectedIds,
@@ -1151,11 +1241,11 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1151
1241
  customerId: nextCustomerId,
1152
1242
  error: _context8.t2 instanceof Error ? _context8.t2.message : String(_context8.t2)
1153
1243
  }));
1154
- case 59:
1244
+ case 69:
1155
1245
  case "end":
1156
1246
  return _context8.stop();
1157
1247
  }
1158
- }, _callee8, this, [[21, 53]]);
1248
+ }, _callee8, this, [[23, 63]]);
1159
1249
  }));
1160
1250
  function refreshWalletAssetsFromBusinessAsync(_x9) {
1161
1251
  return _refreshWalletAssetsFromBusinessAsync.apply(this, arguments);
@@ -1179,6 +1269,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1179
1269
  return {
1180
1270
  state: this.getWalletAssetsState(),
1181
1271
  searchResults: _toConsumableArray(this.searchResults),
1272
+ pendingAutoSelectSearchCodes: _toConsumableArray(this.pendingAutoSelectSearchCodes),
1182
1273
  walletParams: this.walletParams ? _objectSpread({}, this.walletParams) : null,
1183
1274
  calculationContext: {
1184
1275
  orderTotalAmount: this.walletAssetsCalculationContext.orderTotalAmount,
@@ -1193,6 +1284,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1193
1284
  if (!(snapshot !== null && snapshot !== void 0 && snapshot.state)) return this.getWalletAssetsState();
1194
1285
  this.walletAssetsRequestSequence += 1;
1195
1286
  this.searchResults = Array.isArray(snapshot.searchResults) ? _toConsumableArray(snapshot.searchResults) : [];
1287
+ this.pendingAutoSelectSearchCodes = this.walletAssetsBehavior.autoSelectAfterSearch && Array.isArray(snapshot.pendingAutoSelectSearchCodes) ? new Set(snapshot.pendingAutoSelectSearchCodes.map(normalizeWalletAssetCode).filter(Boolean)) : new Set();
1196
1288
  this.walletParams = snapshot.walletParams ? _objectSpread({}, snapshot.walletParams) : null;
1197
1289
  this.walletAssetsCalculationContext = {
1198
1290
  orderTotalAmount: Number(((_snapshot$calculation = snapshot.calculationContext) === null || _snapshot$calculation === void 0 ? void 0 : _snapshot$calculation.orderTotalAmount) || 0),
@@ -1210,6 +1302,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1210
1302
  key: "selectWalletAsset",
1211
1303
  value: function selectWalletAsset(assetId, options) {
1212
1304
  var assetKey = String(assetId);
1305
+ var asset = this.walletAssetsState.items.find(function (item) {
1306
+ return getWalletAssetKey(item) === assetKey;
1307
+ });
1213
1308
  var committedKeys = new Set(this.walletAssetsState.committedIds.map(function (id) {
1214
1309
  return String(id);
1215
1310
  }));
@@ -1220,22 +1315,27 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1220
1315
  var selectionSources = _objectSpread({}, this.walletAssetsState.selectionSources);
1221
1316
  delete selectionSources[assetKey];
1222
1317
  if (options.selected) {
1223
- var asset = this.walletAssetsState.items.find(function (item) {
1224
- return getWalletAssetKey(item) === assetKey;
1225
- });
1226
1318
  if (!asset || !isWalletAssetAvailable(asset)) {
1227
1319
  return this.getWalletAssetsState();
1228
1320
  }
1229
1321
  selectedIds.push(assetId);
1230
1322
  selectionSources[assetKey] = options.source || 'manual';
1323
+ } else if (asset) {
1324
+ this.clearPendingAutoSelectForAsset(asset);
1231
1325
  }
1232
- return this.recalculateWalletAssets(this.walletAssetsState.items, selectedIds, selectionSources);
1326
+ var nextState = this.recalculateWalletAssets(this.walletAssetsState.items, selectedIds, selectionSources);
1327
+ if (options.selected && asset && nextState.selectedIds.some(function (id) {
1328
+ return String(id) === assetKey;
1329
+ })) {
1330
+ this.clearPendingAutoSelectForAsset(asset);
1331
+ }
1332
+ return nextState;
1233
1333
  }
1234
1334
  }, {
1235
1335
  key: "scanWalletAssetAsync",
1236
1336
  value: function () {
1237
1337
  var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
1238
- var normalizedCode, selectedAsset, result, paymentAssets, asset, items, assetId, selected;
1338
+ var normalizedCode, selectedAsset, result, paymentAssets, asset, items, recalculatedState, assetId, selected, isSelected;
1239
1339
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1240
1340
  while (1) switch (_context9.prev = _context9.next) {
1241
1341
  case 0:
@@ -1288,21 +1388,28 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1288
1388
  });
1289
1389
  case 14:
1290
1390
  items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
1291
- this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1391
+ recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1292
1392
  assetId = getWalletAssetId(asset);
1293
- selected = assetId !== undefined && isWalletAssetAvailable(asset) ? this.selectWalletAsset(assetId, {
1393
+ selected = this.walletAssetsBehavior.autoSelectAfterSearch && assetId !== undefined && isWalletAssetAvailable(asset) ? this.selectWalletAsset(assetId, {
1294
1394
  selected: true,
1295
1395
  source: 'scan'
1296
- }) : this.getWalletAssetsState();
1396
+ }) : recalculatedState;
1397
+ isSelected = assetId !== undefined && selected.selectedIds.some(function (id) {
1398
+ return String(id) === String(assetId);
1399
+ });
1400
+ if (isSelected) {
1401
+ this.clearPendingAutoSelectForAsset(asset);
1402
+ } else if (this.walletAssetsBehavior.autoSelectAfterSearch) {
1403
+ this.pendingAutoSelectSearchCodes.add(normalizeWalletAssetCode(normalizedCode));
1404
+ this.queuePendingAutoSelectForAssets([asset]);
1405
+ }
1297
1406
  return _context9.abrupt("return", {
1298
1407
  type: result.type,
1299
1408
  asset: asset,
1300
- selected: assetId !== undefined && selected.selectedIds.some(function (id) {
1301
- return String(id) === String(assetId);
1302
- }),
1409
+ selected: isSelected,
1303
1410
  state: selected
1304
1411
  });
1305
- case 19:
1412
+ case 21:
1306
1413
  case "end":
1307
1414
  return _context9.stop();
1308
1415
  }
@@ -1316,6 +1423,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1316
1423
  }, {
1317
1424
  key: "clearWalletAssetSelection",
1318
1425
  value: function clearWalletAssetSelection() {
1426
+ this.pendingAutoSelectSearchCodes.clear();
1319
1427
  return this.recalculateWalletAssets(this.walletAssetsState.items, [], {});
1320
1428
  }
1321
1429
  }, {
@@ -1491,6 +1599,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1491
1599
  key: "clearSearchResults",
1492
1600
  value: function clearSearchResults() {
1493
1601
  this.searchResults = [];
1602
+ this.pendingAutoSelectSearchCodes.clear();
1494
1603
  this.paymentModule.logInfo('[WalletPass] 搜索结果缓存已清除');
1495
1604
  }
1496
1605
 
@@ -1522,6 +1631,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1522
1631
  this.walletRecommendList = [];
1523
1632
  this.userIdentificationCodes = [];
1524
1633
  this.searchResults = [];
1634
+ this.pendingAutoSelectSearchCodes.clear();
1525
1635
  this.walletParams = null;
1526
1636
  this.walletInitData = null;
1527
1637
  this.walletAssetsRequestSequence += 1;
@@ -9,7 +9,7 @@ import { RequestPlugin, WindowPlugin } from '../../plugins';
9
9
  export * from './types';
10
10
  import { ProductList } from '../../modules/ProductList';
11
11
  import { PaymentModule } from '../../modules/Payment';
12
- import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
12
+ import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
13
13
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
14
14
  import type { ScheduleModule } from '../../modules/Schedule';
15
15
  import { QuotationModule } from '../../modules/Quotation';
@@ -326,6 +326,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
326
326
  getWalletAssetsState(): WalletAssetsState;
327
327
  /** 导出 Shared Checkout 跨运行时恢复所需的钱包状态与搜索缓存。 */
328
328
  exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
329
+ /** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
330
+ configureWalletAssetsBehavior(options: WalletAssetsBehaviorOptions): void;
329
331
  /**
330
332
  * 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
331
333
  */
@@ -3821,6 +3821,14 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
3821
3821
  return this.store.payment.wallet.exportWalletAssetsSnapshot();
3822
3822
  }
3823
3823
 
3824
+ /** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
3825
+ }, {
3826
+ key: "configureWalletAssetsBehavior",
3827
+ value: function configureWalletAssetsBehavior(options) {
3828
+ if (!this.store.payment) throw new Error('payment 模块未初始化');
3829
+ this.store.payment.wallet.configureWalletAssetsBehavior(options);
3830
+ }
3831
+
3824
3832
  /**
3825
3833
  * 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
3826
3834
  */
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
326
326
  * 获取当前的客户搜索条件
327
327
  * @returns 当前搜索条件
328
328
  */
329
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
329
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
330
330
  /**
331
331
  * 获取客户列表状态(包含滚动加载相关状态)
332
332
  * @returns 客户状态
@@ -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
- });
@@ -397,12 +397,18 @@ export interface WalletAssetsState {
397
397
  export interface WalletAssetsSnapshot {
398
398
  state: WalletAssetsState;
399
399
  searchResults: SearchIdentificationCodeItem[];
400
+ /** 已搜索但尚未满足订单条件、等待首次可用后自动选中的 Wallet Asset code。 */
401
+ pendingAutoSelectSearchCodes?: string[];
400
402
  walletParams: WalletDeductionRecommendParams | null;
401
403
  calculationContext: {
402
404
  orderTotalAmount: number;
403
405
  products: any[];
404
406
  };
405
407
  }
408
+ export interface WalletAssetsBehaviorOptions {
409
+ /** 搜索到 Wallet Asset 后,当前或后续首次可用时是否自动选中。 */
410
+ autoSelectAfterSearch?: boolean;
411
+ }
406
412
  export interface RefreshWalletAssetsOptions {
407
413
  /** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
408
414
  preserveSelection?: boolean;
@@ -472,6 +478,8 @@ export interface WalletPassPayment {
472
478
  refreshWalletAssetsFromBusinessAsync: (businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions) => Promise<WalletAssetsState>;
473
479
  /** 获取共享钱包资产状态快照。 */
474
480
  getWalletAssetsState: () => WalletAssetsState;
481
+ /** 配置仅影响 Wallet Assets 的交互行为。 */
482
+ configureWalletAssetsBehavior: (options: WalletAssetsBehaviorOptions) => void;
475
483
  /** 导出供 Shared Checkout 跨运行时传递的 Wallet Assets 快照。 */
476
484
  exportWalletAssetsSnapshot: () => WalletAssetsSnapshot;
477
485
  /** 恢复 Shared Checkout 传回的 Wallet Assets 快照。 */
@@ -1,4 +1,4 @@
1
- import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, RefreshWalletAssetsOptions, SelectWalletAssetOptions, ScanWalletAssetResult } from './types';
1
+ import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, RefreshWalletAssetsOptions, SelectWalletAssetOptions, ScanWalletAssetResult } from './types';
2
2
  import type { PaymentModule } from './index';
3
3
  /**
4
4
  * 钱包支付实现
@@ -12,8 +12,11 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
12
12
  private walletInitData;
13
13
  private walletAssetsState;
14
14
  private walletAssetsRequestSequence;
15
+ private walletAssetsBehavior;
16
+ private pendingAutoSelectSearchCodes;
15
17
  private walletAssetsCalculationContext;
16
18
  constructor(paymentModule: PaymentModule);
19
+ configureWalletAssetsBehavior(options: WalletAssetsBehaviorOptions): void;
17
20
  /**
18
21
  * 发送事件的辅助方法
19
22
  * 支持使用WalletPassHooks或PaymentHooks
@@ -28,6 +31,9 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
28
31
  * 接口暂时缺失某个扫码 code 时继续保留旧值,避免列表闪空。
29
32
  */
30
33
  private syncSearchedWalletAssets;
34
+ private isPendingAutoSelectAsset;
35
+ private clearPendingAutoSelectForAsset;
36
+ private queuePendingAutoSelectForAssets;
31
37
  /**
32
38
  * 生成钱包API默认参数
33
39
  * 根据业务数据生成标准的钱包API参数,并存储在模块中
@@ -46,6 +46,12 @@ function matchesWalletAssetCode(asset, normalizedCode) {
46
46
  (identifier) => String(identifier ?? "").trim() === normalizedCode
47
47
  );
48
48
  }
49
+ function normalizeWalletAssetCode(code) {
50
+ return String(code ?? "").trim().toUpperCase();
51
+ }
52
+ function getWalletAssetCodeKeys(asset) {
53
+ return [asset == null ? void 0 : asset.code, asset == null ? void 0 : asset.encoded].map(normalizeWalletAssetCode).filter(Boolean);
54
+ }
49
55
  function isWalletAssetAvailable(asset) {
50
56
  if (!asset)
51
57
  return false;
@@ -107,11 +113,23 @@ var WalletPassPaymentImpl = class {
107
113
  this.walletInitData = null;
108
114
  this.walletAssetsState = createInitialWalletAssetsState();
109
115
  this.walletAssetsRequestSequence = 0;
116
+ this.walletAssetsBehavior = {
117
+ autoSelectAfterSearch: true
118
+ };
119
+ this.pendingAutoSelectSearchCodes = /* @__PURE__ */ new Set();
110
120
  this.walletAssetsCalculationContext = {
111
121
  orderTotalAmount: 0,
112
122
  products: []
113
123
  };
114
124
  }
125
+ configureWalletAssetsBehavior(options) {
126
+ if (options.autoSelectAfterSearch === void 0)
127
+ return;
128
+ this.walletAssetsBehavior.autoSelectAfterSearch = options.autoSelectAfterSearch;
129
+ if (!options.autoSelectAfterSearch) {
130
+ this.pendingAutoSelectSearchCodes.clear();
131
+ }
132
+ }
115
133
  /**
116
134
  * 发送事件的辅助方法
117
135
  * 支持使用WalletPassHooks或PaymentHooks
@@ -250,6 +268,25 @@ var WalletPassPaymentImpl = class {
250
268
  refreshedAssets
251
269
  );
252
270
  }
271
+ isPendingAutoSelectAsset(asset) {
272
+ return getWalletAssetCodeKeys(asset).some(
273
+ (code) => this.pendingAutoSelectSearchCodes.has(code)
274
+ );
275
+ }
276
+ clearPendingAutoSelectForAsset(asset) {
277
+ getWalletAssetCodeKeys(asset).forEach((code) => {
278
+ this.pendingAutoSelectSearchCodes.delete(code);
279
+ });
280
+ }
281
+ queuePendingAutoSelectForAssets(assets) {
282
+ if (!this.walletAssetsBehavior.autoSelectAfterSearch)
283
+ return;
284
+ assets.forEach((asset) => {
285
+ getWalletAssetCodeKeys(asset).forEach((code) => {
286
+ this.pendingAutoSelectSearchCodes.add(code);
287
+ });
288
+ });
289
+ }
253
290
  /**
254
291
  * 生成钱包API默认参数
255
292
  * 根据业务数据生成标准的钱包API参数,并存储在模块中
@@ -777,7 +814,12 @@ var WalletPassPaymentImpl = class {
777
814
  );
778
815
  const selectedIds = preserveSelection ? [...this.walletAssetsState.selectedIds] : [];
779
816
  const selectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
817
+ const scanSelectedAssets = preserveSelection ? this.walletAssetsState.selectedItems.filter((asset) => {
818
+ const assetId = getWalletAssetId(asset);
819
+ return assetId !== void 0 && assetId !== null && selectionSources[String(assetId)] === "scan";
820
+ }) : [];
780
821
  if (!((_a = businessData.products) == null ? void 0 : _a.length)) {
822
+ this.queuePendingAutoSelectForAssets(scanSelectedAssets);
781
823
  this.generateWalletParams(businessData);
782
824
  const restoredSearchedAssets = this.searchResults.filter(isWalletPaymentAsset).map((item) => ({
783
825
  ...item,
@@ -882,11 +924,43 @@ var WalletPassPaymentImpl = class {
882
924
  }));
883
925
  const latestSelectedIds = preserveSelection ? authoritativeSelectedIds : [];
884
926
  const latestSelectionSources = preserveSelection ? { ...this.walletAssetsState.selectionSources } : {};
885
- return this.recalculateWalletAssets(
927
+ const pendingAutoSelectAssets = this.walletAssetsBehavior.autoSelectAfterSearch ? items.filter(
928
+ (asset) => this.isPendingAutoSelectAsset(asset) && isWalletAssetAvailable(asset)
929
+ ) : [];
930
+ const requestedKeySet = new Set(
931
+ latestSelectedIds.map((id) => String(id))
932
+ );
933
+ pendingAutoSelectAssets.forEach((asset) => {
934
+ const assetId = getWalletAssetId(asset);
935
+ if (assetId === void 0 || assetId === null)
936
+ return;
937
+ const assetKey = String(assetId);
938
+ if (!requestedKeySet.has(assetKey)) {
939
+ requestedKeySet.add(assetKey);
940
+ latestSelectedIds.push(assetId);
941
+ }
942
+ latestSelectionSources[assetKey] = "scan";
943
+ });
944
+ const nextState = this.recalculateWalletAssets(
886
945
  items,
887
946
  latestSelectedIds,
888
947
  latestSelectionSources
889
948
  );
949
+ const selectedKeySet = new Set(
950
+ nextState.selectedIds.map((id) => String(id))
951
+ );
952
+ pendingAutoSelectAssets.forEach((asset) => {
953
+ const assetId = getWalletAssetId(asset);
954
+ if (assetId !== void 0 && assetId !== null && selectedKeySet.has(String(assetId))) {
955
+ this.clearPendingAutoSelectForAsset(asset);
956
+ }
957
+ });
958
+ const droppedScanSelectedAssets = scanSelectedAssets.filter((asset) => {
959
+ const assetId = getWalletAssetId(asset);
960
+ return assetId !== void 0 && assetId !== null && !selectedKeySet.has(String(assetId));
961
+ });
962
+ this.queuePendingAutoSelectForAssets(droppedScanSelectedAssets);
963
+ return nextState;
890
964
  } catch (error) {
891
965
  if (requestSequence !== this.walletAssetsRequestSequence) {
892
966
  return this.getWalletAssetsState();
@@ -926,6 +1000,9 @@ var WalletPassPaymentImpl = class {
926
1000
  return {
927
1001
  state: this.getWalletAssetsState(),
928
1002
  searchResults: [...this.searchResults],
1003
+ pendingAutoSelectSearchCodes: [
1004
+ ...this.pendingAutoSelectSearchCodes
1005
+ ],
929
1006
  walletParams: this.walletParams ? { ...this.walletParams } : null,
930
1007
  calculationContext: {
931
1008
  orderTotalAmount: this.walletAssetsCalculationContext.orderTotalAmount,
@@ -939,6 +1016,9 @@ var WalletPassPaymentImpl = class {
939
1016
  return this.getWalletAssetsState();
940
1017
  this.walletAssetsRequestSequence += 1;
941
1018
  this.searchResults = Array.isArray(snapshot.searchResults) ? [...snapshot.searchResults] : [];
1019
+ this.pendingAutoSelectSearchCodes = this.walletAssetsBehavior.autoSelectAfterSearch && Array.isArray(snapshot.pendingAutoSelectSearchCodes) ? new Set(
1020
+ snapshot.pendingAutoSelectSearchCodes.map(normalizeWalletAssetCode).filter(Boolean)
1021
+ ) : /* @__PURE__ */ new Set();
942
1022
  this.walletParams = snapshot.walletParams ? { ...snapshot.walletParams } : null;
943
1023
  this.walletAssetsCalculationContext = {
944
1024
  orderTotalAmount: Number(
@@ -957,6 +1037,9 @@ var WalletPassPaymentImpl = class {
957
1037
  }
958
1038
  selectWalletAsset(assetId, options) {
959
1039
  const assetKey = String(assetId);
1040
+ const asset = this.walletAssetsState.items.find(
1041
+ (item) => getWalletAssetKey(item) === assetKey
1042
+ );
960
1043
  const committedKeys = new Set(
961
1044
  this.walletAssetsState.committedIds.map((id) => String(id))
962
1045
  );
@@ -968,20 +1051,23 @@ var WalletPassPaymentImpl = class {
968
1051
  const selectionSources = { ...this.walletAssetsState.selectionSources };
969
1052
  delete selectionSources[assetKey];
970
1053
  if (options.selected) {
971
- const asset = this.walletAssetsState.items.find(
972
- (item) => getWalletAssetKey(item) === assetKey
973
- );
974
1054
  if (!asset || !isWalletAssetAvailable(asset)) {
975
1055
  return this.getWalletAssetsState();
976
1056
  }
977
1057
  selectedIds.push(assetId);
978
1058
  selectionSources[assetKey] = options.source || "manual";
1059
+ } else if (asset) {
1060
+ this.clearPendingAutoSelectForAsset(asset);
979
1061
  }
980
- return this.recalculateWalletAssets(
1062
+ const nextState = this.recalculateWalletAssets(
981
1063
  this.walletAssetsState.items,
982
1064
  selectedIds,
983
1065
  selectionSources
984
1066
  );
1067
+ if (options.selected && asset && nextState.selectedIds.some((id) => String(id) === assetKey)) {
1068
+ this.clearPendingAutoSelectForAsset(asset);
1069
+ }
1070
+ return nextState;
985
1071
  }
986
1072
  async scanWalletAssetAsync(code) {
987
1073
  const normalizedCode = String(code || "").trim();
@@ -1024,24 +1110,34 @@ var WalletPassPaymentImpl = class {
1024
1110
  };
1025
1111
  }
1026
1112
  const items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
1027
- this.recalculateWalletAssets(
1113
+ const recalculatedState = this.recalculateWalletAssets(
1028
1114
  items,
1029
1115
  this.walletAssetsState.selectedIds,
1030
1116
  this.walletAssetsState.selectionSources
1031
1117
  );
1032
1118
  const assetId = getWalletAssetId(asset);
1033
- const selected = assetId !== void 0 && isWalletAssetAvailable(asset) ? this.selectWalletAsset(assetId, {
1119
+ const selected = this.walletAssetsBehavior.autoSelectAfterSearch && assetId !== void 0 && isWalletAssetAvailable(asset) ? this.selectWalletAsset(assetId, {
1034
1120
  selected: true,
1035
1121
  source: "scan"
1036
- }) : this.getWalletAssetsState();
1122
+ }) : recalculatedState;
1123
+ const isSelected = assetId !== void 0 && selected.selectedIds.some((id) => String(id) === String(assetId));
1124
+ if (isSelected) {
1125
+ this.clearPendingAutoSelectForAsset(asset);
1126
+ } else if (this.walletAssetsBehavior.autoSelectAfterSearch) {
1127
+ this.pendingAutoSelectSearchCodes.add(
1128
+ normalizeWalletAssetCode(normalizedCode)
1129
+ );
1130
+ this.queuePendingAutoSelectForAssets([asset]);
1131
+ }
1037
1132
  return {
1038
1133
  type: result.type,
1039
1134
  asset,
1040
- selected: assetId !== void 0 && selected.selectedIds.some((id) => String(id) === String(assetId)),
1135
+ selected: isSelected,
1041
1136
  state: selected
1042
1137
  };
1043
1138
  }
1044
1139
  clearWalletAssetSelection() {
1140
+ this.pendingAutoSelectSearchCodes.clear();
1045
1141
  return this.recalculateWalletAssets(
1046
1142
  this.walletAssetsState.items,
1047
1143
  [],
@@ -1156,6 +1252,7 @@ var WalletPassPaymentImpl = class {
1156
1252
  */
1157
1253
  clearSearchResults() {
1158
1254
  this.searchResults = [];
1255
+ this.pendingAutoSelectSearchCodes.clear();
1159
1256
  this.paymentModule.logInfo("[WalletPass] 搜索结果缓存已清除");
1160
1257
  }
1161
1258
  /**
@@ -1178,6 +1275,7 @@ var WalletPassPaymentImpl = class {
1178
1275
  this.walletRecommendList = [];
1179
1276
  this.userIdentificationCodes = [];
1180
1277
  this.searchResults = [];
1278
+ this.pendingAutoSelectSearchCodes.clear();
1181
1279
  this.walletParams = null;
1182
1280
  this.walletInitData = null;
1183
1281
  this.walletAssetsRequestSequence += 1;
@@ -9,7 +9,7 @@ import { RequestPlugin, WindowPlugin } from '../../plugins';
9
9
  export * from './types';
10
10
  import { ProductList } from '../../modules/ProductList';
11
11
  import { PaymentModule } from '../../modules/Payment';
12
- import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
12
+ import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
13
13
  import type { SalesSummaryModule } from '../../modules/SalesSummary';
14
14
  import type { ScheduleModule } from '../../modules/Schedule';
15
15
  import { QuotationModule } from '../../modules/Quotation';
@@ -326,6 +326,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
326
326
  getWalletAssetsState(): WalletAssetsState;
327
327
  /** 导出 Shared Checkout 跨运行时恢复所需的钱包状态与搜索缓存。 */
328
328
  exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
329
+ /** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
330
+ configureWalletAssetsBehavior(options: WalletAssetsBehaviorOptions): void;
329
331
  /**
330
332
  * 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
331
333
  */
@@ -2535,6 +2535,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2535
2535
  throw new Error("payment 模块未初始化");
2536
2536
  return this.store.payment.wallet.exportWalletAssetsSnapshot();
2537
2537
  }
2538
+ /** 配置仅影响 Wallet Assets,不改变 Promotion/Voucher 选择流程。 */
2539
+ configureWalletAssetsBehavior(options) {
2540
+ if (!this.store.payment)
2541
+ throw new Error("payment 模块未初始化");
2542
+ this.store.payment.wallet.configureWalletAssetsBehavior(options);
2543
+ }
2538
2544
  /**
2539
2545
  * 恢复 Shared Checkout 钱包快照,并把选择重新同步为订单 pending payment。
2540
2546
  */
@@ -311,7 +311,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
311
311
  date: string;
312
312
  status: string;
313
313
  week: string;
314
- weekNum: 0 | 2 | 1 | 5 | 4 | 3 | 6;
314
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -326,7 +326,7 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
326
326
  * 获取当前的客户搜索条件
327
327
  * @returns 当前搜索条件
328
328
  */
329
- getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "skip" | "num">;
329
+ getCurrentCustomerSearchParams(): Omit<import("../../modules").ShopGetCustomerListParams, "num" | "skip">;
330
330
  /**
331
331
  * 获取客户列表状态(包含滚动加载相关状态)
332
332
  * @returns 客户状态
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.48",
4
+ "version": "2.3.49",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",