@pisell/pisellos 2.3.226 → 2.3.227

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.
Files changed (47) hide show
  1. package/dist/modules/Customer/types.d.ts +0 -4
  2. package/dist/modules/Order/index.d.ts +3 -1
  3. package/dist/modules/Order/index.js +82 -125
  4. package/dist/modules/Order/types.d.ts +0 -2
  5. package/dist/modules/Order/utils.js +0 -2
  6. package/dist/modules/Product/index.d.ts +1 -1
  7. package/dist/modules/Rules/index.js +1 -1
  8. package/dist/modules/Rules/types.d.ts +2 -0
  9. package/dist/modules/Summary/utils.d.ts +1 -1
  10. package/dist/solution/BaseSales/index.js +0 -3
  11. package/dist/solution/BookingByStep/index.d.ts +2 -2
  12. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +13 -13
  13. package/dist/solution/Checkout/index.js +69 -104
  14. package/dist/solution/Checkout/types.d.ts +0 -1
  15. package/dist/solution/ScanOrder/index.js +2 -10
  16. package/dist/solution/UnifiedBookingSales/draftDiscounts.d.ts +8 -0
  17. package/dist/solution/UnifiedBookingSales/draftDiscounts.js +101 -0
  18. package/dist/solution/UnifiedBookingSales/index.d.ts +7 -0
  19. package/dist/solution/UnifiedBookingSales/index.js +1253 -1072
  20. package/dist/solution/UnifiedBookingSales/types.d.ts +5 -0
  21. package/dist/solution/VenueBooking/index.js +490 -522
  22. package/lib/modules/Customer/types.d.ts +0 -4
  23. package/lib/modules/Order/index.d.ts +3 -1
  24. package/lib/modules/Order/index.js +9 -46
  25. package/lib/modules/Order/types.d.ts +0 -2
  26. package/lib/modules/Order/utils.js +1 -5
  27. package/lib/modules/Product/index.d.ts +1 -1
  28. package/lib/modules/Rules/index.js +1 -1
  29. package/lib/modules/Rules/types.d.ts +2 -0
  30. package/lib/modules/Summary/utils.d.ts +1 -1
  31. package/lib/solution/BaseSales/index.js +0 -3
  32. package/lib/solution/BookingByStep/index.d.ts +2 -2
  33. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +13 -13
  34. package/lib/solution/Checkout/index.js +0 -21
  35. package/lib/solution/Checkout/types.d.ts +0 -1
  36. package/lib/solution/ScanOrder/index.js +0 -6
  37. package/lib/solution/UnifiedBookingSales/draftDiscounts.d.ts +8 -0
  38. package/lib/solution/UnifiedBookingSales/draftDiscounts.js +36 -0
  39. package/lib/solution/UnifiedBookingSales/index.d.ts +7 -0
  40. package/lib/solution/UnifiedBookingSales/index.js +78 -0
  41. package/lib/solution/UnifiedBookingSales/types.d.ts +5 -0
  42. package/lib/solution/VenueBooking/index.js +1 -6
  43. package/package.json +1 -1
  44. package/dist/modules/Order/utils/bookingUuid.d.ts +0 -4
  45. package/dist/modules/Order/utils/bookingUuid.js +0 -24
  46. package/lib/modules/Order/utils/bookingUuid.d.ts +0 -4
  47. package/lib/modules/Order/utils/bookingUuid.js +0 -25
@@ -44,10 +44,6 @@ export interface ShopGetCustomerListParams {
44
44
  num?: number;
45
45
  /** 搜索关键词 */
46
46
  search?: string;
47
- /** Full national phone number, without the international calling code. */
48
- phone?: string;
49
- /** Exact email lookup, independent from the generic search keyword. */
50
- email?: string;
51
47
  /** 关联查询参数 */
52
48
  with?: CustomerWith[];
53
49
  /** wallet搜索标识 */
@@ -131,6 +131,8 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
131
131
  scannedDiscountList?: Discount[];
132
132
  }>;
