@pisell/pisellos 2.2.282 → 2.2.283

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.
@@ -45,6 +45,7 @@ var PisellOSCore = /*#__PURE__*/function () {
45
45
  this.serverOptions = options.server;
46
46
  }
47
47
  this.initialize(options);
48
+ console.log('constructor123456543');
48
49
  }
49
50
  _createClass(PisellOSCore, [{
50
51
  key: "initialize",
@@ -512,7 +512,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
512
512
  generateIdempotencyToken(): string;
513
513
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
514
514
  createOrder(params: CommitOrderParams['query']): {
515
- type: "virtual" | "appointment_booking";
515
+ type: "appointment_booking" | "virtual";
516
516
  platform: string;
517
517
  sales_channel: string;
518
518
  order_sales_channel: string;
@@ -37,7 +37,7 @@ import { isNormalProduct } from "../Product/utils";
37
37
  import dayjs from 'dayjs';
38
38
  import { ensureOrderPaymentNumber, mergeOrderPaymentRecord, resolveOrderPaymentIdentity } from "./payment-utils";
39
39
  import { resolvePaymentNumberDevicePrefix, resolvePaymentNumberDevicePrefixFromDeviceId } from "../../utils/payment-number";
40
- import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid } from "../../solution/BaseSales/utils/cartPromotion";
40
+ import { processCartPromotion, appendPromotionTags as _appendPromotionTags, getOrderProductUid as getPromotionUid, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY } from "../../solution/BaseSales/utils/cartPromotion";
41
41
  import { buildProductLineFingerprint, getProductIdentityIndex, getSafeProductNum, isIdentityMatch, normalizeOrderProduct } from "../../solution/ScanOrder/utils";
42
42
  import { hasManualProductDiscountFlag, syncManualProductDiscountProductNum } from "./utils/manualProductDiscount";
43
43
  import { expandHydratedProductsForDiscountCollection, restoreHydratedBundleDiscounts } from "./utils/bundleDiscountHydration";
@@ -4018,8 +4018,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4018
4018
  booking: booking
4019
4019
  }) : null;
4020
4020
  var productToAdd = (linked === null || linked === void 0 ? void 0 : linked.product) || product;
4021
- var incomingFingerprint = buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4021
+ var disableMerge = (options === null || options === void 0 ? void 0 : options.disableMerge) === true;
4022
+ var incomingFingerprint = disableMerge ? '' : buildProductLineFingerprint(getProductSkuOptions(productToAdd), productToAdd.product_bundle);
4022
4023
  var normalizedIncoming = mergeOrderProductDisplayFields(productToAdd, normalizeOrderProduct(productToAdd));
4024
+ if (disableMerge) {
4025
+ normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, _defineProperty({}, PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY, true));
4026
+ }
4023
4027
  var isWeighingProduct = Number(((_normalizedIncoming$p = normalizedIncoming.product_sku) === null || _normalizedIncoming$p === void 0 ? void 0 : _normalizedIncoming$p.open_sold_weight) || 0) === 1;
4024
4028
  var netWeight = Number((_normalizedIncoming$p2 = normalizedIncoming.product_sku) === null || _normalizedIncoming$p2 === void 0 ? void 0 : _normalizedIncoming$p2.net_weight);
4025
4029
  if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
@@ -4038,7 +4042,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4038
4042
  var hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
4039
4043
  var hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
4040
4044
  var isIncomingCustomItem = ((_productToAdd$metadat = productToAdd.metadata) === null || _productToAdd$metadat === void 0 || (_productToAdd$metadat = _productToAdd$metadat.origin) === null || _productToAdd$metadat === void 0 ? void 0 : _productToAdd$metadat.isCustomItem) === true || ((_origin = productToAdd._origin) === null || _origin === void 0 ? void 0 : _origin.isCustomItem) === true;
4041
- var shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4045
+ var shouldForceNewLine = disableMerge || !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
4042
4046
  var matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
4043
4047
  var _item$metadata3;
4044
4048
  if (_this27.hasGoodPassDiscount(item)) return false;
@@ -4168,7 +4172,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4168
4172
  singleLine.num = 1;
4169
4173
  delete singleLine.product_quantity;
