@pisell/pisellos 2.2.187 → 2.2.188

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.
@@ -314,7 +314,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
314
314
  }, {
315
315
  key: "calcDiscount",
316
316
  value: function calcDiscount(_ref2, options) {
317
- var _this3 = this;
317
+ var _options$selectedList,
318
+ _this3 = this;
318
319
  var discountList = _ref2.discountList,
319
320
  productList = _ref2.productList,
320
321
  holders = _ref2.holders,
@@ -360,6 +361,13 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
360
361
  var filteredDiscountList = addModeDiscount.filter(function (discount) {
361
362
  return !discount.isManualSelect;
362
363
  });
364
+ var hasDiscountInput = editModeDiscount.length > 0 || addModeDiscount.length > 0 || Boolean(options === null || options === void 0 ? void 0 : options.discountId) || Boolean(options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.length) || Boolean(options === null || options === void 0 ? void 0 : options.scan);
365
+ if (!hasDiscountInput) {
366
+ return {
367
+ discountList: discountList,
368
+ productList: productList
369
+ };
370
+ }
363
371
 
364
372
  // 🔥 扁平化商品列表:将 bundle 子商品展开为虚拟商品
365
373
  var flattenProductsWithBundle = function flattenProductsWithBundle(productList) {
@@ -1177,8 +1185,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1177
1185
  var _product$discount_lis9;
1178
1186
  // 主商品:检查自己的 discount_list
1179
1187
  if (flatItem.type === 'main' && (_product$discount_lis9 = product.discount_list) !== null && _product$discount_lis9 !== void 0 && _product$discount_lis9.some(function (item) {
1180
- var _options$selectedList;
1181
- return options === null || options === void 0 || (_options$selectedList = options.selectedList) === null || _options$selectedList === void 0 ? void 0 : _options$selectedList.some(function (n) {
1188
+ var _options$selectedList2;
1189
+ return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
1182
1190
  var _item$discount4;
1183
1191
  return n.discountId === ((_item$discount4 = item.discount) === null || _item$discount4 === void 0 ? void 0 : _item$discount4.resource_id);
1184
1192
  });
@@ -1189,14 +1197,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1189
1197
  if (flatItem.type === 'bundle') {
1190
1198
  var _product$discount_lis10, _flatItem$parentProdu8;
1191
1199
  if ((_product$discount_lis10 = product.discount_list) !== null && _product$discount_lis10 !== void 0 && _product$discount_lis10.some(function (item) {
1192
- var _options$selectedList2;
1193
- return options === null || options === void 0 || (_options$selectedList2 = options.selectedList) === null || _options$selectedList2 === void 0 ? void 0 : _options$selectedList2.some(function (n) {
1200
+ var _options$selectedList3;
1201
+ return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
1194
1202
  var _item$discount5;
1195
1203
  return n.discountId === ((_item$discount5 = item.discount) === null || _item$discount5 === void 0 ? void 0 : _item$discount5.resource_id);
1196
1204
  });
1197
1205
  }) || (_flatItem$parentProdu8 = flatItem.parentProduct) !== null && _flatItem$parentProdu8 !== void 0 && (_flatItem$parentProdu8 = _flatItem$parentProdu8.discount_list) !== null && _flatItem$parentProdu8 !== void 0 && _flatItem$parentProdu8.some(function (item) {
1198
- var _options$selectedList3;
1199
- return options === null || options === void 0 || (_options$selectedList3 = options.selectedList) === null || _options$selectedList3 === void 0 ? void 0 : _options$selectedList3.some(function (n) {
1206
+ var _options$selectedList4;
1207
+ return options === null || options === void 0 || (_options$selectedList4 = options.selectedList) === null || _options$selectedList4 === void 0 ? void 0 : _options$selectedList4.some(function (n) {
1200
1208
  var _item$discount6;
1201
1209
  return n.discountId === ((_item$discount6 = item.discount) === null || _item$discount6 === void 0 ? void 0 : _item$discount6.resource_id);
1202
1210
  });
@@ -1871,7 +1879,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1871
1879
  } else {
1872
1880
  // 🔥 没有子商品被拆分,使用原有逻辑
1873
1881
  mainProductArr.forEach(function (mainProduct) {
1874
- var _ref14, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
1882
+ var _ref15, _mainProductData$main, _mainProductData$disc, _mainProductData$disc2, _mainProductData$disc3;
1875
1883
  var mainProductData = _this3.hooks.getProduct(mainProduct);
1876
1884
 
1877
1885
  // 重组bundle
@@ -1886,6 +1894,9 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1886
1894
  } else {
1887
1895
  // 🔥 关键:拆分后的bundle item
1888
1896
  processedBundleItems.forEach(function (item) {
1897
+ var _item$price, _ref14, _item$bundle_selling_;
1898
+ var nextBundlePrice = (_item$price = item.price) !== null && _item$price !== void 0 ? _item$price : bundleItem.price;
1899
+ var nextBundleSellingPrice = (_ref14 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref14 !== void 0 ? _ref14 : bundleItem.bundle_selling_price;
1889
1900
  // 🔥 更新 discount_list 中的 num,使其与拆分后的 item.num 一致
1890
1901
  var updatedDiscountList = (item.discount_list || []).map(function (discount) {
1891
1902
  var _discount$metadata10;
@@ -1900,10 +1911,10 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1900
1911
  newBundle.push(_objectSpread(_objectSpread({}, bundleItem), {}, {
1901
1912
  _id: item._id,
1902
1913
  product_id: bundleItem.product_id,
1903
- price: item.price,
1914
+ price: nextBundlePrice,
1904
1915
  num: item.num,
1905
1916
  discount_list: updatedDiscountList,
1906
- bundle_selling_price: bundleItem.bundle_selling_price !== undefined ? item.price : undefined
1917
+ bundle_selling_price: bundleItem.bundle_selling_price !== undefined ? nextBundleSellingPrice : undefined
1907
1918
  }));
1908
1919
  });
1909
1920
  }
@@ -1912,7 +1923,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1912
1923
 
1913
1924
  // 主商品已经在前面的 setProduct 中应用过折扣;这里只替换 bundle,
1914
1925
  // 避免把主商品 discount_list 再扣一次。
1915
- var mainSellingPrice = (_ref14 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref14 !== void 0 ? _ref14 : 0;
1926
+ var mainSellingPrice = (_ref15 = (_mainProductData$main = mainProductData.main_product_selling_price) !== null && _mainProductData$main !== void 0 ? _mainProductData$main : mainProductData.price) !== null && _ref15 !== void 0 ? _ref15 : 0;
1916
1927
  var newTotal = Number(mainSellingPrice || 0);
1917
1928
  var newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
1918
1929
 
@@ -1930,8 +1941,8 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
1930
1941
  // 累加 bundle 的折后价格(只累加一次)
1931
1942
  if (newBundle.length > 0) {
1932
1943
  newBundle.forEach(function (item) {
1933
- var _item$bundle_selling_;
1934
- var bundleSellingPrice = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price;
1944
+ var _item$bundle_selling_2;
1945
+ var bundleSellingPrice = (_item$bundle_selling_2 = item.bundle_selling_price) !== null && _item$bundle_selling_2 !== void 0 ? _item$bundle_selling_2 : item.price;
1935
1946
  newTotal += Number(bundleSellingPrice) * Number(item.num);
1936
1947
  });
1937
1948
 
@@ -2060,14 +2071,14 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
2060
2071
  var ruleType = usageRules.type;
2061
2072
  // 套餐适用范围配置
2062
2073
  var packageScope = usageRules === null || usageRules === void 0 ? void 0 : usageRules.package_scope;
2063
- var _ref15 = packageScope || {},
2064
- scopeType = _ref15.type,
2065
- _ref15$exclude_bundle = _ref15.exclude_bundle_product_ids,
2066
- exclude_bundle_product_ids = _ref15$exclude_bundle === void 0 ? [] : _ref15$exclude_bundle,
2067
- _ref15$include_bundle = _ref15.include_bundle_product_ids,
2068
- include_bundle_product_ids = _ref15$include_bundle === void 0 ? [] : _ref15$include_bundle,
2069
- _ref15$filter = _ref15.filter,
2070
- filter = _ref15$filter === void 0 ? 0 : _ref15$filter;
2074
+ var _ref16 = packageScope || {},
2075
+ scopeType = _ref16.type,
2076
+ _ref16$exclude_bundle = _ref16.exclude_bundle_product_ids,
2077
+ exclude_bundle_product_ids = _ref16$exclude_bundle === void 0 ? [] : _ref16$exclude_bundle,
2078
+ _ref16$include_bundle = _ref16.include_bundle_product_ids,
2079
+ include_bundle_product_ids = _ref16$include_bundle === void 0 ? [] : _ref16$include_bundle,
2080
+ _ref16$filter = _ref16.filter,
2081
+ filter = _ref16$filter === void 0 ? 0 : _ref16$filter;
2071
2082
  var isMainProduct = flatItem.type === 'main'; // 单独购买
2072
2083
  var isBundleItem = flatItem.type === 'bundle'; // 套餐中购买
2073
2084
 
@@ -607,7 +607,7 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
607
607
  };
608
608
  externalSaleNumber = params.externalSaleNumber || params.external_sale_number;
609
609
  if (params.forceRemote) {
610
- _context5.next = 35;
610
+ _context5.next = 36;
611
611
  break;
612
612
  }
613
613
  if (!(params.orderId !== undefined)) {
@@ -650,58 +650,59 @@ export var BaseSalesImpl = /*#__PURE__*/function (_BaseModule) {
650
650
  _context5.t0 = _context5.t1;
651
651
  case 26:
652
652
  localRecord = _context5.t0;
653
+ debugger;
653
654
  if (!localRecord) {
654
- _context5.next = 35;
655
+ _context5.next = 36;
655
656
  break;
656
657
  }
657
- _context5.next = 30;
658
+ _context5.next = 31;
658
659
  return this.store.order.hydrateTempOrderFromRecord(localRecord, {
659
660
  recalcOnHydrate: false
660
661
  });
661
- case 30:
662
+ case 31:
662
663
  _sales = _context5.sent;
663
664
  this.currentSalesDetail = _sales;
664
- _context5.next = 34;
665
+ _context5.next = 35;
665
666
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
666
667
  sales: _sales
667
668
  });
668
- case 34:
669
- return _context5.abrupt("return", _sales);
670
669
  case 35:
670
+ return _context5.abrupt("return", _sales);
671
+ case 36:
671
672
  if (!(params.orderId === undefined || params.orderId === null)) {
672
- _context5.next = 37;
673
+ _context5.next = 38;
673
674
  break;
674
675
  }
675
676
  throw new Error('加载销售详情需要 orderId,或本地库中存在对应 externalSaleNumber/orderNumber');
676
- case 37:
677
- _context5.next = 39;
677
+ case 38:
678
+ _context5.next = 40;
678
679
  return this.store.order.getOrderInfoByRemote(Number(params.orderId));
679
- case 39:
680
+ case 40:
680
681
  res = _context5.sent;
681
682
  if (!(!res || res.code !== 200)) {
682
- _context5.next = 43;
683
+ _context5.next = 44;
683
684
  break;
684
685
  }
685
686
  message = res && (res.message || res.msg) || "\u52A0\u8F7D\u9500\u552E\u8BE6\u60C5\u5931\u8D25: ".concat(params.orderId);
686
687
  throw new Error(message);
687
- case 43:
688
- _context5.next = 45;
688
+ case 44:
689
+ _context5.next = 46;
689
690
  return this.store.order.hydrateTempOrderFromRecord(res.data, {
690
691
  recalcOnHydrate: false
691
692
  });
692
- case 45:
693
+ case 46:
693
694
  sales = _context5.sent;
694
- _context5.next = 48;
695
+ _context5.next = 49;
695
696
  return this.store.order.saveDraft();
696
- case 48:
697
+ case 49:
697
698
  this.currentSalesDetail = sales;
698
- _context5.next = 51;
699
+ _context5.next = 52;
699
700
  return this.core.effects.emit("".concat(this.name, ":onSalesOrderLoaded"), {
700
701
  sales: sales
701
702
  });
702
- case 51:
703
- return _context5.abrupt("return", sales);
704
703
  case 52:
704
+ return _context5.abrupt("return", sales);
705
+ case 53:
705
706
  case "end":
706
707
  return _context5.stop();
707
708
  }
@@ -230,7 +230,7 @@ export function mergeIdenticalPromotionCartLines(products) {
230
230
  _step;
231
231
  try {
232
232
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
233
- var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$booking_uid, _line$metadata4, _line$product_variant;
233
+ var _line$metadata, _ref2, _line$metadata$source, _line$metadata2, _ref3, _promotion$finalPrice, _line$metadata3, _line$booking_uid, _line$metadata4, _line$order_detail_id, _line$product_variant;
234
234
  var line = _step.value;
235
235
  if (getGiftInfo(line)) {
236
236
  merged.push(line);
@@ -245,7 +245,8 @@ export function mergeIdenticalPromotionCartLines(products) {
245
245
  var unitPrice = String((_ref2 = (_line$metadata$source = (_line$metadata2 = line.metadata) === null || _line$metadata2 === void 0 ? void 0 : _line$metadata2.source_product_price) !== null && _line$metadata$source !== void 0 ? _line$metadata$source : line.selling_price) !== null && _ref2 !== void 0 ? _ref2 : '');
246
246
  var promoUnitPrice = String((_ref3 = (_promotion$finalPrice = promotion.finalPrice) !== null && _promotion$finalPrice !== void 0 ? _promotion$finalPrice : (_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.main_product_selling_price) !== null && _ref3 !== void 0 ? _ref3 : '');
247
247
  var bookingUid = (_line$booking_uid = line === null || line === void 0 ? void 0 : line.booking_uid) !== null && _line$booking_uid !== void 0 ? _line$booking_uid : line === null || line === void 0 || (_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.booking_uid;
248
- var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
248
+ var orderDetailId = (_line$order_detail_id = line === null || line === void 0 ? void 0 : line.order_detail_id) !== null && _line$order_detail_id !== void 0 ? _line$order_detail_id : line === null || line === void 0 ? void 0 : line.orderDetailId;
249
+ var mergeKey = [line.product_id, (_line$product_variant = line.product_variant_id) !== null && _line$product_variant !== void 0 ? _line$product_variant : 0, fingerprint, bookingUid ? String(bookingUid) : '', orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '' ? String(orderDetailId) : '', promotion.strategyId, unitPrice, promoUnitPrice].join('#');
249
250
  var hitIndex = indexByKey.get(mergeKey);
250
251
  if (hitIndex === undefined) {
251
252
  indexByKey.set(mergeKey, merged.length);
@@ -413,6 +414,15 @@ function getGiftInfo(product) {
413
414
  var _product$metadata2;
414
415
  return (product === null || product === void 0 || (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._giftInfo) || (product === null || product === void 0 ? void 0 : product._giftInfo) || null;
415
416
  }
417
+ function isPersistedGeneratedVoucher(product) {
418
+ var _product$order_detail;
419
+ var orderDetailId = (_product$order_detail = product === null || product === void 0 ? void 0 : product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : product === null || product === void 0 ? void 0 : product.orderDetailId;
420
+ if (orderDetailId === undefined || orderDetailId === null || orderDetailId === '') {
421
+ return false;
422
+ }
423
+ var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
424
+ return (product === null || product === void 0 ? void 0 : product.extension_type) === 'product_voucher' || metadata.parent_order_detail_id !== undefined || metadata.gift_card_type !== undefined;
425
+ }
416
426
  function getProductBundleForEvaluator(product) {
417
427
  var bundles = Array.isArray(product === null || product === void 0 ? void 0 : product.product_bundle) ? product.product_bundle : [];
418
428
  return bundles.map(function (b) {
@@ -441,14 +451,19 @@ function getProductBundleForEvaluator(product) {
441
451
  * // => 单行 num=4,清除 _promotion 后重新评估
442
452
  */
443
453
  export function buildConsolidateKeyForPromotion(item) {
444
- var _item$booking_uid, _item$metadata, _item$product_variant2;
454
+ var _item$booking_uid, _item$metadata, _item$order_detail_id, _item$product_variant3;
445
455
  var fingerprint = buildProductLineFingerprint(item.product_option_item, item.product_bundle);
446
456
  var bookingUid = (_item$booking_uid = item === null || item === void 0 ? void 0 : item.booking_uid) !== null && _item$booking_uid !== void 0 ? _item$booking_uid : item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.booking_uid;
447
- if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
457
+ var orderDetailId = (_item$order_detail_id = item === null || item === void 0 ? void 0 : item.order_detail_id) !== null && _item$order_detail_id !== void 0 ? _item$order_detail_id : item === null || item === void 0 ? void 0 : item.orderDetailId;
458
+ if (orderDetailId !== undefined && orderDetailId !== null && orderDetailId !== '') {
448
459
  var _item$product_variant;
449
- return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(bookingUid)].join('#');
460
+ return [item.product_id, (_item$product_variant = item.product_variant_id) !== null && _item$product_variant !== void 0 ? _item$product_variant : 0, fingerprint, String(orderDetailId)].join('#');
461
+ }
462
+ if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
463
+ var _item$product_variant2;
464
+ return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint, String(bookingUid)].join('#');
450
465
  }
451
- return [item.product_id, (_item$product_variant2 = item.product_variant_id) !== null && _item$product_variant2 !== void 0 ? _item$product_variant2 : 0, fingerprint].join('#');
466
+ return [item.product_id, (_item$product_variant3 = item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0, fingerprint].join('#');
452
467
  }
453
468
  function consolidateMainProductsForPromotion(entries) {
454
469
  if (!Array.isArray(entries) || entries.length <= 1) {
@@ -882,11 +897,11 @@ export function appendPromotionTags(products, evaluator) {
882
897
 
883
898
  // 评估器期望的 product shape,最少字段集
884
899
  var evaluatorInput = products.map(function (item, index) {
885
- var _ref14, _item$id, _item$product_variant3, _item$price, _item$quantity;
900
+ var _ref14, _item$id, _item$product_variant4, _item$price, _item$quantity;
886
901
  return {
887
902
  id: index,
888
903
  product_id: Number((_ref14 = (_item$id = item === null || item === void 0 ? void 0 : item.id) !== null && _item$id !== void 0 ? _item$id : item === null || item === void 0 ? void 0 : item.product_id) !== null && _ref14 !== void 0 ? _ref14 : 0) || 0,
889
- product_variant_id: Number((_item$product_variant3 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant3 !== void 0 ? _item$product_variant3 : 0) || 0,
904
+ product_variant_id: Number((_item$product_variant4 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant4 !== void 0 ? _item$product_variant4 : 0) || 0,
890
905
  name: (item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.name) || '',
891
906
  price: Number((_item$price = item === null || item === void 0 ? void 0 : item.price) !== null && _item$price !== void 0 ? _item$price : 0) || 0,
892
907
  quantity: Number((_item$quantity = item === null || item === void 0 ? void 0 : item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : 1) || 1,
@@ -975,7 +990,12 @@ export function processCartPromotion(list, evaluator, options) {
975
990
  for (var i = 0; i < list.length; i++) {
976
991
  var item = list[i];
977
992
  var giftInfo = getGiftInfo(item);
978
- if (giftInfo) {
993
+ if (isPersistedGeneratedVoucher(item)) {
994
+ editProductsWithIndex.push({
995
+ item: item,
996
+ originalListIndex: i
997
+ });
998
+ } else if (giftInfo) {
979
999
  existingGiftsWithIndex.push({
980
1000
  item: item,
981
1001
  originalListIndex: i
@@ -1039,12 +1059,12 @@ export function processCartPromotion(list, evaluator, options) {
1039
1059
  var promotionProducts = [];
1040
1060
  var originalItemMap = new Map();
1041
1061
  var productsForStrategies = consolidatedMainProductsWithIndex.map(function (_ref16, i) {
1042
- var _item$product_id, _item$product_variant4, _item$metadata2, _item$num;
1062
+ var _item$product_id, _item$product_variant5, _item$metadata2, _item$num;
1043
1063
  var item = _ref16.item;
1044
1064
  return {
1045
1065
  id: i,
1046
1066
  product_id: Number((_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : 0) || 0,
1047
- product_variant_id: Number((_item$product_variant4 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant4 !== void 0 ? _item$product_variant4 : 0) || 0,
1067
+ product_variant_id: Number((_item$product_variant5 = item === null || item === void 0 ? void 0 : item.product_variant_id) !== null && _item$product_variant5 !== void 0 ? _item$product_variant5 : 0) || 0,
1048
1068
  name: (item === null || item === void 0 || (_item$metadata2 = item.metadata) === null || _item$metadata2 === void 0 ? void 0 : _item$metadata2.product_name) || (item === null || item === void 0 ? void 0 : item.title) || '',
1049
1069
  price: getOrderProductBasePrice(item),
1050
1070
  quantity: Number((_item$num = item === null || item === void 0 ? void 0 : item.num) !== null && _item$num !== void 0 ? _item$num : 1) || 1,
@@ -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 | 1 | 2 | 6 | 3 | 4 | 5;
314
+ weekNum: 0 | 1 | 2 | 3 | 5 | 4 | 6;
315
315
  }[]>;
316
316
  submitTimeSlot(timeSlots: TimeSliceItem): void;
317
317
  private getScheduleDataByIds;
@@ -2,8 +2,6 @@ var _excluded = ["id"],
2
2
  _excluded2 = ["product_id"],
3
3
  _excluded3 = ["product_id"];
4
4
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
5
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
5
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
6
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
7
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
@@ -27,6 +25,8 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
27
25
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28
26
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
29
27
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
30
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
31
31
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
32
32
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
@@ -41,7 +41,19 @@ import { buildCartView } from "./utils/cartView";
41
41
  import { buildCacheItemFromCartDetail, buildCacheItemFromDetail, buildRequiresDetailPayload as _buildRequiresDetailPayload, decideAddProduct as decideAddProductUtil, decideAfterDetail as decideAfterDetailUtil, decideAutoClose as decideAutoCloseUtil, getIsEject as getIsEjectUtil, getIsOnlySession as getIsOnlySessionUtil, transformDetailToProductAndBooking as transformDetailToProductAndBookingUtil } from "./utils/addProductDecision";
42
42
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
43
43
  import { buildNormalProductCacheItemFromOrderLine as buildNormalProductCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine";
44
+ import { buildProductOptionStringFromOrderLine } from "../../modules/BookingContext/utils/orderLineDisplay";
44
45
  import { applyBookingsStatus, resolveScheduleId, restoreBookingsStatus } from "./utils/bookingStatus";
46
+ function withProductOptionString(cacheItem) {
47
+ var _cacheItem$_extend;
48
+ var productOptionString = buildProductOptionStringFromOrderLine(cacheItem);
49
+ if (!productOptionString) return cacheItem;
50
+ return _objectSpread(_objectSpread({}, cacheItem), {}, {
51
+ product_option_string: (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem.product_option_string) || productOptionString,
52
+ _extend: _objectSpread(_objectSpread({}, (cacheItem === null || cacheItem === void 0 ? void 0 : cacheItem._extend) || {}), {}, {
53
+ product_option_string: (cacheItem === null || cacheItem === void 0 || (_cacheItem$_extend = cacheItem._extend) === null || _cacheItem$_extend === void 0 ? void 0 : _cacheItem$_extend.product_option_string) || productOptionString
54
+ })
55
+ });
56
+ }
45
57
  export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
46
58
  _inherits(BookingTicketImpl, _BaseSalesImpl);
47
59
  var _super = _createSuper(BookingTicketImpl);
@@ -1579,10 +1591,12 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
1579
1591
  }, {
1580
1592
  key: "getProductExtend",
1581
1593
  value: function getProductExtend(cacheItem, extra) {
1582
- return getProductExtendUtil({
1583
- cacheItem: cacheItem,
1594
+ var preparedCacheItem = withProductOptionString(cacheItem);
1595
+ var result = getProductExtendUtil({
1596
+ cacheItem: preparedCacheItem,
1584
1597
  ctx: this.buildBookingCalcContext(extra)
1585
1598
  });
1599
+ return result;
1586
1600
  }
1587
1601
 
1588
1602
  /**
@@ -34,6 +34,7 @@ __export(buildCacheItemFromOrderLine_exports, {
34
34
  module.exports = __toCommonJS(buildCacheItemFromOrderLine_exports);
35
35
  var import_dayjs = __toESM(require("dayjs"));
36
36
  var import_manualProductDiscount = require("../../Order/utils/manualProductDiscount");
37
+ var import_orderLineDisplay = require("./orderLineDisplay");
37
38
  function safeFormat(value, fmt) {
38
39
  if (value === void 0 || value === null)
39
40
  return void 0;
@@ -178,6 +179,7 @@ function buildCacheItemFromOrderLine(input) {
178
179
  const capacity = resolveCapacityFromBooking(booking);
179
180
  const holderId = ((_a = booking.metadata) == null ? void 0 : _a.holder_id) ?? booking.holder_id;
180
181
  const productTitle = resolveProductTitle(product, booking, sourceProduct);
182
+ const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
181
183
  const other = {
182
184
  product_variant_id: product.product_variant_id ?? 0,
183
185
  option: Array.isArray(product.product_option_item) ? [...product.product_option_item] : [],
@@ -206,7 +208,8 @@ function buildCacheItemFromOrderLine(input) {
206
208
  discount_reason: (0, import_manualProductDiscount.resolveManualDiscountMessage)(
207
209
  product.discount_list,
208
210
  (_c = product.metadata) == null ? void 0 : _c.product_discount_reason
209
- ) || void 0
211
+ ) || void 0,
212
+ ...productOptionString ? { product_option_string: productOptionString } : {}
210
213
  };
211
214
  const manualDiscount = (product.discount_list || []).find((d) => (d == null ? void 0 : d.type) === "product");
212
215
  if (manualDiscount && extend.origin_total === selling) {
@@ -233,6 +236,7 @@ function buildCacheItemFromOrderLine(input) {
233
236
  price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? selling,
234
237
  selling_price: product.selling_price,
235
238
  original_price: product.original_price,
239
+ ...productOptionString ? { product_option_string: productOptionString } : {},
236
240
  _extend: extend,
237
241
  new: 0,
238
242
  autoClose: false,
@@ -22,6 +22,7 @@ __export(buildNormalProductCacheItemFromOrderLine_exports, {
22
22
  buildNormalProductCacheItemFromOrderLine: () => buildNormalProductCacheItemFromOrderLine
23
23
  });
24
24
  module.exports = __toCommonJS(buildNormalProductCacheItemFromOrderLine_exports);
25
+ var import_orderLineDisplay = require("./orderLineDisplay");
25
26
  function resolveSourceProductPrice(product, sourceProduct) {
26
27
  var _a, _b, _c;
27
28
  const metadata = product.metadata || {};
@@ -85,6 +86,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
85
86
  Array.isArray(product.product_bundle) ? product.product_bundle : []
86
87
  );
87
88
  const originExtend = (_c = (_b = product.metadata) == null ? void 0 : _b.origin) == null ? void 0 : _c._extend;
89
+ const productOptionString = (0, import_orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
88
90
  const other = {
89
91
  product_id: resolvedId,
90
92
  product_variant_id: product.product_variant_id ?? 0,
@@ -110,6 +112,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
110
112
  skuValue: JSON.parse(JSON.stringify(skuValue)),
111
113
  _skuValue: JSON.parse(JSON.stringify(skuValue)),
112
114
  isNormalProduct: true,
115
+ ...productOptionString ? { product_option_string: productOptionString } : {},
113
116
  ...(originExtend == null ? void 0 : originExtend.priceOverride) !== void 0 ? { priceOverride: originExtend.priceOverride } : {},
114
117
  ...(originExtend == null ? void 0 : originExtend.bundle_edit) !== void 0 ? { bundle_edit: originExtend.bundle_edit } : {}
115
118
  };
@@ -128,6 +131,7 @@ function buildNormalProductCacheItemFromOrderLine(input) {
128
131
  price: (sourceProduct == null ? void 0 : sourceProduct.price) ?? sourcePrice,
129
132
  selling_price: product.selling_price,
130
133
  original_price: product.original_price,
134
+ ...productOptionString ? { product_option_string: productOptionString } : {},
131
135
  note: product.note,
132
136
  order_detail_id: product.order_detail_id ?? null,
133
137
  new: 0,
@@ -0,0 +1 @@
1
+ export declare function buildProductOptionStringFromOrderLine(product: any): string;
@@ -0,0 +1,56 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/modules/BookingContext/utils/orderLineDisplay.ts
20
+ var orderLineDisplay_exports = {};
21
+ __export(orderLineDisplay_exports, {
22
+ buildProductOptionStringFromOrderLine: () => buildProductOptionStringFromOrderLine
23
+ });
24
+ module.exports = __toCommonJS(orderLineDisplay_exports);
25
+ function pickDisplayText(value) {
26
+ if (value === void 0 || value === null)
27
+ return "";
28
+ if (typeof value === "string")
29
+ return value;
30
+ if (typeof value !== "object")
31
+ return String(value);
32
+ return value.auto || value.original || value.en || value["zh-CN"] || value["zh-HK"] || "";
33
+ }
34
+ function formatNamePair(group, item) {
35
+ const groupText = pickDisplayText(group);
36
+ const itemText = pickDisplayText(item);
37
+ if (groupText && itemText)
38
+ return `${groupText}:${itemText}`;
39
+ return groupText || itemText;
40
+ }
41
+ function buildProductOptionStringFromOrderLine(product) {
42
+ const segments = [];
43
+ const sku = (product == null ? void 0 : product.product_sku) || {};
44
+ if (Array.isArray(sku.variant)) {
45
+ for (const variant of sku.variant) {
46
+ const segment = formatNamePair(variant == null ? void 0 : variant.group, variant == null ? void 0 : variant.item);
47
+ if (segment)
48
+ segments.push(segment);
49
+ }
50
+ }
51
+ return segments.join(", ");
52
+ }
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ buildProductOptionStringFromOrderLine
56
+ });
@@ -312,7 +312,11 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
312
312
  recalcOnHydrate?: boolean;
313
313
  }): Promise<OrderTempOrder>;
314
314
  private normalizeTempOrderForRuntime;
315
+ private pickHydratedDisplayText;
316
+ private formatHydratedNamePair;
317
+ private buildHydratedProductOptionString;
315
318
  private normalizeHydratedProductOptionItem;
319
+ private mergeHydratedProductOptionDisplayFields;
316
320
  private resolveHydratedProductOptions;
317
321
  private normalizeHydratedOrderProduct;
318
322
  getLastOrderInfo(): Record<string, any> | undefined;