133
133
  applyDiscount(options?: {
134
+ /** Draft recovery must remove stale discounts even when no card survives revalidation. */
135
+ force?: boolean;
134
136
  reapplyBookingDiscountProductUids?: string[];
135
137
  reapplyWeighedDiscountProductUids?: string[];
136
138
  preferredEntitlementPassIds?: number[];
@@ -642,7 +644,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
642
644
  generateIdempotencyToken(): string;
643
645
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
644
646
  createOrder(params: CommitOrderParams['query']): {
645
- type: "appointment_booking" | "virtual";
647
+ type: "virtual" | "appointment_booking";
646
648
  platform: string;
647
649
  sales_channel: string;
648
650
  order_sales_channel: string;
@@ -31,7 +31,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
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); }
33
33
  import { loadSalesOrderSnapshot } from "../../shared/sales/loadSalesOrderSnapshot";
34
- import { assignBookingUuid, ensureBookingUuid } from "./utils/bookingUuid";
35
34
  import { PAYMENT_REFRESH_MESSAGE, requiresLocalPaymentRefresh, stripLocalEftposState } from "./localEftposState";
36
35
  import { BaseModule } from "../BaseModule";
37
36
  import { OrderHooks } from "./types";
@@ -1377,7 +1376,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1377
1376
  delete tempOrder.discount_list;
1378
1377
  var discountList = ((_this$store$discount16 = this.store.discount) === null || _this$store$discount16 === void 0 ? void 0 : _this$store$discount16.getDiscountList()) || [];
1379
1378
  var shouldSkipDiscountCalculation = this.shouldSkipDiscountCalculation(tempOrder);
1380
- if (shouldSkipDiscountCalculation) return;
1379
+ if (shouldSkipDiscountCalculation && !(options !== null && options !== void 0 && options.force)) return;
1381
1380
  var rulesModule = this.store.rules;
1382
1381
  if (!rulesModule) return;
1383
1382
  var result = rulesModule.calcDiscount({
@@ -1391,7 +1390,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1391
1390
  }, {
1392
1391
  reapplyBookingDiscountProductUids: options === null || options === void 0 ? void 0 : options.reapplyBookingDiscountProductUids,
1393
1392
  reapplyWeighedDiscountProductUids: options === null || options === void 0 ? void 0 : options.reapplyWeighedDiscountProductUids,
1394
- preferredEntitlementPassIds: options === null || options === void 0 ? void 0 : options.preferredEntitlementPassIds
1393
+ preferredEntitlementPassIds: options === null || options === void 0 ? void 0 : options.preferredEntitlementPassIds,
1394
+ force: options === null || options === void 0 ? void 0 : options.force
1395
1395
  });
1396
1396
  if (result !== null && result !== void 0 && result.productList) {
1397
1397
  var previousProductsByUid = indexOrderProductsByUid(tempOrder.products);
@@ -3760,7 +3760,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3760
3760
  }),
3761
3761
  booking_uid: bookingUid
3762
3762
  }),
