@pisell/pisellos 2.3.89 → 2.3.90

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.
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -1,6 +1,6 @@
1
1
  var _excluded = ["custom_product_bundle_map_id"],
2
2
  _excluded2 = ["unique_identification_number"],
3
- _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per"],
3
+ _excluded3 = ["num", "surcharge_fee", "discount_amount", "discount_type", "discountway", "product_discount_reason", "discount_per", "production_code"],
4
4
  _excluded4 = ["_extend", "relation_id", "table_form_id", "resource_id", "summary", "lastOrderInfo", "paid_amount", "shop_id", "shop_note", "shop_service_type", "start_time", "customer", "discount_list", "tax_fee", "total_amount", "total_refund_amount", "create_date", "holder_id"],
5
5
  _excluded5 = ["collect_pax", "table_occupancy_duration"];
6
6
  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; }
@@ -814,6 +814,11 @@ function normalizeSubmitPlatform(platform) {
814
814
  if (lower === 'h5') return 'H5';
815
815
  return value;
816
816
  }
817
+ function normalizeSubmitProductionCode(value) {
818
+ if (value === undefined || value === null) return undefined;
819
+ var productionCode = String(value).trim();
820
+ return productionCode || undefined;
821
+ }
817
822
 
818
823
  // 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
819
824
  function formatSubmitOptionItems(options) {
@@ -825,6 +830,9 @@ function formatSubmitOptionItems(options) {
825
830
  option_group_item_id: d === null || d === void 0 ? void 0 : d.option_group_item_id,
826
831
  option_group_id: d === null || d === void 0 ? void 0 : d.option_group_id
827
832
  });
833
+ var productionCode = normalizeSubmitProductionCode(d === null || d === void 0 ? void 0 : d.production_code);
834
+ delete option.production_code;
835
+ if (productionCode !== undefined) option.production_code = productionCode;
828
836
  var addPrice = (_d$add_price = d === null || d === void 0 ? void 0 : d.add_price) !== null && _d$add_price !== void 0 ? _d$add_price : d === null || d === void 0 ? void 0 : d.price;
829
837
  if (addPrice !== undefined) option.add_price = String(addPrice);
830
838
  delete option.price;
@@ -865,10 +873,13 @@ function formatSubmitBundleItems(bundle) {
865
873
  var num = toBundleNumber((_rawBundle$num = rawBundle.num) !== null && _rawBundle$num !== void 0 ? _rawBundle$num : rawBundle.quantity, 1);
866
874
  var bundleMapId = resolveSubmitBundleMapId(rawBundle);
867
875
  var hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
868
- return {
876
+ var productionCode = normalizeSubmitProductionCode(rawBundle.production_code);
877
+ return _objectSpread(_objectSpread({
869
878
  is_charge_tax: (_rawBundle$is_charge_ = rawBundle.is_charge_tax) !== null && _rawBundle$is_charge_ !== void 0 ? _rawBundle$is_charge_ : 0,
870
- bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0,
871
- production_code: rawBundle.production_code,
879
+ bundle_variant_id: (_rawBundle$bundle_var = rawBundle.bundle_variant_id) !== null && _rawBundle$bundle_var !== void 0 ? _rawBundle$bundle_var : 0
880
+ }, productionCode !== undefined ? {
881
+ production_code: productionCode
882
+ } : {}), {}, {
872
883
  num: num,
873
884
  quantity: toBundleNumber((_rawBundle$quantity = rawBundle.quantity) !== null && _rawBundle$quantity !== void 0 ? _rawBundle$quantity : rawBundle.num, num),
874
885
  extension_id: (_rawBundle$extension_ = rawBundle.extension_id) !== null && _rawBundle$extension_ !== void 0 ? _rawBundle$extension_ : 0,
@@ -890,7 +901,7 @@ function formatSubmitBundleItems(bundle) {
890
901
  relation_surcharge_ids: relationSurchargeIds,
891
902
  product_discount_difference: productDiscountDifference
892
903
  })
893
- };
904
+ });
894
905
  });
895
906
  }
896
907
 
