@pisell/pisellos 2.3.228 → 2.3.230

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 (39) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/Customer/types.d.ts +4 -0
  3. package/dist/modules/Order/index.d.ts +1 -1
  4. package/dist/modules/Order/index.js +123 -79
  5. package/dist/modules/Order/types.d.ts +2 -0
  6. package/dist/modules/Order/utils/bookingUuid.d.ts +4 -0
  7. package/dist/modules/Order/utils/bookingUuid.js +24 -0
  8. package/dist/modules/Order/utils.js +2 -0
  9. package/dist/modules/Product/index.d.ts +1 -1
  10. package/dist/modules/Summary/utils.d.ts +1 -1
  11. package/dist/solution/BaseSales/index.js +3 -0
  12. package/dist/solution/BookingByStep/index.d.ts +3 -3
  13. package/dist/solution/BookingTicket/index.d.ts +1 -0
  14. package/dist/solution/BookingTicket/index.js +49 -18
  15. package/dist/solution/BookingTicket/utils/redeemArrival.d.ts +6 -6
  16. package/dist/solution/Checkout/index.js +104 -69
  17. package/dist/solution/Checkout/types.d.ts +1 -0
  18. package/dist/solution/ScanOrder/index.js +10 -2
  19. package/dist/solution/VenueBooking/index.js +522 -490
  20. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  21. package/lib/modules/Customer/types.d.ts +4 -0
  22. package/lib/modules/Order/index.d.ts +1 -1
  23. package/lib/modules/Order/index.js +44 -6
  24. package/lib/modules/Order/types.d.ts +2 -0
  25. package/lib/modules/Order/utils/bookingUuid.d.ts +4 -0
  26. package/lib/modules/Order/utils/bookingUuid.js +25 -0
  27. package/lib/modules/Order/utils.js +5 -1
  28. package/lib/modules/Product/index.d.ts +1 -1
  29. package/lib/modules/Summary/utils.d.ts +1 -1
  30. package/lib/solution/BaseSales/index.js +3 -0
  31. package/lib/solution/BookingByStep/index.d.ts +3 -3
  32. package/lib/solution/BookingTicket/index.d.ts +1 -0
  33. package/lib/solution/BookingTicket/index.js +27 -6
  34. package/lib/solution/BookingTicket/utils/redeemArrival.d.ts +6 -6
  35. package/lib/solution/Checkout/index.js +21 -0
  36. package/lib/solution/Checkout/types.d.ts +1 -0
  37. package/lib/solution/ScanOrder/index.js +6 -0
  38. package/lib/solution/VenueBooking/index.js +6 -1
  39. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ // 导出评估器
2
+ export { PromotionEvaluator } from "./evaluator";
3
+
4
+ // 导出适配器
5
+ export { PromotionAdapter } from "./adapter";
6
+ export { default } from "./adapter";
7
+
8
+ // 导出策略配置示例常量
9
+ export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
@@ -44,6 +44,10 @@ 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;
47
51
  /** 关联查询参数 */
48
52
  with?: CustomerWith[];
49
53
  /** wallet搜索标识 */
@@ -644,7 +644,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
644
644
  generateIdempotencyToken(): string;
645
645
  syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
646
646
  createOrder(params: CommitOrderParams['query']): {
647
- type: "appointment_booking" | "virtual";
647
+ type: "virtual" | "appointment_booking";
648
648
  platform: string;
649
649
  sales_channel: string;
650
650
  order_sales_channel: string;
@@ -31,6 +31,7 @@ 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";
34
35
  import { PAYMENT_REFRESH_MESSAGE, requiresLocalPaymentRefresh, stripLocalEftposState } from "./localEftposState";
35
36
  import { BaseModule } from "../BaseModule";
36
37
  import { OrderHooks } from "./types";
@@ -3760,7 +3761,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3760
3761
  }),
3761
3762
  booking_uid: bookingUid
3762
3763
  }),