3763
- booking: _objectSpread(_objectSpread({}, ensureBookingUuid(params.booking)), {}, {
3763
+ booking: _objectSpread(_objectSpread({}, params.booking), {}, {
3764
3764
  is_all: normalizeBookingIsAll(params.booking),
3765
3765
  product_uid: productUid,
3766
3766
  sub_type: normalizeBookingSubType(params.booking),
@@ -4628,7 +4628,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4628
4628
  var tempOrder = this.ensureTempOrder();
4629
4629
  var bookings = tempOrder.bookings || [];
4630
4630
  var firstIndex = bookings.findIndex(isFulfillmentTimingBooking);
4631
- var nextBooking = ensureBookingUuid(buildPickupTimingBooking(input, bookings[firstIndex]));
4631
+ var nextBooking = buildPickupTimingBooking(input, bookings[firstIndex]);
4632
4632
  // Keep the first row's identity and position; repair duplicate marked rows only.
4633
4633
  tempOrder.bookings = firstIndex === -1 ? [].concat(_toConsumableArray(bookings), [nextBooking]) : bookings.flatMap(function (booking, index) {
4634
4634
  return index === firstIndex ? [nextBooking] : isFulfillmentTimingBooking(booking) ? [] : [booking];
@@ -5562,9 +5562,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5562
5562
  }, {
5563
5563
  key: "appendProductLineToTempOrder",
5564
5564
  value: function appendProductLineToTempOrder(tempOrder, product, booking, options) {
5565
- var _booking,
5566
- _tempOrder$bookings2,
5567
- _normalizedIncoming$p,
5565
+ var _normalizedIncoming$p,
5568
5566
  _normalizedIncoming$p2,
5569
5567
  _booking_uid,
5570
5568
  _metadata,
@@ -5572,17 +5570,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5572
5570
  _productToAdd$metadat,
5573
5571
  _origin,
5574
5572
  _this37 = this;
5575
- var incomingBookingUuid = (_booking = booking) === null || _booking === void 0 ? void 0 : _booking.uuid;
5576
- if (booking && incomingBookingUuid && (_tempOrder$bookings2 = tempOrder.bookings) !== null && _tempOrder$bookings2 !== void 0 && _tempOrder$bookings2.some(function (item) {
5577
- return item.uuid === incomingBookingUuid;
5578
- })) {
5579
- // Appending a copy creates a different booking; editing uses the update path below.
5580
- booking = _objectSpread(_objectSpread({}, booking), {}, {
5581
- uuid: createUuidV4(),
5582
- id: undefined,
5583
- schedule_event_id: undefined
5584
- });
5585
- }
5586
5573
  var linked = booking ? this.createLinkedProductAndBooking({
5587
5574
  product: product,
5588
5575
  booking: booking
@@ -5740,12 +5727,6 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5740
5727
  singleLine.num = 1;
5741
5728
  delete singleLine.product_quantity;
5742
5729
  var singleBooking = cloneDeep(booking);
5743
- if (index > 0) {
5744
- // Both single-add and batch-add quantity splits create separate appointments.
5745
- delete singleBooking.uuid;
5746
- delete singleBooking.schedule_event_id;
5747
- delete singleBooking.id;
5748
- }
5749
5730
  var bookingHolder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
5750
5731
  var metadataHolder = booking !== null && booking !== void 0 && (_booking$metadata6 = booking.metadata) !== null && _booking$metadata6 !== void 0 && _booking$metadata6.holder && _typeof(booking.metadata.holder) === 'object' ? booking.metadata.holder : null;
5751
5732
  var rawHolderIds = (_ref70 = (_ref71 = (_bookingHolder$form_r = bookingHolder === null || bookingHolder === void 0 ? void 0 : bookingHolder.form_record) !== null && _bookingHolder$form_r !== void 0 ? _bookingHolder$form_r : booking === null || booking === void 0 || (_booking$metadata7 = booking.metadata) === null || _booking$metadata7 === void 0 ? void 0 : _booking$metadata7.holder_id) !== null && _ref71 !== void 0 ? _ref71 : metadataHolder === null || metadataHolder === void 0 ? void 0 : metadataHolder.form_record) !== null && _ref70 !== void 0 ? _ref70 : product === null || product === void 0 || (_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.holder_id;
@@ -6117,13 +6098,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6117
6098
  var _replaceBookingProductWithRelatedRetailDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
6118
6099
  var _target$metadata,
6119
6100
  _target$metadata2,
6120
- _this41 = this,
6121
6101
  _params$product$num,
6122
6102
  _target$metadata3,
6123
6103
  _params$product$metad,
6124
6104
  _params$product$metad2,
6125
- _params$booking$metad;
6126
- var live, mutation, beforeCommit, uid, getUid, targetIndex, target, scopeKey, targetBookingUid, targetBookings, children, start, serviceDatetime, ownedUids, nextUids, retainedChildUids, nextChildren, _iterator23, _step23, _loop2, publishedFields, guardedFields, readFields, baseline, identity, isCurrentOrder, draft, removed, _iterator24, _step24, line, _iterator25, _step25, _draft$_extend, _line, replacement, replacementBooking, _iterator26, _step26, _step26$value, index, child, beforePublish;
6105
+ _params$booking$metad,
6106
+ _this41 = this;
6107
+ var live, mutation, beforeCommit, uid, getUid, targetIndex, target, scopeKey, targetBookingUid, children, start, serviceDatetime, ownedUids, nextUids, retainedChildUids, nextChildren, _iterator23, _step23, _loop2, publishedFields, guardedFields, readFields, baseline, identity, isCurrentOrder, draft, removed, _iterator24, _step24, line, _iterator25, _step25, _draft$_extend, _line, replacement, _iterator26, _step26, _step26$value, index, child, beforePublish;
6127
6108
  return _regeneratorRuntime().wrap(function _callee30$(_context32) {
6128
6109
  while (1) switch (_context32.prev = _context32.next) {
6129
6110
  case 0:
@@ -6142,18 +6123,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6142
6123
  target = live.products[targetIndex];
6143
6124
  scopeKey = String((target === null || target === void 0 || (_target$metadata = target.metadata) === null || _target$metadata === void 0 ? void 0 : _target$metadata.venue_booking_scope_key) || '');
6144
6125
  targetBookingUid = String((target === null || target === void 0 ? void 0 : target.booking_uid) || (target === null || target === void 0 || (_target$metadata2 = target.metadata) === null || _target$metadata2 === void 0 ? void 0 : _target$metadata2.booking_uid) || '');
6145
- targetBookings = (live.bookings || []).filter(function (row) {
6146
- return _this41.getBookingUniqueIdentificationNumber(row) === targetBookingUid;
6147
- });
6148
- if (!(!uid || !target || !scopeKey || live.order_id || target.order_detail_id != null || Number(target.num) !== 1 || Number((_params$product$num = params.product.num) !== null && _params$product$num !== void 0 ? _params$product$num : 1) !== 1 || ((_target$metadata3 = target.metadata) === null || _target$metadata3 === void 0 ? void 0 : _target$metadata3.venue_booking_role) !== 'party_main' || ((_params$product$metad = params.product.metadata) === null || _params$product$metad === void 0 ? void 0 : _params$product$metad.venue_booking_role) !== 'party_main' || ((_params$product$metad2 = params.product.metadata) === null || _params$product$metad2 === void 0 ? void 0 : _params$product$metad2.venue_booking_scope_key) !== scopeKey || !Array.isArray(params.relatedRetailProducts) || (live.payments || []).length > 0 || !targetBookingUid || String(((_params$booking$metad = params.booking.metadata) === null || _params$booking$metad === void 0 ? void 0 : _params$booking$metad.unique_identification_number) || '') !== targetBookingUid || targetBookings.length !== 1 || live.products.filter(function (line) {
6126
+ if (!(!uid || !target || !scopeKey || live.order_id || target.order_detail_id != null || Number(target.num) !== 1 || Number((_params$product$num = params.product.num) !== null && _params$product$num !== void 0 ? _params$product$num : 1) !== 1 || ((_target$metadata3 = target.metadata) === null || _target$metadata3 === void 0 ? void 0 : _target$metadata3.venue_booking_role) !== 'party_main' || ((_params$product$metad = params.product.metadata) === null || _params$product$metad === void 0 ? void 0 : _params$product$metad.venue_booking_role) !== 'party_main' || ((_params$product$metad2 = params.product.metadata) === null || _params$product$metad2 === void 0 ? void 0 : _params$product$metad2.venue_booking_scope_key) !== scopeKey || !Array.isArray(params.relatedRetailProducts) || (live.payments || []).length > 0 || !targetBookingUid || String(((_params$booking$metad = params.booking.metadata) === null || _params$booking$metad === void 0 ? void 0 : _params$booking$metad.unique_identification_number) || '') !== targetBookingUid || (live.bookings || []).filter(function (booking) {
6127
+ return _this41.getBookingUniqueIdentificationNumber(booking) === targetBookingUid;
6128
+ }).length !== 1 || live.products.filter(function (line) {
6149
6129
  var _line$metadata3, _line$metadata4;
6150
6130
  return ((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_main' && ((_line$metadata4 = line.metadata) === null || _line$metadata4 === void 0 ? void 0 : _line$metadata4.venue_booking_scope_key) === scopeKey;
6151
6131
  }).length !== 1)) {
6152
- _context32.next = 13;
6132
+ _context32.next = 12;
6153
6133
  break;
6154
6134
  }
6155
6135
  throw new Error('[Order] Party replacement requires one unsubmitted, unpaid main booking in the same scope');
6156
- case 13:
6136
+ case 12:
6157
6137
  children = live.products.filter(function (line) {
6158
6138
  var _line$metadata5, _line$metadata6;
6159
6139
  return ((_line$metadata5 = line.metadata) === null || _line$metadata5 === void 0 ? void 0 : _line$metadata5.venue_booking_role) === 'party_extra' && String(((_line$metadata6 = line.metadata) === null || _line$metadata6 === void 0 ? void 0 : _line$metadata6.venue_booking_parent_uid) || '') === uid;
@@ -6162,25 +6142,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6162
6142
  var _line$metadata7;
6163
6143
  return !getUid(line) || ((_line$metadata7 = line.metadata) === null || _line$metadata7 === void 0 ? void 0 : _line$metadata7.venue_booking_scope_key) !== scopeKey || line.order_detail_id != null || _this41.hasLinkedBookingUid(line);
6164
6144
  })) {
6165
- _context32.next = 16;
6145
+ _context32.next = 15;
6166
6146
  break;
6167
6147
  }
6168
6148
  throw new Error('[Order] Related retail line does not belong to this local Party scope');
6169
- case 16:
6149
+ case 15:
6170
6150
  start = params.booking.start_at || "".concat(params.booking.start_date || '', " ").concat(params.booking.start_time || '').trim();
6171
6151
  if (!(!start || !dayjs(start).isValid())) {
6172
- _context32.next = 19;
6152
+ _context32.next = 18;
6173
6153
  break;
6174
6154
  }
6175
6155
  throw new Error('[Order] Party service datetime is required');
6176
- case 19:
6156
+ case 18:
6177
6157
  serviceDatetime = dayjs(start).format('YYYY-MM-DD HH:mm:ss');
6178
6158
  ownedUids = new Set(children.map(getUid));
6179
6159
  nextUids = new Set();
6180
6160
  retainedChildUids = new Set();
6181
6161
  nextChildren = cloneDeep(params.relatedRetailProducts);
6182
6162
  _iterator23 = _createForOfIteratorHelper(nextChildren);
6183
- _context32.prev = 25;
6163
+ _context32.prev = 24;
6184
6164
  _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
6185
6165
  var _child$metadata, _child$metadata2, _child$metadata3, _child$metadata4, _child$num;
6186
6166
  var child, childUid, purchaseDatetime, normalizedPurchaseDatetime, previous, _live$_extend, _rawChild$_origin, previousForms, rawChild;
@@ -6221,27 +6201,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6221
6201
  }, _loop2);
6222
6202
  });
6223
6203
  _iterator23.s();
6224
- case 28:
6204
+ case 27:
6225
6205
  if ((_step23 = _iterator23.n()).done) {
6226
- _context32.next = 32;
6206
+ _context32.next = 31;
6227
6207
  break;
6228
6208
  }
6229
- return _context32.delegateYield(_loop2(), "t0", 30);
6230
- case 30:
6231
- _context32.next = 28;
6209
+ return _context32.delegateYield(_loop2(), "t0", 29);
6210
+ case 29:
6211
+ _context32.next = 27;
6232
6212
  break;
6233
- case 32:
6234
- _context32.next = 37;
6213
+ case 31:
6214
+ _context32.next = 36;
6235
6215
  break;
6236
- case 34:
6237
- _context32.prev = 34;
6238
- _context32.t1 = _context32["catch"](25);
6216
+ case 33:
6217
+ _context32.prev = 33;
6218
+ _context32.t1 = _context32["catch"](24);
6239
6219
  _iterator23.e(_context32.t1);
6240
- case 37:
6241
- _context32.prev = 37;
6220
+ case 36:
6221
+ _context32.prev = 36;
6242
6222
  _iterator23.f();
6243
- return _context32.finish(37);
6244
- case 40:
6223
+ return _context32.finish(36);
6224
+ case 39:
6245
6225
  publishedFields = ['products', 'bookings', 'notes', '_extend', 'metadata', 'holder', 'holder_relations', 'currency_code', 'currency_symbol', 'currency_format'];
6246
6226
  guardedFields = [].concat(publishedFields, ['customer_id', 'discount_list', 'shop_discount', 'payments']);
6247
6227
  readFields = function readFields(order, fields) {
@@ -6296,45 +6276,43 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6296
6276
  venue_booking_service_datetime: serviceDatetime
6297
6277
  });
6298
6278
  replacement.unique_identification_number = uid;
6299
- replacementBooking = cloneDeep(params.booking);
6300
- replacementBooking.uuid = targetBookings[0].uuid || replacementBooking.uuid;
6301
- _context32.next = 62;
6302
- return this.appendProductLineToTempOrder(draft, replacement, replacementBooking, {
6279
+ _context32.next = 59;
6280
+ return this.appendProductLineToTempOrder(draft, replacement, cloneDeep(params.booking), {
6303
6281
  insertAtIndex: targetIndex,
6304
6282
  disableMerge: true,
6305
6283
  beforeCommit: beforeCommit
6306
6284
  });
6307
- case 62:
6285
+ case 59:
6308
6286
  _iterator26 = _createForOfIteratorHelper(nextChildren.entries());
6309
- _context32.prev = 63;
6287
+ _context32.prev = 60;
6310
6288
  _iterator26.s();
6311
- case 65:
6289
+ case 62:
6312
6290
  if ((_step26 = _iterator26.n()).done) {
6313
- _context32.next = 71;
6291
+ _context32.next = 68;
6314
6292
  break;
6315
6293
  }
6316
6294
  _step26$value = _slicedToArray(_step26.value, 2), index = _step26$value[0], child = _step26$value[1];
6317
- _context32.next = 69;
6295
+ _context32.next = 66;
6318
6296
  return this.appendProductLineToTempOrder(draft, child, undefined, {
6319
6297
  insertAtIndex: targetIndex + index + 1,
6320
6298
  disableMerge: true,
6321
6299
  beforeCommit: beforeCommit
6322
6300
  });
6323
- case 69:
6324
- _context32.next = 65;
6301
+ case 66:
6302
+ _context32.next = 62;
6325
6303
  break;
6326
- case 71:
6327
- _context32.next = 76;
6304
+ case 68:
6305
+ _context32.next = 73;
6328
6306
  break;
6307
+ case 70:
6308
+ _context32.prev = 70;
6309
+ _context32.t2 = _context32["catch"](60);
6310
+ _iterator26.e(_context32.t2);
6329
6311
  case 73:
6330
6312
  _context32.prev = 73;
6331
- _context32.t2 = _context32["catch"](63);
6332
- _iterator26.e(_context32.t2);
6333
- case 76:
6334
- _context32.prev = 76;
6335
6313
  _iterator26.f();
6336
- return _context32.finish(76);
6337
- case 79:
6314
+ return _context32.finish(73);
6315
+ case 76:
6338
6316
  this.removeSalesNotesForMissingProductLines(draft);
6339
6317
  this.syncTempOrderHolderFromBookings(draft);
6340
6318
  beforePublish = function beforePublish() {
@@ -6348,45 +6326,45 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6348
6326
  };
6349
6327
  beforePublish();
6350
6328
  if (!mutation.commit) {
6351
- _context32.next = 88;
6329
+ _context32.next = 85;
6352
6330
  break;
6353
6331
  }
6354
- _context32.next = 86;
6332
+ _context32.next = 83;
6355
6333
  return mutation.commit({
6356
6334
  beforeCommit: beforePublish
6357
6335
  });
6358
- case 86:
6359
- _context32.next = 89;
6336
+ case 83:
6337
+ _context32.next = 86;
6360
6338
  break;
6361
- case 88:
6339
+ case 85:
6362
6340
  // No await between the final CAS and publication; preserve every unrelated live field.
6363
6341
  Object.assign(live, readFields(draft, publishedFields));
6364
- case 89:
6365
- _context32.prev = 89;
6342
+ case 86:
6343
+ _context32.prev = 86;
6366
6344
  if (isCurrentOrder()) this.persistTempOrder();
6367
- _context32.next = 93;
6345
+ _context32.next = 90;
6368
6346
  return this.finalizeProductOrderMutation(live, {
6369
6347
  isCurrentOrder: isCurrentOrder
6370
6348
  });
6371
- case 93:
6372
- _context32.next = 98;
6349
+ case 90:
6350
+ _context32.next = 95;
6373
6351
  break;
6374
- case 95:
6375
- _context32.prev = 95;
6376
- _context32.t3 = _context32["catch"](89);
6352
+ case 92:
6353
+ _context32.prev = 92;
6354
+ _context32.t3 = _context32["catch"](86);
6377
6355
  // Already committed. Do not invite a second replacement or restore a stale snapshot.
6378
6356
  this.logWarning('Party replacement committed; finalization failed', {
6379
6357
  productLineUid: uid,
6380
6358
  committed: true,
6381
6359
  error: _context32.t3 instanceof Error ? _context32.t3.message : String(_context32.t3)
6382
6360
  });
6383
- case 98:
6361
+ case 95:
6384
6362
  return _context32.abrupt("return", live.products);
6385
- case 99:
6363
+ case 96:
6386
6364
  case "end":
6387
6365
  return _context32.stop();
6388
6366
  }
6389
- }, _callee30, this, [[25, 34, 37, 40], [63, 73, 76, 79], [89, 95]]);
6367
+ }, _callee30, this, [[24, 33, 36, 39], [60, 70, 73, 76], [86, 92]]);
6390
6368
  }));
6391
6369
  function replaceBookingProductWithRelatedRetailDraft(_x35) {
6392
6370
  return _replaceBookingProductWithRelatedRetailDraft.apply(this, arguments);
@@ -6874,29 +6852,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6874
6852
  });
6875
6853
  }
6876
6854
  if (booking) {
6877
- var _normalizedProduct$me, _targetProduct$metada21, _targetProduct$metada22, _bookings$find;
6855
+ var _normalizedProduct$me, _targetProduct$metada21;
6878
6856
  var productUid = String(((_normalizedProduct$me = normalizedProduct.metadata) === null || _normalizedProduct$me === void 0 ? void 0 : _normalizedProduct$me.unique_identification_number) || ((_targetProduct$metada21 = targetProduct.metadata) === null || _targetProduct$metada21 === void 0 ? void 0 : _targetProduct$metada21.unique_identification_number) || unique_identification_number || createUuidV4());
6879
6857
  normalizedProduct.metadata = _objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), {}, {
6880
6858
  unique_identification_number: productUid
6881
6859
  });
6882
- var originalBookingUid = targetProduct.booking_uid || ((_targetProduct$metada22 = targetProduct.metadata) === null || _targetProduct$metada22 === void 0 ? void 0 : _targetProduct$metada22.booking_uid) || preservedBookingUid;
6883
- var bookings = tempOrder.bookings || [];
6884
- var eventId = booking.schedule_event_id;
6885
- var originalBooking = (_bookings$find = bookings.find(function (row) {
6886
- return Number(eventId) > 0 && String(row.schedule_event_id) === String(eventId);
6887
- })) !== null && _bookings$find !== void 0 ? _bookings$find : bookings.find(function (row) {
6888
- var _row$metadata;
6889
- return originalBookingUid && ((_row$metadata = row.metadata) === null || _row$metadata === void 0 ? void 0 : _row$metadata.unique_identification_number) === originalBookingUid;
6890
- });
6891
- var _booking$uuid = booking.uuid,
6892
- incomingUuid = _booking$uuid === void 0 ? originalBooking === null || originalBooking === void 0 ? void 0 : originalBooking.uuid : _booking$uuid;
6893
6860
  var linked = this.createLinkedProductAndBooking({
6894
6861
  product: _objectSpread(_objectSpread({}, normalizedProduct), {}, {
6895
6862
  unique_identification_number: productUid
6896
6863
  }),
6897
- booking: _objectSpread(_objectSpread({}, booking), {}, {
6898
- uuid: (originalBooking === null || originalBooking === void 0 ? void 0 : originalBooking.uuid) || incomingUuid
6899
- })
6864
+ booking: booking
6900
6865
  });
6901
6866
  this.removeLinkedBookingsForProduct(tempOrder, targetProduct);
6902
6867
  normalizedProduct = _objectSpread(_objectSpread({}, normalizedProduct), {}, {
@@ -7264,7 +7229,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7264
7229
  key: "updateOrderProductQuantityDraft",
7265
7230
  value: function () {
7266
7231
  var _updateOrderProductQuantityDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params, options) {
7267
- var _this$store$tempOrder10, _targetProduct$metada23;
7232
+ var _this$store$tempOrder10, _targetProduct$metada22;
7268
7233
  var isCurrentOrder, product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, mutation, tempOrder, identityLookup, productIndex, targetUid, targetProduct, isPersistedOrderLine, normalizedProduct, settlementSnapshot, currencyProductId, asset, requiredAmount, balance, beforeCommit, isVirtualSettlement, promotionPayload;
7269
7234
  return _regeneratorRuntime().wrap(function _callee39$(_context42) {
7270
7235
  while (1) switch (_context42.prev = _context42.next) {
@@ -7315,7 +7280,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7315
7280
  normalizedProduct = this.normalizeVirtualSettlementProductIfEnabled(normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
7316
7281
  num: getSafeProductNum(num),
7317
7282
  metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
7318
- unique_identification_number: ((_targetProduct$metada23 = targetProduct.metadata) === null || _targetProduct$metada23 === void 0 ? void 0 : _targetProduct$metada23.unique_identification_number) || unique_identification_number
7283
+ unique_identification_number: ((_targetProduct$metada22 = targetProduct.metadata) === null || _targetProduct$metada22 === void 0 ? void 0 : _targetProduct$metada22.unique_identification_number) || unique_identification_number
7319
7284
  })
7320
7285
  })));
7321
7286
  normalizedProduct.discount_list = normalizeOrderProductDiscountList(isPersistedOrderLine ? syncReducedEntitlementPassUsageCount(normalizedProduct.discount_list, targetProduct.num, normalizedProduct.num) : normalizedProduct.discount_list);
@@ -7436,17 +7401,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7436
7401
  throw new Error('[Order] 目标 booking 不存在,无法更新');
7437
7402
  }
7438
7403
  var targetBooking = tempOrder.bookings[bookingIndex] || {};
7439
- var _updates$uuid = updates.uuid,
7440
- incomingUuid = _updates$uuid === void 0 ? targetBooking.uuid : _updates$uuid;
7441
7404
  var nextBooking = _objectSpread(_objectSpread(_objectSpread({}, targetBooking), updates), {}, {
7442
- uuid: targetBooking.uuid || incomingUuid,
7443
7405
  metadata: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, targetBooking.metadata || {}), updates.metadata || {}), Number((_targetBooking$metada = targetBooking.metadata) === null || _targetBooking$metada === void 0 ? void 0 : _targetBooking$metada.is_change_by_redeem) === 1 ? {
7444
7406
  is_change_by_redeem: 1
7445
7407
  } : {}), {}, {
7446
7408
  unique_identification_number: bookingUid
7447
7409
  })
7448
7410
  });