@@ -922,7 +933,9 @@ function normalizeSubmitProduct(product) {
922
933
  _deprecatedDiscountway = submitProduct.discountway,
923
934
  _deprecatedProductDiscountReason = submitProduct.product_discount_reason,
924
935
  _deprecatedDiscountPer = submitProduct.discount_per,
936
+ rawProductionCode = submitProduct.production_code,
925
937
  productRest = _objectWithoutProperties(submitProduct, _excluded3);
938
+ var productionCode = normalizeSubmitProductionCode(rawProductionCode);
926
939
  delete productRest["product_".concat('option', "_item")];
927
940
  var rawMetadata = submitProduct.metadata || {};
928
941
  var bookingUid = rawMetadata.booking_uid;
@@ -954,7 +967,9 @@ function normalizeSubmitProduct(product) {
954
967
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
955
968
  option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option)
956
969
  });
957
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), bookingUid ? {
970
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), productionCode !== undefined ? {
971
+ production_code: productionCode
972
+ } : {}), bookingUid ? {
958
973
  booking_uid: bookingUid
959
974
  } : {}), bundleEdit !== undefined ? {
960
975
  bundle_edit: bundleEdit
@@ -855,6 +855,11 @@ function normalizeSubmitPlatform(platform) {
855
855
  if (lower === 'h5') return 'H5';
856
856
  return value;
857
857
  }
858
+ function normalizeSubmitProductionCode(value) {
859
+ if (value === undefined || value === null) return undefined;
860
+ const productionCode = String(value).trim();
861
+ return productionCode || undefined;
862
+ }
858
863
 
859
864
  // 后端 checkout 协议字段 option_group_item_id;tempOrder 内部也保持同一字段名。
860
865
  function formatSubmitOptionItems(options) {
@@ -866,6 +871,9 @@ function formatSubmitOptionItems(options) {
866
871
  option_group_item_id: d?.option_group_item_id,
867
872
  option_group_id: d?.option_group_id
868
873
  };
874
+ const productionCode = normalizeSubmitProductionCode(d?.production_code);
875
+ delete option.production_code;
876
+ if (productionCode !== undefined) option.production_code = productionCode;
869
877
  const addPrice = d?.add_price ?? d?.price;
870
878
  if (addPrice !== undefined) option.add_price = String(addPrice);
871
879
  delete option.price;
@@ -906,10 +914,13 @@ function formatSubmitBundleItems(bundle) {
906
914
  const num = toBundleNumber(rawBundle.num ?? rawBundle.quantity, 1);
907
915
  const bundleMapId = resolveSubmitBundleMapId(rawBundle);
908
916
  const hasSubmitBundleDiscounts = Array.isArray(rawBundle.discount_list) && rawBundle.discount_list.length > 0;
917
+ const productionCode = normalizeSubmitProductionCode(rawBundle.production_code);
909
918
  return {
910
919
  is_charge_tax: rawBundle.is_charge_tax ?? 0,
911
920
  bundle_variant_id: rawBundle.bundle_variant_id ?? 0,
912
- production_code: rawBundle.production_code,
921
+ ...(productionCode !== undefined ? {
922
+ production_code: productionCode
923
+ } : {}),
913
924
  num,
914
925
  quantity: toBundleNumber(rawBundle.quantity ?? rawBundle.num, num),
915
926
  extension_id: rawBundle.extension_id ?? 0,
@@ -966,8 +977,10 @@ function normalizeSubmitProduct(product) {
966
977
  discountway: _deprecatedDiscountway,
967
978
  product_discount_reason: _deprecatedProductDiscountReason,
968
979
  discount_per: _deprecatedDiscountPer,
980
+ production_code: rawProductionCode,
969
981
  ...productRest
970
982
  } = submitProduct;
983
+ const productionCode = normalizeSubmitProductionCode(rawProductionCode);
971
984
  delete productRest[`product_${'option'}_item`];
972
985
  const rawMetadata = submitProduct.metadata || {};
973
986
  const bookingUid = rawMetadata.booking_uid;
@@ -1001,6 +1014,9 @@ function normalizeSubmitProduct(product) {
1001
1014
  };
1002
1015
  return {
1003
1016
  ...productRest,
1017
+ ...(productionCode !== undefined ? {
1018
+ production_code: productionCode
1019
+ } : {}),
1004
1020
  ...(bookingUid ? {
1005
1021
  booking_uid: bookingUid
1006
1022
  } : {}),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.89",
4
+ "version": "2.3.90",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",