3763
- booking: _objectSpread(_objectSpread({}, params.booking), {}, {
3764
+ booking: _objectSpread(_objectSpread({}, ensureBookingUuid(params.booking)), {}, {
3764
3765
  is_all: normalizeBookingIsAll(params.booking),
3765
3766
  product_uid: productUid,
3766
3767
  sub_type: normalizeBookingSubType(params.booking),
@@ -4628,7 +4629,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4628
4629
  var tempOrder = this.ensureTempOrder();
4629
4630
  var bookings = tempOrder.bookings || [];
4630
4631
  var firstIndex = bookings.findIndex(isFulfillmentTimingBooking);
4631
- var nextBooking = buildPickupTimingBooking(input, bookings[firstIndex]);
4632
+ var nextBooking = ensureBookingUuid(buildPickupTimingBooking(input, bookings[firstIndex]));
4632
4633
  // Keep the first row's identity and position; repair duplicate marked rows only.
4633
4634
  tempOrder.bookings = firstIndex === -1 ? [].concat(_toConsumableArray(bookings), [nextBooking]) : bookings.flatMap(function (booking, index) {
4634
4635
  return index === firstIndex ? [nextBooking] : isFulfillmentTimingBooking(booking) ? [] : [booking];
@@ -5562,7 +5563,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5562
5563
  }, {
5563
5564
  key: "appendProductLineToTempOrder",
5564
5565
  value: function appendProductLineToTempOrder(tempOrder, product, booking, options) {
5565
- var _normalizedIncoming$p,
5566
+ var _booking,
5567
+ _tempOrder$bookings2,
5568
+ _normalizedIncoming$p,
5566
5569
  _normalizedIncoming$p2,
5567
5570
  _booking_uid,
5568
5571
  _metadata,
@@ -5570,6 +5573,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5570
5573
  _productToAdd$metadat,
5571
5574
  _origin,
5572
5575
  _this37 = this;
5576
+ var incomingBookingUuid = (_booking = booking) === null || _booking === void 0 ? void 0 : _booking.uuid;
5577
+ if (booking && incomingBookingUuid && (_tempOrder$bookings2 = tempOrder.bookings) !== null && _tempOrder$bookings2 !== void 0 && _tempOrder$bookings2.some(function (item) {
5578
+ return item.uuid === incomingBookingUuid;
5579
+ })) {
5580
+ // Appending a copy creates a different booking; editing uses the update path below.
5581
+ booking = _objectSpread(_objectSpread({}, booking), {}, {
5582
+ uuid: createUuidV4(),
5583
+ id: undefined,
5584
+ schedule_event_id: undefined
5585
+ });
5586
+ }
5573
5587
  var linked = booking ? this.createLinkedProductAndBooking({
5574
5588
  product: product,
5575
5589
  booking: booking
@@ -5727,6 +5741,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5727
5741
  singleLine.num = 1;
5728
5742
  delete singleLine.product_quantity;
5729
5743
  var singleBooking = cloneDeep(booking);
5744
+ if (index > 0) {
5745
+ // Both single-add and batch-add quantity splits create separate appointments.
5746
+ delete singleBooking.uuid;
5747
+ delete singleBooking.schedule_event_id;
5748
+ delete singleBooking.id;
5749
+ }
5730
5750
  var bookingHolder = booking !== null && booking !== void 0 && booking.holder && _typeof(booking.holder) === 'object' ? booking.holder : null;
5731
5751
  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;
5732
5752
  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;
@@ -6098,13 +6118,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6098
6118
  var _replaceBookingProductWithRelatedRetailDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(params) {
6099
6119
  var _target$metadata,
6100
6120
  _target$metadata2,
6121
+ _this41 = this,
6101
6122
  _params$product$num,
6102
6123
  _target$metadata3,
6103
6124
  _params$product$metad,
6104
6125
  _params$product$metad2,
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;
6126
+ _params$booking$metad;
6127
+ 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;
6108
6128
  return _regeneratorRuntime().wrap(function _callee30$(_context32) {
6109
6129
  while (1) switch (_context32.prev = _context32.next) {
6110
6130
  case 0:
@@ -6123,17 +6143,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6123
6143
  target = live.products[targetIndex];
6124
6144
  scopeKey = String((target === null || target === void 0 || (_target$metadata = target.metadata) === null || _target$metadata === void 0 ? void 0 : _target$metadata.venue_booking_scope_key) || '');
6125
6145
  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) || '');
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) {
6146
+ targetBookings = (live.bookings || []).filter(function (row) {
6147
+ return _this41.getBookingUniqueIdentificationNumber(row) === targetBookingUid;
6148
+ });
6149
+ 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) {
6129
6150
  var _line$metadata3, _line$metadata4;
6130
6151
  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;
6131
6152
  }).length !== 1)) {
6132
- _context32.next = 12;
6153
+ _context32.next = 13;
6133
6154
  break;
6134
6155
  }
6135
6156
  throw new Error('[Order] Party replacement requires one unsubmitted, unpaid main booking in the same scope');
6136
- case 12:
6157
+ case 13:
6137
6158
  children = live.products.filter(function (line) {
6138
6159
  var _line$metadata5, _line$metadata6;
6139
6160
  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;
@@ -6142,25 +6163,25 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6142
6163
  var _line$metadata7;
6143
6164
  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);
6144
6165
  })) {
6145
- _context32.next = 15;
6166
+ _context32.next = 16;
6146
6167
  break;
6147
6168
  }
6148
6169
  throw new Error('[Order] Related retail line does not belong to this local Party scope');
6149
- case 15:
6170
+ case 16:
6150
6171
  start = params.booking.start_at || "".concat(params.booking.start_date || '', " ").concat(params.booking.start_time || '').trim();
6151
6172
  if (!(!start || !dayjs(start).isValid())) {
6152
- _context32.next = 18;
6173
+ _context32.next = 19;
6153
6174
  break;
6154
6175
  }
6155
6176
  throw new Error('[Order] Party service datetime is required');
6156
- case 18:
6177
+ case 19:
6157
6178
  serviceDatetime = dayjs(start).format('YYYY-MM-DD HH:mm:ss');
6158
6179
  ownedUids = new Set(children.map(getUid));
6159
6180
  nextUids = new Set();
6160
6181
  retainedChildUids = new Set();
6161
6182
  nextChildren = cloneDeep(params.relatedRetailProducts);
6162
6183
  _iterator23 = _createForOfIteratorHelper(nextChildren);
6163
- _context32.prev = 24;
6184
+ _context32.prev = 25;
6164
6185
  _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
6165
6186
  var _child$metadata, _child$metadata2, _child$metadata3, _child$metadata4, _child$num;
6166
6187
  var child, childUid, purchaseDatetime, normalizedPurchaseDatetime, previous, _live$_extend, _rawChild$_origin, previousForms, rawChild;
@@ -6201,27 +6222,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6201
6222
  }, _loop2);
6202
6223
  });
6203
6224
  _iterator23.s();
6204
- case 27:
6225
+ case 28:
6205
6226
  if ((_step23 = _iterator23.n()).done) {
6206
- _context32.next = 31;
6227
+ _context32.next = 32;
6207
6228
  break;
6208
6229
  }
6209
- return _context32.delegateYield(_loop2(), "t0", 29);
6210
- case 29:
6211
- _context32.next = 27;
6230
+ return _context32.delegateYield(_loop2(), "t0", 30);
6231
+ case 30:
6232
+ _context32.next = 28;
6212
6233
  break;
6213
- case 31:
6214
- _context32.next = 36;
6234
+ case 32:
6235
+ _context32.next = 37;
6215
6236
  break;
6216
- case 33:
6217
- _context32.prev = 33;
6218
- _context32.t1 = _context32["catch"](24);
6237
+ case 34:
6238
+ _context32.prev = 34;
6239
+ _context32.t1 = _context32["catch"](25);
6219
6240
  _iterator23.e(_context32.t1);
6220
- case 36:
6221
- _context32.prev = 36;
6241
+ case 37:
6242
+ _context32.prev = 37;
6222
6243
  _iterator23.f();
6223
- return _context32.finish(36);
6224
- case 39:
6244
+ return _context32.finish(37);
6245
+ case 40:
6225
6246
  publishedFields = ['products', 'bookings', 'notes', '_extend', 'metadata', 'holder', 'holder_relations', 'currency_code', 'currency_symbol', 'currency_format'];
6226
6247
  guardedFields = [].concat(publishedFields, ['customer_id', 'discount_list', 'shop_discount', 'payments']);
6227
6248
  readFields = function readFields(order, fields) {
@@ -6276,43 +6297,45 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6276
6297
  venue_booking_service_datetime: serviceDatetime
6277
6298
  });