7449
- assignBookingUuid(nextBooking);
7450
7411
  this.syncBookingMetadataHolder(nextBooking, nextBooking.metadata);
7451
7412
  nextBooking.is_all = normalizeBookingIsAll(nextBooking);
7452
7413
  nextBooking.sub_type = normalizeBookingSubType(nextBooking);
@@ -8703,12 +8664,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8703
8664
  key: "createOrderByCheckout",
8704
8665
  value: (function () {
8705
8666
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
8706
- var _params$bookings2, _params$payments, _params$bookings3, _params$relation_prod2, _params$payments2, _params$payments3;
8667
+ var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
8707
8668
  var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
8708
8669
  return _regeneratorRuntime().wrap(function _callee57$(_context61) {
8709
8670
  while (1) switch (_context61.prev = _context61.next) {
8710
8671
  case 0:
8711
- (_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 || _params$bookings2.forEach(assignBookingUuid);
8712
8672
  // 过滤掉由在线店铺下单的 payment 支付数据
8713
8673
  onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
8714
8674
  params.payments = (_params$payments = params.payments) === null || _params$payments === void 0 ? void 0 : _params$payments.filter(function (p) {
@@ -8719,7 +8679,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8719
8679
  platform: params.platform,
8720
8680
  is_deposit: params.is_deposit,
8721
8681
  customer_id: params.customer_id,
8722
- bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
8682
+ bookingsCount: ((_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 ? void 0 : _params$bookings2.length) || 0,
8723
8683
  relationProductsCount: ((_params$relation_prod2 = params.relation_products) === null || _params$relation_prod2 === void 0 ? void 0 : _params$relation_prod2.length) || 0,
8724
8684
  paymentsCount: ((_params$payments2 = params.payments) === null || _params$payments2 === void 0 ? void 0 : _params$payments2.length) || 0,
8725
8685
  depositAmount: params.deposit_amount,
@@ -8732,7 +8692,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8732
8692
  return p.code;
8733
8693
  })) || []
8734
8694
  });
8735
- _context61.prev = 4;
8695
+ _context61.prev = 3;
8736
8696
  // 构建订单数据,设置默认值并允许 params 覆盖
8737
8697
  orderData = _objectSpread({
8738
8698
  sales_channel: 'my_pisel',
@@ -8780,30 +8740,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8780
8740
  hasOrderId: !!orderData.order_id,
8781
8741
  smallTicketDataFlag: orderData.small_ticket_data_flag
8782
8742
  });
8783
- _context61.next = 11;
8743
+ _context61.next = 10;
8784
8744
  return this.request.post('/order/checkout', orderData, {
8785
8745
  osServer: true,
8786
8746
  customToast: function customToast() {}
8787
8747
  });
8788
- case 11:
8748
+ case 10:
8789
8749
  response = _context61.sent;
8790
8750
  this.logInfo('Order API called successfully', {
8791
8751
  response: response
8792
8752
  });
8793
8753
  return _context61.abrupt("return", response);
8794
- case 16:
8795
- _context61.prev = 16;
8796
- _context61.t0 = _context61["catch"](4);
8754
+ case 15:
8755
+ _context61.prev = 15;
8756
+ _context61.t0 = _context61["catch"](3);
8797
8757
  console.error('[Order] createOrderByCheckout 创建订单失败:', _context61.t0);
8798
8758
  this.logInfo('Order API called failed', {
8799
8759
  error: _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0)
8800
8760
  });
8801
8761
  throw _context61.t0;
8802
- case 21:
8762
+ case 20:
8803
8763
  case "end":
8804
8764
  return _context61.stop();
8805
8765
  }
8806
- }, _callee57, this, [[4, 16]]);
8766
+ }, _callee57, this, [[3, 15]]);
8807
8767
  }));
