@pisell/pisellos 2.2.318 → 2.2.319

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.
Files changed (33) hide show
  1. package/dist/model/strategy/adapter/promotion/evaluator.js +5 -4
  2. package/dist/modules/Discount/types.d.ts +4 -0
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/index.js +740 -775
  5. package/dist/modules/Order/types.d.ts +2 -2
  6. package/dist/modules/Order/types.js +2 -2
  7. package/dist/modules/Order/utils.js +45 -45
  8. package/dist/modules/Payment/walletpass.js +32 -6
  9. package/dist/modules/Rules/index.d.ts +3 -10
  10. package/dist/modules/Rules/index.js +169 -87
  11. package/dist/modules/Rules/promotionSelection.d.ts +14 -0
  12. package/dist/modules/Rules/promotionSelection.js +390 -0
  13. package/dist/modules/Rules/types.d.ts +9 -0
  14. package/dist/solution/BaseSales/index.js +41 -21
  15. package/dist/solution/BaseSales/utils/cartPromotion.js +5 -2
  16. package/dist/solution/BookingByStep/index.d.ts +1 -1
  17. package/lib/model/strategy/adapter/promotion/evaluator.js +5 -4
  18. package/lib/modules/Discount/types.d.ts +4 -0
  19. package/lib/modules/Order/index.d.ts +1 -1
  20. package/lib/modules/Order/index.js +13 -8
  21. package/lib/modules/Order/types.d.ts +2 -2
  22. package/lib/modules/Order/types.js +2 -2
  23. package/lib/modules/Order/utils.js +1 -1
  24. package/lib/modules/Payment/walletpass.js +23 -1
  25. package/lib/modules/Rules/index.d.ts +3 -10
  26. package/lib/modules/Rules/index.js +62 -22
  27. package/lib/modules/Rules/promotionSelection.d.ts +14 -0
  28. package/lib/modules/Rules/promotionSelection.js +230 -0
  29. package/lib/modules/Rules/types.d.ts +9 -0
  30. package/lib/solution/BaseSales/index.js +19 -5
  31. package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
  32. package/lib/solution/BookingByStep/index.d.ts +1 -1
  33. package/package.json +1 -1