6278
6299
  replacement.unique_identification_number = uid;
6279
- _context32.next = 59;
6280
- return this.appendProductLineToTempOrder(draft, replacement, cloneDeep(params.booking), {
6300
+ replacementBooking = cloneDeep(params.booking);
6301
+ replacementBooking.uuid = targetBookings[0].uuid || replacementBooking.uuid;
6302
+ _context32.next = 62;
6303
+ return this.appendProductLineToTempOrder(draft, replacement, replacementBooking, {
6281
6304
  insertAtIndex: targetIndex,
6282
6305
  disableMerge: true,
6283
6306
  beforeCommit: beforeCommit
6284
6307
  });
6285
- case 59:
6308
+ case 62:
6286
6309
  _iterator26 = _createForOfIteratorHelper(nextChildren.entries());
6287
- _context32.prev = 60;
6310
+ _context32.prev = 63;
6288
6311
  _iterator26.s();
6289
- case 62:
6312
+ case 65:
6290
6313
  if ((_step26 = _iterator26.n()).done) {
6291
- _context32.next = 68;
6314
+ _context32.next = 71;
6292
6315
  break;
6293
6316
  }
6294
6317
  _step26$value = _slicedToArray(_step26.value, 2), index = _step26$value[0], child = _step26$value[1];
6295
- _context32.next = 66;
6318
+ _context32.next = 69;
6296
6319
  return this.appendProductLineToTempOrder(draft, child, undefined, {
6297
6320
  insertAtIndex: targetIndex + index + 1,
6298
6321
  disableMerge: true,
6299
6322
  beforeCommit: beforeCommit
6300
6323
  });
6301
- case 66:
6302
- _context32.next = 62;
6324
+ case 69:
6325
+ _context32.next = 65;
6303
6326
  break;
6304
- case 68:
6305
- _context32.next = 73;
6327
+ case 71:
6328
+ _context32.next = 76;
6306
6329
  break;
6307
- case 70:
6308
- _context32.prev = 70;
6309
- _context32.t2 = _context32["catch"](60);
6310
- _iterator26.e(_context32.t2);
6311
6330
  case 73:
6312
6331
  _context32.prev = 73;
6313
- _iterator26.f();
6314
- return _context32.finish(73);
6332
+ _context32.t2 = _context32["catch"](63);
6333
+ _iterator26.e(_context32.t2);
6315
6334
  case 76:
6335
+ _context32.prev = 76;
6336
+ _iterator26.f();
6337
+ return _context32.finish(76);
6338
+ case 79:
6316
6339
  this.removeSalesNotesForMissingProductLines(draft);
6317
6340
  this.syncTempOrderHolderFromBookings(draft);
6318
6341
  beforePublish = function beforePublish() {
@@ -6326,45 +6349,45 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6326
6349
  };
6327
6350
  beforePublish();
6328
6351
  if (!mutation.commit) {
6329
- _context32.next = 85;
6352
+ _context32.next = 88;
6330
6353
  break;
6331
6354
  }
6332
- _context32.next = 83;
6355
+ _context32.next = 86;
6333
6356
  return mutation.commit({
6334
6357
  beforeCommit: beforePublish
6335
6358
  });
6336
- case 83:
6337
- _context32.next = 86;
6359
+ case 86:
6360
+ _context32.next = 89;
6338
6361
  break;
6339
- case 85:
6362
+ case 88:
6340
6363
  // No await between the final CAS and publication; preserve every unrelated live field.
6341
6364
  Object.assign(live, readFields(draft, publishedFields));
6342
- case 86:
6343
- _context32.prev = 86;
6365
+ case 89:
6366
+ _context32.prev = 89;
6344
6367
  if (isCurrentOrder()) this.persistTempOrder();
6345
- _context32.next = 90;
6368
+ _context32.next = 93;
6346
6369
  return this.finalizeProductOrderMutation(live, {
6347
6370
  isCurrentOrder: isCurrentOrder
6348
6371
  });
6349
- case 90:
6350
- _context32.next = 95;
6372
+ case 93:
6373
+ _context32.next = 98;
6351
6374
  break;
6352
- case 92:
6353
- _context32.prev = 92;
6354
- _context32.t3 = _context32["catch"](86);
6375
+ case 95:
6376
+ _context32.prev = 95;
6377
+ _context32.t3 = _context32["catch"](89);
6355
6378
  // Already committed. Do not invite a second replacement or restore a stale snapshot.
6356
6379
  this.logWarning('Party replacement committed; finalization failed', {
6357
6380
  productLineUid: uid,
6358
6381
  committed: true,
6359
6382
  error: _context32.t3 instanceof Error ? _context32.t3.message : String(_context32.t3)
6360
6383
  });
6361
- case 95:
6384
+ case 98:
6362
6385
  return _context32.abrupt("return", live.products);
6363
- case 96:
6386
+ case 99:
6364
6387
  case "end":
6365
6388
  return _context32.stop();
6366
6389
  }
6367
- }, _callee30, this, [[24, 33, 36, 39], [60, 70, 73, 76], [86, 92]]);
6390
+ }, _callee30, this, [[25, 34, 37, 40], [63, 73, 76, 79], [89, 95]]);
6368
6391
  }));