4170
4174
  _appendResult = this.appendProductLineToTempOrder(tempOrder, singleLine, cloneDeep(booking), {
4171
- insertAtIndex: insertAtIndex
4175
+ insertAtIndex: insertAtIndex,
4176
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4172
4177
  });
4173
4178
  if (!_appendResult) {
4174
4179
  _context21.next = 17;
@@ -4189,7 +4194,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4189
4194
  return _context21.abrupt("return", tempOrder.products);
4190
4195
  case 24:
4191
4196
  appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
4192
- insertAtIndex: insertAtIndex
4197
+ insertAtIndex: insertAtIndex,
4198
+ disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge
4193
4199
  });
4194
4200
  if (!appendResult) {
4195
4201
  _context21.next = 28;
@@ -328,6 +328,8 @@ export type AddProductBookingInput = Record<string, any>;
328
328
  */
329
329
  export interface AddProductToOrderOptions {
330
330
  insertAfterProductUid?: string;
331
+ /** 跳过同商品/规格匹配,始终新增购物车行。 */
332
+ disableMerge?: boolean;
331
333
  }
332
334
  /**
333
335
  * 删除商品后的可选位置保持策略。
@@ -1,4 +1,9 @@
1
1
  import type { OrderProduct } from '../../../modules/Order/types';
2
+ /**
3
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
4
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
5
+ */
6
+ export declare const PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
2
7
  /**
3
8
  * Cart promotion 工具集(OS 内部纯函数)
4
9
  *
@@ -23,6 +23,12 @@ import { cloneDeep } from 'lodash-es';
23
23
  import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../../modules/Order/utils";
24
24
  import { buildProductLineFingerprint, getSafeProductNum } from "../../ScanOrder/utils";
25
25
 
26
+ /**
27
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
28
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
29
+ */
30
+ export var PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = '_productLineMergeDisabled';
31
+
26
32
  /**
27
33
  * Cart promotion 工具集(OS 内部纯函数)
28
34
  *
@@ -483,10 +489,13 @@ function hasGoodPassDiscount(product) {
483
489
  }
484
490
 
485
491
  /**
486
- * 商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
492
+ * 不合并商品、商品券、自定义商品、称重行以及编辑订单历史行都有各自的促销合并边界。
487
493
  */
488
494
  function getPromotionLineMergeBoundary(product) {
489
- var _product$product_sku, _product$metadata3;
495
+ var _product$metadata3, _product$product_sku, _product$metadata4;
496
+ if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]) === true) {
497
+ return "separate:".concat(getOrderProductUid(product));
498
+ }
490
499
  if ((product === null || product === void 0 ? void 0 : product.product_id) === undefined || (product === null || product === void 0 ? void 0 : product.product_id) === null) {
491
500
  return "custom:".concat(getOrderProductUid(product));
492
501
  }
@@ -496,7 +505,7 @@ function getPromotionLineMergeBoundary(product) {
496
505
  if (Number((product === null || product === void 0 || (_product$product_sku = product.product_sku) === null || _product$product_sku === void 0 ? void 0 : _product$product_sku.open_sold_weight) || 0) === 1) {
497
506
  return "weighing:".concat(getOrderProductUid(product));
498
507
  }
499
- if ((product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.is_edit_for_runtime) !== true) return '';
508
+ if ((product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.is_edit_for_runtime) !== true) return '';
500
509
  return "edit:".concat(getOrderProductUid(product));
501
510
  }