@@ -71,8 +71,8 @@ export interface OrderGiftSelectResult {
71
71
  /**
72
72
  * 赠品解析回调签名(SDK → OS 的返回值)。
73
73
  *
74
- * - 单选项:SDK 内部自动构造商品,不弹窗
75
- * - 多选项:SDK 弹窗等用户确认后构造
74
+ * - 唯一且无规格/套餐的候选:SDK 自动构造商品
75
+ * - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
76
76
  * - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
77
77
  *
78
78
  * 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
@@ -30,8 +30,8 @@ export var OrderHooks = /*#__PURE__*/function (OrderHooks) {
30
30
  /**
31
31
  * 赠品解析回调签名(SDK → OS 的返回值)。
32
32
  *
33
- * - 单选项:SDK 内部自动构造商品,不弹窗
34
- * - 多选项:SDK 弹窗等用户确认后构造
33
+ * - 唯一且无规格/套餐的候选:SDK 自动构造商品
34
+ * - 有规格/套餐或多个候选:SDK 弹窗等用户确认后构造
35
35
  * - 用户取消:抛错或返回空数组(OS 视为放弃本次添加)
36
36
  *
37
37
  * 返回数组时沿用旧协议,只写 tempOrder.products;返回对象时可同时写入预约 bookings。
@@ -1115,10 +1115,10 @@ function formatSubmitOptionItems(options) {
1115
1115
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1116
1116
  if (!Array.isArray(options)) return [];
1117
1117
  return options.map(function (d) {
1118
- var _d$add_price;
1118
+ var _ref34, _d$option_group_item_, _d$add_price;
1119
1119
  var option = _objectSpread(_objectSpread({}, d && _typeof(d) === 'object' ? d : {}), {}, {
1120
1120
  num: d === null || d === void 0 ? void 0 : d.num,
1121
- option_group_item_id: d === null || d === void 0 ? void 0 : d.option_group_item_id,
1121
+ option_group_item_id: (_ref34 = (_d$option_group_item_ = d === null || d === void 0 ? void 0 : d.option_group_item_id) !== null && _d$option_group_item_ !== void 0 ? _d$option_group_item_ : d === null || d === void 0 ? void 0 : d.product_option_item_id) !== null && _ref34 !== void 0 ? _ref34 : d === null || d === void 0 ? void 0 : d.id,
1122
1122
  option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
1123
1123
  });
1124
1124
  var productionCode = normalizeSubmitProductionCode(d === null || d === void 0 ? void 0 : d.production_code);
@@ -1151,7 +1151,7 @@ function formatSubmitBundleItems(bundle) {
1151
1151
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1152
1152
  if (!Array.isArray(bundle)) return [];
1153
1153
  return bundle.map(function (b) {
1154
- var _ref34, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref35, _rawBundle$price_type, _ref36, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
1154
+ var _ref35, _rawBundle$price, _rawBundle$surcharge_, _rawBundle$num, _rawBundle$is_charge_, _rawBundle$bundle_var, _rawBundle$quantity, _rawBundle$extension_, _rawBundle$extension_2, _ref36, _rawBundle$price_type, _ref37, _rawBundle$price_type2, _rawBundle$bundle_gro, _rawBundle$bundle_id, _rawBundle$bundle_pro;
1155
1155
  var rawBundle = b && _typeof(b) === 'object' ? b : {};
1156
1156
  var existedMetadata = rawBundle.metadata && _typeof(rawBundle.metadata) === 'object' ? rawBundle.metadata : {};
1157
1157
  var _customProductBundleMapId = existedMetadata.custom_product_bundle_map_id,
@@ -1162,7 +1162,7 @@ function formatSubmitBundleItems(bundle) {
1162
1162
  var sellingPrice = formatOptions.virtualSettlementMode ? '0.00' : getBundleSellingMagnitude(rawBundle).toFixed(2);
1163
1163
  // payment 价由整单折扣均摊层产出;缺省(无折扣)时与 selling 净额同义。
1164
1164
  var paymentPrice = formatOptions.virtualSettlementMode ? '0.00' : rawBundle.bundle_payment_price !== undefined && rawBundle.bundle_payment_price !== null && rawBundle.bundle_payment_price !== '' ? toMoneyString(rawBundle.bundle_payment_price) : sellingPrice;
1165
- var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref34 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref34 !== void 0 ? _ref34 : rawBundle.bundle_selling_price;
1165
+ var priceValue = formatOptions.virtualSettlementMode ? 0 : (_ref35 = (_rawBundle$price = rawBundle.price) !== null && _rawBundle$price !== void 0 ? _rawBundle$price : rawBundle.custom_price) !== null && _ref35 !== void 0 ? _ref35 : rawBundle.bundle_selling_price;
1166
1166
  var relationSurchargeIds = Array.isArray(rawBundle.relation_surcharge_ids) ? rawBundle.relation_surcharge_ids : Array.isArray(existedMetadata.relation_surcharge_ids) ? existedMetadata.relation_surcharge_ids : [];
1167
1167
  var surchargeFee = toMoneyString((_rawBundle$surcharge_ = rawBundle.surcharge_fee) !== null && _rawBundle$surcharge_ !== void 0 ? _rawBundle$surcharge_ : existedMetadata.surcharge_fee);
1168
1168
  var productDiscountDifference = toBundleNumber(existedMetadata.product_discount_difference, 0);
@@ -1181,8 +1181,8 @@ function formatSubmitBundleItems(bundle) {
1181
1181
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
1182
1182
  extension_type: (_rawBundle$extension_2 = rawBundle.extension_type) !== null && _rawBundle$extension_2 !== void 0 ? _rawBundle$extension_2 : 'normal',
1183
1183
  price: priceValue,
1184
- price_type: (_ref35 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref35 !== void 0 ? _ref35 : '',
1185
- price_type_ext: (_ref36 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref36 !== void 0 ? _ref36 : '',
1184
+ price_type: (_ref36 = (_rawBundle$price_type = rawBundle.price_type) !== null && _rawBundle$price_type !== void 0 ? _rawBundle$price_type : rawBundle.custom_price_type) !== null && _ref36 !== void 0 ? _ref36 : '',
1185
+ price_type_ext: (_ref37 = (_rawBundle$price_type2 = rawBundle.price_type_ext) !== null && _rawBundle$price_type2 !== void 0 ? _rawBundle$price_type2 : rawBundle.custom_price_type_ext) !== null && _ref37 !== void 0 ? _ref37 : '',
1186
1186
  bundle_selling_price: sellingPrice,
1187
1187
  bundle_payment_price: paymentPrice,
1188
1188
  option: formatSubmitOptionItems(rawBundle.option, formatOptions),
@@ -1218,11 +1218,11 @@ function formatSubmitBundleItems(bundle) {
1218
1218
  * 法币仅做字段/metadata 裁剪;虚拟币在出站前再次执行零加价与固定单价断言。
1219
1219
  */
1220
1220
  function normalizeSubmitProduct(product) {
1221
- var _ref38, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
1221
+ var _ref39, _submitProduct$bundle, _rawMetadata$product_, _rawMetadata$selected, _rawMetadata$selected2, _submitProduct$produc, _submitProduct$paymen;
1222
1222
  var formatOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1223
- var _ref37 = product,
1224
- _runtimeUid = _ref37.unique_identification_number,
1225
- submitProduct = _objectWithoutProperties(_ref37, _excluded2);
1223
+ var _ref38 = product,
1224
+ _runtimeUid = _ref38.unique_identification_number,
1225
+ submitProduct = _objectWithoutProperties(_ref38, _excluded2);
1226
1226
  var num = submitProduct.num,
1227
1227
  _productExtend = submitProduct._extend,
1228
1228
  _productSurchargeFee = submitProduct.surcharge_fee,
@@ -1240,7 +1240,7 @@ function normalizeSubmitProduct(product) {
1240
1240
  // 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
1241
1241
  // 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
1242
1242
  var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
1243
- var bundleEdit = (_ref38 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref38 !== void 0 ? _ref38 : hasProductBundle ? 0 : undefined;
1243
+ var bundleEdit = (_ref39 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref39 !== void 0 ? _ref39 : hasProductBundle ? 0 : undefined;
1244
1244
  var cleanMetadata = {};
1245
1245
  if (rawMetadata.unique_identification_number) {
1246
1246
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
@@ -1481,7 +1481,7 @@ export function resolveSubmitOrderType(params) {
1481
1481
  return 'virtual';
1482
1482
  }
1483
1483
  export function buildSubmitPayload(params) {
1484
- var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref40, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1484
+ var _tempOrder$metadata2, _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref41, _tempOrder$is_price_i, _tempOrder$is_deposit, _tempOrder$_extend, _enhancedPayload$summ;
1485
1485
  var tempOrder = params.tempOrder,
1486
1486
  cacheId = params.cacheId,
1487
1487
  _params$now = params.now,
@@ -1496,29 +1496,29 @@ export function buildSubmitPayload(params) {
1496
1496
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1497
1497
  var bookingUuid = createUuidV4();
1498
1498
  var virtualSettlementMode = ((_tempOrder$metadata2 = tempOrder.metadata) === null || _tempOrder$metadata2 === void 0 || (_tempOrder$metadata2 = _tempOrder$metadata2.currency_settlement_config) === null || _tempOrder$metadata2 === void 0 ? void 0 : _tempOrder$metadata2.settlement_type) === 'virtual_currency';
1499
- var _ref39 = tempOrder,
1500
- _extend = _ref39._extend,
1501
- _relationId = _ref39.relation_id,
1502
- _tableFormId = _ref39.table_form_id,
1503
- _resourceId = _ref39.resource_id,
1504
- _summary = _ref39.summary,
1505
- _lastOrderInfo = _ref39.lastOrderInfo,
1506
- _paidAmount = _ref39.paid_amount,
1507
- _shopId = _ref39.shop_id,
1508
- _shopNote = _ref39.shop_note,
1509
- _shopServiceType = _ref39.shop_service_type,
1510
- _startTime = _ref39.start_time,
1511
- _customer = _ref39.customer,
1512
- _discountList = _ref39.discount_list,
1513
- _orderMetaList = _ref39.order_meta_list,
1514
- _rootTaxFee = _ref39.tax_fee,
1515
- _totalAmount = _ref39.total_amount,
1516
- _totalRefundAmount = _ref39.total_refund_amount,
1517
- _createDate = _ref39.create_date,
1518
- _holderId = _ref39.holder_id,
1519
- _paymentStatus = _ref39.payment_status,
1520
- _notes = _ref39.notes,
1521
- tempOrderRest = _objectWithoutProperties(_ref39, _excluded4);
1499
+ var _ref40 = tempOrder,
1500
+ _extend = _ref40._extend,
1501
+ _relationId = _ref40.relation_id,
1502
+ _tableFormId = _ref40.table_form_id,
1503
+ _resourceId = _ref40.resource_id,
1504
+ _summary = _ref40.summary,
1505
+ _lastOrderInfo = _ref40.lastOrderInfo,
1506
+ _paidAmount = _ref40.paid_amount,
1507
+ _shopId = _ref40.shop_id,
1508
+ _shopNote = _ref40.shop_note,
1509
+ _shopServiceType = _ref40.shop_service_type,
1510
+ _startTime = _ref40.start_time,
1511
+ _customer = _ref40.customer,
1512
+ _discountList = _ref40.discount_list,
1513
+ _orderMetaList = _ref40.order_meta_list,
1514
+ _rootTaxFee = _ref40.tax_fee,
1515
+ _totalAmount = _ref40.total_amount,
1516
+ _totalRefundAmount = _ref40.total_refund_amount,
1517
+ _createDate = _ref40.create_date,
1518
+ _holderId = _ref40.holder_id,
1519
+ _paymentStatus = _ref40.payment_status,
1520
+ _notes = _ref40.notes,
1521
+ tempOrderRest = _objectWithoutProperties(_ref40, _excluded4);
1522
1522
  var resolvedBusinessCode = businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code;
1523
1523
  var normalizedOrderMetaList = normalizeOrderMetaList(tempOrder.order_meta_list);
1524
1524
  var submitType = resolveSubmitOrderType({
@@ -1545,7 +1545,7 @@ export function buildSubmitPayload(params) {
1545
1545
  type: submitType,
1546
1546
  business_code: resolvedBusinessCode,
1547
1547
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1548
- order_sales_channel: (_ref40 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref40 !== void 0 ? _ref40 : 'online_store',
1548
+ order_sales_channel: (_ref41 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref41 !== void 0 ? _ref41 : 'online_store',
1549
1549
  status: tempOrder.status || 'normal'
1550
1550
  }, params.includePaymentStatus !== false ? {
1551
1551
  payment_status: tempOrder.payment_status || 'payment_processing'
@@ -1573,13 +1573,13 @@ export function buildSubmitPayload(params) {
1573
1573
  // holder: tempOrder.holder || null,
1574
1574
  summary: summary || tempOrder.summary || createEmptySummary(),
1575
1575
  metadata: function () {
1576
- var _ref41 = tempOrder.metadata || {},
1577
- _collectPax = _ref41.collect_pax,
1578
- _tableOccupancyDuration = _ref41.table_occupancy_duration,
1579
- _cartSettlementKey = _ref41.cart_settlement_key,
1580
- _cartSettlementSnapshot = _ref41.cart_settlement_snapshot,
1581
- _legalCurrencySnapshot = _ref41.legal_currency_snapshot,
1582
- rest = _objectWithoutProperties(_ref41, _excluded5);
1576
+ var _ref42 = tempOrder.metadata || {},
1577
+ _collectPax = _ref42.collect_pax,
1578
+ _tableOccupancyDuration = _ref42.table_occupancy_duration,
1579
+ _cartSettlementKey = _ref42.cart_settlement_key,
1580
+ _cartSettlementSnapshot = _ref42.cart_settlement_snapshot,
1581
+ _legalCurrencySnapshot = _ref42.legal_currency_snapshot,
1582
+ rest = _objectWithoutProperties(_ref42, _excluded5);
1583
1583
  return _objectSpread({}, rest);
1584
1584
  }()
1585
1585
  }, (_tempOrder$_extend = tempOrder._extend) !== null && _tempOrder$_extend !== void 0 && (_tempOrder$_extend = _tempOrder$_extend.salesNotesState) !== null && _tempOrder$_extend !== void 0 && _tempOrder$_extend.dirty ? {
@@ -1809,8 +1809,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
1809
1809
  return tempOrder._extend.productsByUid[uid].origin;
1810
1810
  }
1811
1811
  var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1812
- var _ref42, _item$product_id, _ref43, _product$product_id;
1813
- return item === product || getOrderProductLineUid(item) === uid || String((_ref42 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref42 !== void 0 ? _ref42 : '') === String((_ref43 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref43 !== void 0 ? _ref43 : '');
1812
+ var _ref43, _item$product_id, _ref44, _product$product_id;
1813
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref43 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref43 !== void 0 ? _ref43 : '') === String((_ref44 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref44 !== void 0 ? _ref44 : '');
1814
1814
  });
1815
1815
  var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1816
1816
  return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend4 = tempOrder._extend) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4.productsByUid) === null || _tempOrder$_extend4 === void 0 || (_tempOrder$_extend4 = _tempOrder$_extend4[matchedUid]) === null || _tempOrder$_extend4 === void 0 ? void 0 : _tempOrder$_extend4.origin) || null : null;
@@ -1525,7 +1525,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1525
1525
  key: "scanWalletAssetAsync",
1526
1526
  value: function () {
1527
1527
  var _scanWalletAssetAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(code) {
1528
- var normalizedCode, selectedAsset, result, paymentAssets, asset, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
1528
+ var normalizedCode, selectedAsset, result, paymentAssets, matchedAsset, assetsToApply, asset, _items, assetIds, selectionSources, _selected, items, recalculatedState, assetId, recalculatedAsset, selected, isSelected, selectedStateAsset, resolvedAsset;
1529
1529
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1530
1530
  while (1) switch (_context9.prev = _context9.next) {
1531
1531
  case 0:
@@ -1578,11 +1578,13 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1578
1578
  if (paymentAssets.length > 0) {
1579
1579
  this.searchResults = mergeWalletAssets(this.searchResults, paymentAssets);
1580
1580
  }
1581
- asset = paymentAssets.find(function (item) {
1581
+ matchedAsset = paymentAssets.find(function (item) {
1582
1582
  return String((item === null || item === void 0 ? void 0 : item.code) || '') === normalizedCode;
1583
- }) || paymentAssets[0];
1583
+ }); // 精确命中券码时仅处理该券;未命中时处理接口返回的全部结果。
1584
+ assetsToApply = matchedAsset ? [matchedAsset] : paymentAssets;
1585
+ asset = assetsToApply[0];
1584
1586
  if (asset) {
1585
- _context9.next = 17;
1587
+ _context9.next = 19;
1586
1588
  break;
1587
1589
  }
1588
1590
  return _context9.abrupt("return", {
@@ -1591,7 +1593,31 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1591
1593
  selected: false,
1592
1594
  state: this.getWalletAssetsState()
1593
1595
  });
1594
- case 17:
1596
+ case 19:
1597
+ if (!(!matchedAsset && assetsToApply.length > 1)) {
1598
+ _context9.next = 26;
1599
+ break;
1600
+ }
1601
+ _items = mergeWalletAssets(this.walletAssetsState.items, assetsToApply);
1602
+ assetIds = assetsToApply.map(function (item) {
1603
+ return getWalletAssetId(item);
1604
+ }).filter(function (id) {
1605
+ return id !== undefined && id !== null;
1606
+ });
1607
+ selectionSources = _objectSpread({}, this.walletAssetsState.selectionSources);
1608
+ assetIds.forEach(function (id) {
1609
+ selectionSources[String(id)] = 'scan';
1610
+ });
1611
+ _selected = this.walletAssetsBehavior.autoSelectAfterSearch ? this.recalculateWalletAssets(_items, Array.from(new Set([].concat(_toConsumableArray(this.walletAssetsState.selectedIds), _toConsumableArray(assetIds)))), selectionSources) : this.recalculateWalletAssets(_items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1612
+ return _context9.abrupt("return", {
1613
+ type: result.type,
1614
+ asset: asset,
1615
+ selected: assetIds.some(function (id) {
1616
+ return _selected.selectedIds.includes(id);
1617
+ }),
1618
+ state: _selected
1619
+ });
1620
+ case 26:
1595
1621
  items = mergeWalletAssets(this.walletAssetsState.items, [asset]);
1596
1622
  recalculatedState = this.recalculateWalletAssets(items, this.walletAssetsState.selectedIds, this.walletAssetsState.selectionSources);
1597
1623
  assetId = getWalletAssetId(asset);
@@ -1621,7 +1647,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
1621
1647
  selected: isSelected,
1622
1648
  state: selected
1623
1649
  });
1624
- case 27:
1650
+ case 36:
1625
1651
  case "end":
1626
1652
  return _context9.stop();
1627
1653
  }
@@ -1,6 +1,6 @@
1
1
  import { Module, PisellCore, ModuleOptions } from '../../types';
2
2
  import { BaseModule } from '../BaseModule';
3
- import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, UnavailableReason } from './types';
3
+ import { Rules, RulesModuleAPI, DiscountResult, RulesFormSubject, RulesCalcDiscountOptions, RulesCalcDiscountParams, UnavailableReason } from './types';
4
4
  import { Discount } from '../Discount/types';
5
5
  import { WindowPlugin } from '../../plugins';
6
6
  export declare class RulesModule extends BaseModule implements Module, RulesModuleAPI {
@@ -44,15 +44,8 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
44
44
  resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
45
45
  private isItemRewardProductDiscount;
46
46
  private getUnavailableReason;
47
- calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
48
- discountList: Discount[];
49
- productList: any[];
50
- holders: {
51
- form_record_id: number;
52
- }[];
53
- isFormSubject: RulesFormSubject;
54
- orderTotalAmount: number;
55
- }, options?: RulesCalcDiscountOptions): DiscountResult;
47
+ calcDiscount(params: RulesCalcDiscountParams, options?: RulesCalcDiscountOptions): DiscountResult;
48
+ private calcDiscountCore;
56
49
  /**
57
50
  * 检查优惠是否符合 PackageSubItemUsageRules 配置
58
51
  * @param discount 优惠券