6369
6392
  function replaceBookingProductWithRelatedRetailDraft(_x35) {
6370
6393
  return _replaceBookingProductWithRelatedRetailDraft.apply(this, arguments);
@@ -6852,16 +6875,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6852
6875
  });
6853
6876
  }
6854
6877
  if (booking) {
6855
- var _normalizedProduct$me, _targetProduct$metada21;
6878
+ var _normalizedProduct$me, _targetProduct$metada21, _targetProduct$metada22, _bookings$find;
6856
6879
  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());
6857
6880
  normalizedProduct.metadata = _objectSpread(_objectSpread({}, normalizedProduct.metadata || {}), {}, {
6858
6881
  unique_identification_number: productUid
6859
6882
  });
6883
+ var originalBookingUid = targetProduct.booking_uid || ((_targetProduct$metada22 = targetProduct.metadata) === null || _targetProduct$metada22 === void 0 ? void 0 : _targetProduct$metada22.booking_uid) || preservedBookingUid;
6884
+ var bookings = tempOrder.bookings || [];
6885
+ var eventId = booking.schedule_event_id;
6886
+ var originalBooking = (_bookings$find = bookings.find(function (row) {
6887
+ return Number(eventId) > 0 && String(row.schedule_event_id) === String(eventId);
6888
+ })) !== null && _bookings$find !== void 0 ? _bookings$find : bookings.find(function (row) {
6889
+ var _row$metadata;
6890
+ return originalBookingUid && ((_row$metadata = row.metadata) === null || _row$metadata === void 0 ? void 0 : _row$metadata.unique_identification_number) === originalBookingUid;
6891
+ });
6892
+ var _booking$uuid = booking.uuid,
6893
+ incomingUuid = _booking$uuid === void 0 ? originalBooking === null || originalBooking === void 0 ? void 0 : originalBooking.uuid : _booking$uuid;
6860
6894
  var linked = this.createLinkedProductAndBooking({
6861
6895
  product: _objectSpread(_objectSpread({}, normalizedProduct), {}, {
6862
6896
  unique_identification_number: productUid
6863
6897
  }),
6864
- booking: booking
6898
+ booking: _objectSpread(_objectSpread({}, booking), {}, {
6899
+ uuid: (originalBooking === null || originalBooking === void 0 ? void 0 : originalBooking.uuid) || incomingUuid
6900
+ })
6865
6901
  });