8808
8768
  function createOrderByCheckout(_x71) {
8809
8769
  return _createOrderByCheckout.apply(this, arguments);
@@ -8814,13 +8774,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8814
8774
  key: "submitSalesOrder",
8815
8775
  value: function () {
8816
8776
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
8817
- var _query$bookings;
8818
8777
  var url, query, fetchUrl, handledByOsServer, requestQuery;
8819
8778
  return _regeneratorRuntime().wrap(function _callee58$(_context62) {
8820
8779
  while (1) switch (_context62.prev = _context62.next) {
8821
8780
  case 0:
8822
8781
  url = params.url, query = params.query;
8823
- (_query$bookings = query.bookings) === null || _query$bookings === void 0 || _query$bookings.forEach(assignBookingUuid);
8824
8782
  fetchUrl = url || '/order/sales/checkout';
8825
8783
  handledByOsServer = this.isSalesCheckoutHandledByOsServer(fetchUrl);
8826
8784
  requestQuery = handledByOsServer ? query : stripLocalEftposState(stripOsPrivatePayloadFields(query));
@@ -8831,7 +8789,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8831
8789
  osServer: true,
8832
8790
  customToast: function customToast() {}
8833
8791
  }));
8834
- case 7:
8792
+ case 6:
8835
8793
  case "end":
8836
8794
  return _context62.stop();
8837
8795
  }
@@ -9326,8 +9284,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9326
9284
  }) : [];