502
511
  function isPersistedGeneratedVoucher(product) {
@@ -921,13 +930,13 @@ export function resolveStrategyEligibleProducts(matched) {
921
930
  export function calculateUnfulfilledPromotions(processedProducts, applicableStrategiesResult, mainProducts) {
922
931
  var unfulfilledMap = new Map();
923
932
  var _loop2 = function _loop2() {
924
- var _product$metadata4, _ref13, _product$_originalPro, _product$metadata5, _product$num2;
933
+ var _product$metadata5, _ref13, _product$_originalPro, _product$metadata6, _product$num2;
925
934
  var product = processedProducts[i];
926
- var promotion = product === null || product === void 0 || (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4._promotion;
935
+ var promotion = product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5._promotion;
927
936
  if (!promotion || promotion.inPromotion !== false) return 0; // continue
928
937
  var strategyId = promotion.strategyId;
929
938
  if (!strategyId) return 0; // continue
930
- var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
939
+ var lookupUid = String((_ref13 = (_product$_originalPro = product === null || product === void 0 ? void 0 : product._originalProductUid) !== null && _product$_originalPro !== void 0 ? _product$_originalPro : product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number) !== null && _ref13 !== void 0 ? _ref13 : '');
931
940
  var originalIndex = mainProducts.findIndex(function (item) {
932
941
  return getOrderProductUid(item) === lookupUid;
933
942
  });
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -451,7 +451,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
451
451
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
452
452
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
453
453
  */
454
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
454
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
455
+ action: "reloadCatalog";
456
+ } | {
457
+ action: "add";
458
+ cacheItem: any;
459
+ } | {
460
+ action: "requiresDetail";
461
+ payload: AddProductRequiresDetailPayload;
462
+ } | {
463
+ action: "requiresBookingEdit";
464
+ cacheItem: any;
465
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
466
+ };
455
467
  /** 规格弹窗 callback 后的第二段决策。 */
456
468
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
457
469
  /**
@@ -41,7 +41,7 @@ import { handleGlobalScan, handleCustomerScan, handleUniversalScan } from "./uti
41
41
  import scanCache from "./utils/scan/scanCache";
42
42
  import { formatGlobalScanResult } from "./utils/scan/formatGlobalScan";
43
43
  import { applyGlobalScan } from "./utils/scan/applyGlobalScan";
44
- import { buildCartView } from "./utils/cartView";
44
+ import { buildCartView, isWalkInCustomer } from "./utils/cartView";
45
45
  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";
46
46
  import { buildCacheItemFromOrderLine as buildCacheItemFromOrderLineUtil } from "../../modules/BookingContext/utils/buildCacheItemFromOrderLine";
47
47
  import { buildSessionCatalogStaleInfo, isSessionCatalogDateStale } from "./utils/sessionCatalogStale";
@@ -678,7 +678,13 @@ export var BookingTicketImpl = /*#__PURE__*/function (_BaseSalesImpl) {
678
678
  try {
679
679
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
680
680
  var item = _step.value;
681
- var topLevelId = Number(item.customer_id);
681
+ var rawCustomerId = item.customer_id;
682
+ if (!rawCustomerId || isWalkInCustomer({
683
+ id: rawCustomerId
684
+ })) {
685
+ continue;
686
+ }
687
+ var topLevelId = Number(rawCustomerId);
682
688
  if (Number.isFinite(topLevelId) && topLevelId > 0) {
683
689
  return topLevelId;
684
690
  }
package/lib/core/index.js CHANGED
@@ -50,6 +50,7 @@ var PisellOSCore = class {
50
50
  this.serverOptions = options.server;
51
51
  }
52
52
  this.initialize(options);
53
+ console.log("constructor123456543");
53
54
  }
54
55
  initialize(options) {
55
56
  if (options == null ? void 0 : options.plugins) {
@@ -1,51 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/model/strategy/adapter/promotion/index.ts
30
- var promotion_exports = {};
31
- __export(promotion_exports, {
32
- BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
33
- ITEM_REWARD_STRATEGY: () => import_examples.ITEM_REWARD_STRATEGY,
34
- PromotionAdapter: () => import_adapter.PromotionAdapter,
35
- PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
36
- X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
37
- default: () => import_adapter2.default
38
- });
39
- module.exports = __toCommonJS(promotion_exports);
40
- var import_evaluator = require("./evaluator");
41
- var import_adapter = require("./adapter");
42
- var import_adapter2 = __toESM(require("./adapter"));
43
- var import_examples = require("./examples");
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- BUY_X_GET_Y_FREE_STRATEGY,
47
- ITEM_REWARD_STRATEGY,
48
- PromotionAdapter,
49
- PromotionEvaluator,
50
- X_ITEMS_FOR_Y_PRICE_STRATEGY
51
- });
@@ -512,7 +512,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
512
512
  generateIdempotencyToken(): string;
513
513
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
514
514
  createOrder(params: CommitOrderParams['query']): {
515
- type: "virtual" | "appointment_booking";
515
+ type: "appointment_booking" | "virtual";
516
516
  platform: string;
517
517
  sales_channel: string;
518
518
  order_sales_channel: string;
@@ -3048,7 +3048,8 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3048
3048
  var _a, _b, _c, _d, _e, _f;
3049
3049
  const linked = booking ? this.createLinkedProductAndBooking({ product, booking }) : null;
3050
3050
  const productToAdd = (linked == null ? void 0 : linked.product) || product;
3051
- const incomingFingerprint = (0, import_utils3.buildProductLineFingerprint)(
3051
+ const disableMerge = (options == null ? void 0 : options.disableMerge) === true;
3052
+ const incomingFingerprint = disableMerge ? "" : (0, import_utils3.buildProductLineFingerprint)(
3052
3053
  (0, import_utils.getProductSkuOptions)(productToAdd),
3053
3054
  productToAdd.product_bundle
3054
3055
  );
@@ -3056,6 +3057,12 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3056
3057
  productToAdd,
3057
3058
  (0, import_utils3.normalizeOrderProduct)(productToAdd)
3058
3059
  );
3060
+ if (disableMerge) {
3061
+ normalizedIncoming.metadata = {
3062
+ ...normalizedIncoming.metadata || {},
3063
+ [import_cartPromotion.PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]: true
3064
+ };
3065
+ }
3059
3066
  const isWeighingProduct = Number(((_a = normalizedIncoming.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1;
3060
3067
  const netWeight = Number((_b = normalizedIncoming.product_sku) == null ? void 0 : _b.net_weight);
3061
3068
  if (isWeighingProduct && (!Number.isFinite(netWeight) || netWeight <= 0)) {
@@ -3079,7 +3086,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3079
3086
  const hasIncomingManualProductDiscount = isManualProductDiscountProduct(normalizedIncoming);
3080
3087
  const hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
3081
3088
  const isIncomingCustomItem = ((_e = (_d = productToAdd.metadata) == null ? void 0 : _d.origin) == null ? void 0 : _e.isCustomItem) === true || ((_f = productToAdd._origin) == null ? void 0 : _f.isCustomItem) === true;
3082
- const shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
3089
+ const shouldForceNewLine = disableMerge || !!booking || hasIncomingProductNote || hasIncomingManualProductDiscount || hasIncomingBookingUid || isIncomingCustomItem || isWeighingProduct;
3083
3090
  const matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex((item) => {
3084
3091
  var _a2;
3085
3092
  if (this.hasGoodPassDiscount(item))
@@ -3235,7 +3242,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3235
3242
  tempOrder,
3236
3243
  singleLine,
3237
3244
  (0, import_lodash_es.cloneDeep)(booking),
3238
- { insertAtIndex }
3245
+ { insertAtIndex, disableMerge: options == null ? void 0 : options.disableMerge }
3239
3246
  );
3240
3247
  if (appendResult2)
3241
3248
  await appendResult2;
@@ -3250,7 +3257,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
3250
3257
  tempOrder,
3251
3258
  product,
3252
3259
  booking,
3253
- { insertAtIndex }
3260
+ { insertAtIndex, disableMerge: options == null ? void 0 : options.disableMerge }
3254
3261
  );
3255
3262
  if (appendResult)
3256
3263
  await appendResult;
@@ -328,6 +328,8 @@ export type AddProductBookingInput = Record<string, any>;
328
328
  */
329
329
  export interface AddProductToOrderOptions {
330
330
  insertAfterProductUid?: string;
331
+ /** 跳过同商品/规格匹配,始终新增购物车行。 */
332
+ disableMerge?: boolean;
331
333
  }
332
334
  /**
333
335
  * 删除商品后的可选位置保持策略。
@@ -1,4 +1,9 @@
1
1
  import type { OrderProduct } from '../../../modules/Order/types';
2
+ /**
3
+ * 运行态商品行标记:该行由“不合并商品”加车策略创建,促销重算时必须保持独立。
4
+ * `normalizeSubmitProduct` 会按白名单裁剪 metadata,不会把此字段提交到后端。
5
+ */
6
+ export declare const PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
2
7
  /**
3
8
  * Cart promotion 工具集(OS 内部纯函数)
4
9
  *
@@ -29,6 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/solution/BaseSales/utils/cartPromotion.ts
30
30
  var cartPromotion_exports = {};
31
31
  __export(cartPromotion_exports, {
32
+ PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY: () => PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY,
32
33
  appendPromotionTags: () => appendPromotionTags,
33
34
  buildConsolidateKeyForPromotion: () => buildConsolidateKeyForPromotion,
34
35
  calculateUnfulfilledPromotions: () => calculateUnfulfilledPromotions,
@@ -46,6 +47,7 @@ var import_decimal = __toESM(require("decimal.js"));
46
47
  var import_lodash_es = require("lodash-es");
47
48
  var import_utils = require("../../../modules/Order/utils");
48
49
  var import_utils2 = require("../../ScanOrder/utils");
50
+ var PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY = "_productLineMergeDisabled";
49
51
  function getOrderProductBasePrice(product) {
50
52
  const metadata = (product == null ? void 0 : product.metadata) || {};
51
53
  const optionSum = (0, import_utils.sumOptionUnitPrice)((0, import_utils.getProductSkuOptions)(product)).toNumber();
@@ -382,17 +384,20 @@ function hasGoodPassDiscount(product) {
382
384
  );
383
385
  }
384
386
  function getPromotionLineMergeBoundary(product) {
385
- var _a, _b;
387
+ var _a, _b, _c;
388
+ if (((_a = product == null ? void 0 : product.metadata) == null ? void 0 : _a[PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY]) === true) {
389
+ return `separate:${getOrderProductUid(product)}`;
390
+ }
386
391
  if ((product == null ? void 0 : product.product_id) === void 0 || (product == null ? void 0 : product.product_id) === null) {
387
392
  return `custom:${getOrderProductUid(product)}`;
388
393
  }
389
394
  if (hasGoodPassDiscount(product)) {
390
395
  return `good-pass:${getOrderProductUid(product)}`;
391
396
  }
392
- if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
397
+ if (Number(((_b = product == null ? void 0 : product.product_sku) == null ? void 0 : _b.open_sold_weight) || 0) === 1) {
393
398
  return `weighing:${getOrderProductUid(product)}`;
394
399
  }
395
- if (((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.is_edit_for_runtime) !== true)
400
+ if (((_c = product == null ? void 0 : product.metadata) == null ? void 0 : _c.is_edit_for_runtime) !== true)
396
401
  return "";
397
402
  return `edit:${getOrderProductUid(product)}`;
398
403
  }
@@ -1065,6 +1070,7 @@ function processCartPromotion(list, evaluator, options) {
1065
1070
  }
1066
1071
  // Annotate the CommonJS export names for ESM import in node:
1067
1072
  0 && (module.exports = {
1073
+ PRODUCT_LINE_MERGE_DISABLED_METADATA_KEY,
1068
1074
  appendPromotionTags,
1069
1075
  buildConsolidateKeyForPromotion,
1070
1076
  calculateUnfulfilledPromotions,
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 1 | 5 | 2 | 4 | 3 | 6;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -451,7 +451,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
451
451
  * 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
452
452
  * 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
453
453
  */
454
- decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
454
+ decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
455
+ action: "reloadCatalog";
456
+ } | {
457
+ action: "add";
458
+ cacheItem: any;
459
+ } | {
460
+ action: "requiresDetail";
461
+ payload: AddProductRequiresDetailPayload;
462
+ } | {
463
+ action: "requiresBookingEdit";
464
+ cacheItem: any;
465
+ payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
466
+ };
455
467
  /** 规格弹窗 callback 后的第二段决策。 */
456
468
  decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
457
469
  /**
@@ -392,7 +392,11 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
392
392
  }
393
393
  getDiscountCustomerId(discounts) {
394
394
  for (const item of discounts) {
395
- const topLevelId = Number(item.customer_id);
395
+ const rawCustomerId = item.customer_id;
396
+ if (!rawCustomerId || (0, import_cartView.isWalkInCustomer)({ id: rawCustomerId })) {
397
+ continue;
398
+ }
399
+ const topLevelId = Number(rawCustomerId);
396
400
  if (Number.isFinite(topLevelId) && topLevelId > 0) {
397
401
  return topLevelId;
398
402
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.2.282",
4
+ "version": "2.2.283",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",