6866
6902
  this.removeLinkedBookingsForProduct(tempOrder, targetProduct);
6867
6903
  normalizedProduct = _objectSpread(_objectSpread({}, normalizedProduct), {}, {
@@ -7229,7 +7265,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7229
7265
  key: "updateOrderProductQuantityDraft",
7230
7266
  value: function () {
7231
7267
  var _updateOrderProductQuantityDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params, options) {
7232
- var _this$store$tempOrder10, _targetProduct$metada22;
7268
+ var _this$store$tempOrder10, _targetProduct$metada23;
7233
7269
  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;
7234
7270
  return _regeneratorRuntime().wrap(function _callee39$(_context42) {
7235
7271
  while (1) switch (_context42.prev = _context42.next) {
@@ -7280,7 +7316,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7280
7316
  normalizedProduct = this.normalizeVirtualSettlementProductIfEnabled(normalizeOrderProduct(_objectSpread(_objectSpread({}, targetProduct), {}, {
7281
7317
  num: getSafeProductNum(num),
7282
7318
  metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
7283
- unique_identification_number: ((_targetProduct$metada22 = targetProduct.metadata) === null || _targetProduct$metada22 === void 0 ? void 0 : _targetProduct$metada22.unique_identification_number) || unique_identification_number
7319
+ unique_identification_number: ((_targetProduct$metada23 = targetProduct.metadata) === null || _targetProduct$metada23 === void 0 ? void 0 : _targetProduct$metada23.unique_identification_number) || unique_identification_number
7284
7320
  })
7285
7321
  })));
7286
7322
  normalizedProduct.discount_list = normalizeOrderProductDiscountList(isPersistedOrderLine ? syncReducedEntitlementPassUsageCount(normalizedProduct.discount_list, targetProduct.num, normalizedProduct.num) : normalizedProduct.discount_list);
@@ -7401,13 +7437,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7401
7437
  throw new Error('[Order] 目标 booking 不存在,无法更新');
7402
7438
  }
7403
7439
  var targetBooking = tempOrder.bookings[bookingIndex] || {};
7440
+ var _updates$uuid = updates.uuid,
7441
+ incomingUuid = _updates$uuid === void 0 ? targetBooking.uuid : _updates$uuid;
7404
7442
  var nextBooking = _objectSpread(_objectSpread(_objectSpread({}, targetBooking), updates), {}, {
7443
+ uuid: targetBooking.uuid || incomingUuid,
7405
7444
  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 ? {
7406
7445
  is_change_by_redeem: 1
7407
7446
  } : {}), {}, {
7408
7447
  unique_identification_number: bookingUid
7409
7448
  })
7410
7449
  });
7450
+ assignBookingUuid(nextBooking);
7411
7451
  this.syncBookingMetadataHolder(nextBooking, nextBooking.metadata);
7412
7452
  nextBooking.is_all = normalizeBookingIsAll(nextBooking);
7413
7453
  nextBooking.sub_type = normalizeBookingSubType(nextBooking);
@@ -8664,11 +8704,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8664
8704
  key: "createOrderByCheckout",
8665
8705
  value: (function () {
8666
8706
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(params) {
8667
- var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
8707
+ var _params$bookings2, _params$payments, _params$bookings3, _params$relation_prod2, _params$payments2, _params$payments3;
8668
8708
  var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
8669
8709
  return _regeneratorRuntime().wrap(function _callee57$(_context61) {
8670
8710
  while (1) switch (_context61.prev = _context61.next) {
8671
8711
  case 0:
8712
+ (_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 || _params$bookings2.forEach(assignBookingUuid);
8672
8713
  // 过滤掉由在线店铺下单的 payment 支付数据
8673
8714
  onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
8674
8715
  params.payments = (_params$payments = params.payments) === null || _params$payments === void 0 ? void 0 : _params$payments.filter(function (p) {
@@ -8679,7 +8720,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8679
8720
  platform: params.platform,
8680
8721
  is_deposit: params.is_deposit,
8681
8722
  customer_id: params.customer_id,
8682
- bookingsCount: ((_params$bookings2 = params.bookings) === null || _params$bookings2 === void 0 ? void 0 : _params$bookings2.length) || 0,
8723
+ bookingsCount: ((_params$bookings3 = params.bookings) === null || _params$bookings3 === void 0 ? void 0 : _params$bookings3.length) || 0,
8683
8724
  relationProductsCount: ((_params$relation_prod2 = params.relation_products) === null || _params$relation_prod2 === void 0 ? void 0 : _params$relation_prod2.length) || 0,
8684
8725
  paymentsCount: ((_params$payments2 = params.payments) === null || _params$payments2 === void 0 ? void 0 : _params$payments2.length) || 0,
8685
8726
  depositAmount: params.deposit_amount,
@@ -8692,7 +8733,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8692
8733
  return p.code;
8693
8734
  })) || []
8694
8735
  });
8695
- _context61.prev = 3;
8736
+ _context61.prev = 4;
8696
8737
  // 构建订单数据,设置默认值并允许 params 覆盖
8697
8738
  orderData = _objectSpread({
8698
8739
  sales_channel: 'my_pisel',
@@ -8740,30 +8781,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8740
8781
  hasOrderId: !!orderData.order_id,
8741
8782
  smallTicketDataFlag: orderData.small_ticket_data_flag
8742
8783
  });
8743
- _context61.next = 10;
8784
+ _context61.next = 11;
8744
8785
  return this.request.post('/order/checkout', orderData, {
8745
8786
  osServer: true,
8746
8787
  customToast: function customToast() {}
8747
8788
  });
8748
- case 10:
8789
+ case 11:
8749
8790
  response = _context61.sent;
8750
8791
  this.logInfo('Order API called successfully', {
8751
8792
  response: response
8752
8793
  });
8753
8794
  return _context61.abrupt("return", response);
8754
- case 15:
8755
- _context61.prev = 15;
8756
- _context61.t0 = _context61["catch"](3);
8795
+ case 16:
8796
+ _context61.prev = 16;
8797
+ _context61.t0 = _context61["catch"](4);
8757
8798
  console.error('[Order] createOrderByCheckout 创建订单失败:', _context61.t0);
8758
8799
  this.logInfo('Order API called failed', {
8759
8800
  error: _context61.t0 instanceof Error ? _context61.t0.message : String(_context61.t0)
8760
8801
  });
8761
8802
  throw _context61.t0;
8762
- case 20:
8803
+ case 21:
8763
8804
  case "end":
8764
8805
  return _context61.stop();
8765
8806
  }
8766
- }, _callee57, this, [[3, 15]]);
8807
+ }, _callee57, this, [[4, 16]]);
8767
8808
  }));
