@pisell/pisellos 2.3.21 → 2.3.22

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.
@@ -3910,7 +3910,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3910
3910
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
3911
3911
  var previous = previousByIdentity.get(_this23.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
3912
3912
  if (!previous || _typeof(previous) !== 'object') return bundle;
3913
- return _objectSpread(_objectSpread({}, bundle), {}, {
3913
+ return _objectSpread(_objectSpread(_objectSpread({}, bundle), (bundle.cover === undefined || bundle.cover === null || bundle.cover === '') && previous.cover !== undefined && previous.cover !== null && previous.cover !== '' ? {
3914
+ cover: previous.cover
3915
+ } : {}), {}, {
3914
3916
  price: previous.price,
3915
3917
  custom_price: previous.custom_price,
3916
3918
  bundle_payment_price: previous.bundle_payment_price,
@@ -586,11 +586,14 @@ export function createDefaultOrderRulesHooks() {
586
586
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
587
587
  var current = currentByIdentity.get(getBundleIdentity(bundle));
588
588
  if (!current) return bundle;
589
+ var bundleWithDisplayFields = _objectSpread(_objectSpread({}, bundle), isEmptyOrderProductDisplayValue(bundle.cover) && !isEmptyOrderProductDisplayValue(current.cover) ? {
590
+ cover: current.cover
591
+ } : {});
589
592
  var isProductPriceBundle = ((_bundle$price_type_ex2 = bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : current.price_type_ext) === 'product_price';
590
- if (!isProductPriceBundle) return bundle;
593
+ if (!isProductPriceBundle) return bundleWithDisplayFields;
591
594
  var sourcePrice = (_ref18 = (_ref19 = (_current$price = current.price) !== null && _current$price !== void 0 ? _current$price : current.custom_price) !== null && _ref19 !== void 0 ? _ref19 : current.original_price) !== null && _ref18 !== void 0 ? _ref18 : current.bundle_selling_price;
592
595
  var originalPrice = (_ref20 = (_ref21 = (_ref22 = (_current$original_pri = current.original_price) !== null && _current$original_pri !== void 0 ? _current$original_pri : current.product_price) !== null && _ref22 !== void 0 ? _ref22 : current.price) !== null && _ref21 !== void 0 ? _ref21 : current.custom_price) !== null && _ref20 !== void 0 ? _ref20 : sourcePrice;
593
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundle), sourcePrice !== undefined ? {
596
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, bundleWithDisplayFields), sourcePrice !== undefined ? {
594
597
  price: sourcePrice
595
598
  } : {}), originalPrice !== undefined ? {
596
599
  original_price: originalPrice
@@ -863,6 +866,7 @@ function formatSubmitBundleItems(bundle) {
863
866
  bundle_group_id: (_rawBundle$bundle_gro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_group_id) !== null && _rawBundle$bundle_gro !== void 0 ? _rawBundle$bundle_gro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.group_id,
864
867
  bundle_id: (_rawBundle$bundle_id = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_id) !== null && _rawBundle$bundle_id !== void 0 ? _rawBundle$bundle_id : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.id,
865
868
  bundle_product_id: (_rawBundle$bundle_pro = rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle.bundle_product_id) !== null && _rawBundle$bundle_pro !== void 0 ? _rawBundle$bundle_pro : rawBundle === null || rawBundle === void 0 ? void 0 : rawBundle._bundle_product_id,
869
+ cover: rawBundle.cover,
866
870
  metadata: _objectSpread(_objectSpread(_objectSpread({}, submitMetadata), hasSubmitBundleDiscounts && bundleMapId !== undefined ? {
867
871
  custom_product_bundle_map_id: bundleMapId
868
872
  } : {}), {}, {
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "session" | "normal";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -448,6 +448,7 @@ declare class Server {
448
448
  private collectSalesDetailProductIds;
449
449
  private buildSalesDetailProductSnapshotMap;
450
450
  private withProductCatalogSnapshots;
451
+ private withBundleCatalogSnapshots;
451
452
  private withSalesDetailProductSnapshots;
452
453
  private withPendingSyncProductTitles;
453
454
  private buildProductTitleSnapshot;
@@ -5123,12 +5123,20 @@ var Server = /*#__PURE__*/function () {
5123
5123
  value: function collectSalesDetailProductIds(order) {
5124
5124
  var products = Array.isArray(order === null || order === void 0 ? void 0 : order.products) ? order.products : [];
5125
5125
  var productIds = new Set();
5126
- products.forEach(function (product) {
5127
- var _product$product_id2;
5128
- var rawProductId = (_product$product_id2 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product === null || product === void 0 ? void 0 : product.id;
5126
+ var addProductId = function addProductId(rawProductId) {
5129
5127
  if (rawProductId === undefined || rawProductId === null || rawProductId === '') return;
5130
5128
  var productId = Number(rawProductId);
5131
5129
  if (Number.isFinite(productId)) productIds.add(productId);
5130
+ };
5131
+ products.forEach(function (product) {
5132
+ var _product$product_id2;
5133
+ addProductId((_product$product_id2 = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id2 !== void 0 ? _product$product_id2 : product === null || product === void 0 ? void 0 : product.id);
5134
+ if (Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) {
5135
+ product.product_bundle.forEach(function (bundle) {
5136
+ var _ref61, _bundle$bundle_produc2;
5137
+ addProductId((_ref61 = (_bundle$bundle_produc2 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc2 !== void 0 ? _bundle$bundle_produc2 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref61 !== void 0 ? _ref61 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id);
5138
+ });
5139
+ }
5132
5140
  });
5133
5141
  return Array.from(productIds);
5134
5142
  }
@@ -5196,6 +5204,31 @@ var Server = /*#__PURE__*/function () {
5196
5204
  })
5197
5205
  } : {});
5198
5206
  }
5207
+ }, {
5208
+ key: "withBundleCatalogSnapshots",
5209
+ value: function withBundleCatalogSnapshots(product, snapshotMap) {
5210
+ if (!Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle)) return product;
5211
+ var hasChanged = false;
5212
+ var productBundle = product.product_bundle.map(function (bundle) {
5213
+ var _ref62, _bundle$bundle_produc3;
5214
+ if (!bundle || _typeof(bundle) !== 'object') return bundle;
5215
+ var rawProductId = (_ref62 = (_bundle$bundle_produc3 = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc3 !== void 0 ? _bundle$bundle_produc3 : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref62 !== void 0 ? _ref62 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id;
5216
+ if (rawProductId === undefined || rawProductId === null || rawProductId === '') return bundle;
5217
+ var productId = Number(rawProductId);
5218
+ if (!Number.isFinite(productId)) return bundle;
5219
+ var snapshot = snapshotMap[String(productId)];
5220
+ var shouldFillCover = (bundle.cover === undefined || bundle.cover === null || bundle.cover === '') && (snapshot === null || snapshot === void 0 ? void 0 : snapshot.cover) !== undefined && snapshot.cover !== null && snapshot.cover !== '';
5221
+ if (!shouldFillCover) return bundle;
5222
+ hasChanged = true;
5223
+ return _objectSpread(_objectSpread({}, bundle), {}, {
5224
+ cover: snapshot.cover
5225
+ });
5226
+ });
5227
+ if (!hasChanged) return product;
5228
+ return _objectSpread(_objectSpread({}, product), {}, {
5229
+ product_bundle: productBundle
5230
+ });
5231
+ }
5199
5232
  }, {
5200
5233
  key: "withSalesDetailProductSnapshots",
5201
5234
  value: function () {
@@ -5224,7 +5257,8 @@ var Server = /*#__PURE__*/function () {
5224
5257
  case 8:
5225
5258
  hasChanged = false;
5226
5259
  enrichedProducts = products.map(function (product) {
5227
- var nextProduct = _this13.withProductCatalogSnapshots(product, snapshotMap);
5260
+ var productWithBundleSnapshots = _this13.withBundleCatalogSnapshots(product, snapshotMap);
5261
+ var nextProduct = _this13.withProductCatalogSnapshots(productWithBundleSnapshots, snapshotMap);
5228
5262
  if (nextProduct !== product) hasChanged = true;
5229
5263
  return nextProduct;
5230
5264
  });
@@ -5302,7 +5336,7 @@ var Server = /*#__PURE__*/function () {
5302
5336
  }, {
5303
5337
  key: "resolveProductTitleValue",
5304
5338
  value: function resolveProductTitleValue(value, key, currentLocale) {
5305
- var _ref61, _ref62, _value$key;
5339
+ var _ref63, _ref64, _value$key;
5306
5340
  if (value === undefined || value === null || value === '') return null;
5307
5341
  if (_typeof(value) !== 'object') {
5308
5342
  var title = String(value);
@@ -5312,7 +5346,7 @@ var Server = /*#__PURE__*/function () {
5312
5346
  }
5313
5347
  var normalizedKey = key.replace('-', '_');
5314
5348
  var dashedKey = key.replace('_', '-');
5315
- var rawValue = (_ref61 = (_ref62 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref62 !== void 0 ? _ref62 : value[dashedKey]) !== null && _ref61 !== void 0 ? _ref61 : key === 'auto' ? value.default : undefined;
5349
+ var rawValue = (_ref63 = (_ref64 = (_value$key = value[key]) !== null && _value$key !== void 0 ? _value$key : value[normalizedKey]) !== null && _ref64 !== void 0 ? _ref64 : value[dashedKey]) !== null && _ref63 !== void 0 ? _ref63 : key === 'auto' ? value.default : undefined;
5316
5350
  if (rawValue === undefined || rawValue === null || rawValue === '') return null;
5317
5351
  if (_typeof(rawValue) === 'object') return this.resolveFirstProductTitleValue(rawValue);
5318
5352
  return String(rawValue);
@@ -63,6 +63,8 @@ export interface OrderProductBundleItem {
63
63
  bundle_group_id?: number;
64
64
  /** 套餐商品 ID */
65
65
  bundle_id?: number;
66
+ /** 套餐子商品封面图 */
67
+ cover?: string | null;
66
68
  /** 套餐商品规格 ID */
67
69
  bundle_variant_id?: number;
68
70
  /** 数量 */
@@ -191,6 +191,16 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
191
191
  discountList: Discount[];
192
192
  }>;
193
193
  getDiscountList(): Discount[];
194
+ /** 读取 Discount 模块原始券列表(未经过 bookingTime 等过滤)。 */
195
+ getOriginalDiscountList(): Discount[];
196
+ /**
197
+ * 同步写入 Discount 模块的 discountList / originalDiscountList。
198
+ * 供 Holder 补全等场景在 OS store 层更新 machinecode holder 字段。
199
+ */
200
+ replaceDiscountStoreLists(params: {
201
+ discountList: Discount[];
202
+ originalDiscountList?: Discount[];
203
+ }): Promise<void>;
194
204
  scanPromotionCode(code: string, customerId?: number): Promise<BaseSalesScanCodeResult>;
195
205
  setDiscountSelected(params: {
196
206
  discountId: number;