@pisell/pisellos 2.3.169 → 2.3.170

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.
@@ -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;
@@ -1139,7 +1139,7 @@ function formatSubmitOptionItems(options, formatOptions = {}) {
1139
1139
  const option = {
1140
1140
  ...(d && typeof d === 'object' ? d : {}),
1141
1141
  num: d?.num,
1142
- option_group_item_id: d?.option_group_item_id,
1142
+ option_group_item_id: d?.option_group_item_id ?? d?.product_option_item_id ?? d?.id,
1143
1143
  option_group_id: d?.option_group_id
1144
1144
  };
1145
1145
  const productionCode = normalizeSubmitProductionCode(d?.production_code);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.169",
4
+ "version": "2.3.170",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",