8768
8809
  function createOrderByCheckout(_x71) {
8769
8810
  return _createOrderByCheckout.apply(this, arguments);
@@ -8774,11 +8815,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8774
8815
  key: "submitSalesOrder",
8775
8816
  value: function () {
8776
8817
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(params) {
8818
+ var _query$bookings;
8777
8819
  var url, query, fetchUrl, handledByOsServer, requestQuery;
8778
8820
  return _regeneratorRuntime().wrap(function _callee58$(_context62) {
8779
8821
  while (1) switch (_context62.prev = _context62.next) {
8780
8822
  case 0:
8781
8823
  url = params.url, query = params.query;
8824
+ (_query$bookings = query.bookings) === null || _query$bookings === void 0 || _query$bookings.forEach(assignBookingUuid);
8782
8825
  fetchUrl = url || '/order/sales/checkout';
8783
8826
  handledByOsServer = this.isSalesCheckoutHandledByOsServer(fetchUrl);
8784
8827
  requestQuery = handledByOsServer ? query : stripLocalEftposState(stripOsPrivatePayloadFields(query));
@@ -8789,7 +8832,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8789
8832
  osServer: true,
8790
8833
  customToast: function customToast() {}
8791
8834
  }));
8792
- case 6:
8835
+ case 7:
8793
8836
  case "end":
8794
8837
  return _context62.stop();
8795
8838
  }
@@ -9284,7 +9327,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
9284
9327
  }) : [];