9327
9285
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
9328
9286
  var booking = _this57.normalizeHydratedBookingHolder(b || {});
9329
- var submitted = isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
9330
- return _objectSpread(_objectSpread({}, submitted ? ensureBookingUuid(booking) : booking), {}, {
9287
+ return _objectSpread(_objectSpread({}, booking), {}, {
9331
9288
  is_all: normalizeBookingIsAll(booking),
9332
9289
  sub_type: normalizeBookingSubType(booking)
9333
9290
  });
@@ -617,8 +617,6 @@ export interface CommitOrderParams {
617
617
  };
618
618
  }
619
619
  export interface OrderSubmitBooking {
620
- /** Stable booking identity, created once and shared with external allocations. */
621
- uuid?: string | null;
622
620
  relation_id?: string;
623
621
  form_id?: string;
624
622
  collect_pax?: number;
@@ -31,7 +31,6 @@ import { hasManualProductDiscountFlag } from "./utils/manualProductDiscount";
31
31
  import { getProductHolderConfig } from "../Holder/utils";
32
32
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
33
33
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
34
- import { assignBookingUuid } from "./utils/bookingUuid";
35
34
  import { encodeSalesNotes } from "./salesNotes";
36
35
  import { isFulfillmentTimingBooking } from "./pickupTiming";
37
36
  import { ensureHolderRelationUuids, getProductHolderRelations, hasProductBooking, removeProductHolderRelations } from "./holderRelations";
@@ -1665,7 +1664,6 @@ export function buildSubmitPayload(params) {
1665
1664
  bookings: (tempOrder.bookings || []).filter(function (booking) {
1666
1665
  return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
1667
1666
  }).map(function (booking) {
1668
- assignBookingUuid(booking);
1669
1667
  return normalizeSubmitBooking(booking);
1670
1668
  }),
1671
1669
  payments: tempOrder.payments || [],
@@ -49,5 +49,5 @@ export declare class Product extends BaseModule implements Module {
49
49
  getCategories(): ProductCategory[];
50
50
  setOtherParams(key: string, value: any): void;
51
51
  getOtherParams(): any;
52
- getProductType(): "duration" | "normal" | "session";
52
+ getProductType(): "normal" | "duration" | "session";
53
53
  }
@@ -498,7 +498,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
498
498
  }
499
499
  });
