@pisell/pisellos 2.3.15 → 2.3.17

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 } from "./examples";
@@ -230,6 +230,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
230
230
  * const ids = this.collectBookingHolderRecords(booking);
231
231
  */
232
232
  private collectBookingHolderRecords;
233
+ private setProductHolderFromBooking;
234
+ private syncLinkedBookingHoldersToProducts;
233
235
  /**
234
236
  * 按 form_record 顺序读取 booking holder 的主字段名称。
235
237
  *
@@ -458,7 +460,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
458
460
  generateIdempotencyToken(): string;
459
461
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
460
462
  createOrder(params: CommitOrderParams['query']): {
461
- type: "appointment_booking" | "virtual";
463
+ type: "virtual" | "appointment_booking";
462
464
  platform: string;
463
465
  sales_channel: string;
464
466
  order_sales_channel: string;
@@ -712,6 +712,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
712
712
  // 也需要让 Rules.calcDiscount 把 DiscountModule 的 isSelected / isAvailable /
713
713
  // appliedProductDetails / savedAmount 复位。
714
714
  if (!tempOrder) return;
715
+ this.syncLinkedBookingHoldersToProducts(tempOrder);
715
716
  delete tempOrder.discount_list;
716
717
  var discountList = ((_this$store$discount9 = this.store.discount) === null || _this$store$discount9 === void 0 ? void 0 : _this$store$discount9.getDiscountList()) || [];
717
718
  var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
@@ -2431,6 +2432,48 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2431
2432
  return record !== undefined && record !== null && record !== '';
2432
2433
  });
2433
2434
  }
2435
+ }, {
2436
+ key: "setProductHolderFromBooking",
2437
+ value: function setProductHolderFromBooking(product, booking) {
2438
+ if (!product || !booking) return;
2439
+ var holderRecords = this.collectBookingHolderRecords(booking);
2440
+ if (!product.metadata || _typeof(product.metadata) !== 'object') {
2441
+ product.metadata = {};
2442
+ }
2443
+ product.metadata.holder_id = holderRecords.length > 0 ? holderRecords : null;
2444
+ }
2445
+ }, {
2446
+ key: "syncLinkedBookingHoldersToProducts",
2447
+ value: function syncLinkedBookingHoldersToProducts(tempOrder) {
2448
+ var _this13 = this;
2449
+ var bookings = tempOrder.bookings || [];
2450
+ var products = tempOrder.products || [];
2451
+ if (!bookings.length || !products.length) return;
2452
+ var bookingByProductUid = new Map();
2453
+ var bookingByBookingUid = new Map();
2454
+ bookings.forEach(function (booking) {
2455
+ var _booking$metadata2, _booking$metadata3;
2456
+ if (!booking || _typeof(booking) !== 'object') return;
2457
+ var productUid = booking.product_uid || ((_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.product_uid);
2458
+ if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
2459
+ bookingByProductUid.set(String(productUid), booking);
2460
+ }
2461
+ var bookingUid = ((_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.unique_identification_number) || booking.booking_uid;
2462
+ if (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '') {
2463
+ bookingByBookingUid.set(String(bookingUid), booking);
2464
+ }
2465
+ });
2466
+ products.forEach(function (product) {
2467
+ var _product$metadata5, _product$metadata6;
2468
+ if (!product || _typeof(product) !== 'object') return;
2469
+ var productUid = ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) || product.unique_identification_number;
2470
+ var bookingUid = product.booking_uid || ((_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
2471
+ var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
2472
+ if (linkedBooking) {
2473
+ _this13.setProductHolderFromBooking(product, linkedBooking);
2474
+ }
2475
+ });
2476
+ }
2434
2477
 
2435
2478
  /**
2436
2479
  * 按 form_record 顺序读取 booking holder 的主字段名称。
@@ -2535,41 +2578,42 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2535
2578
  value: function syncTempOrderHolderFromBookings(tempOrder) {
2536
2579
  var bookings = tempOrder.bookings || [];
2537
2580
  var hasHolderSource = bookings.some(function (booking) {
2538
- var _booking$metadata2;
2539
- return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== undefined;
2581
+ var _booking$metadata4;
2582
+ return (booking === null || booking === void 0 ? void 0 : booking.holder) !== undefined || (booking === null || booking === void 0 || (_booking$metadata4 = booking.metadata) === null || _booking$metadata4 === void 0 ? void 0 : _booking$metadata4.holder_id) !== undefined;
2540
2583
  });
2541
2584
  var nextHolder = this.buildTempOrderHolderFromBookings(tempOrder);
2542
2585
  if (nextHolder || hasHolderSource || bookings.length === 0) {
2543
2586
  tempOrder.holder = nextHolder;
2544
2587
  }
2588
+ this.syncLinkedBookingHoldersToProducts(tempOrder);
2545
2589
  }
2546
2590
  }, {
2547
2591
  key: "getBookingUniqueIdentificationNumber",
2548
2592
  value: function getBookingUniqueIdentificationNumber(booking) {
2549
- var _booking$metadata3;
2550
- var uid = booking === null || booking === void 0 || (_booking$metadata3 = booking.metadata) === null || _booking$metadata3 === void 0 ? void 0 : _booking$metadata3.unique_identification_number;
2593
+ var _booking$metadata5;
2594
+ var uid = booking === null || booking === void 0 || (_booking$metadata5 = booking.metadata) === null || _booking$metadata5 === void 0 ? void 0 : _booking$metadata5.unique_identification_number;
2551
2595
  if (uid === undefined || uid === null || uid === '') return null;
2552
2596
  return String(uid);
2553
2597
  }
2554
2598
  }, {
2555
2599
  key: "findBookingIndexByUniqueIdentificationNumber",
2556
2600
  value: function findBookingIndexByUniqueIdentificationNumber(tempOrder, uniqueIdentificationNumber) {
2557
- var _this13 = this;
2601
+ var _this14 = this;
2558
2602
  return (tempOrder.bookings || []).findIndex(function (booking) {
2559
- return _this13.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
2603
+ return _this14.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
2560
2604
  });
2561
2605
  }
2562
2606
  }, {
2563
2607
  key: "removeLinkedBookingsForProduct",
2564
2608
  value: function removeLinkedBookingsForProduct(tempOrder, product) {
2565
- var _product$metadata5,
2566
- _product$metadata6,
2567
- _this14 = this;
2568
- var productUid = (product === null || product === void 0 || (_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
2569
- var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.booking_uid);
2609
+ var _product$metadata7,
2610
+ _product$metadata8,
2611
+ _this15 = this;
2612
+ var productUid = (product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
2613
+ var bookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.booking_uid);
2570
2614
  if (!productUid && !bookingUid) return;
2571
2615
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
2572
- var currentBookingUid = _this14.getBookingUniqueIdentificationNumber(booking);
2616
+ var currentBookingUid = _this15.getBookingUniqueIdentificationNumber(booking);
2573
2617
  if (bookingUid && currentBookingUid === String(bookingUid)) return false;
2574
2618
  if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
2575
2619
  return true;
@@ -2892,15 +2936,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2892
2936
  }, {
2893
2937
  key: "productHasCustomerBoundDiscount",
2894
2938
  value: function productHasCustomerBoundDiscount(product) {
2895
- var _this15 = this;
2939
+ var _this16 = this;
2896
2940
  if (((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (discount) {
2897
- return _this15.isCustomerBoundDiscount(discount);
2941
+ return _this16.isCustomerBoundDiscount(discount);
2898
2942
  })) {
2899
2943
  return true;
2900
2944
  }
2901
2945
  return ((product === null || product === void 0 ? void 0 : product.product_bundle) || []).some(function (bundle) {
2902
2946
  return ((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []).some(function (discount) {
2903
- return _this15.isCustomerBoundDiscount(discount);
2947
+ return _this16.isCustomerBoundDiscount(discount);
2904
2948
  });
2905
2949
  });
2906
2950
  }
@@ -2909,18 +2953,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2909
2953
  value: function shouldSkipDiscountCalculation(tempOrder) {
2910
2954
  var _this$store$discount13,
2911
2955
  _this$store$discount14,
2912
- _this16 = this;
2956
+ _this17 = this;
2913
2957
  if (this.hasActiveCustomerBoundDiscount) return false;
2914
2958
  var discountList = ((_this$store$discount13 = this.store.discount) === null || _this$store$discount13 === void 0 || (_this$store$discount14 = _this$store$discount13.getDiscountList) === null || _this$store$discount14 === void 0 ? void 0 : _this$store$discount14.call(_this$store$discount13)) || [];
2915
2959
  if (discountList.length > 0) return false;
2916
2960
  return !(tempOrder.products || []).some(function (product) {
2917
- return _this16.productHasCustomerBoundDiscount(product);
2961
+ return _this17.productHasCustomerBoundDiscount(product);
2918
2962
  });
2919
2963
  }
2920
2964
  }, {
2921
2965
  key: "clearCustomerBoundDiscounts",
2922
2966
  value: function clearCustomerBoundDiscounts(tempOrder) {
2923
- var _this17 = this,
2967
+ var _this18 = this,
2924
2968
  _discountModule$getDi,
2925
2969
  _discountModule$getOr,
2926
2970
  _discountModule$setDi,
@@ -2929,7 +2973,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2929
2973
  var filterDiscountList = function filterDiscountList(discountList) {
2930
2974
  if (!Array.isArray(discountList)) return [];
2931
2975
  return discountList.filter(function (discount) {
2932
- var shouldRemove = _this17.isCustomerBoundDiscount(discount);
2976
+ var shouldRemove = _this18.isCustomerBoundDiscount(discount);
2933
2977
  if (shouldRemove) didRemoveCustomerBoundDiscount = true;
2934
2978
  return !shouldRemove;
2935
2979
  });
@@ -2957,11 +3001,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2957
3001
  var currentOriginalDiscounts = ((_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
2958
3002
  var nextDiscounts = currentDiscounts.filter(function (discount) {
2959
3003
  if (discount !== null && discount !== void 0 && discount.isEditMode) return true;
2960
- return !_this17.isCustomerBoundDiscount(discount);
3004
+ return !_this18.isCustomerBoundDiscount(discount);
2961
3005
  });
2962
3006
  var nextOriginalDiscounts = currentOriginalDiscounts.filter(function (discount) {
2963
3007
  if (discount !== null && discount !== void 0 && discount.isEditMode) return true;
2964
- return !_this17.isCustomerBoundDiscount(discount);
3008
+ return !_this18.isCustomerBoundDiscount(discount);
2965
3009
  });
2966
3010
  void ((_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, nextDiscounts));
2967
3011
  void ((_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, nextOriginalDiscounts));
@@ -3129,7 +3173,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3129
3173
  }, {
3130
3174
  key: "addOrderPayment",
3131
3175
  value: function addOrderPayment(payment) {
3132
- var _this18 = this;
3176
+ var _this19 = this;
3133
3177
  this.logInfo('addOrderPayment', {
3134
3178
  payment: payment
3135
3179
  });
@@ -3146,7 +3190,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3146
3190
  void this.recalculateSummary({
3147
3191
  createIfMissing: true
3148
3192
  }).catch(function (error) {
3149
- _this18.logError('recalculate summary after addOrderPayment failed', {
3193
+ _this19.logError('recalculate summary after addOrderPayment failed', {
3150
3194
  error: error instanceof Error ? error.message : String(error)
3151
3195
  });
3152
3196
  });
@@ -3228,7 +3272,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3228
3272
  }, {
3229
3273
  key: "applyPaymentLifecycleChange",
3230
3274
  value: function applyPaymentLifecycleChange(tempOrder, options) {
3231
- var _this19 = this;
3275
+ var _this20 = this;
3232
3276
  this.updateTempOrderPaymentStatus(tempOrder);
3233
3277
  if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
3234
3278
  this.persistTempOrder();
@@ -3238,7 +3282,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3238
3282
  void this.recalculateSummary({
3239
3283
  createIfMissing: true
3240
3284
  }).catch(function (error) {
3241
- _this19.logError("recalculate summary after ".concat(logContext, " failed"), {
3285
+ _this20.logError("recalculate summary after ".concat(logContext, " failed"), {
3242
3286
  error: error instanceof Error ? error.message : String(error)
3243
3287
  });
3244
3288
  });
@@ -3282,7 +3326,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3282
3326
  }, {
3283
3327
  key: "updateVoucherOrderPayments",
3284
3328
  value: function updateVoucherOrderPayments(payments, options) {
3285
- var _this20 = this;
3329
+ var _this21 = this;
3286
3330
  var tempOrder = this.ensureTempOrder();
3287
3331
  var isOrderPaymentType = function isOrderPaymentType(value) {
3288
3332
  return value === 'normal' || value === 'deposit';
@@ -3317,7 +3361,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3317
3361
  });
3318
3362
  };
3319
3363
  var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
3320
- return _this20.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
3364
+ return _this21.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
3321
3365
  defaultPaid: false
3322
3366
  });
3323
3367
  })).filter(function (payment) {
@@ -3366,7 +3410,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3366
3410
  void this.recalculateSummary({
3367
3411
  createIfMissing: true
3368
3412
  }).catch(function (error) {
3369
- _this20.logError('recalculate summary after updateVoucherOrderPayments failed', {
3413
+ _this21.logError('recalculate summary after updateVoucherOrderPayments failed', {
3370
3414
  error: error instanceof Error ? error.message : String(error)
3371
3415
  });
3372
3416
  });
@@ -3433,8 +3477,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3433
3477
  }, {
3434
3478
  key: "hasLinkedBookingUid",
3435
3479
  value: function hasLinkedBookingUid(product) {
3436
- var _product$booking_uid, _product$metadata7;
3437
- var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.booking_uid;
3480
+ var _product$booking_uid, _product$metadata9;
3481
+ var bookingUid = (_product$booking_uid = product === null || product === void 0 ? void 0 : product.booking_uid) !== null && _product$booking_uid !== void 0 ? _product$booking_uid : product === null || product === void 0 || (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.booking_uid;
3438
3482
  return bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '';
3439
3483
  }
3440
3484
 
@@ -3502,7 +3546,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3502
3546
  var _appendProductLineToTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(tempOrder, product, booking) {
3503
3547
  var _booking_uid,
3504
3548
  _metadata,
3505
- _this21 = this;
3549
+ _this22 = this;
3506
3550
  var linked, productToAdd, incomingFingerprint, normalizedIncoming, incomingBookingUid, hasIncomingGoodPass, hasIncomingProductNote, hasIncomingBookingUid, shouldForceNewLine, matchedIndex, matchedProduct, existedFingerprint, shouldMerge, _targetProduct$metada, targetProduct, targetUid, normalizedProduct, nextNum, targetIsManualProductDiscount, nextDiscountList;
3507
3551
  return _regeneratorRuntime().wrap(function _callee16$(_context18) {
3508
3552
  while (1) switch (_context18.prev = _context18.next) {
@@ -3527,8 +3571,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3527
3571
  hasIncomingBookingUid = this.hasLinkedBookingUid(productToAdd) || this.hasLinkedBookingUid(normalizedIncoming);
3528
3572
  shouldForceNewLine = !!booking || hasIncomingProductNote || hasIncomingBookingUid;
3529
3573
  matchedIndex = hasIncomingGoodPass || shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
3530
- if (_this21.hasGoodPassDiscount(item)) return false;
3531
- if (_this21.hasOrderProductLineNote(item)) return false;
3574
+ if (_this22.hasGoodPassDiscount(item)) return false;
3575
+ if (_this22.hasOrderProductLineNote(item)) return false;
3532
3576
  if (item.order_detail_id !== undefined && item.order_detail_id !== null) return false;
3533
3577
  if (item.product_id !== productToAdd.product_id) return false;
3534
3578
  if (item.product_variant_id !== productToAdd.product_variant_id) return false;
@@ -3825,17 +3869,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3825
3869
  }, {
3826
3870
  key: "preservePersistedBundlePriceFields",
3827
3871
  value: function preservePersistedBundlePriceFields(previousBundles, nextBundles) {
3828
- var _this22 = this;
3872
+ var _this23 = this;
3829
3873
  if (!Array.isArray(nextBundles)) return nextBundles;
3830
3874
  if (!Array.isArray(previousBundles) || previousBundles.length === 0) return nextBundles;
3831
3875
  var previousByIdentity = new Map();
3832
3876
  previousBundles.forEach(function (bundle) {
3833
- var identity = _this22.getBundleRuntimeIdentity(bundle);
3877
+ var identity = _this23.getBundleRuntimeIdentity(bundle);
3834
3878
  if (identity) previousByIdentity.set(identity, bundle);
3835
3879
  });
3836
3880
  return nextBundles.map(function (bundle, index) {
3837
3881
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
3838
- var previous = previousByIdentity.get(_this22.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
3882
+ var previous = previousByIdentity.get(_this23.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
3839
3883
  if (!previous || _typeof(previous) !== 'object') return bundle;
3840
3884
  return _objectSpread(_objectSpread({}, bundle), {}, {
3841
3885
  price: previous.price,
@@ -4022,7 +4066,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4022
4066
  key: "updateOrderProducts",
4023
4067
  value: function () {
4024
4068
  var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(paramsList) {
4025
- var _this23 = this;
4069
+ var _this24 = this;
4026
4070
  var tempOrder;
4027
4071
  return _regeneratorRuntime().wrap(function _callee20$(_context22) {
4028
4072
  while (1) switch (_context22.prev = _context22.next) {
@@ -4035,7 +4079,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4035
4079
  return _context22.abrupt("return", tempOrder.products);
4036
4080
  case 3:
4037
4081
  paramsList.forEach(function (params) {
4038
- _this23.applyOrderProductUpdateToTempOrder(tempOrder, params);
4082
+ _this24.applyOrderProductUpdateToTempOrder(tempOrder, params);
4039
4083
  });
4040
4084
  _context22.next = 6;
4041
4085
  return this.finalizeAfterProductsMutation(tempOrder);
@@ -4205,7 +4249,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4205
4249
  key: "removeProductsFromOrder",
4206
4250
  value: (function () {
4207
4251
  var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(identities) {
4208
- var _this24 = this;
4252
+ var _this25 = this;
4209
4253
  var tempOrder, productsBeforeRemove, bookingsBeforeRemove, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3;
4210
4254
  return _regeneratorRuntime().wrap(function _callee23$(_context26) {
4211
4255
  while (1) switch (_context26.prev = _context26.next) {
@@ -4260,7 +4304,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4260
4304
  }
4261
4305
  if (productUid !== undefined && productUid !== null && productUid !== '') {
4262
4306
  bookingsBeforeRemove.forEach(function (booking) {
4263
- var bookingUid = _this24.getBookingUniqueIdentificationNumber(booking);
4307
+ var bookingUid = _this25.getBookingUniqueIdentificationNumber(booking);
4264
4308
  if (bookingUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) {
4265
4309
  linkedBookingUidsToRemove.add(bookingUid);
4266
4310
  }
@@ -4739,10 +4783,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4739
4783
  value: function extractSubmitErrorResponse(error) {
4740
4784
  var _error$response,
4741
4785
  _error$response2,
4742
- _this25 = this;
4786
+ _this26 = this;
4743
4787
  var candidates = [error === null || error === void 0 || (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data, error === null || error === void 0 ? void 0 : error.data, error === null || error === void 0 || (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.body, error === null || error === void 0 ? void 0 : error.body];
4744
4788
  return candidates.find(function (candidate) {
4745
- return _this25.isSubmitErrorResponse(candidate);
4789
+ return _this26.isSubmitErrorResponse(candidate);
4746
4790
  }) || null;
4747
4791
  }
4748
4792
  }, {
@@ -5403,7 +5447,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5403
5447
  }, {
5404
5448
  key: "normalizeTempOrderForRuntime",
5405
5449
  value: function normalizeTempOrderForRuntime(raw, options) {
5406
- var _this26 = this;
5450
+ var _this27 = this;
5407
5451
  var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), raw || {});
5408
5452
  // ES 列表详情使用 id 表示订单主键;OS 详情态统一依赖 order_id 驱动操作按钮。
5409
5453
  if ((nextTempOrder.order_id === undefined || nextTempOrder.order_id === null) && (raw === null || raw === void 0 ? void 0 : raw.id) !== undefined && (raw === null || raw === void 0 ? void 0 : raw.id) !== null) {
@@ -5426,10 +5470,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5426
5470
  nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
5427
5471
  var rawProducts = Array.isArray(raw.products) ? raw.products : [];
5428
5472
  nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
5429
- return _this26.normalizeHydratedOrderProduct(p);
5473
+ return _this27.normalizeHydratedOrderProduct(p);
5430
5474
  }) : [];
5431
5475
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
5432
- var booking = _this26.normalizeHydratedBookingHolder(b || {});
5476
+ var booking = _this27.normalizeHydratedBookingHolder(b || {});
5433
5477
  return _objectSpread(_objectSpread({}, booking), {}, {
5434
5478
  is_all: normalizeBookingIsAll(booking),
5435
5479
  sub_type: normalizeBookingSubType(booking)
@@ -5459,11 +5503,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5459
5503
  _step22;
5460
5504
  try {
5461
5505
  for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {
5462
- var _product$metadata8, _ref74, _ref75, _existed$origin, _rawProduct$metadata;
5506
+ var _product$metadata10, _ref74, _ref75, _existed$origin, _rawProduct$metadata;
5463
5507
  var _step22$value = _slicedToArray(_step22.value, 2),
5464
5508
  index = _step22$value[0],
5465
5509
  product = _step22$value[1];
5466
- var uid = (_product$metadata8 = product.metadata) === null || _product$metadata8 === void 0 ? void 0 : _product$metadata8.unique_identification_number;
5510
+ var uid = (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number;
5467
5511
  if (!uid) continue;
5468
5512
  var existed = productsByUid[uid] && _typeof(productsByUid[uid]) === 'object' ? productsByUid[uid] : {};
5469
5513
  var rawProduct = rawProducts[index] && _typeof(rawProducts[index]) === 'object' ? rawProducts[index] : product;
@@ -5501,8 +5545,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5501
5545
  var bookingUidByProductUid = new Map();
5502
5546
  var productByUid = new Map();
5503
5547
  (tempOrder.products || []).forEach(function (product) {
5504
- var _product$metadata9;
5505
- var productUid = (product === null || product === void 0 || (_product$metadata9 = product.metadata) === null || _product$metadata9 === void 0 ? void 0 : _product$metadata9.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
5548
+ var _product$metadata11;
5549
+ var productUid = (product === null || product === void 0 || (_product$metadata11 = product.metadata) === null || _product$metadata11 === void 0 ? void 0 : _product$metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
5506
5550
  if (productUid !== undefined && productUid !== null && String(productUid) !== '') {
5507
5551
  productByUid.set(String(productUid), product);
5508
5552
  }
@@ -5523,8 +5567,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5523
5567
  bookingUidByProductUid.set(String(productUid), bookingUid);
5524
5568
  });
5525
5569
  (tempOrder.products || []).forEach(function (product) {
5526
- var _product$metadata10;
5527
- var productUid = (product === null || product === void 0 || (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
5570
+ var _product$metadata12;
5571
+ var productUid = (product === null || product === void 0 || (_product$metadata12 = product.metadata) === null || _product$metadata12 === void 0 ? void 0 : _product$metadata12.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
5528
5572
  if (productUid === undefined || productUid === null || String(productUid) === '') return;
5529
5573
  var bookingUid = bookingUidByProductUid.get(String(productUid));
5530
5574
  if (!bookingUid) return;
@@ -5535,6 +5579,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5535
5579
  product.booking_uid = linkedBookingUid;
5536
5580
  product.metadata.booking_uid = linkedBookingUid;
5537
5581
  });
5582
+ this.syncLinkedBookingHoldersToProducts(tempOrder);
5538
5583
  }
5539
5584
  }, {
5540
5585
  key: "pickHydratedDisplayText",
@@ -5597,7 +5642,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5597
5642
  }, {
5598
5643
  key: "normalizeHydratedOrderProduct",
5599
5644
  value: function normalizeHydratedOrderProduct(product) {
5600
- var _this27 = this;
5645
+ var _this28 = this;
5601
5646
  var row = _objectSpread({}, product || {});
5602
5647
  if (row.num === undefined && row.product_quantity !== undefined) {
5603
5648
  row.num = row.product_quantity;
@@ -5605,7 +5650,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5605
5650
  var productSku = ensureProductSku(row);
5606
5651
  row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
5607
5652
  option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
5608
- return _this27.normalizeHydratedProductOptionItem(optionItem || {});
5653
+ return _this28.normalizeHydratedProductOptionItem(optionItem || {});
5609
5654
  }))
5610
5655
  });
5611
5656
  delete row["product_".concat('option', "_item")];
@@ -329,11 +329,12 @@ function buildSurchargeQuantityTotals(nodes) {
329
329
  }
330
330
  function getFallbackAllProductSurchargeIds(surchargeList) {
331
331
  return (surchargeList || []).reduce(function (ids, config) {
332
- var _config$open_product, _config$is_all;
332
+ var _config$open_product, _config$is_all, _config$open_schedule;
333
333
  var id = getSurchargeConfigId(config);
334
334
  if (id === undefined) return ids;
335
335
  if (Number((_config$open_product = config.open_product) !== null && _config$open_product !== void 0 ? _config$open_product : 0) === 0) return ids;
336
336
  if (Number((_config$is_all = config.is_all) !== null && _config$is_all !== void 0 ? _config$is_all : 0) !== 1) return ids;
337
+ if (Number((_config$open_schedule = config.open_schedule) !== null && _config$open_schedule !== void 0 ? _config$open_schedule : 0) === 1 && config.schedule_type !== 'all') return ids;
337
338
  ids.push(id);
338
339
  return ids;
339
340
  }, []);
@@ -431,9 +431,9 @@ declare class Server {
431
431
  private shouldLookupLocalPrintOrder;
432
432
  private getLocalPrintOrderLookup;
433
433
  private handleLocalPrintOrder;
434
- private handleMachinecodeBatchMetadata;
434
+ private handleMachinecodeBatchMeta;
435
435
  private resolveMachinecodeBatchMetadataLookup;
436
- private syncMachinecodeBatchMetadataToLocalOrder;
436
+ private syncMachinecodeRedeemStatusToLocalOrder;
437
437
  private handleOrderCheckoutSubmit;
438
438
  private handleSyncCheckoutSubmit;
439
439
  private handlePendingSyncCheckoutOrder;