9285
9328
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
9286
9329
  var booking = _this57.normalizeHydratedBookingHolder(b || {});
9287
- return _objectSpread(_objectSpread({}, booking), {}, {
9330
+ var submitted = isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
9331
+ return _objectSpread(_objectSpread({}, submitted ? ensureBookingUuid(booking) : booking), {}, {
9288
9332
  is_all: normalizeBookingIsAll(booking),
9289
9333
  sub_type: normalizeBookingSubType(booking)
9290
9334
  });
@@ -617,6 +617,8 @@ 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;
620
622
  relation_id?: string;
621
623
  form_id?: string;
622
624
  collect_pax?: number;
@@ -0,0 +1,4 @@
1
+ /** Cross-system booking identity; independent from the legacy cart-line UID. */
2
+ export declare function ensureBookingUuid<T extends Record<string, any>>(booking: T): T;
3
+ /** Retain a generated UUID on the draft so a checkout retry sends the same value. */
4
+ export declare function assignBookingUuid(booking: Record<string, any> | null | undefined): void;
@@ -0,0 +1,24 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import { createUuidV4 } from "./orderCollectionIdentity";
8
+
9
+ /** Cross-system booking identity; independent from the legacy cart-line UID. */
10
+ export function ensureBookingUuid(booking) {
11
+ if (booking.uuid) return booking;
12
+ // Only an explicit null confirms that an existing booking needs a UUID when saved.
13
+ if (booking.uuid !== null && Number(booking.schedule_event_id || booking.id) > 0) return booking;
14
+ return _objectSpread(_objectSpread({}, booking), {}, {
15
+ uuid: createUuidV4()
16
+ });
17
+ }
18
+
19
+ /** Retain a generated UUID on the draft so a checkout retry sends the same value. */
20
+ export function assignBookingUuid(booking) {
21
+ if (!booking) return;
22
+ var resolved = ensureBookingUuid(booking);
23
+ if (resolved !== booking) booking.uuid = resolved.uuid;
24
+ }
@@ -31,6 +31,7 @@ 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";
34
35
  import { encodeSalesNotes } from "./salesNotes";
35
36
  import { isFulfillmentTimingBooking } from "./pickupTiming";
36
37
  import { ensureHolderRelationUuids, getProductHolderRelations, hasProductBooking, removeProductHolderRelations } from "./holderRelations";
@@ -1664,6 +1665,7 @@ export function buildSubmitPayload(params) {
1664
1665
  bookings: (tempOrder.bookings || []).filter(function (booking) {
1665
1666
  return isFulfillmentTimingBooking(booking) || Number(booking.parent_id) !== 0;
1666
1667
  }).map(function (booking) {
1668
+ assignBookingUuid(booking);
1667
1669
  return normalizeSubmitBooking(booking);
1668
1670
  }),
1669
1671
  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(): "normal" | "duration" | "session";
52
+ getProductType(): "normal" | "session" | "duration";
53
53
  }
@@ -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[]) => "0.00" | Decimal;
75
+ export declare const calculateTaxFee: (shopInfo: any, items: CartItem[]) => Decimal | "0.00";
76
76
  /**
77
77
  * @title: 计算定金
78
78
  * @param items - 购物车商品数组
@@ -256,6 +256,9 @@ 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
+ }
259
262
  var persistentIdField = BASE_SALES_PERSISTENT_ID_FIELD_BY_KIND[kind];
260
263
  if (isBaseSalesBlankValue(mergedItem[persistentIdField]) && !isBaseSalesBlankValue(identityMergedItem[persistentIdField])) {
261
264
  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 | 1 | 2 | 6 | 4 | 5 | 3;
345
+ weekNum: 0 | 1 | 2 | 5 | 4 | 3 | 6;
346
346
  }[]>;
347
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
348
348
  private getScheduleDataByIds;
@@ -361,7 +361,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
361
361
  count: number;
362
362
  left: number;
363
363
  summaryCount: number;
364
- status: "lots_of_space" | "filling_up_fast" | "sold_out";
364
+ status: "sold_out" | "lots_of_space" | "filling_up_fast";
365
365
  }[];
366
366
  /**
367
367
  * 找到多个资源的公共可用时间段
@@ -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<"normal" | "duration" | "session">;
392
+ getProductTypeById(id: number): Promise<"normal" | "session" | "duration">;
393
393
  /**
394
394
  * 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
395
395
  *