500
500
  }
501
- 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);
501
+ var hasDiscountInput = (options === null || options === void 0 ? void 0 : options.force) === true || 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);
502
502
  if (!hasDiscountInput) {
503
503
  return {
504
504
  discountList: discountList,
@@ -34,6 +34,8 @@ export interface RulesCalcDiscountParams {
34
34
  orderTotalAmount: number;
35
35
  }
36
36
  export interface RulesCalcDiscountOptions {
37
+ /** Clear stale line discounts when draft revalidation yields no eligible cards. */
38
+ force?: boolean;
37
39
  isSelected?: boolean;
38
40
  discountId?: number;
39
41
  selectedList?: SetDiscountSelectedParams[];
@@ -72,7 +72,7 @@ export declare const calculateOriginSubtotal: (items: CartItem[]) => string;
72
72
  * @return {*}
73
73
  * @Author: xiangfeng.xue
74
74
  */
75
- export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
75
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => "0.00" | Decimal;
76
76
  /**
77
77
  * @title: 计算定金
78
78
  * @param items - 购物车商品数组
@@ -256,9 +256,6 @@ function mergeBaseSalesCollectionItem(kind, currentItem, incomingItem, uidRemaps
256
256
  }
257
257
  }
258
258
  var mergedItem = mergedUid ? setOrderCollectionUid(kind, incomingItem, mergedUid) : cloneDeep(incomingItem);
259
- if (kind === 'booking' && !mergedItem.uuid && currentItem.uuid !== undefined) {
260
- mergedItem.uuid = currentItem.uuid;
261
- }
262
259
  var persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
263
260
  if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
264
261
  mergedItem[persistentIdField] = identityMergedItem[persistentIdField];
@@ -342,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
342
342
  date: string;
343
343
  status: string;
344
344
  week: string;
345
- weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
345
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -389,7 +389,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
389
389
  };
390
390
  setOtherData(key: string, value: any): void;
391
391
  getOtherData(key: string): any;
392
- getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
392
+ getProductTypeById(id: number): Promise<"normal" | "duration" | "session">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *