@pisell/pisellos 2.2.316 → 2.2.317

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.
@@ -1242,54 +1242,52 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1242
1242
  key: "evaluatePromotion",
1243
1243
  value: (function () {
1244
1244
  var _evaluatePromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(options) {
1245
- var _this$promotionEvalua,
1246
- _this$promotionEvalua2,
1247
- _this6 = this;
1248
- var tempOrder, strategyConfigs, result, removeSet, _iterator3, _step3, reduce, _iterator6, _step6, _loop2, _iterator4, _step4, _loop, _ret, payload;
1249
- return _regeneratorRuntime().wrap(function _callee7$(_context9) {
1250
- while (1) switch (_context9.prev = _context9.next) {
1245
+ var _this$promotionEvalua, _this$promotionEvalua2;
1246
+ var tempOrder, strategyConfigs, result, removeSet, _iterator3, _step3, reduce, _iterator6, _step6, _loop, _iterator4, _step4, addAction, giftMutationBaseline, giftResult, giftProducts, giftBookings, _iterator5, _step5, _step5$value, index, gp, booking, linked, payload;
1247
+ return _regeneratorRuntime().wrap(function _callee7$(_context8) {
1248
+ while (1) switch (_context8.prev = _context8.next) {
1251
1249
  case 0:
1252
1250
  if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1253
- _context9.next = 2;
1251
+ _context8.next = 2;
1254
1252
  break;
1255
1253
  }
1256
- return _context9.abrupt("return", null);
1254
+ return _context8.abrupt("return", null);
1257
1255
  case 2:
1258
1256
  if (!(this.isApplyingPromotion || this.isEmittingPromotionApplied)) {
1259
- _context9.next = 4;
1257
+ _context8.next = 4;
1260
1258
  break;
1261
1259
  }
1262
- return _context9.abrupt("return", null);
1260
+ return _context8.abrupt("return", null);
1263
1261
  case 4:
1264
1262
  if (this.promotionEvaluator) {
1265
- _context9.next = 6;
1263
+ _context8.next = 6;
1266
1264
  break;
1267
1265
  }
1268
- return _context9.abrupt("return", null);
1266
+ return _context8.abrupt("return", null);
1269
1267
  case 6:
1270
1268
  tempOrder = this.store.tempOrder;
1271
1269
  if (tempOrder) {
1272
- _context9.next = 9;
1270
+ _context8.next = 9;
1273
1271
  break;
1274
1272
  }
1275
- return _context9.abrupt("return", null);
1273
+ return _context8.abrupt("return", null);
1276
1274
  case 9:
1277
1275
  if (!this.isActiveVirtualSettlementOrder(tempOrder)) {
1278
- _context9.next = 12;
1276
+ _context8.next = 12;
1279
1277
  break;
1280
1278
  }
1281
1279
  tempOrder.products = normalizeVirtualSettlementProducts(tempOrder.products);
1282
- return _context9.abrupt("return", null);
1280
+ return _context8.abrupt("return", null);
1283
1281
  case 12:
1284
1282
  strategyConfigs = (_this$promotionEvalua = (_this$promotionEvalua2 = this.promotionEvaluator).getStrategyConfigs) === null || _this$promotionEvalua === void 0 ? void 0 : _this$promotionEvalua.call(_this$promotionEvalua2);
1285
1283
  if (!(Array.isArray(strategyConfigs) && strategyConfigs.length === 0)) {
1286
- _context9.next = 15;
1284
+ _context8.next = 15;
1287
1285
  break;
1288
1286
  }
1289
- return _context9.abrupt("return", null);
1287
+ return _context8.abrupt("return", null);
1290
1288
  case 15:
1291
1289
  this.isApplyingPromotion = true;
1292
- _context9.prev = 16;
1290
+ _context8.prev = 16;
1293
1291
  result = processCartPromotion(tempOrder.products, this.promotionEvaluator); // step 1: toRemove —— 直接过滤
1294
1292
  if (result.giftActions.toRemove.length > 0) {
1295
1293
  removeSet = new Set(result.giftActions.toRemove.map(String));
@@ -1301,20 +1299,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1301
1299
 
1302
1300
  // step 2: toReduce —— 调整数量
1303
1301
  _iterator3 = _createForOfIteratorHelper(result.giftActions.toReduce);
1304
- _context9.prev = 20;
1302
+ _context8.prev = 20;
1305
1303
  _iterator3.s();
1306
1304
  case 22:
1307
1305
  if ((_step3 = _iterator3.n()).done) {
1308
- _context9.next = 42;
1306
+ _context8.next = 42;
1309
1307
  break;
1310
1308
  }
1311
1309
  reduce = _step3.value;
1312
1310
  _iterator6 = _createForOfIteratorHelper(reduce.items);
1313
- _context9.prev = 25;
1314
- _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
1311
+ _context8.prev = 25;
1312
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
1315
1313
  var item, product;
1316
- return _regeneratorRuntime().wrap(function _loop2$(_context8) {
1317
- while (1) switch (_context8.prev = _context8.next) {
1314
+ return _regeneratorRuntime().wrap(function _loop$(_context7) {
1315
+ while (1) switch (_context7.prev = _context7.next) {
1318
1316
  case 0:
1319
1317
  item = _step6.value;
1320
1318
  product = result.products.find(function (p) {
@@ -1325,52 +1323,52 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1325
1323
  }
1326
1324
  case 3:
1327
1325
  case "end":
1328
- return _context8.stop();
1326
+ return _context7.stop();
1329
1327
  }
1330
- }, _loop2);
1328
+ }, _loop);
1331
1329
  });
1332
1330
  _iterator6.s();
1333
1331
  case 28:
1334
1332
  if ((_step6 = _iterator6.n()).done) {
1335
- _context9.next = 32;
1333
+ _context8.next = 32;
1336
1334
  break;
1337
1335
  }
1338
- return _context9.delegateYield(_loop2(), "t0", 30);
1336
+ return _context8.delegateYield(_loop(), "t0", 30);
1339
1337
  case 30:
1340
- _context9.next = 28;
1338
+ _context8.next = 28;
1341
1339
  break;
1342
1340
  case 32:
1343
- _context9.next = 37;
1341
+ _context8.next = 37;
1344
1342
  break;
1345
1343
  case 34:
1346
- _context9.prev = 34;
1347
- _context9.t1 = _context9["catch"](25);
1348
- _iterator6.e(_context9.t1);
1344
+ _context8.prev = 34;
1345
+ _context8.t1 = _context8["catch"](25);
1346
+ _iterator6.e(_context8.t1);
1349
1347
  case 37:
1350
- _context9.prev = 37;
1348
+ _context8.prev = 37;
1351
1349
  _iterator6.f();
1352
- return _context9.finish(37);
1350
+ return _context8.finish(37);
1353
1351
  case 40:
1354
- _context9.next = 22;
1352
+ _context8.next = 22;
1355
1353
  break;
1356
1354
  case 42:
1357
- _context9.next = 47;
1355
+ _context8.next = 47;
1358
1356
  break;
1359
1357
  case 44:
1360
- _context9.prev = 44;
1361
- _context9.t2 = _context9["catch"](20);
1362
- _iterator3.e(_context9.t2);
1358
+ _context8.prev = 44;
1359
+ _context8.t2 = _context8["catch"](20);
1360
+ _iterator3.e(_context8.t2);
1363
1361
  case 47:
1364
- _context9.prev = 47;
1362
+ _context8.prev = 47;
1365
1363
  _iterator3.f();
1366
- return _context9.finish(47);
1364
+ return _context8.finish(47);
1367
1365
  case 50:
1368
1366
  if (!(result.giftActions.toAdd.length > 0)) {
1369
- _context9.next = 76;
1367
+ _context8.next = 115;
1370
1368
  break;
1371
1369
  }
1372
1370
  if (this.giftSelectResolver) {
1373
- _context9.next = 55;
1371
+ _context8.next = 55;
1374
1372
  break;
1375
1373
  }
1376
1374
  if (result.giftActions.toAdd.some(function (g) {
@@ -1381,190 +1379,143 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1381
1379
  } else {
1382
1380
  console.warn('[OrderModule] giftSelectResolver not set, skip applying single-option gifts', result.giftActions.toAdd);
1383
1381
  }
1384
- _context9.next = 76;
1382
+ _context8.next = 115;
1385
1383
  break;
1386
1384
  case 55:
1387
1385
  _iterator4 = _createForOfIteratorHelper(result.giftActions.toAdd);
1388
- _context9.prev = 56;
1389
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
1390
- var addAction, _sameStrategy$metadat, sameStrategy, giftMutationBaseline, giftResult, giftProducts, giftBookings, _iterator5, _step5, _step5$value, index, gp, booking, linked;
1391
- return _regeneratorRuntime().wrap(function _loop$(_context7) {
1392
- while (1) switch (_context7.prev = _context7.next) {
1393
- case 0:
1394
- addAction = _step4.value;
1395
- if (!(addAction.giftOptions.length === 1)) {
1396
- _context7.next = 6;
1397
- break;
1398
- }
1399
- sameStrategy = result.products.find(function (p) {
1400
- var _p$metadata;
1401
- return ((_p$metadata = p.metadata) === null || _p$metadata === void 0 || (_p$metadata = _p$metadata._giftInfo) === null || _p$metadata === void 0 ? void 0 : _p$metadata.strategyId) === addAction.strategyId;
1402
- });
1403
- if (!(sameStrategy && !sameStrategy.booking_uid && !((_sameStrategy$metadat = sameStrategy.metadata) !== null && _sameStrategy$metadat !== void 0 && _sameStrategy$metadat.booking_uid))) {
1404
- _context7.next = 6;
1405
- break;
1406
- }
1407
- sameStrategy.num = (Number(sameStrategy.num) || 0) + (addAction.giftCount || 1);
1408
- return _context7.abrupt("return", 0);
1409
- case 6:
1410
- giftMutationBaseline = options !== null && options !== void 0 && options.isCurrentOrder ? cloneDeep({
1411
- products: tempOrder.products,
1412
- bookings: tempOrder.bookings
1413
- }) : null;
1414
- _context7.prev = 7;
1415
- _context7.next = 10;
1416
- return _this6.giftSelectResolver({
1417
- strategyId: addAction.strategyId,
1418
- strategyName: addAction.strategyName,
1419
- giftCount: addAction.giftCount,
1420
- giftOptions: addAction.giftOptions,
1421
- sourceProductIds: addAction.sourceProductIds
1422
- });
1423
- case 10:
1424
- giftResult = _context7.sent;
1425
- if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1426
- _context7.next = 13;
1427
- break;
1428
- }
1429
- return _context7.abrupt("return", {
1430
- v: null
1431
- });
1432
- case 13:
1433
- if (!(options !== null && options !== void 0 && options.isCurrentOrder && !isEqual({
1434
- products: tempOrder.products,
1435
- bookings: tempOrder.bookings
1436
- }, giftMutationBaseline))) {
1437
- _context7.next = 15;
1438
- break;
1439
- }
1440
- return _context7.abrupt("return", {
1441
- v: null
1442
- });
1443
- case 15:
1444
- giftProducts = Array.isArray(giftResult) ? giftResult : giftResult === null || giftResult === void 0 ? void 0 : giftResult.products;
1445
- giftBookings = Array.isArray(giftResult) ? [] : (giftResult === null || giftResult === void 0 ? void 0 : giftResult.bookings) || [];
1446
- if (!(Array.isArray(giftProducts) && giftProducts.length > 0)) {
1447
- _context7.next = 42;
1448
- break;
1449
- }
1450
- _iterator5 = _createForOfIteratorHelper(giftProducts.entries());
1451
- _context7.prev = 19;
1452
- _iterator5.s();
1453
- case 21:
1454
- if ((_step5 = _iterator5.n()).done) {
1455
- _context7.next = 34;
1456
- break;
1457
- }
1458
- _step5$value = _slicedToArray(_step5.value, 2), index = _step5$value[0], gp = _step5$value[1];
1459
- if (gp) {
1460
- _context7.next = 25;
1461
- break;
1462
- }
1463
- return _context7.abrupt("continue", 32);
1464
- case 25:
1465
- booking = giftBookings[index];
1466
- if (!booking) {
1467
- _context7.next = 31;
1468
- break;
1469
- }
1470
- linked = _this6.createLinkedProductAndBooking({
1471
- product: gp,
1472
- booking: booking
1473
- });
1474
- result.products.push(linked.product);
1475
- tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
1476
- return _context7.abrupt("continue", 32);
1477
- case 31:
1478
- // normalize 略过:调用方应保证返回完整 OrderProduct。
1479
- result.products.push(gp);
1480
- case 32:
1481
- _context7.next = 21;
1482
- break;
1483
- case 34:
1484
- _context7.next = 39;
1485
- break;
1486
- case 36:
1487
- _context7.prev = 36;
1488
- _context7.t0 = _context7["catch"](19);
1489
- _iterator5.e(_context7.t0);
1490
- case 39:
1491
- _context7.prev = 39;
1492
- _iterator5.f();
1493
- return _context7.finish(39);
1494
- case 42:
1495
- _context7.next = 51;
1496
- break;
1497
- case 44:
1498
- _context7.prev = 44;
1499
- _context7.t1 = _context7["catch"](7);
1500
- if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1501
- _context7.next = 48;
1502
- break;
1503
- }
1504
- return _context7.abrupt("return", {
1505
- v: null
1506
- });
1507
- case 48:
1508
- if (!(options !== null && options !== void 0 && options.isCurrentOrder && !isEqual({
1509
- products: tempOrder.products,
1510
- bookings: tempOrder.bookings
1511
- }, giftMutationBaseline))) {
1512
- _context7.next = 50;
1513
- break;
1514
- }
1515
- return _context7.abrupt("return", {
1516
- v: null
1517
- });
1518
- case 50:
1519
- // 用户取消 / 选择失败 → 视为放弃本次新增
1520
- console.warn('[OrderModule] giftSelectResolver rejected, skip add gift', addAction.strategyId, _context7.t1);
1521
- case 51:
1522
- case "end":
1523
- return _context7.stop();
1524
- }
1525
- }, _loop, null, [[7, 44], [19, 36, 39, 42]]);
1526
- });
1386
+ _context8.prev = 56;
1527
1387
  _iterator4.s();
1528
- case 59:
1388
+ case 58:
1529
1389
  if ((_step4 = _iterator4.n()).done) {
1530
- _context9.next = 68;
1390
+ _context8.next = 107;
1531
1391
  break;
1532
1392
  }
1533
- return _context9.delegateYield(_loop(), "t3", 61);
1534
- case 61:
1535
- _ret = _context9.t3;
1536
- if (!(_ret === 0)) {
1537
- _context9.next = 64;
1393
+ addAction = _step4.value;
1394
+ // 唯一候选也可能有规格/套餐。每次补赠都交给 SDK 判断,不能复用旧赠品的选择。
1395
+ giftMutationBaseline = options !== null && options !== void 0 && options.isCurrentOrder ? cloneDeep({
1396
+ products: tempOrder.products,
1397
+ bookings: tempOrder.bookings
1398
+ }) : null;
1399
+ _context8.prev = 61;
1400
+ _context8.next = 64;
1401
+ return this.giftSelectResolver({
1402
+ strategyId: addAction.strategyId,
1403
+ strategyName: addAction.strategyName,
1404
+ giftCount: addAction.giftCount,
1405
+ giftOptions: addAction.giftOptions,
1406
+ sourceProductIds: addAction.sourceProductIds
1407
+ });
1408
+ case 64:
1409
+ giftResult = _context8.sent;
1410
+ if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1411
+ _context8.next = 67;
1538
1412
  break;
1539
1413
  }
1540
- return _context9.abrupt("continue", 66);
1541
- case 64:
1542
- if (!_ret) {
1543
- _context9.next = 66;
1414
+ return _context8.abrupt("return", null);
1415
+ case 67:
1416
+ if (!(options !== null && options !== void 0 && options.isCurrentOrder && !isEqual({
1417
+ products: tempOrder.products,
1418
+ bookings: tempOrder.bookings
1419
+ }, giftMutationBaseline))) {
1420
+ _context8.next = 69;
1544
1421
  break;
1545
1422
  }
1546
- return _context9.abrupt("return", _ret.v);
1547
- case 66:
1548
- _context9.next = 59;
1423
+ return _context8.abrupt("return", null);
1424
+ case 69:
1425
+ giftProducts = Array.isArray(giftResult) ? giftResult : giftResult === null || giftResult === void 0 ? void 0 : giftResult.products;
1426
+ giftBookings = Array.isArray(giftResult) ? [] : (giftResult === null || giftResult === void 0 ? void 0 : giftResult.bookings) || [];
1427
+ if (!(Array.isArray(giftProducts) && giftProducts.length > 0)) {
1428
+ _context8.next = 96;
1429
+ break;
1430
+ }
1431
+ _iterator5 = _createForOfIteratorHelper(giftProducts.entries());
1432
+ _context8.prev = 73;
1433
+ _iterator5.s();
1434
+ case 75:
1435
+ if ((_step5 = _iterator5.n()).done) {
1436
+ _context8.next = 88;
1437
+ break;
1438
+ }
1439
+ _step5$value = _slicedToArray(_step5.value, 2), index = _step5$value[0], gp = _step5$value[1];
1440
+ if (gp) {
1441
+ _context8.next = 79;
1442
+ break;
1443
+ }
1444
+ return _context8.abrupt("continue", 86);
1445
+ case 79:
1446
+ booking = giftBookings[index];
1447
+ if (!booking) {
1448
+ _context8.next = 85;
1449
+ break;
1450
+ }
1451
+ linked = this.createLinkedProductAndBooking({
1452
+ product: gp,
1453
+ booking: booking
1454
+ });
1455
+ result.products.push(linked.product);
1456
+ tempOrder.bookings = [].concat(_toConsumableArray(tempOrder.bookings || []), [linked.booking]);
1457
+ return _context8.abrupt("continue", 86);
1458
+ case 85:
1459
+ // normalize 略过:调用方应保证返回完整 OrderProduct。
1460
+ result.products.push(gp);
1461
+ case 86:
1462
+ _context8.next = 75;
1549
1463
  break;
1550
- case 68:
1551
- _context9.next = 73;
1464
+ case 88:
1465
+ _context8.next = 93;
1552
1466
  break;
1553
- case 70:
1554
- _context9.prev = 70;
1555
- _context9.t4 = _context9["catch"](56);
1556
- _iterator4.e(_context9.t4);
1557
- case 73:
1558
- _context9.prev = 73;
1467
+ case 90:
1468
+ _context8.prev = 90;
1469
+ _context8.t3 = _context8["catch"](73);
1470
+ _iterator5.e(_context8.t3);
1471
+ case 93:
1472
+ _context8.prev = 93;
1473
+ _iterator5.f();
1474
+ return _context8.finish(93);
1475
+ case 96:
1476
+ _context8.next = 105;
1477
+ break;
1478
+ case 98:
1479
+ _context8.prev = 98;
1480
+ _context8.t4 = _context8["catch"](61);
1481
+ if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1482
+ _context8.next = 102;
1483
+ break;
1484
+ }
1485
+ return _context8.abrupt("return", null);
1486
+ case 102:
1487
+ if (!(options !== null && options !== void 0 && options.isCurrentOrder && !isEqual({
1488
+ products: tempOrder.products,
1489
+ bookings: tempOrder.bookings
1490
+ }, giftMutationBaseline))) {
1491
+ _context8.next = 104;
1492
+ break;
1493
+ }
1494
+ return _context8.abrupt("return", null);
1495
+ case 104:
1496
+ // 用户取消 / 选择失败 → 视为放弃本次新增
1497
+ console.warn('[OrderModule] giftSelectResolver rejected, skip add gift', addAction.strategyId, _context8.t4);
1498
+ case 105:
1499
+ _context8.next = 58;
1500
+ break;
1501
+ case 107:
1502
+ _context8.next = 112;
1503
+ break;
1504
+ case 109:
1505
+ _context8.prev = 109;
1506
+ _context8.t5 = _context8["catch"](56);
1507
+ _iterator4.e(_context8.t5);
1508
+ case 112:
1509
+ _context8.prev = 112;
1559
1510
  _iterator4.f();
1560
- return _context9.finish(73);
1561
- case 76:
1511
+ return _context8.finish(112);
1512
+ case 115:
1562
1513
  if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
1563
- _context9.next = 78;
1514
+ _context8.next = 117;
1564
1515
  break;
1565
1516
  }
1566
- return _context9.abrupt("return", null);
1567
- case 78:
1517
+ return _context8.abrupt("return", null);
1518
+ case 117:
1568
1519
  tempOrder.products = result.products;
1569
1520
  this.lastUnfulfilledPromotions = result.unfulfilledPromotions;
1570
1521
  this.lastGiftActions = result.giftActions;
@@ -1581,21 +1532,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1581
1532
  }),
1582
1533
  products: tempOrder.products
1583
1534
  };
1584
- return _context9.abrupt("return", payload);
1585
- case 85:
1586
- _context9.prev = 85;
1587
- _context9.t5 = _context9["catch"](16);
1588
- console.error('[OrderModule] applyPromotion failed', _context9.t5);
1589
- return _context9.abrupt("return", null);
1590
- case 89:
1591
- _context9.prev = 89;
1535
+ return _context8.abrupt("return", payload);
1536
+ case 124:
1537
+ _context8.prev = 124;
1538
+ _context8.t6 = _context8["catch"](16);
1539
+ console.error('[OrderModule] applyPromotion failed', _context8.t6);
1540
+ return _context8.abrupt("return", null);
1541
+ case 128:
1542
+ _context8.prev = 128;
1592
1543
  this.isApplyingPromotion = false;
1593
- return _context9.finish(89);
1594
- case 92:
1544
+ return _context8.finish(128);
1545
+ case 131:
1595
1546
  case "end":
1596
- return _context9.stop();
1547
+ return _context8.stop();
1597
1548
  }
1598
- }, _callee7, this, [[16, 85, 89, 92], [20, 44, 47, 50], [25, 34, 37, 40], [56, 70, 73, 76]]);
1549
+ }, _callee7, this, [[16, 124, 128, 131], [20, 44, 47, 50], [25, 34, 37, 40], [56, 109, 112, 115], [61, 98], [73, 90, 93, 96]]);
1599
1550
  }));
1600
1551
  function evaluatePromotion(_x8) {
1601
1552
  return _evaluatePromotion.apply(this, arguments);
@@ -1625,29 +1576,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1625
1576
  value: (function () {
1626
1577
  var _applyPromotion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1627
1578
  var payload, tempOrder;
1628
- return _regeneratorRuntime().wrap(function _callee8$(_context10) {
1629
- while (1) switch (_context10.prev = _context10.next) {
1579
+ return _regeneratorRuntime().wrap(function _callee8$(_context9) {
1580
+ while (1) switch (_context9.prev = _context9.next) {
1630
1581
  case 0:
1631
- _context10.next = 2;
1582
+ _context9.next = 2;
1632
1583
  return this.evaluatePromotion();
1633
1584
  case 2:
1634
- payload = _context10.sent;
1585
+ payload = _context9.sent;
1635
1586
  if (payload) {
1636
- _context10.next = 5;
1587
+ _context9.next = 5;
1637
1588
  break;
1638
1589
  }
1639
- return _context10.abrupt("return");
1590
+ return _context9.abrupt("return");
1640
1591
  case 5:
1641
1592
  tempOrder = this.store.tempOrder;
1642
1593
  if (tempOrder) {
1643
- _context10.next = 8;
1594
+ _context9.next = 8;
1644
1595
  break;
1645
1596
  }
1646
- return _context10.abrupt("return");
1597
+ return _context9.abrupt("return");
1647
1598
  case 8:
1648
1599
  this.applyDiscount();
1649
1600
  this.sanitizeTempOrderProducts(tempOrder);
1650
- _context10.next = 12;
1601
+ _context9.next = 12;
1651
1602
  return this.recalculateSummary({
1652
1603
  createIfMissing: true
1653
1604
  });
@@ -1656,7 +1607,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1656
1607
  this.emitPromotionApplied(payload);
1657
1608
  case 14:
1658
1609
  case "end":
1659
- return _context10.stop();
1610
+ return _context9.stop();
1660
1611
  }
1661
1612
  }, _callee8, this);
1662
1613
  }));
@@ -1831,12 +1782,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1831
1782
  }, {
1832
1783
  key: "rememberPointCardSnapshotCodeCandidates",
1833
1784
  value: function rememberPointCardSnapshotCodeCandidates(value) {
1834
- var _this7 = this;
1785
+ var _this6 = this;
1835
1786
  collectPointCardSnapshotCodeCandidates(value).forEach(function (_ref18) {
1836
1787
  var id = _ref18.id,
1837
1788
  code = _ref18.code;
1838
- if (!_this7.pointCardSnapshotCodeCandidates.has(id)) {
1839
- _this7.pointCardSnapshotCodeCandidates.set(id, code);
1789
+ if (!_this6.pointCardSnapshotCodeCandidates.has(id)) {
1790
+ _this6.pointCardSnapshotCodeCandidates.set(id, code);
1840
1791
  }
1841
1792
  });
1842
1793
  }
@@ -1985,11 +1936,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
1985
1936
  key: "saveDraft",
1986
1937
  value: function () {
1987
1938
  var _saveDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1988
- return _regeneratorRuntime().wrap(function _callee9$(_context11) {
1989
- while (1) switch (_context11.prev = _context11.next) {
1939
+ return _regeneratorRuntime().wrap(function _callee9$(_context10) {
1940
+ while (1) switch (_context10.prev = _context10.next) {
1990
1941
  case 0:
1991
1942
  case "end":
1992
- return _context11.stop();
1943
+ return _context10.stop();
1993
1944
  }
1994
1945
  }, _callee9);
1995
1946
  }));
@@ -2007,13 +1958,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2007
1958
  key: "hydrateTempOrderFromLocalRecord",
2008
1959
  value: function () {
2009
1960
  var _hydrateTempOrderFromLocalRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(record) {
2010
- return _regeneratorRuntime().wrap(function _callee10$(_context12) {
2011
- while (1) switch (_context12.prev = _context12.next) {
1961
+ return _regeneratorRuntime().wrap(function _callee10$(_context11) {
1962
+ while (1) switch (_context11.prev = _context11.next) {
2012
1963
  case 0:
2013
- return _context12.abrupt("return", this.hydrateTempOrderFromRecord(record));
1964
+ return _context11.abrupt("return", this.hydrateTempOrderFromRecord(record));
2014
1965
  case 1:
2015
1966
  case "end":
2016
- return _context12.stop();
1967
+ return _context11.stop();
2017
1968
  }
2018
1969
  }, _callee10, this);
2019
1970
  }));
@@ -2043,23 +1994,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2043
1994
  }, {
2044
1995
  key: "calculatePaymentTotal",
2045
1996
  value: function calculatePaymentTotal(payments) {
2046
- var _this8 = this;
1997
+ var _this7 = this;
2047
1998
  return mapPaymentItemsToOrderPayments(payments, {
2048
1999
  includeVoided: false
2049
2000
  }).reduce(function (sum, payment) {
2050
2001
  if (!isPaidPaymentRecord(payment)) return sum;
2051
- return sum.plus(_this8.calculatePaymentEffectiveAmount(payment));
2002
+ return sum.plus(_this7.calculatePaymentEffectiveAmount(payment));
2052
2003
  }, new Decimal(0));
2053
2004
  }
2054
2005
  }, {
2055
2006
  key: "calculateOrderPaidPaymentTotal",
2056
2007
  value: function calculateOrderPaidPaymentTotal(payments) {
2057
- var _this9 = this;
2008
+ var _this8 = this;
2058
2009
  return mapPaymentItemsToOrderPayments(payments, {
2059
2010
  includeVoided: false
2060
2011
  }).reduce(function (sum, payment) {
2061
2012
  if (!isPaidPaymentRecord(payment)) return sum;
2062
- return sum.plus(_this9.calculatePaymentGapAmount(payment));
2013
+ return sum.plus(_this8.calculatePaymentGapAmount(payment));
2063
2014
  }, new Decimal(0));
2064
2015
  }
2065
2016
  }, {
@@ -2195,13 +2146,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2195
2146
  }, {
2196
2147
  key: "calculateDepositPaidAmount",
2197
2148
  value: function calculateDepositPaidAmount(payments) {
2198
- var _this10 = this;
2149
+ var _this9 = this;
2199
2150
  return (payments || []).reduce(function (sum, payment) {
2200
2151
  var paymentRecord = payment;
2201
2152
  if (!isPaidPaymentRecord(paymentRecord)) return sum;
2202
2153
  var isDepositPayment = paymentRecord.type === 'deposit' || paymentRecord.order_payment_type === 'deposit';
2203
2154
  if (!isDepositPayment) return sum;
2204
- return sum.plus(_this10.calculatePaymentGapAmount(paymentRecord));
2155
+ return sum.plus(_this9.calculatePaymentGapAmount(paymentRecord));
2205
2156
  }, new Decimal(0));
2206
2157
  }
2207
2158
  }, {
@@ -2238,17 +2189,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2238
2189
  }, {
2239
2190
  key: "getPaymentNumberDevicePrefixSync",
2240
2191
  value: function getPaymentNumberDevicePrefixSync() {
2241
- var _this11 = this;
2192
+ var _this10 = this;
2242
2193
  return resolvePaymentNumberDevicePrefixFromDeviceId(function (key) {
2243
- return _this11.getPaymentNumberAppData(key);
2194
+ return _this10.getPaymentNumberAppData(key);
2244
2195
  });
2245
2196
  }
2246
2197
  }, {
2247
2198
  key: "getPaymentNumberDevicePrefixAsync",
2248
2199
  value: function getPaymentNumberDevicePrefixAsync() {
2249
- var _this12 = this;
2200
+ var _this11 = this;
2250
2201
  return resolvePaymentNumberDevicePrefix(function (key) {
2251
- return _this12.getPaymentNumberAppData(key);
2202
+ return _this11.getPaymentNumberAppData(key);
2252
2203
  });
2253
2204
  }
2254
2205
  }, {
@@ -2378,16 +2329,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2378
2329
  }, {
2379
2330
  key: "calculatePaidPaymentSummary",
2380
2331
  value: function calculatePaidPaymentSummary(payments) {
2381
- var _this13 = this;
2332
+ var _this12 = this;
2382
2333
  return (payments || []).reduce(function (summary, payment) {
2383
2334
  var paymentRecord = payment;
2384
2335
  if (!isPaidPaymentRecord(paymentRecord)) return summary;
2385
2336
  return {
2386
2337
  customerPaidAmount: summary.customerPaidAmount.plus(paymentRecord.amount || 0),
2387
- orderPaidAmount: summary.orderPaidAmount.plus(_this13.calculatePaymentOrderAmount(paymentRecord)),
2388
- gapPaidAmount: summary.gapPaidAmount.plus(_this13.calculatePaymentGapAmount(paymentRecord)),
2389
- payServiceChargeAmount: summary.payServiceChargeAmount.plus(_this13.calculatePaymentServiceFee(paymentRecord)),
2390
- roundingAmount: summary.roundingAmount.plus(_this13.calculatePaymentRoundingAmount(paymentRecord))
2338
+ orderPaidAmount: summary.orderPaidAmount.plus(_this12.calculatePaymentOrderAmount(paymentRecord)),
2339
+ gapPaidAmount: summary.gapPaidAmount.plus(_this12.calculatePaymentGapAmount(paymentRecord)),
2340
+ payServiceChargeAmount: summary.payServiceChargeAmount.plus(_this12.calculatePaymentServiceFee(paymentRecord)),
2341
+ roundingAmount: summary.roundingAmount.plus(_this12.calculatePaymentRoundingAmount(paymentRecord))
2391
2342
  };
2392
2343
  }, {
2393
2344
  customerPaidAmount: new Decimal(0),
@@ -2594,15 +2545,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2594
2545
  }, {
2595
2546
  key: "normalizeFingerprintValue",
2596
2547
  value: function normalizeFingerprintValue(value) {
2597
- var _this14 = this;
2548
+ var _this13 = this;
2598
2549
  if (Array.isArray(value)) {
2599
2550
  return value.map(function (item) {
2600
- return _this14.normalizeFingerprintValue(item);
2551
+ return _this13.normalizeFingerprintValue(item);
2601
2552
  });
2602
2553
  }
2603
2554
  if (!value || _typeof(value) !== 'object') return value !== null && value !== void 0 ? value : '';
2604
2555
  return Object.keys(value).sort().reduce(function (result, key) {
2605
- result[key] = _this14.normalizeFingerprintValue(value[key]);
2556
+ result[key] = _this13.normalizeFingerprintValue(value[key]);
2606
2557
  return result;
2607
2558
  }, {});
2608
2559
  }
@@ -2617,7 +2568,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2617
2568
  _sku$barcode,
2618
2569
  _ref26,
2619
2570
  _sku$variant_id,
2620
- _this15 = this;
2571
+ _this14 = this;
2621
2572
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
2622
2573
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
2623
2574
  var discountTypes = ((product === null || product === void 0 ? void 0 : product.discount_list) || []).map(function (discount) {
@@ -2656,7 +2607,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2656
2607
  option_group_id: (_option$option_group_ = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_ !== void 0 ? _option$option_group_ : null,
2657
2608
  option_group_item_id: (_ref28 = (_option$option_group_2 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_2 !== void 0 ? _option$option_group_2 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref28 !== void 0 ? _ref28 : null,
2658
2609
  num: Number((_option$num = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num !== void 0 ? _option$num : 1) || 1,
2659
- add_price: _this15.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
2610
+ add_price: _this14.normalizeFingerprintMoney((_option$add_price = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price !== void 0 ? _option$add_price : option === null || option === void 0 ? void 0 : option.price)
2660
2611
  };
2661
2612
  })
2662
2613
  }),
@@ -2666,8 +2617,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2666
2617
  bundle_product_id: (_ref29 = (_ref30 = (_bundle$bundle_produc = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_product_id) !== null && _bundle$bundle_produc !== void 0 ? _bundle$bundle_produc : bundle === null || bundle === void 0 ? void 0 : bundle._bundle_product_id) !== null && _ref30 !== void 0 ? _ref30 : bundle === null || bundle === void 0 ? void 0 : bundle.product_id) !== null && _ref29 !== void 0 ? _ref29 : null,
2667
2618
  bundle_variant_id: (_ref31 = (_bundle$bundle_varian = bundle === null || bundle === void 0 ? void 0 : bundle.bundle_variant_id) !== null && _bundle$bundle_varian !== void 0 ? _bundle$bundle_varian : bundle === null || bundle === void 0 ? void 0 : bundle.product_variant_id) !== null && _ref31 !== void 0 ? _ref31 : 0,
2668
2619
  num: getSafeProductNum((_bundle$num = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num !== void 0 ? _bundle$num : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
2669
- price: _this15.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
2670
- bundle_selling_price: _this15.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
2620
+ price: _this14.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.price),
2621
+ bundle_selling_price: _this14.normalizeFingerprintMoney(bundle === null || bundle === void 0 ? void 0 : bundle.bundle_selling_price),
2671
2622
  price_type: (_bundle$price_type = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type !== void 0 ? _bundle$price_type : '',
2672
2623
  price_type_ext: (_bundle$price_type_ex = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex !== void 0 ? _bundle$price_type_ex : ''
2673
2624
  };
@@ -2677,7 +2628,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2677
2628
  return {
2678
2629
  type: (_ref32 = (_discount$type2 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type2 !== void 0 ? _discount$type2 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref32 !== void 0 ? _ref32 : '',
2679
2630
  discount_id: (_ref33 = (_ref34 = (_discount$discount_id = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id !== void 0 ? _discount$discount_id : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref34 !== void 0 ? _ref34 : discount === null || discount === void 0 || (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _ref33 !== void 0 ? _ref33 : null,
2680
- amount: _this15.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2631
+ amount: _this14.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2681
2632
  };
2682
2633
  }))
2683
2634
  };
@@ -2685,9 +2636,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2685
2636
  }, {
2686
2637
  key: "buildOrderProductsFingerprint",
2687
2638
  value: function buildOrderProductsFingerprint(products) {
2688
- var _this16 = this;
2639
+ var _this15 = this;
2689
2640
  var items = (products || []).map(function (product) {
2690
- return _this16.buildProductFingerprintItem(product);
2641
+ return _this15.buildProductFingerprintItem(product);
2691
2642
  });
2692
2643
  items.sort(function (left, right) {
2693
2644
  return JSON.stringify(left).localeCompare(JSON.stringify(right));
@@ -2709,7 +2660,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2709
2660
  _sku$barcode2,
2710
2661
  _ref36,
2711
2662
  _sku$variant_id2,
2712
- _this17 = this;
2663
+ _this16 = this;
2713
2664
  var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.store.tempOrder || {};
2714
2665
  var sku = (product === null || product === void 0 ? void 0 : product.product_sku) || {};
2715
2666
  var metadata = (product === null || product === void 0 ? void 0 : product.metadata) || {};
@@ -2746,7 +2697,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2746
2697
  option_group_id: (_option$option_group_3 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_3 !== void 0 ? _option$option_group_3 : null,
2747
2698
  option_group_item_id: (_ref38 = (_option$option_group_4 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_4 !== void 0 ? _option$option_group_4 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref38 !== void 0 ? _ref38 : null,
2748
2699
  num: Number((_option$num2 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num2 !== void 0 ? _option$num2 : 1) || 1,
2749
- add_price: _this17.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
2700
+ add_price: _this16.normalizeFingerprintMoney((_option$add_price2 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price2 !== void 0 ? _option$add_price2 : option === null || option === void 0 ? void 0 : option.price)
2750
2701
  };
2751
2702
  })
2752
2703
  }),
@@ -2760,14 +2711,14 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2760
2711
  num: getSafeProductNum((_bundle$num2 = bundle === null || bundle === void 0 ? void 0 : bundle.num) !== null && _bundle$num2 !== void 0 ? _bundle$num2 : bundle === null || bundle === void 0 ? void 0 : bundle.quantity),
2761
2712
  price_type: (_bundle$price_type2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type) !== null && _bundle$price_type2 !== void 0 ? _bundle$price_type2 : '',
2762
2713
  price_type_ext: (_bundle$price_type_ex2 = bundle === null || bundle === void 0 ? void 0 : bundle.price_type_ext) !== null && _bundle$price_type_ex2 !== void 0 ? _bundle$price_type_ex2 : '',
2763
- option: _this17.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
2714
+ option: _this16.normalizeFingerprintValue(((bundle === null || bundle === void 0 ? void 0 : bundle.option) || []).map(function (option) {
2764
2715
  var _ref44, _option$id3, _option$option_group_5, _ref45, _option$option_group_6, _option$num3, _option$add_price3;
2765
2716
  return {
2766
2717
  id: (_ref44 = (_option$id3 = option === null || option === void 0 ? void 0 : option.id) !== null && _option$id3 !== void 0 ? _option$id3 : option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _ref44 !== void 0 ? _ref44 : null,
2767
2718
  option_group_id: (_option$option_group_5 = option === null || option === void 0 ? void 0 : option.option_group_id) !== null && _option$option_group_5 !== void 0 ? _option$option_group_5 : null,
2768
2719
  option_group_item_id: (_ref45 = (_option$option_group_6 = option === null || option === void 0 ? void 0 : option.option_group_item_id) !== null && _option$option_group_6 !== void 0 ? _option$option_group_6 : option === null || option === void 0 ? void 0 : option.id) !== null && _ref45 !== void 0 ? _ref45 : null,
2769
2720
  num: Number((_option$num3 = option === null || option === void 0 ? void 0 : option.num) !== null && _option$num3 !== void 0 ? _option$num3 : 1) || 1,
2770
- add_price: _this17.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
2721
+ add_price: _this16.normalizeFingerprintMoney((_option$add_price3 = option === null || option === void 0 ? void 0 : option.add_price) !== null && _option$add_price3 !== void 0 ? _option$add_price3 : option === null || option === void 0 ? void 0 : option.price)
2771
2722
  };
2772
2723
  }))
2773
2724
  };
@@ -2777,7 +2728,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2777
2728
  return {
2778
2729
  type: (_ref46 = (_discount$type4 = discount === null || discount === void 0 ? void 0 : discount.type) !== null && _discount$type4 !== void 0 ? _discount$type4 : discount === null || discount === void 0 ? void 0 : discount.tag) !== null && _ref46 !== void 0 ? _ref46 : '',
2779
2730
  discount_id: (_ref47 = (_ref48 = (_discount$discount_id2 = discount === null || discount === void 0 ? void 0 : discount.discount_id) !== null && _discount$discount_id2 !== void 0 ? _discount$discount_id2 : discount === null || discount === void 0 ? void 0 : discount.order_discount_id) !== null && _ref48 !== void 0 ? _ref48 : discount === null || discount === void 0 || (_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.resource_id) !== null && _ref47 !== void 0 ? _ref47 : null,
2780
- amount: _this17.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2731
+ amount: _this16.normalizeFingerprintMoney(discount === null || discount === void 0 ? void 0 : discount.amount)
2781
2732
  };
2782
2733
  }))
2783
2734
  };
@@ -2785,10 +2736,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
2785
2736
  }, {
2786
2737
  key: "buildOrderProductsStructuralFingerprint",
2787
2738
  value: function buildOrderProductsStructuralFingerprint(products) {
2788
- var _this18 = this;
2739
+ var _this17 = this;
2789
2740
  var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.store.tempOrder || {};
2790
2741
  var items = (products || []).map(function (product) {
2791
- return _this18.buildProductStructuralFingerprintItem(product, order);
2742
+ return _this17.buildProductStructuralFingerprintItem(product, order);
2792
2743
  });
2793
2744
  items.sort(function (left, right) {
2794
2745
  return JSON.stringify(left).localeCompare(JSON.stringify(right));
@@ -3050,11 +3001,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3050
3001
  value: function () {
3051
3002
  var _replaceTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(tempOrder, options) {
3052
3003
  var nextTempOrder;
3053
- return _regeneratorRuntime().wrap(function _callee11$(_context13) {
3054
- while (1) switch (_context13.prev = _context13.next) {
3004
+ return _regeneratorRuntime().wrap(function _callee11$(_context12) {
3005
+ while (1) switch (_context12.prev = _context12.next) {
3055
3006
  case 0:
3056
3007
  if (isTempOrder(tempOrder)) {
3057
- _context13.next = 2;
3008
+ _context12.next = 2;
3058
3009
  break;
3059
3010
  }
3060
3011
  throw new Error('无效的 tempOrder 数据');
@@ -3066,15 +3017,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3066
3017
  this.store.tempOrder = nextTempOrder;
3067
3018
  this.clearCustomerWalletRuntimeState();
3068
3019
  if (!((options === null || options === void 0 ? void 0 : options.recalculateSummary) !== false)) {
3069
- _context13.next = 11;
3020
+ _context12.next = 11;
3070
3021
  break;
3071
3022
  }
3072
- _context13.next = 9;
3023
+ _context12.next = 9;
3073
3024
  return this.recalculateSummary({
3074
3025
  createIfMissing: false
3075
3026
  });
3076
3027
  case 9:
3077
- _context13.next = 12;
3028
+ _context12.next = 12;
3078
3029
  break;
3079
3030
  case 11:
3080
3031
  this.store.summary = createEmptySummary();
@@ -3083,16 +3034,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3083
3034
  this.persistTempOrder();
3084
3035
  }
3085
3036
  if (!(options !== null && options !== void 0 && options.saveDraft)) {
3086
- _context13.next = 16;
3037
+ _context12.next = 16;
3087
3038
  break;
3088
3039
  }
3089
- _context13.next = 16;
3040
+ _context12.next = 16;
3090
3041
  return this.saveDraft();
3091
3042
  case 16:
3092
- return _context13.abrupt("return", nextTempOrder);
3043
+ return _context12.abrupt("return", nextTempOrder);
3093
3044
  case 17:
3094
3045
  case "end":
3095
- return _context13.stop();
3046
+ return _context12.stop();
3096
3047
  }
3097
3048
  }, _callee11, this);
3098
3049
  }));
@@ -3184,28 +3135,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3184
3135
  value: function () {
3185
3136
  var _addNewOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
3186
3137
  var tempOrder;
3187
- return _regeneratorRuntime().wrap(function _callee12$(_context14) {
3188
- while (1) switch (_context14.prev = _context14.next) {
3138
+ return _regeneratorRuntime().wrap(function _callee12$(_context13) {
3139
+ while (1) switch (_context13.prev = _context13.next) {
3189
3140
  case 0:
3190
3141
  tempOrder = this.ensureTempOrder();
3191
3142
  this.ensureExternalSaleNumber(tempOrder);
3192
- _context14.next = 4;
3143
+ _context13.next = 4;
3193
3144
  return this.recalculateSummary({
3194
3145
  createIfMissing: true
3195
3146
  });
3196
3147
  case 4:
3197
3148
  this.persistTempOrder();
3198
3149
  if (!this.draftPersistEnabled) {
3199
- _context14.next = 8;
3150
+ _context13.next = 8;
3200
3151
  break;
3201
3152
  }
3202
- _context14.next = 8;
3153
+ _context13.next = 8;
3203
3154
  return this.saveDraft();
3204
3155
  case 8:
3205
- return _context14.abrupt("return", tempOrder);
3156
+ return _context13.abrupt("return", tempOrder);
3206
3157
  case 9:
3207
3158
  case "end":
3208
- return _context14.stop();
3159
+ return _context13.stop();
3209
3160
  }
3210
3161
  }, _callee12, this);
3211
3162
  }));
@@ -3249,9 +3200,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3249
3200
  }, {
3250
3201
  key: "sanitizeTempOrderProducts",
3251
3202
  value: function sanitizeTempOrderProducts(tempOrder) {
3252
- var _this19 = this;
3203
+ var _this18 = this;
3253
3204
  tempOrder.products = (tempOrder.products || []).map(function (product) {
3254
- return _this19.sanitizeOrderProductForTempOrder(_this19.normalizeVirtualSettlementProductIfEnabled(product));
3205
+ return _this18.sanitizeOrderProductForTempOrder(_this18.normalizeVirtualSettlementProductIfEnabled(product));
3255
3206
  });
3256
3207
  this.syncTempOrderSettlementState(tempOrder);
3257
3208
  ensureUniqueProductLineUids(tempOrder);
@@ -3371,7 +3322,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3371
3322
  }, {
3372
3323
  key: "syncLinkedBookingHoldersToProducts",
3373
3324
  value: function syncLinkedBookingHoldersToProducts(tempOrder) {
3374
- var _this20 = this;
3325
+ var _this19 = this;
3375
3326
  var bookings = tempOrder.bookings || [];
3376
3327
  var products = tempOrder.products || [];
3377
3328
  if (!bookings.length || !products.length) return;
@@ -3397,7 +3348,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3397
3348
  var bookingUid = product.booking_uid || ((_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.booking_uid);
3398
3349
  var linkedBooking = (productUid !== undefined && productUid !== null && String(productUid) !== '' ? bookingByProductUid.get(String(productUid)) : undefined) || (bookingUid !== undefined && bookingUid !== null && String(bookingUid) !== '' ? bookingByBookingUid.get(String(bookingUid)) : undefined);
3399
3350
  if (linkedBooking) {
3400
- _this20.setProductHolderFromBooking(product, linkedBooking);
3351
+ _this19.setProductHolderFromBooking(product, linkedBooking);
3401
3352
  }
3402
3353
  });
3403
3354
  }
@@ -3528,9 +3479,9 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3528
3479
  }, {
3529
3480
  key: "findBookingIndexByUniqueIdentificationNumber",
3530
3481
  value: function findBookingIndexByUniqueIdentificationNumber(tempOrder, uniqueIdentificationNumber) {
3531
- var _this21 = this;
3482
+ var _this20 = this;
3532
3483
  return (tempOrder.bookings || []).findIndex(function (booking) {
3533
- return _this21.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
3484
+ return _this20.getBookingUniqueIdentificationNumber(booking) === uniqueIdentificationNumber;
3534
3485
  });
3535
3486
  }
3536
3487
  }, {
@@ -3538,13 +3489,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3538
3489
  value: function removeLinkedBookingsForProduct(tempOrder, product) {
3539
3490
  var _product$metadata5,
3540
3491
  _product$metadata6,
3541
- _this22 = this;
3492
+ _this21 = this;
3542
3493
  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);
3543
3494
  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);
3544
3495
  if (!productUid && !bookingUid) return;
3545
3496
  tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
3546
3497
  if (isFulfillmentTimingBooking(booking)) return true;
3547
- var currentBookingUid = _this22.getBookingUniqueIdentificationNumber(booking);
3498
+ var currentBookingUid = _this21.getBookingUniqueIdentificationNumber(booking);
3548
3499
  if (bookingUid && currentBookingUid === String(bookingUid)) return false;
3549
3500
  if (productUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) return false;
3550
3501
  return true;
@@ -3593,21 +3544,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3593
3544
  var _recalculateSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(options) {
3594
3545
  var _this$otherParams3, _ref53, _salesSummaryResult$e;
3595
3546
  var tempOrder, originalSnapshot, hasShopDiscountChanged, shouldReuseOriginalSnapshot, snapshotSummary, shouldFullRecalculateFromSnapshot, summaryProducts, salesSummary, existedSummary, totalRefundAmount, paidPaymentSummary, emptyBaseSummary, emptySummaryBase, emptySummaryWithDeposit, emptySummary, summaryMutationBaseline, salesSummaryResult, roundingAmount, payServiceChargeAmount, hasSalesSummaryAmount, expectAmount, amountPaymentPatch, normalizedExpectAmountPatch, summaryForGap, summary;
3596
- return _regeneratorRuntime().wrap(function _callee13$(_context15) {
3597
- while (1) switch (_context15.prev = _context15.next) {
3547
+ return _regeneratorRuntime().wrap(function _callee13$(_context14) {
3548
+ while (1) switch (_context14.prev = _context14.next) {
3598
3549
  case 0:
3599
3550
  if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
3600
- _context15.next = 2;
3551
+ _context14.next = 2;
3601
3552
  break;
3602
3553
  }
3603
- return _context15.abrupt("return", null);
3554
+ return _context14.abrupt("return", null);
3604
3555
  case 2:
3605
3556
  tempOrder = options !== null && options !== void 0 && options.createIfMissing ? this.ensureTempOrder() : this.store.tempOrder;
3606
3557
  if (tempOrder) {
3607
- _context15.next = 5;
3558
+ _context14.next = 5;
3608
3559
  break;
3609
3560
  }
3610
- return _context15.abrupt("return", null);
3561
+ return _context14.abrupt("return", null);
3611
3562
  case 5:
3612
3563
  this.sanitizeTempOrderProducts(tempOrder);
3613
3564
  originalSnapshot = this.getOriginalSalesSnapshot(tempOrder);
@@ -3615,10 +3566,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3615
3566
  shouldReuseOriginalSnapshot = originalSnapshot && !hasShopDiscountChanged;
3616
3567
  snapshotSummary = shouldReuseOriginalSnapshot ? this.restoreOriginalSnapshotIfProductsUnchanged(tempOrder, originalSnapshot) : null;
3617
3568
  if (!snapshotSummary) {
3618
- _context15.next = 12;
3569
+ _context14.next = 12;
3619
3570
  break;
3620
3571
  }
3621
- return _context15.abrupt("return", snapshotSummary);
3572
+ return _context14.abrupt("return", snapshotSummary);
3622
3573
  case 12:
3623
3574
  shouldFullRecalculateFromSnapshot = Boolean(originalSnapshot);
3624
3575
  summaryProducts = shouldFullRecalculateFromSnapshot || options !== null && options !== void 0 && options.isCurrentOrder ? cloneDeep(tempOrder.products || []) : tempOrder.products;
@@ -3630,7 +3581,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3630
3581
  totalRefundAmount = existedSummary.total_refund_amount || '0.00';
3631
3582
  paidPaymentSummary = this.calculatePaidPaymentSummary(tempOrder.payments || []);
3632
3583
  if (salesSummary) {
3633
- _context15.next = 28;
3584
+ _context14.next = 28;
3634
3585
  break;
3635
3586
  }
3636
3587
  emptyBaseSummary = _objectSpread(_objectSpread(_objectSpread({}, createEmptySummary()), existedSummary), {}, {
@@ -3656,13 +3607,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3656
3607
  previousSummary: existedSummary,
3657
3608
  summary: emptySummary
3658
3609
  });
3659
- return _context15.abrupt("return", this.store.summary);
3610
+ return _context14.abrupt("return", this.store.summary);
3660
3611
  case 28:
3661
3612
  summaryMutationBaseline = options !== null && options !== void 0 && options.isCurrentOrder ? cloneDeep({
3662
3613
  tempOrder: tempOrder,
3663
3614
  summary: this.store.summary
3664
3615
  }) : null;
3665
- _context15.next = 31;
3616
+ _context14.next = 31;
3666
3617
  return salesSummary.getSummary(_objectSpread({
3667
3618
  products: summaryProducts,
3668
3619
  isPriceIncludeTax: tempOrder.is_price_include_tax,
@@ -3672,21 +3623,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3672
3623
  channel: this.otherParams.channel
3673
3624
  } : {}));
3674
3625
  case 31:
3675
- salesSummaryResult = _context15.sent;
3626
+ salesSummaryResult = _context14.sent;
3676
3627
  if (!(options !== null && options !== void 0 && options.isCurrentOrder && !options.isCurrentOrder())) {
3677
- _context15.next = 34;
3628
+ _context14.next = 34;
3678
3629
  break;
3679
3630
  }
3680
- return _context15.abrupt("return", null);
3631
+ return _context14.abrupt("return", null);
3681
3632
  case 34:
3682
3633
  if (!(options !== null && options !== void 0 && options.isCurrentOrder && !isEqual({
3683
3634
  tempOrder: tempOrder,
3684
3635
  summary: this.store.summary
3685
3636
  }, summaryMutationBaseline))) {
3686
- _context15.next = 36;
3637
+ _context14.next = 36;
3687
3638
  break;
3688
3639
  }
3689
- return _context15.abrupt("return", null);
3640
+ return _context14.abrupt("return", null);
3690
3641
  case 36:
3691
3642
  if (shouldFullRecalculateFromSnapshot || options !== null && options !== void 0 && options.isCurrentOrder) {
3692
3643
  tempOrder.products = summaryProducts;
@@ -3732,10 +3683,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3732
3683
  previousSummary: existedSummary,
3733
3684
  summary: summary
3734
3685
  });
3735
- return _context15.abrupt("return", this.store.summary);
3686
+ return _context14.abrupt("return", this.store.summary);
3736
3687
  case 53:
3737
3688
  case "end":
3738
- return _context15.stop();
3689
+ return _context14.stop();
3739
3690
  }
3740
3691
  }, _callee13, this);
3741
3692
  }));
@@ -3749,26 +3700,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3749
3700
  value: function () {
3750
3701
  var _getOrderSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
3751
3702
  var summary;
3752
- return _regeneratorRuntime().wrap(function _callee14$(_context16) {
3753
- while (1) switch (_context16.prev = _context16.next) {
3703
+ return _regeneratorRuntime().wrap(function _callee14$(_context15) {
3704
+ while (1) switch (_context15.prev = _context15.next) {
3754
3705
  case 0:
3755
- _context16.next = 2;
3706
+ _context15.next = 2;
3756
3707
  return this.recalculateSummary({
3757
3708
  createIfMissing: true
3758
3709
  });
3759
3710
  case 2:
3760
- summary = _context16.sent;
3711
+ summary = _context15.sent;
3761
3712
  if (summary) {
3762
- _context16.next = 5;
3713
+ _context15.next = 5;
3763
3714
  break;
3764
3715
  }
3765
- return _context16.abrupt("return", createEmptySummary());
3716
+ return _context15.abrupt("return", createEmptySummary());
3766
3717
  case 5:
3767
3718
  this.persistTempOrder();
3768
- return _context16.abrupt("return", summary);
3719
+ return _context15.abrupt("return", summary);
3769
3720
  case 7:
3770
3721
  case "end":
3771
- return _context16.stop();
3722
+ return _context15.stop();
3772
3723
  }
3773
3724
  }, _callee14, this);
3774
3725
  }));
@@ -3795,18 +3746,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3795
3746
  key: "syncTempOrderNoteToRemote",
3796
3747
  value: function () {
3797
3748
  var _syncTempOrderNoteToRemote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(orderId, note) {
3798
- return _regeneratorRuntime().wrap(function _callee15$(_context17) {
3799
- while (1) switch (_context17.prev = _context17.next) {
3749
+ return _regeneratorRuntime().wrap(function _callee15$(_context16) {
3750
+ while (1) switch (_context16.prev = _context16.next) {
3800
3751
  case 0:
3801
- _context17.next = 2;
3752
+ _context16.next = 2;
3802
3753
  return this.request.put("/order/order/".concat(orderId, "/note"), {
3803
3754
  note: note
3804
3755
  });
3805
3756
  case 2:
3806
- return _context17.abrupt("return", note);
3757
+ return _context16.abrupt("return", note);
3807
3758
  case 3:
3808
3759
  case "end":
3809
- return _context17.stop();
3760
+ return _context16.stop();
3810
3761
  }
3811
3762
  }, _callee15, this);
3812
3763
  }));
@@ -3871,7 +3822,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3871
3822
  }, {
3872
3823
  key: "removeSalesNotesForMissingProductLines",
3873
3824
  value: function removeSalesNotesForMissingProductLines(tempOrder) {
3874
- var _this23 = this;
3825
+ var _this22 = this;
3875
3826
  var state = this.ensureSalesNotesRuntimeState(tempOrder);
3876
3827
  if (!state.loaded || !Array.isArray(tempOrder.notes) || tempOrder.notes.length === 0) {
3877
3828
  return;
@@ -3883,7 +3834,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3883
3834
  return typeof uid === 'string' && uid.length > 0;
3884
3835
  }));
3885
3836
  var nextNotes = tempOrder.notes.filter(function (note) {
3886
- var primary = _this23.getSalesNotePrimaryRelation(note);
3837
+ var primary = _this22.getSalesNotePrimaryRelation(note);
3887
3838
  if (!primary || primary.target_type !== 'order_detail') return true;
3888
3839
  return remainingProductUids.has(primary.target_uuid);
3889
3840
  });
@@ -3895,7 +3846,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3895
3846
  key: "setSalesNoteOnTempOrder",
3896
3847
  value: function setSalesNoteOnTempOrder(tempOrder, input) {
3897
3848
  var _input$target,
3898
- _this24 = this,
3849
+ _this23 = this,
3899
3850
  _tempOrder$shop_order;
3900
3851
  this.ensureSalesNotesLoadedForMutation(tempOrder);
3901
3852
  var note_type = String(input.note_type || '').trim();
@@ -3919,7 +3870,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
3919
3870
  var notes = tempOrder.notes || [];
3920
3871
  // 当前 allergy policy 固定同一商品行只保留一条;业务调用方不参与去重规则。
3921
3872
  var existingIndex = policy.uniquePerPrimaryTarget ? notes.findIndex(function (note) {
3922
- var primary = _this24.getSalesNotePrimaryRelation(note);
3873
+ var primary = _this23.getSalesNotePrimaryRelation(note);
3923
3874
  return note.note_type === note_type && (primary === null || primary === void 0 ? void 0 : primary.target_type) === 'order_detail' && primary.target_uuid === target_uuid;
3924
3875
  }) : -1;
3925
3876
  var existing = existingIndex >= 0 ? notes[existingIndex] : null;
@@ -4013,16 +3964,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4013
3964
  value: function () {
4014
3965
  var _setSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(input) {
4015
3966
  var tempOrder, note;
4016
- return _regeneratorRuntime().wrap(function _callee16$(_context18) {
4017
- while (1) switch (_context18.prev = _context18.next) {
3967
+ return _regeneratorRuntime().wrap(function _callee16$(_context17) {
3968
+ while (1) switch (_context17.prev = _context17.next) {
4018
3969
  case 0:
4019
3970
  tempOrder = this.ensureTempOrder();
4020
3971
  note = this.setSalesNoteOnTempOrder(tempOrder, input);
4021
3972
  this.notifyTempOrderChanged();
4022
- return _context18.abrupt("return", cloneDeep(note));
3973
+ return _context17.abrupt("return", cloneDeep(note));
4023
3974
  case 4:
4024
3975
  case "end":
4025
- return _context18.stop();
3976
+ return _context17.stop();
4026
3977
  }
4027
3978
  }, _callee16, this);
4028
3979
  }));
@@ -4036,8 +3987,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4036
3987
  value: function () {
4037
3988
  var _removeSalesNote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(uuid) {
4038
3989
  var tempOrder, normalizedUuid, notes, nextNotes, state;
4039
- return _regeneratorRuntime().wrap(function _callee17$(_context19) {
4040
- while (1) switch (_context19.prev = _context19.next) {
3990
+ return _regeneratorRuntime().wrap(function _callee17$(_context18) {
3991
+ while (1) switch (_context18.prev = _context18.next) {
4041
3992
  case 0:
4042
3993
  tempOrder = this.ensureTempOrder();
4043
3994
  this.ensureSalesNotesLoadedForMutation(tempOrder);
@@ -4047,10 +3998,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4047
3998
  return note.uuid !== normalizedUuid;
4048
3999
  });
4049
4000
  if (!(nextNotes.length === notes.length)) {
4050
- _context19.next = 7;
4001
+ _context18.next = 7;
4051
4002
  break;
4052
4003
  }
4053
- return _context19.abrupt("return");
4004
+ return _context18.abrupt("return");
4054
4005
  case 7:
4055
4006
  tempOrder.notes = nextNotes;
4056
4007
  state = this.ensureSalesNotesRuntimeState(tempOrder);
@@ -4058,7 +4009,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4058
4009
  this.notifyTempOrderChanged();
4059
4010
  case 11:
4060
4011
  case "end":
4061
- return _context19.stop();
4012
+ return _context18.stop();
4062
4013
  }
4063
4014
  }, _callee17, this);
4064
4015
  }));
@@ -4072,8 +4023,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4072
4023
  value: function () {
4073
4024
  var _clearSalesNotes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
4074
4025
  var tempOrder, state;
4075
- return _regeneratorRuntime().wrap(function _callee18$(_context20) {
4076
- while (1) switch (_context20.prev = _context20.next) {
4026
+ return _regeneratorRuntime().wrap(function _callee18$(_context19) {
4027
+ while (1) switch (_context19.prev = _context19.next) {
4077
4028
  case 0:
4078
4029
  tempOrder = this.ensureTempOrder();
4079
4030
  tempOrder.notes = [];
@@ -4083,7 +4034,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4083
4034
  this.notifyTempOrderChanged();
4084
4035
  case 6:
4085
4036
  case "end":
4086
- return _context20.stop();
4037
+ return _context19.stop();
4087
4038
  }
4088
4039
  }, _callee18, this);
4089
4040
  }));
@@ -4238,15 +4189,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4238
4189
  }, {
4239
4190
  key: "productHasCustomerBoundDiscount",
4240
4191
  value: function productHasCustomerBoundDiscount(product) {
4241
- var _this25 = this;
4192
+ var _this24 = this;
4242
4193
  if (((product === null || product === void 0 ? void 0 : product.discount_list) || []).some(function (discount) {
4243
- return _this25.isCustomerBoundDiscount(discount);
4194
+ return _this24.isCustomerBoundDiscount(discount);
4244
4195
  })) {
4245
4196
  return true;
4246
4197
  }
4247
4198
  return ((product === null || product === void 0 ? void 0 : product.product_bundle) || []).some(function (bundle) {
4248
4199
  return ((bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || []).some(function (discount) {
4249
- return _this25.isCustomerBoundDiscount(discount);
4200
+ return _this24.isCustomerBoundDiscount(discount);
4250
4201
  });
4251
4202
  });
4252
4203
  }
@@ -4255,18 +4206,18 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4255
4206
  value: function shouldSkipDiscountCalculation(tempOrder) {
4256
4207
  var _this$store$discount20,
4257
4208
  _this$store$discount21,
4258
- _this26 = this;
4209
+ _this25 = this;
4259
4210
  if (this.hasActiveCustomerBoundDiscount) return false;
4260
4211
  var discountList = ((_this$store$discount20 = this.store.discount) === null || _this$store$discount20 === void 0 || (_this$store$discount21 = _this$store$discount20.getDiscountList) === null || _this$store$discount21 === void 0 ? void 0 : _this$store$discount21.call(_this$store$discount20)) || [];
4261
4212
  if (discountList.length > 0) return false;
4262
4213
  return !(tempOrder.products || []).some(function (product) {
4263
- return _this26.productHasCustomerBoundDiscount(product);
4214
+ return _this25.productHasCustomerBoundDiscount(product);
4264
4215
  });
4265
4216
  }
4266
4217
  }, {
4267
4218
  key: "clearCustomerBoundDiscounts",
4268
4219
  value: function clearCustomerBoundDiscounts(tempOrder) {
4269
- var _this27 = this,
4220
+ var _this26 = this,
4270
4221
  _discountModule$getDi,
4271
4222
  _discountModule$getOr,
4272
4223
  _discountModule$setDi,
@@ -4275,7 +4226,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4275
4226
  var filterDiscountList = function filterDiscountList(discountList) {
4276
4227
  if (!Array.isArray(discountList)) return [];
4277
4228
  return discountList.filter(function (discount) {
4278
- var shouldRemove = _this27.isCustomerBoundDiscount(discount);
4229
+ var shouldRemove = _this26.isCustomerBoundDiscount(discount);
4279
4230
  if (shouldRemove) didRemoveCustomerBoundDiscount = true;
4280
4231
  return !shouldRemove;
4281
4232
  });
@@ -4302,12 +4253,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4302
4253
  var currentDiscounts = ((_discountModule$getDi = discountModule.getDiscountList) === null || _discountModule$getDi === void 0 ? void 0 : _discountModule$getDi.call(discountModule)) || [];
4303
4254
  var currentOriginalDiscounts = ((_discountModule$getOr = discountModule.getOriginalDiscountList) === null || _discountModule$getOr === void 0 ? void 0 : _discountModule$getOr.call(discountModule)) || [];
4304
4255
  var nextDiscounts = currentDiscounts.filter(function (discount) {
4305
- if (_this27.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
4306
- return !_this27.isCustomerBoundDiscount(discount);
4256
+ if (_this26.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
4257
+ return !_this26.isCustomerBoundDiscount(discount);
4307
4258
  });
4308
4259
  var nextOriginalDiscounts = currentOriginalDiscounts.filter(function (discount) {
4309
- if (_this27.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
4310
- return !_this27.isCustomerBoundDiscount(discount);
4260
+ if (_this26.shouldKeepCustomerBoundDiscountAfterCustomerChange(discount)) return true;
4261
+ return !_this26.isCustomerBoundDiscount(discount);
4311
4262
  });
4312
4263
  void ((_discountModule$setDi = discountModule.setDiscountList) === null || _discountModule$setDi === void 0 ? void 0 : _discountModule$setDi.call(discountModule, nextDiscounts));
4313
4264
  void ((_discountModule$setOr = discountModule.setOriginalDiscountList) === null || _discountModule$setOr === void 0 ? void 0 : _discountModule$setOr.call(discountModule, nextOriginalDiscounts));
@@ -4474,10 +4425,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4474
4425
  }, {
4475
4426
  key: "setOrderPayments",
4476
4427
  value: function setOrderPayments(payments) {
4477
- var _this28 = this;
4428
+ var _this27 = this;
4478
4429
  var tempOrder = this.ensureTempOrder();
4479
4430
  tempOrder.payments = mapPaymentItemsToOrderPayments((payments || []).map(function (payment) {
4480
- return _this28.normalizePaymentSource(payment, {
4431
+ return _this27.normalizePaymentSource(payment, {
4481
4432
  defaultPaid: false
4482
4433
  });
4483
4434
  }));
@@ -4499,28 +4450,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4499
4450
  value: (function () {
4500
4451
  var _addOrderPaymentAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(payment) {
4501
4452
  var hasPaymentNumber, devicePrefix;
4502
- return _regeneratorRuntime().wrap(function _callee19$(_context21) {
4503
- while (1) switch (_context21.prev = _context21.next) {
4453
+ return _regeneratorRuntime().wrap(function _callee19$(_context20) {
4454
+ while (1) switch (_context20.prev = _context20.next) {
4504
4455
  case 0:
4505
4456
  hasPaymentNumber = String(payment.payment_number || '').trim() !== '';
4506
4457
  if (!hasPaymentNumber) {
4507
- _context21.next = 5;
4458
+ _context20.next = 5;
4508
4459
  break;
4509
4460
  }
4510
- _context21.t0 = 'LOCAL';
4511
- _context21.next = 8;
4461
+ _context20.t0 = 'LOCAL';
4462
+ _context20.next = 8;
4512
4463
  break;
4513
4464
  case 5:
4514
- _context21.next = 7;
4465
+ _context20.next = 7;
4515
4466
  return this.getPaymentNumberDevicePrefixAsync();
4516
4467
  case 7:
4517
- _context21.t0 = _context21.sent;
4468
+ _context20.t0 = _context20.sent;
4518
4469
  case 8:
4519
- devicePrefix = _context21.t0;
4520
- return _context21.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4470
+ devicePrefix = _context20.t0;
4471
+ return _context20.abrupt("return", this.addOrderPaymentWithDevicePrefix(payment, devicePrefix));
4521
4472
  case 10:
4522
4473
  case "end":
4523
- return _context21.stop();
4474
+ return _context20.stop();
4524
4475
  }
4525
4476
  }, _callee19, this);
4526
4477
  }));
@@ -4532,7 +4483,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4532
4483
  }, {
4533
4484
  key: "addOrderPaymentWithDevicePrefix",
4534
4485
  value: function addOrderPaymentWithDevicePrefix(payment, devicePrefix) {
4535
- var _this29 = this;
4486
+ var _this28 = this;
4536
4487
  this.logInfo('addOrderPayment', {
4537
4488
  payment: payment
4538
4489
  });
@@ -4550,7 +4501,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4550
4501
  void this.recalculateSummary({
4551
4502
  createIfMissing: true
4552
4503
  }).catch(function (error) {
4553
- _this29.logError('recalculate summary after addOrderPayment failed', {
4504
+ _this28.logError('recalculate summary after addOrderPayment failed', {
4554
4505
  error: error instanceof Error ? error.message : String(error)
4555
4506
  });
4556
4507
  });
@@ -4575,17 +4526,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4575
4526
  updatedPayment,
4576
4527
  summary,
4577
4528
  payments,
4578
- _args22 = arguments;
4579
- return _regeneratorRuntime().wrap(function _callee20$(_context22) {
4580
- while (1) switch (_context22.prev = _context22.next) {
4529
+ _args21 = arguments;
4530
+ return _regeneratorRuntime().wrap(function _callee20$(_context21) {
4531
+ while (1) switch (_context21.prev = _context21.next) {
4581
4532
  case 0:
4582
- options = _args22.length > 2 && _args22[2] !== undefined ? _args22[2] : {};
4533
+ options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
4583
4534
  tempOrder = this.ensureTempOrder();
4584
4535
  identity = String(paymentIdentity);
4585
4536
  matchMode = options.matchBy === 'compat' || options.matchBy === 'legacy' ? 'compat' : 'payment_number';
4586
4537
  matchedPayment = resolveOrderPaymentIdentity(tempOrder.payments || [], identity, matchMode);
4587
4538
  if (matchedPayment) {
4588
- _context22.next = 8;
4539
+ _context21.next = 8;
4589
4540
  break;
4590
4541
  }
4591
4542
  try {
@@ -4614,15 +4565,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4614
4565
  return nextPayment;
4615
4566
  });
4616
4567
  this.persistTempOrder();
4617
- _context22.next = 13;
4568
+ _context21.next = 13;
4618
4569
  return this.recalculateSummary({
4619
4570
  createIfMissing: true
4620
4571
  });
4621
4572
  case 13:
4622
- summary = _context22.sent;
4573
+ summary = _context21.sent;
4623
4574
  this.persistTempOrder();
4624
4575
  payments = tempOrder.payments;
4625
- return _context22.abrupt("return", {
4576
+ return _context21.abrupt("return", {
4626
4577
  updated: true,
4627
4578
  payment: payments[matchedPayment.index] || updatedPayment,
4628
4579
  payments: payments,
@@ -4630,7 +4581,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4630
4581
  });
4631
4582
  case 17:
4632
4583
  case "end":
4633
- return _context22.stop();
4584
+ return _context21.stop();
4634
4585
  }
4635
4586
  }, _callee20, this);
4636
4587
  }));
@@ -4679,7 +4630,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4679
4630
  }, {
4680
4631
  key: "applyPaymentLifecycleChange",
4681
4632
  value: function applyPaymentLifecycleChange(tempOrder, options) {
4682
- var _this30 = this;
4633
+ var _this29 = this;
4683
4634
  this.updateTempOrderPaymentStatus(tempOrder);
4684
4635
  if ((options === null || options === void 0 ? void 0 : options.persist) !== false) {
4685
4636
  this.persistTempOrder();
@@ -4689,7 +4640,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4689
4640
  void this.recalculateSummary({
4690
4641
  createIfMissing: true
4691
4642
  }).catch(function (error) {
4692
- _this30.logError("recalculate summary after ".concat(logContext, " failed"), {
4643
+ _this29.logError("recalculate summary after ".concat(logContext, " failed"), {
4693
4644
  error: error instanceof Error ? error.message : String(error)
4694
4645
  });
4695
4646
  });
@@ -4733,7 +4684,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4733
4684
  }, {
4734
4685
  key: "updateVoucherOrderPayments",
4735
4686
  value: function updateVoucherOrderPayments(payments, options) {
4736
- var _this31 = this;
4687
+ var _this30 = this;
4737
4688
  var tempOrder = this.ensureTempOrder();
4738
4689
  var isOrderPaymentType = function isOrderPaymentType(value) {
4739
4690
  return value === 'normal' || value === 'deposit';
@@ -4768,7 +4719,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4768
4719
  });
4769
4720
  };
4770
4721
  var mappedVouchers = mapPaymentItemsToOrderPayments(payments.map(function (payment) {
4771
- return _this31.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
4722
+ return _this30.normalizePaymentSource(normalizeVoucherPaymentStatus(withVoucherPaymentType(payment)), {
4772
4723
  defaultPaid: false,
4773
4724
  devicePrefix: options === null || options === void 0 ? void 0 : options.devicePrefix
4774
4725
  });
@@ -4821,7 +4772,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4821
4772
  void this.recalculateSummary({
4822
4773
  createIfMissing: true
4823
4774
  }).catch(function (error) {
4824
- _this31.logError('recalculate summary after updateVoucherOrderPayments failed', {
4775
+ _this30.logError('recalculate summary after updateVoucherOrderPayments failed', {
4825
4776
  error: error instanceof Error ? error.message : String(error)
4826
4777
  });
4827
4778
  });
@@ -4832,32 +4783,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4832
4783
  value: function () {
4833
4784
  var _updateVoucherOrderPaymentsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(payments, options) {
4834
4785
  var needsPaymentNumber, devicePrefix;
4835
- return _regeneratorRuntime().wrap(function _callee21$(_context23) {
4836
- while (1) switch (_context23.prev = _context23.next) {
4786
+ return _regeneratorRuntime().wrap(function _callee21$(_context22) {
4787
+ while (1) switch (_context22.prev = _context22.next) {
4837
4788
  case 0:
4838
4789
  needsPaymentNumber = (payments || []).some(function (payment) {
4839
4790
  return String(payment.payment_number || '').trim() === '';
4840
4791
  });
4841
4792
  if (!needsPaymentNumber) {
4842
- _context23.next = 7;
4793
+ _context22.next = 7;
4843
4794
  break;
4844
4795
  }
4845
- _context23.next = 4;
4796
+ _context22.next = 4;
4846
4797
  return this.getPaymentNumberDevicePrefixAsync();
4847
4798
  case 4:
4848
- _context23.t0 = _context23.sent;
4849
- _context23.next = 8;
4799
+ _context22.t0 = _context22.sent;
4800
+ _context22.next = 8;
4850
4801
  break;
4851
4802
  case 7:
4852
- _context23.t0 = 'LOCAL';
4803
+ _context22.t0 = 'LOCAL';
4853
4804
  case 8:
4854
- devicePrefix = _context23.t0;
4855
- return _context23.abrupt("return", this.updateVoucherOrderPayments(payments, _objectSpread(_objectSpread({}, options), {}, {
4805
+ devicePrefix = _context22.t0;
4806
+ return _context22.abrupt("return", this.updateVoucherOrderPayments(payments, _objectSpread(_objectSpread({}, options), {}, {
4856
4807
  devicePrefix: devicePrefix
4857
4808
  })));
4858
4809
  case 10:
4859
4810
  case "end":
4860
- return _context23.stop();
4811
+ return _context22.stop();
4861
4812
  }
4862
4813
  }, _callee21, this);
4863
4814
  }));
@@ -4879,7 +4830,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4879
4830
  key: "shouldMergeProductToOrder",
4880
4831
  value: function shouldMergeProductToOrder(params) {
4881
4832
  var _this$orderHooks3,
4882
- _this32 = this;
4833
+ _this31 = this;
4883
4834
  var onBeforeMergeProductToOrder = (_this$orderHooks3 = this.orderHooks) === null || _this$orderHooks3 === void 0 ? void 0 : _this$orderHooks3.onBeforeMergeProductToOrder;
4884
4835
  if (!onBeforeMergeProductToOrder) return true;
4885
4836
  var result = onBeforeMergeProductToOrder(_objectSpread(_objectSpread({}, params), {}, {
@@ -4887,7 +4838,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
4887
4838
  }));
4888
4839
  if (result && _typeof(result) === 'object' && typeof result.then === 'function') {
4889
4840
  return Promise.resolve(result).then(function (resolved) {
4890
- return _this32.normalizeShouldMergeProductResult(resolved);
4841
+ return _this31.normalizeShouldMergeProductResult(resolved);
4891
4842
  });
4892
4843
  }
4893
4844
  return this.normalizeShouldMergeProductResult(result);
@@ -5018,77 +4969,77 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5018
4969
  value: function () {
5019
4970
  var _finalizeProductOrderMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(tempOrder, options) {
5020
4971
  var isCurrentOrder, isVirtualSettlement, promotionPayload, summary;
5021
- return _regeneratorRuntime().wrap(function _callee22$(_context24) {
5022
- while (1) switch (_context24.prev = _context24.next) {
4972
+ return _regeneratorRuntime().wrap(function _callee22$(_context23) {
4973
+ while (1) switch (_context23.prev = _context23.next) {
5023
4974
  case 0:
5024
4975
  isCurrentOrder = options === null || options === void 0 ? void 0 : options.isCurrentOrder;
5025
4976
  if (!(isCurrentOrder && !isCurrentOrder())) {
5026
- _context24.next = 3;
4977
+ _context23.next = 3;
5027
4978
  break;
5028
4979
  }
5029
- return _context24.abrupt("return");
4980
+ return _context23.abrupt("return");
5030
4981
  case 3:
5031
4982
  this.syncTempOrderHolderFromBookings(tempOrder);
5032
4983
  this.prepareVirtualSettlementTempOrder(tempOrder);
5033
4984
  isVirtualSettlement = this.isActiveVirtualSettlementOrder(tempOrder);
5034
4985
  if (!(!(options !== null && options !== void 0 && options.skipEditDiscountConfigRefresh) && !isVirtualSettlement)) {
5035
- _context24.next = 9;
4986
+ _context23.next = 9;
5036
4987
  break;
5037
4988
  }
5038
- _context24.next = 9;
4989
+ _context23.next = 9;
5039
4990
  return this.ensureEditDiscountConfigForProductChange(tempOrder);
5040
4991
  case 9:
5041
4992
  if (!(isCurrentOrder && !isCurrentOrder())) {
5042
- _context24.next = 11;
4993
+ _context23.next = 11;
5043
4994
  break;
5044
4995
  }
5045
- return _context24.abrupt("return");
4996
+ return _context23.abrupt("return");
5046
4997
  case 11:
5047
4998
  if (!(!(options !== null && options !== void 0 && options.skipDiscountRecalculation) && !isVirtualSettlement)) {
5048
- _context24.next = 17;
4999
+ _context23.next = 17;
5049
5000
  break;
5050
5001
  }
5051
- _context24.next = 14;
5002
+ _context23.next = 14;
5052
5003
  return this.evaluatePromotion(isCurrentOrder ? {
5053
5004
  isCurrentOrder: isCurrentOrder
5054
5005
  } : undefined);
5055
5006
  case 14:
5056
- _context24.t0 = _context24.sent;
5057
- _context24.next = 18;
5007
+ _context23.t0 = _context23.sent;
5008
+ _context23.next = 18;
5058
5009
  break;
5059
5010
  case 17:
5060
- _context24.t0 = null;
5011
+ _context23.t0 = null;
5061
5012
  case 18:
5062
- promotionPayload = _context24.t0;
5013
+ promotionPayload = _context23.t0;
5063
5014
  if (!(isCurrentOrder && !isCurrentOrder())) {
5064
- _context24.next = 21;
5015
+ _context23.next = 21;
5065
5016
  break;
5066
5017
  }
5067
- return _context24.abrupt("return");
5018
+ return _context23.abrupt("return");
5068
5019
  case 21:
5069
5020
  if (!(options !== null && options !== void 0 && options.skipDiscountRecalculation) && !isVirtualSettlement) {
5070
5021
  this.applyDiscount();
5071
5022
  }
5072
5023
  this.sanitizeTempOrderProducts(tempOrder);
5073
- _context24.next = 25;
5024
+ _context23.next = 25;
5074
5025
  return this.recalculateSummary(_objectSpread({
5075
5026
  createIfMissing: true
5076
5027
  }, isCurrentOrder ? {
5077
5028
  isCurrentOrder: isCurrentOrder
5078
5029
  } : {}));
5079
5030
  case 25:
5080
- summary = _context24.sent;
5031
+ summary = _context23.sent;
5081
5032
  if (!(isCurrentOrder && (!isCurrentOrder() || !summary))) {
5082
- _context24.next = 28;
5033
+ _context23.next = 28;
5083
5034
  break;
5084
5035
  }
5085
- return _context24.abrupt("return");
5036
+ return _context23.abrupt("return");
5086
5037
  case 28:
5087
5038
  this.persistTempOrder();
5088
5039
  this.emitPromotionApplied(promotionPayload);
5089
5040
  case 30:
5090
5041
  case "end":
5091
- return _context24.stop();
5042
+ return _context23.stop();
5092
5043
  }
5093
5044
  }, _callee22, this);
5094
5045
  }));
@@ -5119,7 +5070,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5119
5070
  _productToAdd$_extend,
5120
5071
  _productToAdd$metadat,
5121
5072
  _origin,
5122
- _this33 = this;
5073
+ _this32 = this;
5123
5074
  var linked = booking ? this.createLinkedProductAndBooking({
5124
5075
  product: product,
5125
5076
  booking: booking
@@ -5157,27 +5108,27 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5157
5108
  var shouldForceNewLine = disableMerge || !!booking || hasIncomingGoodPass || isIncomingPersistedEntitlementPass || hasIncomingBookingUid || hasIncomingHolder || isIncomingCustomItem || isWeighingProduct;
5158
5109
  var matchedIndex = shouldForceNewLine ? -1 : tempOrder.products.findIndex(function (item) {
5159
5110
  var _item$metadata4;
5160
- if (_this33.hasGoodPassDiscount(item)) return false;
5111
+ if (_this32.hasGoodPassDiscount(item)) return false;
5161
5112
  if (getProductHolderRelations(tempOrder, item).length > 0 || hasAssignedHolderId((_item$metadata4 = item.metadata) === null || _item$metadata4 === void 0 ? void 0 : _item$metadata4.holder_id)) return false;
5162
- var isRuntimeEntitlementPass = _this33.isRuntimeEntitlementAppend(item, tempOrder);
5113
+ var isRuntimeEntitlementPass = _this32.isRuntimeEntitlementAppend(item, tempOrder);
5163
5114
  if (isIncomingEntitlementAppend !== isRuntimeEntitlementPass) {
5164
5115
  return false;
5165
5116
  }
5166
- if (isIncomingEntitlementAppend && _this33.isPersistedProductLine(item)) {
5117
+ if (isIncomingEntitlementAppend && _this32.isPersistedProductLine(item)) {
5167
5118
  return false;
5168
5119
  }
5169
- var hasExistingProductNote = _this33.hasOrderProductLineNote(item);
5120
+ var hasExistingProductNote = _this32.hasOrderProductLineNote(item);
5170
5121
  if ((hasIncomingProductNote || hasExistingProductNote) && (!isRuntimeEntitlementPass || String(normalizedIncoming.note || '').trim() !== String(item.note || '').trim())) {
5171
5122
  return false;
5172
5123
  }
5173
5124
  var hasExistingManualProductDiscount = isManualProductDiscountProduct(item);
5174
- if (isRuntimeEntitlementPass && !_this33.hasSameEntitlementMergePriceConfig(normalizedIncoming, item)) {
5125
+ if (isRuntimeEntitlementPass && !_this32.hasSameEntitlementMergePriceConfig(normalizedIncoming, item)) {
5175
5126
  return false;
5176
5127
  }
5177
5128
  if ((hasIncomingManualProductDiscount || hasExistingManualProductDiscount) && !isRuntimeEntitlementPass) {
5178
5129
  return false;
5179
5130
  }
5180
- if (_this33.isPersistedProductLine(item)) return false;
5131
+ if (_this32.isPersistedProductLine(item)) return false;
5181
5132
  if (item.product_id !== productToAdd.product_id) return false;
5182
5133
  if (item.product_variant_id !== productToAdd.product_variant_id) return false;
5183
5134
  var existedFingerprint = buildProductLineFingerprint(getProductSkuOptions(item), item.product_bundle);
@@ -5188,10 +5139,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5188
5139
  var commitProductLine = function commitProductLine(shouldMerge) {
5189
5140
  var _options$beforeCommit;
5190
5141
  options === null || options === void 0 || (_options$beforeCommit = options.beforeCommit) === null || _options$beforeCommit === void 0 || _options$beforeCommit.call(options);
5191
- _this33.assertAndLockProductSettlement(tempOrder, productToAdd);
5142
+ _this32.assertAndLockProductSettlement(tempOrder, productToAdd);
5192
5143
  var committedProduct;
5193
5144
  if (matchedIndex === -1 || !matchedProduct || !shouldMerge) {
5194
- _this33.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
5145
+ _this32.captureProductRuntime(tempOrder, productToAdd, normalizedIncoming);
5195
5146
  if (linked) {
5196
5147
  normalizedIncoming.booking_uid = linked.bookingUid;
5197
5148
  normalizedIncoming.metadata = _objectSpread(_objectSpread({}, normalizedIncoming.metadata || {}), {}, {
@@ -5209,7 +5160,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5209
5160
  var _targetProduct$metada;
5210
5161
  var targetProduct = matchedProduct;
5211
5162
  var targetUid = (_targetProduct$metada = targetProduct.metadata) === null || _targetProduct$metada === void 0 ? void 0 : _targetProduct$metada.unique_identification_number;
5212
- var normalizedProduct = _this33.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
5163
+ var normalizedProduct = _this32.normalizeVirtualSettlementProductIfEnabled(mergeOrderProductDisplayFields(targetProduct, normalizeOrderProduct(_objectSpread(_objectSpread({}, productToAdd), {}, {
5213
5164
  metadata: _objectSpread(_objectSpread({}, productToAdd.metadata || {}), {}, {
5214
5165
  unique_identification_number: targetUid
5215
5166
  })
@@ -5232,7 +5183,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5232
5183
  order_detail_id: targetProduct.order_detail_id,
5233
5184
  num: nextNum
5234
5185
  });
5235
- _this33.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
5186
+ _this32.captureProductRuntime(tempOrder, productToAdd, tempOrder.products[matchedIndex], targetUid);
5236
5187
  committedProduct = tempOrder.products[matchedIndex];
5237
5188
  if (matchedIndex !== tempOrder.products.length - 1) {
5238
5189
  var mergedProduct = tempOrder.products[matchedIndex];
@@ -5343,10 +5294,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5343
5294
  key: "addProductToOrder",
5344
5295
  value: (function () {
5345
5296
  var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(product, booking, options) {
5346
- var _this34 = this;
5297
+ var _this33 = this;
5347
5298
  var availabilityCommitGuard, liveTempOrder, beforeCommit, tempOrder, guardedMutationFields, readGuardedMutationFields, guardedMutationBaseline, salesNoteDrafts, mutationSnapshot, attachSalesNoteDrafts, rollbackProductAndNotesMutation, insertAfterProductUid, anchorIndex, insertAtIndex, _ref71, _productRecord$num, productRecord, splitCount, i, splitLine, committedProduct, _committedProduct, _committedProduct2, committedIdentity, isCurrentOrder;
5348
- return _regeneratorRuntime().wrap(function _callee23$(_context25) {
5349
- while (1) switch (_context25.prev = _context25.next) {
5299
+ return _regeneratorRuntime().wrap(function _callee23$(_context24) {
5300
+ while (1) switch (_context24.prev = _context24.next) {
5350
5301
  case 0:
5351
5302
  availabilityCommitGuard = options === null || options === void 0 ? void 0 : options.availabilityCommitGuard;
5352
5303
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
@@ -5385,7 +5336,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5385
5336
  throw new Error('[Order Notes] 商品行缺少 unique_identification_number');
5386
5337
  }
5387
5338
  salesNoteDrafts.forEach(function (draft) {
5388
- _this34.setSalesNoteOnTempOrder(tempOrder, {
5339
+ _this33.setSalesNoteOnTempOrder(tempOrder, {
5389
5340
  note_type: draft.note_type,
5390
5341
  target: {
5391
5342
  target_type: 'order_detail',
@@ -5410,21 +5361,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5410
5361
  return uid !== undefined && uid !== null && String(uid) === String(insertAfterProductUid);
5411
5362
  }) : -1;
5412
5363
  insertAtIndex = options !== null && options !== void 0 && options.insertAtStart ? 0 : anchorIndex >= 0 ? anchorIndex + 1 : undefined;
5413
- _context25.prev = 15;
5364
+ _context24.prev = 15;
5414
5365
  if (!booking) {
5415
- _context25.next = 42;
5366
+ _context24.next = 42;
5416
5367
  break;
5417
5368
  }
5418
5369
  productRecord = product;
5419
5370
  splitCount = getSafeProductNum((_ref71 = (_productRecord$num = productRecord.num) !== null && _productRecord$num !== void 0 ? _productRecord$num : productRecord.product_quantity) !== null && _ref71 !== void 0 ? _ref71 : 1);
5420
5371
  if (!(splitCount > 1)) {
5421
- _context25.next = 35;
5372
+ _context24.next = 35;
5422
5373
  break;
5423
5374
  }
5424
5375
  i = 0;
5425
5376
  case 21:
5426
5377
  if (!(i < splitCount)) {
5427
- _context25.next = 33;
5378
+ _context24.next = 33;
5428
5379
  break;
5429
5380
  }
5430
5381
  splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
@@ -5442,52 +5393,52 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5442
5393
  delete splitLine.booking.metadata.unique_identification_number;
5443
5394
  }
5444
5395
  }
5445
- _context25.next = 26;
5396
+ _context24.next = 26;
5446
5397
  return this.appendProductLineToTempOrder(tempOrder, splitLine.product, splitLine.booking, {
5447
5398
  insertAtIndex: insertAtIndex,
5448
5399
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
5449
5400
  beforeCommit: beforeCommit
5450
5401
  });
5451
5402
  case 26:
5452
- committedProduct = _context25.sent;
5403
+ committedProduct = _context24.sent;
5453
5404
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
5454
5405
  attachSalesNoteDrafts(committedProduct);
5455
5406
  if (insertAtIndex !== undefined) insertAtIndex += 1;
5456
5407
  case 30:
5457
5408
  i += 1;
5458
- _context25.next = 21;
5409
+ _context24.next = 21;
5459
5410
  break;
5460
5411
  case 33:
5461
- _context25.next = 40;
5412
+ _context24.next = 40;
5462
5413
  break;
5463
5414
  case 35:
5464
- _context25.next = 37;
5415
+ _context24.next = 37;
5465
5416
  return this.appendProductLineToTempOrder(tempOrder, product, cloneDeep(booking), {
5466
5417
  insertAtIndex: insertAtIndex,
5467
5418
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
5468
5419
  beforeCommit: beforeCommit
5469
5420
  });
5470
5421
  case 37:
5471
- _committedProduct = _context25.sent;
5422
+ _committedProduct = _context24.sent;
5472
5423
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
5473
5424
  attachSalesNoteDrafts(_committedProduct);
5474
5425
  case 40:
5475
- _context25.next = 47;
5426
+ _context24.next = 47;
5476
5427
  break;
5477
5428
  case 42:
5478
- _context25.next = 44;
5429
+ _context24.next = 44;
5479
5430
  return this.appendProductLineToTempOrder(tempOrder, product, undefined, {
5480
5431
  insertAtIndex: insertAtIndex,
5481
5432
  disableMerge: options === null || options === void 0 ? void 0 : options.disableMerge,
5482
5433
  beforeCommit: beforeCommit
5483
5434
  });
5484
5435
  case 44:
5485
- _committedProduct2 = _context25.sent;
5436
+ _committedProduct2 = _context24.sent;
5486
5437
  availabilityCommitGuard === null || availabilityCommitGuard === void 0 || availabilityCommitGuard();
5487
5438
  attachSalesNoteDrafts(_committedProduct2);
5488
5439
  case 47:
5489
5440
  if (!availabilityCommitGuard) {
5490
- _context25.next = 53;
5441
+ _context24.next = 53;
5491
5442
  break;
5492
5443
  }
5493
5444
  availabilityCommitGuard();
@@ -5495,7 +5446,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5495
5446
  // 调用方的结构 revision 可能不包括备注、价格或结算元数据。
5496
5447
  // 本次会覆盖的字段也要保持原值,不能让草稿覆盖并发编辑。
5497
5448
  if (isEqual(readGuardedMutationFields(liveTempOrder), guardedMutationBaseline)) {
5498
- _context25.next = 52;
5449
+ _context24.next = 52;
5499
5450
  break;
5500
5451
  }
5501
5452
  throw Object.assign(new Error('预约加购期间订单已变化,请重新选择'), {
@@ -5506,57 +5457,57 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5506
5457
  // 字段;其余订单字段继续使用 live 对象,外部持有的订单引用也不变。
5507
5458
  Object.assign(liveTempOrder, readGuardedMutationFields(tempOrder));
5508
5459
  case 53:
5509
- _context25.next = 59;
5460
+ _context24.next = 59;
5510
5461
  break;
5511
5462
  case 55:
5512
- _context25.prev = 55;
5513
- _context25.t0 = _context25["catch"](15);
5463
+ _context24.prev = 55;
5464
+ _context24.t0 = _context24["catch"](15);
5514
5465
  rollbackProductAndNotesMutation();
5515
- throw _context25.t0;
5466
+ throw _context24.t0;
5516
5467
  case 59:
5517
5468
  if (!availabilityCommitGuard) {
5518
- _context25.next = 73;
5469
+ _context24.next = 73;
5519
5470
  break;
5520
5471
  }
5521
5472
  committedIdentity = [liveTempOrder.order_id, liveTempOrder.external_sale_number];
5522
5473
  isCurrentOrder = function isCurrentOrder() {
5523
5474
  var _options$availability, _options$availability2;
5524
- return _this34.store.tempOrder === liveTempOrder && liveTempOrder.order_id === committedIdentity[0] && liveTempOrder.external_sale_number === committedIdentity[1] && ((_options$availability = options === null || options === void 0 || (_options$availability2 = options.availabilityCommitTargetGuard) === null || _options$availability2 === void 0 ? void 0 : _options$availability2.call(options)) !== null && _options$availability !== void 0 ? _options$availability : true);
5475
+ return _this33.store.tempOrder === liveTempOrder && liveTempOrder.order_id === committedIdentity[0] && liveTempOrder.external_sale_number === committedIdentity[1] && ((_options$availability = options === null || options === void 0 || (_options$availability2 = options.availabilityCommitTargetGuard) === null || _options$availability2 === void 0 ? void 0 : _options$availability2.call(options)) !== null && _options$availability !== void 0 ? _options$availability : true);
5525
5476
  };
5526
- _context25.prev = 62;
5477
+ _context24.prev = 62;
5527
5478
  // 新增已发布,即使后续报价/促销收尾失败,也不能向调用方报告未加购。
5528
5479
  // 先保存已提交行;异步结果只允许写回仍属于本次提交的订单。
5529
5480
  if (isCurrentOrder()) this.persistTempOrder();
5530
- _context25.next = 66;
5481
+ _context24.next = 66;
5531
5482
  return this.finalizeProductOrderMutation(liveTempOrder, {
5532
5483
  isCurrentOrder: isCurrentOrder
5533
5484
  });
5534
5485
  case 66:
5535
- _context25.next = 71;
5486
+ _context24.next = 71;
5536
5487
  break;
5537
5488
  case 68:
5538
- _context25.prev = 68;
5539
- _context25.t1 = _context25["catch"](62);
5489
+ _context24.prev = 68;
5490
+ _context24.t1 = _context24["catch"](62);
5540
5491
  this.logWarning('addProductToOrder committed; finalization failed', {
5541
5492
  product_id: product.product_id,
5542
5493
  committed: true,
5543
- error: _context25.t1 instanceof Error ? _context25.t1.message : String(_context25.t1)
5494
+ error: _context24.t1 instanceof Error ? _context24.t1.message : String(_context24.t1)
5544
5495
  });
5545
5496
  case 71:
5546
- _context25.next = 75;
5497
+ _context24.next = 75;
5547
5498
  break;
5548
5499
  case 73:
5549
- _context25.next = 75;
5500
+ _context24.next = 75;
5550
5501
  return this.finalizeProductOrderMutation(liveTempOrder);
5551
5502
  case 75:
5552
5503
  this.logInfo('addProductToOrder success', {
5553
5504
  product_id: product.product_id,
5554
5505
  with_booking: !!booking
5555
5506
  });
5556
- return _context25.abrupt("return", liveTempOrder.products);
5507
+ return _context24.abrupt("return", liveTempOrder.products);
5557
5508
  case 77:
5558
5509
  case "end":
5559
- return _context25.stop();
5510
+ return _context24.stop();
5560
5511
  }
5561
5512
  }, _callee23, this, [[15, 55], [62, 68]]);
5562
5513
  }));
@@ -5580,47 +5531,47 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5580
5531
  value: (function () {
5581
5532
  var _addProductsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(items, options) {
5582
5533
  var tempOrder, beforeCommit, _iterator20, _step20, item, product, booking, _ref72, _productRecord$num2, productRecord, splitCount, i, splitLine, _appendResult, appendResult;
5583
- return _regeneratorRuntime().wrap(function _callee24$(_context26) {
5584
- while (1) switch (_context26.prev = _context26.next) {
5534
+ return _regeneratorRuntime().wrap(function _callee24$(_context25) {
5535
+ while (1) switch (_context25.prev = _context25.next) {
5585
5536
  case 0:
5586
5537
  tempOrder = this.ensureTempOrder();
5587
5538
  if (!(!Array.isArray(items) || items.length === 0)) {
5588
- _context26.next = 3;
5539
+ _context25.next = 3;
5589
5540
  break;
5590
5541
  }
5591
- return _context26.abrupt("return", tempOrder.products);
5542
+ return _context25.abrupt("return", tempOrder.products);
5592
5543
  case 3:
5593
5544
  beforeCommit = this.createCartIntentCommitGuard('add_product', tempOrder);
5594
5545
  _iterator20 = _createForOfIteratorHelper(items || []);
5595
- _context26.prev = 5;
5546
+ _context25.prev = 5;
5596
5547
  _iterator20.s();
5597
5548
  case 7:
5598
5549
  if ((_step20 = _iterator20.n()).done) {
5599
- _context26.next = 33;
5550
+ _context25.next = 33;
5600
5551
  break;
5601
5552
  }
5602
5553
  item = _step20.value;
5603
5554
  product = item.product, booking = item.booking;
5604
5555
  if (product) {
5605
- _context26.next = 12;
5556
+ _context25.next = 12;
5606
5557
  break;
5607
5558
  }
5608
- return _context26.abrupt("continue", 31);
5559
+ return _context25.abrupt("continue", 31);
5609
5560
  case 12:
5610
5561
  if (!booking) {
5611
- _context26.next = 27;
5562
+ _context25.next = 27;
5612
5563
  break;
5613
5564
  }
5614
5565
  productRecord = product;
5615
5566
  splitCount = getSafeProductNum((_ref72 = (_productRecord$num2 = productRecord.num) !== null && _productRecord$num2 !== void 0 ? _productRecord$num2 : productRecord.product_quantity) !== null && _ref72 !== void 0 ? _ref72 : 1);
5616
5567
  if (!(splitCount > 1)) {
5617
- _context26.next = 27;
5568
+ _context25.next = 27;
5618
5569
  break;
5619
5570
  }
5620
5571
  i = 0;
5621
5572
  case 17:
5622
5573
  if (!(i < splitCount)) {
5623
- _context26.next = 26;
5574
+ _context25.next = 26;
5624
5575
  break;
5625
5576
  }
5626
5577
  splitLine = this.createSplitBookingLine(productRecord, booking, i, splitCount);
@@ -5628,52 +5579,52 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5628
5579
  beforeCommit: beforeCommit
5629
5580
  });
5630
5581
  if (!_appendResult) {
5631
- _context26.next = 23;
5582
+ _context25.next = 23;
5632
5583
  break;
5633
5584
  }
5634
- _context26.next = 23;
5585
+ _context25.next = 23;
5635
5586
  return _appendResult;
5636
5587
  case 23:
5637
5588
  i += 1;
5638
- _context26.next = 17;
5589
+ _context25.next = 17;
5639
5590
  break;
5640
5591
  case 26:
5641
- return _context26.abrupt("continue", 31);
5592
+ return _context25.abrupt("continue", 31);
5642
5593
  case 27:
5643
5594
  appendResult = this.appendProductLineToTempOrder(tempOrder, product, booking, {
5644
5595
  beforeCommit: beforeCommit
5645
5596
  });
5646
5597
  if (!appendResult) {
5647
- _context26.next = 31;
5598
+ _context25.next = 31;
5648
5599
  break;
5649
5600
  }
5650
- _context26.next = 31;
5601
+ _context25.next = 31;
5651
5602
  return appendResult;
5652
5603
  case 31:
5653
- _context26.next = 7;
5604
+ _context25.next = 7;
5654
5605
  break;
5655
5606
  case 33:
5656
- _context26.next = 38;
5607
+ _context25.next = 38;
5657
5608
  break;
5658
5609
  case 35:
5659
- _context26.prev = 35;
5660
- _context26.t0 = _context26["catch"](5);
5661
- _iterator20.e(_context26.t0);
5610
+ _context25.prev = 35;
5611
+ _context25.t0 = _context25["catch"](5);
5612
+ _iterator20.e(_context25.t0);
5662
5613
  case 38:
5663
- _context26.prev = 38;
5614
+ _context25.prev = 38;
5664
5615
  _iterator20.f();
5665
- return _context26.finish(38);
5616
+ return _context25.finish(38);
5666
5617
  case 41:
5667
- _context26.next = 43;
5618
+ _context25.next = 43;
5668
5619
  return this.finalizeProductOrderMutation(tempOrder, options);
5669
5620
  case 43:
5670
5621
  this.logInfo('addProductsToOrder success', {
5671
5622
  itemsCount: items.length
5672
5623
  });
5673
- return _context26.abrupt("return", tempOrder.products);
5624
+ return _context25.abrupt("return", tempOrder.products);
5674
5625
  case 45:
5675
5626
  case "end":
5676
- return _context26.stop();
5627
+ return _context25.stop();
5677
5628
  }
5678
5629
  }, _callee24, this, [[5, 35, 38, 41]]);
5679
5630
  }));
@@ -5729,7 +5680,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5729
5680
  }, {
5730
5681
  key: "hasSameEntitlementMergePriceConfig",
5731
5682
  value: function hasSameEntitlementMergePriceConfig(incoming, existing) {
5732
- var _this35 = this;
5683
+ var _this34 = this;
5733
5684
  var buildPriceConfig = function buildPriceConfig(product) {
5734
5685
  var metadata = product.metadata || {};
5735
5686
  var bundle = (product.product_bundle || []).map(function (item) {
@@ -5745,10 +5696,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5745
5696
  return JSON.stringify(left).localeCompare(JSON.stringify(right));
5746
5697
  });
5747
5698
  return JSON.stringify({
5748
- original_price: _this35.normalizeFingerprintMoney(product.original_price),
5749
- source_product_price: _this35.normalizeFingerprintMoney(metadata.source_product_price),
5750
- main_product_original_price: _this35.normalizeFingerprintMoney(metadata.main_product_original_price),
5751
- price_override: _this35.normalizeFingerprintMoney(metadata.price_override),
5699
+ original_price: _this34.normalizeFingerprintMoney(product.original_price),
5700
+ source_product_price: _this34.normalizeFingerprintMoney(metadata.source_product_price),
5701
+ main_product_original_price: _this34.normalizeFingerprintMoney(metadata.main_product_original_price),
5702
+ price_override: _this34.normalizeFingerprintMoney(metadata.price_override),
5752
5703
  is_manual_discount: Boolean(metadata.is_manual_discount),
5753
5704
  bundle: bundle
5754
5705
  });
@@ -5765,17 +5716,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
5765
5716
  }, {
5766
5717
  key: "preservePersistedBundlePriceFields",
5767
5718
  value: function preservePersistedBundlePriceFields(previousBundles, nextBundles) {
5768
- var _this36 = this;
5719
+ var _this35 = this;
5769
5720
  if (!Array.isArray(nextBundles)) return nextBundles;
5770
5721
  if (!Array.isArray(previousBundles) || previousBundles.length === 0) return nextBundles;
5771
5722
  var previousByIdentity = new Map();
5772
5723
  previousBundles.forEach(function (bundle) {
5773
- var identity = _this36.getBundleRuntimeIdentity(bundle);
5724
+ var identity = _this35.getBundleRuntimeIdentity(bundle);
5774
5725
  if (identity) previousByIdentity.set(identity, bundle);
5775
5726
  });
5776
5727
  return nextBundles.map(function (bundle, index) {
5777
5728
  if (!bundle || _typeof(bundle) !== 'object') return bundle;
5778
- var previous = previousByIdentity.get(_this36.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
5729
+ var previous = previousByIdentity.get(_this35.getBundleRuntimeIdentity(bundle)) || previousBundles[index];
5779
5730
  if (!previous || _typeof(previous) !== 'object') return bundle;
5780
5731
  return _objectSpread(_objectSpread(_objectSpread({}, bundle), (bundle.cover === undefined || bundle.cover === null || bundle.cover === '') && previous.cover !== undefined && previous.cover !== null && previous.cover !== '' ? {
5781
5732
  cover: previous.cover
@@ -6049,8 +6000,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6049
6000
  value: function () {
6050
6001
  var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(params) {
6051
6002
  var tempOrder, reapplyWeighedDiscountProductUids, updatedProductUid, promotionPayload;
6052
- return _regeneratorRuntime().wrap(function _callee25$(_context27) {
6053
- while (1) switch (_context27.prev = _context27.next) {
6003
+ return _regeneratorRuntime().wrap(function _callee25$(_context26) {
6004
+ while (1) switch (_context26.prev = _context26.next) {
6054
6005
  case 0:
6055
6006
  tempOrder = this.ensureTempOrder();
6056
6007
  if (this.isRestrictedCartProductUpdate(tempOrder, params)) {
@@ -6058,16 +6009,16 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6058
6009
  }
6059
6010
  reapplyWeighedDiscountProductUids = [];
6060
6011
  updatedProductUid = this.applyOrderProductUpdateToTempOrder(tempOrder, params, reapplyWeighedDiscountProductUids);
6061
- _context27.next = 6;
6012
+ _context26.next = 6;
6062
6013
  return this.evaluatePromotion();
6063
6014
  case 6:
6064
- promotionPayload = _context27.sent;
6015
+ promotionPayload = _context26.sent;
6065
6016
  this.applyDiscount({
6066
6017
  reapplyWeighedDiscountProductUids: reapplyWeighedDiscountProductUids,
6067
6018
  reapplyBookingDiscountProductUids: params.allow_booking_discount_reapply && updatedProductUid ? [String(updatedProductUid)] : undefined
6068
6019
  });
6069
6020
  this.sanitizeTempOrderProducts(tempOrder);
6070
- _context27.next = 11;
6021
+ _context26.next = 11;
6071
6022
  return this.recalculateSummary({
6072
6023
  createIfMissing: true
6073
6024
  });
@@ -6077,10 +6028,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6077
6028
  this.logInfo('updateOrderProduct success', {
6078
6029
  params: params
6079
6030
  });
6080
- return _context27.abrupt("return", tempOrder.products);
6031
+ return _context26.abrupt("return", tempOrder.products);
6081
6032
  case 15:
6082
6033
  case "end":
6083
- return _context27.stop();
6034
+ return _context26.stop();
6084
6035
  }
6085
6036
  }, _callee25, this);
6086
6037
  }));
@@ -6093,33 +6044,33 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6093
6044
  key: "updateOrderProducts",
6094
6045
  value: function () {
6095
6046
  var _updateOrderProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(paramsList) {
6096
- var _this37 = this;
6047
+ var _this36 = this;
6097
6048
  var tempOrder, reapplyWeighedDiscountProductUids, reapplyBookingDiscountProductUids;
6098
- return _regeneratorRuntime().wrap(function _callee26$(_context28) {
6099
- while (1) switch (_context28.prev = _context28.next) {
6049
+ return _regeneratorRuntime().wrap(function _callee26$(_context27) {
6050
+ while (1) switch (_context27.prev = _context27.next) {
6100
6051
  case 0:
6101
6052
  tempOrder = this.ensureTempOrder();
6102
6053
  if (paramsList.length) {
6103
- _context28.next = 3;
6054
+ _context27.next = 3;
6104
6055
  break;
6105
6056
  }
6106
- return _context28.abrupt("return", tempOrder.products);
6057
+ return _context27.abrupt("return", tempOrder.products);
6107
6058
  case 3:
6108
6059
  if (paramsList.some(function (params) {
6109
- return _this37.isRestrictedCartProductUpdate(tempOrder, params);
6060
+ return _this36.isRestrictedCartProductUpdate(tempOrder, params);
6110
6061
  })) {
6111
6062
  this.createCartIntentCommitGuard('update_product', tempOrder)();
6112
6063
  }
6113
6064
  reapplyWeighedDiscountProductUids = [];
6114
6065
  reapplyBookingDiscountProductUids = paramsList.reduce(function (acc, params) {
6115
- var updatedProductUid = _this37.applyOrderProductUpdateToTempOrder(tempOrder, params, reapplyWeighedDiscountProductUids);
6066
+ var updatedProductUid = _this36.applyOrderProductUpdateToTempOrder(tempOrder, params, reapplyWeighedDiscountProductUids);
6116
6067
  // 批量改预约时间时,延迟到最后一次折扣计算里统一恢复已选预约折扣卡。
6117
6068
  if (params.allow_booking_discount_reapply && updatedProductUid) {
6118
6069
  acc.push(String(updatedProductUid));
6119
6070
  }
6120
6071
  return acc;
6121
6072
  }, []);
6122
- _context28.next = 8;
6073
+ _context27.next = 8;
6123
6074
  return this.finalizeAfterProductsMutation(tempOrder, {
6124
6075
  reapplyWeighedDiscountProductUids: reapplyWeighedDiscountProductUids,
6125
6076
  reapplyBookingDiscountProductUids: reapplyBookingDiscountProductUids.length ? reapplyBookingDiscountProductUids : undefined
@@ -6128,10 +6079,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6128
6079
  this.logInfo('updateOrderProduct success', {
6129
6080
  paramsList: paramsList
6130
6081
  });
6131
- return _context28.abrupt("return", tempOrder.products);
6082
+ return _context27.abrupt("return", tempOrder.products);
6132
6083
  case 10:
6133
6084
  case "end":
6134
- return _context28.stop();
6085
+ return _context27.stop();
6135
6086
  }
6136
6087
  }, _callee26, this);
6137
6088
  }));
@@ -6146,15 +6097,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6146
6097
  var _updateOrderProductQuantity = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(params, options) {
6147
6098
  var _this$store$tempOrder9, _targetProduct$metada22;
6148
6099
  var isCurrentOrder, product_id, product_variant_id, num, unique_identification_number, identity_key, product_sku, product_bundle, tempOrder, identityLookup, productIndex, targetUid, targetProduct, isPersistedOrderLine, normalizedProduct, settlementSnapshot, currencyProductId, asset, requiredAmount, balance, isVirtualSettlement, promotionPayload;
6149
- return _regeneratorRuntime().wrap(function _callee27$(_context29) {
6150
- while (1) switch (_context29.prev = _context29.next) {
6100
+ return _regeneratorRuntime().wrap(function _callee27$(_context28) {
6101
+ while (1) switch (_context28.prev = _context28.next) {
6151
6102
  case 0:
6152
6103
  isCurrentOrder = options === null || options === void 0 ? void 0 : options.isCurrentOrder;
6153
6104
  if (!(isCurrentOrder && !isCurrentOrder())) {
6154
- _context29.next = 3;
6105
+ _context28.next = 3;
6155
6106
  break;
6156
6107
  }
6157
- return _context29.abrupt("return", ((_this$store$tempOrder9 = this.store.tempOrder) === null || _this$store$tempOrder9 === void 0 ? void 0 : _this$store$tempOrder9.products) || []);
6108
+ return _context28.abrupt("return", ((_this$store$tempOrder9 = this.store.tempOrder) === null || _this$store$tempOrder9 === void 0 ? void 0 : _this$store$tempOrder9.products) || []);
6158
6109
  case 3:
6159
6110
  product_id = params.product_id, product_variant_id = params.product_variant_id, num = params.num, unique_identification_number = params.unique_identification_number, identity_key = params.identity_key, product_sku = params.product_sku, product_bundle = params.product_bundle;
6160
6111
  tempOrder = this.ensureTempOrder();
@@ -6184,7 +6135,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6184
6135
  productIndex = getProductIdentityIndex(tempOrder.products, identityLookup);
6185
6136
  }
6186
6137
  if (!(productIndex === -1)) {
6187
- _context29.next = 16;
6138
+ _context28.next = 16;
6188
6139
  break;
6189
6140
  }
6190
6141
  throw new Error('[Order] 目标商品不存在,无法更新数量');
@@ -6200,7 +6151,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6200
6151
  normalizedProduct.discount_list = normalizeOrderProductDiscountList(isPersistedOrderLine ? syncReducedEntitlementPassUsageCount(normalizedProduct.discount_list, targetProduct.num, normalizedProduct.num) : normalizedProduct.discount_list);
6201
6152
  settlementSnapshot = getSelectedSettlementSnapshot(normalizedProduct);
6202
6153
  if (!(this.isMultiCurrencySettlementEnabled() && (settlementSnapshot === null || settlementSnapshot === void 0 ? void 0 : settlementSnapshot.settlement_type) === 'virtual_currency' && tempOrder.customer_id && Number(tempOrder.customer_id) !== 1)) {
6203
- _context29.next = 30;
6154
+ _context28.next = 30;
6204
6155
  break;
6205
6156
  }
6206
6157
  currencyProductId = Number(settlementSnapshot.currency_product_id);
@@ -6208,7 +6159,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6208
6159
  return Number(item === null || item === void 0 ? void 0 : item.product_id) === currencyProductId;
6209
6160
  });
6210
6161
  if (asset) {
6211
- _context29.next = 26;
6162
+ _context28.next = 26;
6212
6163
  break;
6213
6164
  }
6214
6165
  throw new VirtualCurrencyAssetNotFoundError(currencyProductId);
@@ -6220,7 +6171,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6220
6171
  }, new Decimal(0));
6221
6172
  balance = new Decimal(asset.balance || 0);
6222
6173
  if (!balance.lt(requiredAmount)) {
6223
- _context29.next = 30;
6174
+ _context28.next = 30;
6224
6175
  break;
6225
6176
  }
6226
6177
  throw new VirtualCurrencyBalanceError(balance.toFixed(2), requiredAmount.toFixed(2));
@@ -6229,46 +6180,46 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6229
6180
  this.createCartIntentCommitGuard('increase_quantity', tempOrder)();
6230
6181
  }
6231
6182
  if (!(isCurrentOrder && !isCurrentOrder())) {
6232
- _context29.next = 33;
6183
+ _context28.next = 33;
6233
6184
  break;
6234
6185
  }
6235
- return _context29.abrupt("return", tempOrder.products);
6186
+ return _context28.abrupt("return", tempOrder.products);
6236
6187
  case 33:
6237
6188
  tempOrder.products[productIndex] = normalizedProduct;
6238
6189
  if (!isCurrentOrder) {
6239
- _context29.next = 39;
6190
+ _context28.next = 39;
6240
6191
  break;
6241
6192
  }
6242
- _context29.next = 37;
6193
+ _context28.next = 37;
6243
6194
  return this.finalizeProductOrderMutation(tempOrder, {
6244
6195
  skipEditDiscountConfigRefresh: true,
6245
6196
  isCurrentOrder: isCurrentOrder
6246
6197
  });
6247
6198
  case 37:
6248
- _context29.next = 55;
6199
+ _context28.next = 55;
6249
6200
  break;
6250
6201
  case 39:
6251
6202
  this.prepareVirtualSettlementTempOrder(tempOrder);
6252
6203
  isVirtualSettlement = this.isActiveVirtualSettlementOrder(tempOrder);
6253
6204
  if (isVirtualSettlement) {
6254
- _context29.next = 47;
6205
+ _context28.next = 47;
6255
6206
  break;
6256
6207
  }
6257
- _context29.next = 44;
6208
+ _context28.next = 44;
6258
6209
  return this.evaluatePromotion();
6259
6210
  case 44:
6260
- _context29.t0 = _context29.sent;
6261
- _context29.next = 48;
6211
+ _context28.t0 = _context28.sent;
6212
+ _context28.next = 48;
6262
6213
  break;
6263
6214
  case 47:
6264
- _context29.t0 = null;
6215
+ _context28.t0 = null;
6265
6216
  case 48:
6266
- promotionPayload = _context29.t0;
6217
+ promotionPayload = _context28.t0;
6267
6218
  if (!isVirtualSettlement) {
6268
6219
  this.applyDiscount();
6269
6220
  }
6270
6221
  this.sanitizeTempOrderProducts(tempOrder);
6271
- _context29.next = 53;
6222
+ _context28.next = 53;
6272
6223
  return this.recalculateSummary({
6273
6224
  createIfMissing: true
6274
6225
  });
@@ -6279,10 +6230,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6279
6230
  this.logInfo('updateOrderProductQuantity success', {
6280
6231
  params: params
6281
6232
  });
6282
- return _context29.abrupt("return", tempOrder.products);
6233
+ return _context28.abrupt("return", tempOrder.products);
6283
6234
  case 57:
6284
6235
  case "end":
6285
- return _context29.stop();
6236
+ return _context28.stop();
6286
6237
  }
6287
6238
  }, _callee27, this);
6288
6239
  }));
@@ -6329,20 +6280,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6329
6280
  value: (function () {
6330
6281
  var _finalizeAfterProductsMutation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(tempOrder, options) {
6331
6282
  var promotionPayload;
6332
- return _regeneratorRuntime().wrap(function _callee28$(_context30) {
6333
- while (1) switch (_context30.prev = _context30.next) {
6283
+ return _regeneratorRuntime().wrap(function _callee28$(_context29) {
6284
+ while (1) switch (_context29.prev = _context29.next) {
6334
6285
  case 0:
6335
6286
  this.syncTempOrderHolderFromBookings(tempOrder);
6336
- _context30.next = 3;
6287
+ _context29.next = 3;
6337
6288
  return this.evaluatePromotion();
6338
6289
  case 3:
6339
- promotionPayload = _context30.sent;
6290
+ promotionPayload = _context29.sent;
6340
6291
  this.applyDiscount({
6341
6292
  reapplyBookingDiscountProductUids: options === null || options === void 0 ? void 0 : options.reapplyBookingDiscountProductUids,
6342
6293
  reapplyWeighedDiscountProductUids: options === null || options === void 0 ? void 0 : options.reapplyWeighedDiscountProductUids
6343
6294
  });
6344
6295
  this.sanitizeTempOrderProducts(tempOrder);
6345
- _context30.next = 8;
6296
+ _context29.next = 8;
6346
6297
  return this.recalculateSummary({
6347
6298
  createIfMissing: true
6348
6299
  });
@@ -6351,7 +6302,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6351
6302
  this.emitPromotionApplied(promotionPayload);
6352
6303
  case 10:
6353
6304
  case "end":
6354
- return _context30.stop();
6305
+ return _context29.stop();
6355
6306
  }
6356
6307
  }, _callee28, this);
6357
6308
  }));
@@ -6372,24 +6323,24 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6372
6323
  value: (function () {
6373
6324
  var _removeProductsFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identities, options) {
6374
6325
  var _this$store$tempOrder10,
6375
- _this38 = this;
6376
- var isCurrentOrder, tempOrder, productsBeforeRemove, bookingsBeforeRemove, preserveDisplayPosition, anchorIndex, productsAfterAnchor, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop3, remainingProductIndex, remainingProduct, nextProduct, productsWithoutRemaining, nextProductIndex;
6377
- return _regeneratorRuntime().wrap(function _callee29$(_context32) {
6378
- while (1) switch (_context32.prev = _context32.next) {
6326
+ _this37 = this;
6327
+ var isCurrentOrder, tempOrder, productsBeforeRemove, bookingsBeforeRemove, preserveDisplayPosition, anchorIndex, productsAfterAnchor, matchedProducts, removedProducts, _i2, _removedProducts, product, linkedBookingUidsToRemove, _iterator21, _step21, _loop2, remainingProductIndex, remainingProduct, nextProduct, productsWithoutRemaining, nextProductIndex;
6328
+ return _regeneratorRuntime().wrap(function _callee29$(_context31) {
6329
+ while (1) switch (_context31.prev = _context31.next) {
6379
6330
  case 0:
6380
6331
  isCurrentOrder = options === null || options === void 0 ? void 0 : options.isCurrentOrder;
6381
6332
  if (!(isCurrentOrder && !isCurrentOrder())) {
6382
- _context32.next = 3;
6333
+ _context31.next = 3;
6383
6334
  break;
6384
6335
  }
6385
- return _context32.abrupt("return", ((_this$store$tempOrder10 = this.store.tempOrder) === null || _this$store$tempOrder10 === void 0 ? void 0 : _this$store$tempOrder10.products) || []);
6336
+ return _context31.abrupt("return", ((_this$store$tempOrder10 = this.store.tempOrder) === null || _this$store$tempOrder10 === void 0 ? void 0 : _this$store$tempOrder10.products) || []);
6386
6337
  case 3:
6387
6338
  tempOrder = this.ensureTempOrder();
6388
6339
  if (identities.length) {
6389
- _context32.next = 6;
6340
+ _context31.next = 6;
6390
6341
  break;
6391
6342
  }
6392
- return _context32.abrupt("return", tempOrder.products);
6343
+ return _context31.abrupt("return", tempOrder.products);
6393
6344
  case 6:
6394
6345
  // 商品删除会同步删除以商品行为主关系的 Notes;快照不完整时禁止产生孤儿 Relation。
6395
6346
  this.ensureSalesNotesLoadedForMutation(tempOrder);
@@ -6422,29 +6373,29 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6422
6373
  }
6423
6374
  linkedBookingUidsToRemove = new Set();
6424
6375
  _iterator21 = _createForOfIteratorHelper(matchedProducts);
6425
- _context32.prev = 19;
6426
- _loop3 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop3() {
6376
+ _context31.prev = 19;
6377
+ _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2() {
6427
6378
  var _metadata11, _metadata12, _metadata13, _metadata14;
6428
6379
  var product, productUid, productBookingUid, isAddTimeProduct;
6429
- return _regeneratorRuntime().wrap(function _loop3$(_context31) {
6430
- while (1) switch (_context31.prev = _context31.next) {
6380
+ return _regeneratorRuntime().wrap(function _loop2$(_context30) {
6381
+ while (1) switch (_context30.prev = _context30.next) {
6431
6382
  case 0:
6432
6383
  product = _step21.value;
6433
6384
  productUid = (product === null || product === void 0 || (_metadata11 = product.metadata) === null || _metadata11 === void 0 ? void 0 : _metadata11.unique_identification_number) || (product === null || product === void 0 ? void 0 : product.unique_identification_number);
6434
6385
  productBookingUid = (product === null || product === void 0 ? void 0 : product.booking_uid) || (product === null || product === void 0 || (_metadata12 = product.metadata) === null || _metadata12 === void 0 ? void 0 : _metadata12.booking_uid);
6435
6386
  isAddTimeProduct = (product === null || product === void 0 || (_metadata13 = product.metadata) === null || _metadata13 === void 0 ? void 0 : _metadata13.product_add_schedule_time) !== undefined && (product === null || product === void 0 || (_metadata14 = product.metadata) === null || _metadata14 === void 0 ? void 0 : _metadata14.product_add_schedule_time) !== null;
6436
6387
  if (!isAddTimeProduct) {
6437
- _context31.next = 6;
6388
+ _context30.next = 6;
6438
6389
  break;
6439
6390
  }
6440
- return _context31.abrupt("return", 1);
6391
+ return _context30.abrupt("return", 1);
6441
6392
  case 6:
6442
6393
  if (productBookingUid !== undefined && productBookingUid !== null && productBookingUid !== '') {
6443
6394
  linkedBookingUidsToRemove.add(String(productBookingUid));
6444
6395
  }
6445
6396
  if (productUid !== undefined && productUid !== null && productUid !== '') {
6446
6397
  bookingsBeforeRemove.forEach(function (booking) {
6447
- var bookingUid = _this38.getBookingUniqueIdentificationNumber(booking);
6398
+ var bookingUid = _this37.getBookingUniqueIdentificationNumber(booking);
6448
6399
  if (bookingUid && String((booking === null || booking === void 0 ? void 0 : booking.product_uid) || '') === String(productUid)) {
6449
6400
  linkedBookingUidsToRemove.add(bookingUid);
6450
6401
  }
@@ -6452,37 +6403,37 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6452
6403
  }
6453
6404
  case 8:
6454
6405
  case "end":
6455
- return _context31.stop();
6406
+ return _context30.stop();
6456
6407
  }
6457
- }, _loop3);
6408
+ }, _loop2);
6458
6409
  });
6459
6410
  _iterator21.s();
6460
6411
  case 22:
6461
6412
  if ((_step21 = _iterator21.n()).done) {
6462
- _context32.next = 28;
6413
+ _context31.next = 28;
6463
6414
  break;
6464
6415
  }
6465
- return _context32.delegateYield(_loop3(), "t0", 24);
6416
+ return _context31.delegateYield(_loop2(), "t0", 24);
6466
6417
  case 24:
6467
- if (!_context32.t0) {
6468
- _context32.next = 26;
6418
+ if (!_context31.t0) {
6419
+ _context31.next = 26;
6469
6420
  break;
6470
6421
  }
6471
- return _context32.abrupt("continue", 26);
6422
+ return _context31.abrupt("continue", 26);
6472
6423
  case 26:
6473
- _context32.next = 22;
6424
+ _context31.next = 22;
6474
6425
  break;
6475
6426
  case 28:
6476
- _context32.next = 33;
6427
+ _context31.next = 33;
6477
6428
  break;
6478
6429
  case 30:
6479
- _context32.prev = 30;
6480
- _context32.t1 = _context32["catch"](19);
6481
- _iterator21.e(_context32.t1);
6430
+ _context31.prev = 30;
6431
+ _context31.t1 = _context31["catch"](19);
6432
+ _iterator21.e(_context31.t1);
6482
6433
  case 33:
6483
- _context32.prev = 33;
6434
+ _context31.prev = 33;
6484
6435
  _iterator21.f();
6485
- return _context32.finish(33);
6436
+ return _context31.finish(33);
6486
6437
  case 36:
6487
6438
  if (linkedBookingUidsToRemove.size > 0) {
6488
6439
  // 删除主预约商品时,同步移除挂在同一 booking_uid 下的加时商品,避免残留孤儿行。
@@ -6514,28 +6465,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6514
6465
  }));
6515
6466
  this.removeSalesNotesForMissingProductLines(tempOrder);
6516
6467
  if (!isCurrentOrder) {
6517
- _context32.next = 45;
6468
+ _context31.next = 45;
6518
6469
  break;
6519
6470
  }
6520
- _context32.next = 43;
6471
+ _context31.next = 43;
6521
6472
  return this.finalizeProductOrderMutation(tempOrder, {
6522
6473
  skipEditDiscountConfigRefresh: true,
6523
6474
  isCurrentOrder: isCurrentOrder
6524
6475
  });
6525
6476
  case 43:
6526
- _context32.next = 47;
6477
+ _context31.next = 47;
6527
6478
  break;
6528
6479
  case 45:
6529
- _context32.next = 47;
6480
+ _context31.next = 47;
6530
6481
  return this.finalizeAfterProductsMutation(tempOrder);
6531
6482
  case 47:
6532
6483
  this.logInfo('removeProductsFromOrder success', {
6533
6484
  identities: identities
6534
6485
  });
6535
- return _context32.abrupt("return", tempOrder.products);
6486
+ return _context31.abrupt("return", tempOrder.products);
6536
6487
  case 49:
6537
6488
  case "end":
6538
- return _context32.stop();
6489
+ return _context31.stop();
6539
6490
  }
6540
6491
  }, _callee29, this, [[19, 30, 33, 36]]);
6541
6492
  }));
@@ -6548,13 +6499,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6548
6499
  key: "removeProductFromOrder",
6549
6500
  value: function () {
6550
6501
  var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(identity, options) {
6551
- return _regeneratorRuntime().wrap(function _callee30$(_context33) {
6552
- while (1) switch (_context33.prev = _context33.next) {
6502
+ return _regeneratorRuntime().wrap(function _callee30$(_context32) {
6503
+ while (1) switch (_context32.prev = _context32.next) {
6553
6504
  case 0:
6554
- return _context33.abrupt("return", this.removeProductsFromOrder([identity], options));
6505
+ return _context32.abrupt("return", this.removeProductsFromOrder([identity], options));
6555
6506
  case 1:
6556
6507
  case "end":
6557
- return _context33.stop();
6508
+ return _context32.stop();
6558
6509
  }
6559
6510
  }, _callee30, this);
6560
6511
  }));
@@ -6572,8 +6523,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6572
6523
  value: (function () {
6573
6524
  var _clearOrderCartLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
6574
6525
  var tempOrder, promotionPayload;
6575
- return _regeneratorRuntime().wrap(function _callee31$(_context34) {
6576
- while (1) switch (_context34.prev = _context34.next) {
6526
+ return _regeneratorRuntime().wrap(function _callee31$(_context33) {
6527
+ while (1) switch (_context33.prev = _context33.next) {
6577
6528
  case 0:
6578
6529
  tempOrder = this.ensureTempOrder();
6579
6530
  this.ensureSalesNotesLoadedForMutation(tempOrder);
@@ -6588,13 +6539,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6588
6539
  productsByUid: {}
6589
6540
  });
6590
6541
  }
6591
- _context34.next = 11;
6542
+ _context33.next = 11;
6592
6543
  return this.evaluatePromotion();
6593
6544
  case 11:
6594
- promotionPayload = _context34.sent;
6545
+ promotionPayload = _context33.sent;
6595
6546
  this.applyDiscount();
6596
6547
  this.sanitizeTempOrderProducts(tempOrder);
6597
- _context34.next = 16;
6548
+ _context33.next = 16;
6598
6549
  return this.recalculateSummary({
6599
6550
  createIfMissing: true
6600
6551
  });
@@ -6602,10 +6553,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6602
6553
  this.persistTempOrder();
6603
6554
  this.emitPromotionApplied(promotionPayload);
6604
6555
  this.logInfo('clearOrderCartLines success', {});
6605
- return _context34.abrupt("return", tempOrder);
6556
+ return _context33.abrupt("return", tempOrder);
6606
6557
  case 20:
6607
6558
  case "end":
6608
- return _context34.stop();
6559
+ return _context33.stop();
6609
6560
  }
6610
6561
  }, _callee31, this);
6611
6562
  }));
@@ -6624,8 +6575,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6624
6575
  var _clearOrderForSettlementSwitch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
6625
6576
  var _this$store$discount22, _this$store$discount23;
6626
6577
  var tempOrder;
6627
- return _regeneratorRuntime().wrap(function _callee32$(_context35) {
6628
- while (1) switch (_context35.prev = _context35.next) {
6578
+ return _regeneratorRuntime().wrap(function _callee32$(_context34) {
6579
+ while (1) switch (_context34.prev = _context34.next) {
6629
6580
  case 0:
6630
6581
  tempOrder = this.ensureTempOrder();
6631
6582
  this.ensureSalesNotesLoadedForMutation(tempOrder);
@@ -6645,26 +6596,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6645
6596
  productsByUid: {}
6646
6597
  });
6647
6598
  }
6648
- _context35.next = 16;
6599
+ _context34.next = 16;
6649
6600
  return (_this$store$discount22 = this.store.discount) === null || _this$store$discount22 === void 0 ? void 0 : _this$store$discount22.setDiscountList([]);
6650
6601
  case 16:
6651
- _context35.next = 18;
6602
+ _context34.next = 18;
6652
6603
  return (_this$store$discount23 = this.store.discount) === null || _this$store$discount23 === void 0 ? void 0 : _this$store$discount23.setOriginalDiscountList([]);
6653
6604
  case 18:
6654
6605
  this.hasActiveCustomerBoundDiscount = false;
6655
6606
  this.lastUnfulfilledPromotions = [];
6656
6607
  this.lastGiftActions = null;
6657
- _context35.next = 23;
6608
+ _context34.next = 23;
6658
6609
  return this.recalculateSummary({
6659
6610
  createIfMissing: true
6660
6611
  });
6661
6612
  case 23:
6662
6613
  this.persistTempOrder();
6663
6614
  this.logInfo('clearOrderForSettlementSwitch success', {});
6664
- return _context35.abrupt("return", tempOrder);
6615
+ return _context34.abrupt("return", tempOrder);
6665
6616
  case 26:
6666
6617
  case "end":
6667
- return _context35.stop();
6618
+ return _context34.stop();
6668
6619
  }
6669
6620
  }, _callee32, this);
6670
6621
  }));
@@ -6706,15 +6657,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6706
6657
  value: function () {
6707
6658
  var _applyLocalPrintOrderNumbers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(order) {
6708
6659
  var tempOrder, shopOrderNumber, shopFullOrderNumber;
6709
- return _regeneratorRuntime().wrap(function _callee33$(_context36) {
6710
- while (1) switch (_context36.prev = _context36.next) {
6660
+ return _regeneratorRuntime().wrap(function _callee33$(_context35) {
6661
+ while (1) switch (_context35.prev = _context35.next) {
6711
6662
  case 0:
6712
6663
  tempOrder = this.ensureTempOrder();
6713
6664
  if (!(!order || _typeof(order) !== 'object')) {
6714
- _context36.next = 3;
6665
+ _context35.next = 3;
6715
6666
  break;
6716
6667
  }
6717
- return _context36.abrupt("return", tempOrder);
6668
+ return _context35.abrupt("return", tempOrder);
6718
6669
  case 3:
6719
6670
  shopOrderNumber = order.shop_order_number;
6720
6671
  shopFullOrderNumber = order.shop_full_order_number;
@@ -6725,13 +6676,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6725
6676
  tempOrder.shop_full_order_number = String(shopFullOrderNumber);
6726
6677
  }
6727
6678
  this.persistTempOrder();
6728
- _context36.next = 10;
6679
+ _context35.next = 10;
6729
6680
  return this.saveDraft();
6730
6681
  case 10:
6731
- return _context36.abrupt("return", tempOrder);
6682
+ return _context35.abrupt("return", tempOrder);
6732
6683
  case 11:
6733
6684
  case "end":
6734
- return _context36.stop();
6685
+ return _context35.stop();
6735
6686
  }
6736
6687
  }, _callee33, this);
6737
6688
  }));
@@ -6746,32 +6697,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6746
6697
  var _saveTempOrderAsDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(params) {
6747
6698
  var _params$cacheId2, _this$otherParams8, _this$otherParams9, _this$otherParams10, _params$type, _this$otherParams11, _payload$products;
6748
6699
  var tempOrder, latestSummary, payload;
6749
- return _regeneratorRuntime().wrap(function _callee34$(_context37) {
6750
- while (1) switch (_context37.prev = _context37.next) {
6700
+ return _regeneratorRuntime().wrap(function _callee34$(_context36) {
6701
+ while (1) switch (_context36.prev = _context36.next) {
6751
6702
  case 0:
6752
6703
  tempOrder = this.ensureTempOrder();
6753
6704
  this.ensureExternalSaleNumber(tempOrder);
6754
6705
  this.persistTempOrder();
6755
- _context37.next = 5;
6706
+ _context36.next = 5;
6756
6707
  return this.recalculateSummary({
6757
6708
  createIfMissing: true
6758
6709
  });
6759
6710
  case 5:
6760
- _context37.t1 = _context37.sent;
6761
- if (_context37.t1) {
6762
- _context37.next = 8;
6711
+ _context36.t1 = _context36.sent;
6712
+ if (_context36.t1) {
6713
+ _context36.next = 8;
6763
6714
  break;
6764
6715
  }
6765
- _context37.t1 = this.store.summary;
6716
+ _context36.t1 = this.store.summary;
6766
6717
  case 8:
6767
- _context37.t0 = _context37.t1;
6768
- if (_context37.t0) {
6769
- _context37.next = 11;
6718
+ _context36.t0 = _context36.t1;
6719
+ if (_context36.t0) {
6720
+ _context36.next = 11;
6770
6721
  break;
6771
6722
  }
6772
- _context37.t0 = createEmptySummary();
6723
+ _context36.t0 = createEmptySummary();
6773
6724
  case 11:
6774
- latestSummary = _context37.t0;
6725
+ latestSummary = _context36.t0;
6775
6726
  payload = buildSubmitPayload({
6776
6727
  tempOrder: tempOrder,
6777
6728
  cacheId: (_params$cacheId2 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId2 !== void 0 ? _params$cacheId2 : this.cacheId,
@@ -6792,13 +6743,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6792
6743
  externalSaleNumber: payload.external_sale_number,
6793
6744
  productsCount: ((_payload$products = payload.products) === null || _payload$products === void 0 ? void 0 : _payload$products.length) || 0
6794
6745
  });
6795
- return _context37.abrupt("return", this.request.post('/order/sales/draft', payload, {
6746
+ return _context36.abrupt("return", this.request.post('/order/sales/draft', payload, {
6796
6747
  osServer: true,
6797
6748
  customToast: function customToast() {}
6798
6749
  }));
6799
6750
  case 18:
6800
6751
  case "end":
6801
- return _context37.stop();
6752
+ return _context36.stop();
6802
6753
  }
6803
6754
  }, _callee34, this);
6804
6755
  }));
@@ -6817,13 +6768,13 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6817
6768
  key: "submitTempOrder",
6818
6769
  value: (function () {
6819
6770
  var _submitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(params) {
6820
- return _regeneratorRuntime().wrap(function _callee35$(_context38) {
6821
- while (1) switch (_context38.prev = _context38.next) {
6771
+ return _regeneratorRuntime().wrap(function _callee35$(_context37) {
6772
+ while (1) switch (_context37.prev = _context37.next) {
6822
6773
  case 0:
6823
- return _context38.abrupt("return", this.runSubmitTempOrder(params));
6774
+ return _context37.abrupt("return", this.runSubmitTempOrder(params));
6824
6775
  case 1:
6825
6776
  case "end":
6826
- return _context38.stop();
6777
+ return _context37.stop();
6827
6778
  }
6828
6779
  }, _callee35, this);
6829
6780
  }));
@@ -6836,15 +6787,15 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6836
6787
  key: "submitTempOrderAsync",
6837
6788
  value: function () {
6838
6789
  var _submitTempOrderAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(params) {
6839
- return _regeneratorRuntime().wrap(function _callee36$(_context39) {
6840
- while (1) switch (_context39.prev = _context39.next) {
6790
+ return _regeneratorRuntime().wrap(function _callee36$(_context38) {
6791
+ while (1) switch (_context38.prev = _context38.next) {
6841
6792
  case 0:
6842
- return _context39.abrupt("return", this.runSubmitTempOrder(_objectSpread(_objectSpread({}, params), {}, {
6793
+ return _context38.abrupt("return", this.runSubmitTempOrder(_objectSpread(_objectSpread({}, params), {}, {
6843
6794
  syncMode: true
6844
6795
  })));
6845
6796
  case 1:
6846
6797
  case "end":
6847
- return _context39.stop();
6798
+ return _context38.stop();
6848
6799
  }
6849
6800
  }, _callee36, this);
6850
6801
  }));
@@ -6859,12 +6810,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6859
6810
  var _runSubmitTempOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(params) {
6860
6811
  var _params$cacheId3, _this$otherParams12, _ref92, _ref93, _submitSnapshot$busin, _this$otherParams13, _this$otherParams14, _submitSnapshot$type;
6861
6812
  var tempOrder, isOnlineStorePlatform, shouldConfirmPendingVoucherPayments, hasPaymentOverride, preparedPaymentOverride, latestSummary, effectiveCacheId, hasPaymentStatusOverride, shouldOverridePaymentStatus, hasSmallTicketDataFlagOverride, enhancePayload, submitSnapshot, payload, result, _payload$payments, _payload$payments2, backendErrorResponse, isLocalPendingSubmit, salesNotesState, submittedOrderId, resultRecord;
6862
- return _regeneratorRuntime().wrap(function _callee37$(_context40) {
6863
- while (1) switch (_context40.prev = _context40.next) {
6813
+ return _regeneratorRuntime().wrap(function _callee37$(_context39) {
6814
+ while (1) switch (_context39.prev = _context39.next) {
6864
6815
  case 0:
6865
6816
  tempOrder = this.ensureTempOrder();
6866
6817
  if (!requiresLocalPaymentRefresh(tempOrder)) {
6867
- _context40.next = 3;
6818
+ _context39.next = 3;
6868
6819
  break;
6869
6820
  }
6870
6821
  throw new Error(PAYMENT_REFRESH_MESSAGE);
@@ -6890,26 +6841,26 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6890
6841
  }
6891
6842
  }
6892
6843
  this.persistTempOrder();
6893
- _context40.next = 12;
6844
+ _context39.next = 12;
6894
6845
  return this.recalculateSummary({
6895
6846
  createIfMissing: true
6896
6847
  });
6897
6848
  case 12:
6898
- _context40.t1 = _context40.sent;
6899
- if (_context40.t1) {
6900
- _context40.next = 15;
6849
+ _context39.t1 = _context39.sent;
6850
+ if (_context39.t1) {
6851
+ _context39.next = 15;
6901
6852
  break;
6902
6853
  }
6903
- _context40.t1 = this.store.summary;
6854
+ _context39.t1 = this.store.summary;
6904
6855
  case 15:
6905
- _context40.t0 = _context40.t1;
6906
- if (_context40.t0) {
6907
- _context40.next = 18;
6856
+ _context39.t0 = _context39.t1;
6857
+ if (_context39.t0) {
6858
+ _context39.next = 18;
6908
6859
  break;
6909
6860
  }
6910
- _context40.t0 = createEmptySummary();
6861
+ _context39.t0 = createEmptySummary();
6911
6862
  case 18:
6912
- latestSummary = _context40.t0;
6863
+ latestSummary = _context39.t0;
6913
6864
  effectiveCacheId = (_params$cacheId3 = params === null || params === void 0 ? void 0 : params.cacheId) !== null && _params$cacheId3 !== void 0 ? _params$cacheId3 : this.cacheId;
6914
6865
  hasPaymentStatusOverride = (params === null || params === void 0 ? void 0 : params.paymentStatus) !== undefined;
6915
6866
  shouldOverridePaymentStatus = hasPaymentStatusOverride && !isOnlineStorePlatform && !shouldConfirmPendingVoucherPayments;
@@ -6945,10 +6896,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6945
6896
  if (!payload.created_at) {
6946
6897
  payload.created_at = dayjs().format('YYYY-MM-DD HH:mm:ss');
6947
6898
  }
6948
- _context40.next = 30;
6899
+ _context39.next = 30;
6949
6900
  return this.saveDraft();
6950
6901
  case 30:
6951
- _context40.prev = 30;
6902
+ _context39.prev = 30;
6952
6903
  this.logInfo('submitTempOrder calling sales checkout', {
6953
6904
  orderId: payload.order_id,
6954
6905
  externalSaleNumber: payload.external_sale_number,
@@ -6958,43 +6909,43 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
6958
6909
  smallTicketDataFlag: payload.small_ticket_data_flag,
6959
6910
  syncMode: payload.sync_mode
6960
6911
  });
6961
- _context40.next = 34;
6912
+ _context39.next = 34;
6962
6913
  return this.submitSalesOrder({
6963
6914
  query: payload
6964
6915
  });
6965
6916
  case 34:
6966
- result = _context40.sent;
6967
- _context40.next = 47;
6917
+ result = _context39.sent;
6918
+ _context39.next = 47;
6968
6919
  break;
6969
6920
  case 37:
6970
- _context40.prev = 37;
6971
- _context40.t2 = _context40["catch"](30);
6972
- backendErrorResponse = this.extractSubmitErrorResponse(_context40.t2);
6921
+ _context39.prev = 37;
6922
+ _context39.t2 = _context39["catch"](30);
6923
+ backendErrorResponse = this.extractSubmitErrorResponse(_context39.t2);
6973
6924
  if (!backendErrorResponse) {
6974
- _context40.next = 44;
6925
+ _context39.next = 44;
6975
6926
  break;
6976
6927
  }
6977
6928
  this.store.syncState = 'failed';
6978
6929
  this.logSubmitBackendRejected(backendErrorResponse, payload);
6979
- return _context40.abrupt("return", backendErrorResponse);
6930
+ return _context39.abrupt("return", backendErrorResponse);
6980
6931
  case 44:
6981
6932
  this.store.syncState = 'failed';
6982
6933
  this.logError('submitTempOrder failed', {
6983
- error: _context40.t2 instanceof Error ? _context40.t2.message : String(_context40.t2),
6934
+ error: _context39.t2 instanceof Error ? _context39.t2.message : String(_context39.t2),
6984
6935
  orderId: payload.order_id,
6985
6936
  externalSaleNumber: payload.external_sale_number,
6986
6937
  paymentStatus: payload.payment_status,
6987
6938
  paymentsCount: ((_payload$payments2 = payload.payments) === null || _payload$payments2 === void 0 ? void 0 : _payload$payments2.length) || 0
6988
6939
  });
6989
- throw _context40.t2;
6940
+ throw _context39.t2;
6990
6941
  case 47:
6991
6942
  if (!this.isSubmitResponseRejected(result)) {
6992
- _context40.next = 51;
6943
+ _context39.next = 51;
6993
6944
  break;
6994
6945
  }
6995
6946
  this.store.syncState = 'failed';
6996
6947
  this.logSubmitBackendRejected(result, payload);
6997
- return _context40.abrupt("return", result);
6948
+ return _context39.abrupt("return", result);
6998
6949
  case 51:
6999
6950
  isLocalPendingSubmit = this.isLocalPendingSubmitResult(result); // need_sync=1 仅表示已进入本地同步队列,不能视为远端已确认 Notes。
7000
6951
  if (Object.prototype.hasOwnProperty.call(payload, 'notes') && !isLocalPendingSubmit) {
@@ -7010,12 +6961,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7010
6961
  })
7011
6962
  });
7012
6963
  if (!(submittedOrderId !== null && submittedOrderId !== undefined)) {
7013
- _context40.next = 60;
6964
+ _context39.next = 60;
7014
6965
  break;
7015
6966
  }
7016
6967
  tempOrder.order_id = submittedOrderId;
7017
6968
  resultRecord = result;
7018
- _context40.next = 60;
6969
+ _context39.next = 60;
7019
6970
  return this.markLocalOrderSynced(submittedOrderId, (resultRecord === null || resultRecord === void 0 ? void 0 : resultRecord.data) || resultRecord || {});
7020
6971
  case 60:
7021
6972
  if (isLocalPendingSubmit) {
@@ -7023,10 +6974,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7023
6974
  } else if (submittedOrderId === null || submittedOrderId === undefined) {
7024
6975
  this.store.syncState = 'submitted';
7025
6976
  }
7026
- return _context40.abrupt("return", result);
6977
+ return _context39.abrupt("return", result);
7027
6978
  case 62:
7028
6979
  case "end":
7029
- return _context40.stop();
6980
+ return _context39.stop();
7030
6981
  }
7031
6982
  }, _callee37, this, [[30, 37]]);
7032
6983
  }));
@@ -7040,8 +6991,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7040
6991
  value: function () {
7041
6992
  var _markLocalOrderSynced = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(orderId, remoteOrder) {
7042
6993
  var tempOrder;
7043
- return _regeneratorRuntime().wrap(function _callee38$(_context41) {
7044
- while (1) switch (_context41.prev = _context41.next) {
6994
+ return _regeneratorRuntime().wrap(function _callee38$(_context40) {
6995
+ while (1) switch (_context40.prev = _context40.next) {
7045
6996
  case 0:
7046
6997
  tempOrder = this.ensureTempOrder();
7047
6998
  tempOrder.order_id = orderId;
@@ -7049,11 +7000,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7049
7000
  this.store.lastOrderInfo = remoteOrder;
7050
7001
  this.store.syncState = 'submitted';
7051
7002
  this.persistTempOrder();
7052
- _context41.next = 8;
7003
+ _context40.next = 8;
7053
7004
  return this.saveDraft();
7054
7005
  case 8:
7055
7006
  case "end":
7056
- return _context41.stop();
7007
+ return _context40.stop();
7057
7008
  }
7058
7009
  }, _callee38, this);
7059
7010
  }));
@@ -7100,10 +7051,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7100
7051
  value: function extractSubmitErrorResponse(error) {
7101
7052
  var _error$response,
7102
7053
  _error$response2,
7103
- _this39 = this;
7054
+ _this38 = this;
7104
7055
  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];
7105
7056
  return candidates.find(function (candidate) {
7106
- return _this39.isSubmitErrorResponse(candidate);
7057
+ return _this38.isSubmitErrorResponse(candidate);
7107
7058
  }) || null;
7108
7059
  }
7109
7060
  }, {
@@ -7131,32 +7082,32 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7131
7082
  key: "syncPaymentsToOrder",
7132
7083
  value: function () {
7133
7084
  var _syncPaymentsToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(params) {
7134
- var _this40 = this,
7085
+ var _this39 = this,
7135
7086
  _params$confirmPendin;
7136
7087
  var tempOrder, needsPaymentNumber, devicePrefix, mappedPayments, shouldConfirmPendingVoucherPayments, effectivePayments, completion, orderPaidPaymentTotal, paymentStatus, paymentSyncIdempotencyToken, enhancePayload, submitParams, submitResult;
7137
- return _regeneratorRuntime().wrap(function _callee39$(_context42) {
7138
- while (1) switch (_context42.prev = _context42.next) {
7088
+ return _regeneratorRuntime().wrap(function _callee39$(_context41) {
7089
+ while (1) switch (_context41.prev = _context41.next) {
7139
7090
  case 0:
7140
7091
  tempOrder = this.ensureTempOrder();
7141
7092
  needsPaymentNumber = (params.payments || []).some(function (payment) {
7142
7093
  return String(payment.payment_number || '').trim() === '';
7143
7094
  });
7144
7095
  if (!needsPaymentNumber) {
7145
- _context42.next = 8;
7096
+ _context41.next = 8;
7146
7097
  break;
7147
7098
  }
7148
- _context42.next = 5;
7099
+ _context41.next = 5;
7149
7100
  return this.getPaymentNumberDevicePrefixAsync();
7150
7101
  case 5:
7151
- _context42.t0 = _context42.sent;
7152
- _context42.next = 9;
7102
+ _context41.t0 = _context41.sent;
7103
+ _context41.next = 9;
7153
7104
  break;
7154
7105
  case 8:
7155
- _context42.t0 = 'LOCAL';
7106
+ _context41.t0 = 'LOCAL';
7156
7107
  case 9:
7157
- devicePrefix = _context42.t0;
7108
+ devicePrefix = _context41.t0;
7158
7109
  mappedPayments = mapPaymentItemsToOrderPayments((params.payments || []).map(function (payment) {
7159
- return _this40.normalizePaymentSource(payment, {
7110
+ return _this39.normalizePaymentSource(payment, {
7160
7111
  defaultPaid: false,
7161
7112
  devicePrefix: devicePrefix
7162
7113
  });
@@ -7169,20 +7120,20 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7169
7120
  tempOrder.payments = effectivePayments;
7170
7121
  tempOrder.payment_status = paymentStatus;
7171
7122
  this.persistTempOrder();
7172
- _context42.next = 21;
7123
+ _context41.next = 21;
7173
7124
  return this.saveDraft();
7174
7125
  case 21:
7175
7126
  if (params.submitWhenPaid) {
7176
- _context42.next = 23;
7127
+ _context41.next = 23;
7177
7128
  break;
7178
7129
  }
7179
- return _context42.abrupt("return", completion);
7130
+ return _context41.abrupt("return", completion);
7180
7131
  case 23:
7181
7132
  if (!(this.store.syncState === 'submitting')) {
7182
- _context42.next = 25;
7133
+ _context41.next = 25;
7183
7134
  break;
7184
7135
  }
7185
- return _context42.abrupt("return", completion);
7136
+ return _context41.abrupt("return", completion);
7186
7137
  case 25:
7187
7138
  this.store.syncState = 'submitting';
7188
7139
  paymentSyncIdempotencyToken = this.buildPaymentSyncIdempotencyToken(tempOrder, effectivePayments);
@@ -7202,28 +7153,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7202
7153
  enhancePayload: enhancePayload
7203
7154
  };
7204
7155
  if (!(params.checkoutSyncTaskEnabled === false)) {
7205
- _context42.next = 35;
7156
+ _context41.next = 35;
7206
7157
  break;
7207
7158
  }
7208
- _context42.next = 32;
7159
+ _context41.next = 32;
7209
7160
  return this.submitTempOrderAsync(submitParams);
7210
7161
  case 32:
7211
- _context42.t1 = _context42.sent;
7212
- _context42.next = 38;
7162
+ _context41.t1 = _context41.sent;
7163
+ _context41.next = 38;
7213
7164
  break;
7214
7165
  case 35:
7215
- _context42.next = 37;
7166
+ _context41.next = 37;
7216
7167
  return this.submitTempOrder(submitParams);
7217
7168
  case 37:
7218
- _context42.t1 = _context42.sent;
7169
+ _context41.t1 = _context41.sent;
7219
7170
  case 38:
7220
- submitResult = _context42.t1;
7221
- return _context42.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
7171
+ submitResult = _context41.t1;
7172
+ return _context41.abrupt("return", _objectSpread(_objectSpread({}, completion), {}, {
7222
7173
  submitResult: submitResult
7223
7174
  }));
7224
7175
  case 40:
7225
7176
  case "end":
7226
- return _context42.stop();
7177
+ return _context41.stop();
7227
7178
  }
7228
7179
  }, _callee39, this);
7229
7180
  }));
@@ -7235,7 +7186,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7235
7186
  }, {
7236
7187
  key: "createOrder",
7237
7188
  value: function createOrder(params) {
7238
- var _this41 = this;
7189
+ var _this40 = this;
7239
7190
  var order = _objectSpread({
7240
7191
  type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
7241
7192
  // 要从外面拿,virtual
@@ -7267,7 +7218,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7267
7218
 
7268
7219
  // 为预约补齐 holder 信息
7269
7220
  if (params !== null && params !== void 0 && (_params$extraData = params.extraData) !== null && _params$extraData !== void 0 && _params$extraData.is_add_holder_info) {
7270
- ensureCartItemOriginHolder(item, _this41.window);
7221
+ ensureCartItemOriginHolder(item, _this40.window);
7271
7222
  }
7272
7223
 
7273
7224
  // 购物车是否为普通商品
@@ -7327,8 +7278,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7327
7278
  var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(order) {
7328
7279
  var _order$query$cartItem, _params$bookings, _params$relation_prod;
7329
7280
  var url, query, fetchUrl, params;
7330
- return _regeneratorRuntime().wrap(function _callee40$(_context43) {
7331
- while (1) switch (_context43.prev = _context43.next) {
7281
+ return _regeneratorRuntime().wrap(function _callee40$(_context42) {
7282
+ while (1) switch (_context42.prev = _context42.next) {
7332
7283
  case 0:
7333
7284
  this.logInfo('submitOrder called', {
7334
7285
  url: order.url,
@@ -7348,10 +7299,10 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7348
7299
  relationProductsCount: ((_params$relation_prod = params.relation_products) === null || _params$relation_prod === void 0 ? void 0 : _params$relation_prod.length) || 0,
7349
7300
  scheduleDate: params.schedule_date
7350
7301
  });
7351
- return _context43.abrupt("return", this.request.post(fetchUrl, params));
7302
+ return _context42.abrupt("return", this.request.post(fetchUrl, params));
7352
7303
  case 6:
7353
7304
  case "end":
7354
- return _context43.stop();
7305
+ return _context42.stop();
7355
7306
  }
7356
7307
  }, _callee40, this);
7357
7308
  }));
@@ -7365,11 +7316,11 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7365
7316
  value: function () {
7366
7317
  var _cancelOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(params) {
7367
7318
  var payload;
7368
- return _regeneratorRuntime().wrap(function _callee41$(_context44) {
7369
- while (1) switch (_context44.prev = _context44.next) {
7319
+ return _regeneratorRuntime().wrap(function _callee41$(_context43) {
7320
+ while (1) switch (_context43.prev = _context43.next) {
7370
7321
  case 0:
7371
7322
  if (!(!Array.isArray(params.order_ids) || params.order_ids.length === 0)) {
7372
- _context44.next = 2;
7323
+ _context43.next = 2;
7373
7324
  break;
7374
7325
  }
7375
7326
  throw new Error('取消订单失败:order_ids 不能为空');
@@ -7385,12 +7336,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7385
7336
  method: 'PUT',
7386
7337
  orderIdsCount: params.order_ids.length
7387
7338
  });
7388
- return _context44.abrupt("return", this.request.put('/order/update-status', payload, {
7339
+ return _context43.abrupt("return", this.request.put('/order/update-status', payload, {
7389
7340
  isShopApi: true
7390
7341
  }));
7391
7342
  case 5:
7392
7343
  case "end":
7393
- return _context44.stop();
7344
+ return _context43.stop();
7394
7345
  }
7395
7346
  }, _callee41, this);
7396
7347
  }));
@@ -7404,17 +7355,17 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7404
7355
  value: function () {
7405
7356
  var _changeBookingStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(params) {
7406
7357
  var url, payload;
7407
- return _regeneratorRuntime().wrap(function _callee42$(_context45) {
7408
- while (1) switch (_context45.prev = _context45.next) {
7358
+ return _regeneratorRuntime().wrap(function _callee42$(_context44) {
7359
+ while (1) switch (_context44.prev = _context44.next) {
7409
7360
  case 0:
7410
7361
  if (params.booking_id) {
7411
- _context45.next = 2;
7362
+ _context44.next = 2;
7412
7363
  break;
7413
7364
  }
7414
7365
  throw new Error('变更预约状态失败:booking_id 不能为空');
7415
7366
  case 2:
7416
7367
  if (params.appointment_status) {
7417
- _context45.next = 4;
7368
+ _context44.next = 4;
7418
7369
  break;
7419
7370
  }
7420
7371
  throw new Error('变更预约状态失败:appointment_status 不能为空');
@@ -7429,12 +7380,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7429
7380
  bookingId: params.booking_id,
7430
7381
  appointmentStatus: params.appointment_status
7431
7382
  });
7432
- return _context45.abrupt("return", this.request.put(url, payload, {
7383
+ return _context44.abrupt("return", this.request.put(url, payload, {
7433
7384
  isShopApi: true
7434
7385
  }));
7435
7386
  case 8:
7436
7387
  case "end":
7437
- return _context45.stop();
7388
+ return _context44.stop();
7438
7389
  }
7439
7390
  }, _callee42, this);
7440
7391
  }));
@@ -7459,8 +7410,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7459
7410
  var _createOrderByCheckout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
7460
7411
  var _params$payments, _params$bookings2, _params$relation_prod2, _params$payments2, _params$payments3;
7461
7412
  var onlineStorePaymentCodeList, _orderData$payments, _orderData$bookings, _orderData$relation_p, _orderData$payments2, _orderData$payments3, orderData, response;
7462
- return _regeneratorRuntime().wrap(function _callee43$(_context46) {
7463
- while (1) switch (_context46.prev = _context46.next) {
7413
+ return _regeneratorRuntime().wrap(function _callee43$(_context45) {
7414
+ while (1) switch (_context45.prev = _context45.next) {
7464
7415
  case 0:
7465
7416
  // 过滤掉由在线店铺下单的 payment 支付数据
7466
7417
  onlineStorePaymentCodeList = ['WXPAY', 'WECHAT', 'ALIPAY', 'APPLE_PAY', 'CREDIT_CARD_3DS', 'CREDIT_CARD_TOKEN', 'GOOGLE_PAY', 'GOOGLE_PAY_3DS', 'CREDIT_CARD'];
@@ -7485,7 +7436,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7485
7436
  return p.code;
7486
7437
  })) || []
7487
7438
  });
7488
- _context46.prev = 3;
7439
+ _context45.prev = 3;
7489
7440
  // 构建订单数据,设置默认值并允许 params 覆盖
7490
7441
  orderData = _objectSpread({
7491
7442
  sales_channel: 'my_pisel',
@@ -7533,28 +7484,28 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7533
7484
  hasOrderId: !!orderData.order_id,
7534
7485
  smallTicketDataFlag: orderData.small_ticket_data_flag
7535
7486
  });
7536
- _context46.next = 10;
7487
+ _context45.next = 10;
7537
7488
  return this.request.post('/order/checkout', orderData, {
7538
7489
  osServer: true,
7539
7490
  customToast: function customToast() {}
7540
7491
  });
7541
7492
  case 10:
7542
- response = _context46.sent;
7493
+ response = _context45.sent;
7543
7494
  this.logInfo('Order API called successfully', {
7544
7495
  response: response
7545
7496
  });
7546
- return _context46.abrupt("return", response);
7497
+ return _context45.abrupt("return", response);
7547
7498
  case 15:
7548
- _context46.prev = 15;
7549
- _context46.t0 = _context46["catch"](3);
7550
- console.error('[Order] createOrderByCheckout 创建订单失败:', _context46.t0);
7499
+ _context45.prev = 15;
7500
+ _context45.t0 = _context45["catch"](3);
7501
+ console.error('[Order] createOrderByCheckout 创建订单失败:', _context45.t0);
7551
7502
  this.logInfo('Order API called failed', {
7552
- error: _context46.t0 instanceof Error ? _context46.t0.message : String(_context46.t0)
7503
+ error: _context45.t0 instanceof Error ? _context45.t0.message : String(_context45.t0)
7553
7504
  });
7554
- throw _context46.t0;
7505
+ throw _context45.t0;
7555
7506
  case 20:
7556
7507
  case "end":
7557
- return _context46.stop();
7508
+ return _context45.stop();
7558
7509
  }
7559
7510
  }, _callee43, this, [[3, 15]]);
7560
7511
  }));
@@ -7568,19 +7519,19 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7568
7519
  value: function () {
7569
7520
  var _submitSalesOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
7570
7521
  var url, query, fetchUrl, requestQuery;
7571
- return _regeneratorRuntime().wrap(function _callee44$(_context47) {
7572
- while (1) switch (_context47.prev = _context47.next) {
7522
+ return _regeneratorRuntime().wrap(function _callee44$(_context46) {
7523
+ while (1) switch (_context46.prev = _context46.next) {
7573
7524
  case 0:
7574
7525
  url = params.url, query = params.query;
7575
7526
  fetchUrl = url || '/order/sales/checkout';
7576
7527
  requestQuery = this.isSalesCheckoutHandledByOsServer(fetchUrl) ? query : stripLocalEftposState(stripOsPrivatePayloadFields(query));
7577
- return _context47.abrupt("return", this.request.post(fetchUrl, requestQuery, {
7528
+ return _context46.abrupt("return", this.request.post(fetchUrl, requestQuery, {
7578
7529
  osServer: true,
7579
7530
  customToast: function customToast() {}
7580
7531
  }));
7581
7532
  case 4:
7582
7533
  case "end":
7583
- return _context47.stop();
7534
+ return _context46.stop();
7584
7535
  }
7585
7536
  }, _callee44, this);
7586
7537
  }));
@@ -7614,30 +7565,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7614
7565
  var _sendCustomerPayLink = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(params) {
7615
7566
  var _params$emails;
7616
7567
  var orderIds;
7617
- return _regeneratorRuntime().wrap(function _callee45$(_context48) {
7618
- while (1) switch (_context48.prev = _context48.next) {
7568
+ return _regeneratorRuntime().wrap(function _callee45$(_context47) {
7569
+ while (1) switch (_context47.prev = _context47.next) {
7619
7570
  case 0:
7620
7571
  orderIds = params.order_ids || params.orderIds || [];
7621
7572
  if (orderIds.length) {
7622
- _context48.next = 3;
7573
+ _context47.next = 3;
7623
7574
  break;
7624
7575
  }
7625
7576
  throw new Error('发送支付链接前必须先提交本地订单并取得订单 ID');
7626
7577
  case 3:
7627
7578
  if ((_params$emails = params.emails) !== null && _params$emails !== void 0 && _params$emails.length) {
7628
- _context48.next = 5;
7579
+ _context47.next = 5;
7629
7580
  break;
7630
7581
  }
7631
7582
  throw new Error('发送支付链接需要至少一个邮箱');
7632
7583
  case 5:
7633
- return _context48.abrupt("return", this.request.post('/order/batch-email', {
7584
+ return _context47.abrupt("return", this.request.post('/order/batch-email', {
7634
7585
  order_ids: orderIds,
7635
7586
  notify_action: params.notify_action || 'order_payment_reminder',
7636
7587
  emails: params.emails
7637
7588
  }));
7638
7589
  case 6:
7639
7590
  case "end":
7640
- return _context48.stop();
7591
+ return _context47.stop();
7641
7592
  }
7642
7593
  }, _callee45, this);
7643
7594
  }));
@@ -7651,12 +7602,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7651
7602
  value: function () {
7652
7603
  var _getSalesOrderByLookup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
7653
7604
  var lookup, res;
7654
- return _regeneratorRuntime().wrap(function _callee46$(_context49) {
7655
- while (1) switch (_context49.prev = _context49.next) {
7605
+ return _regeneratorRuntime().wrap(function _callee46$(_context48) {
7606
+ while (1) switch (_context48.prev = _context48.next) {
7656
7607
  case 0:
7657
7608
  lookup = params.lookup === undefined || params.lookup === null ? '' : String(params.lookup).trim();
7658
7609
  if (lookup) {
7659
- _context49.next = 3;
7610
+ _context48.next = 3;
7660
7611
  break;
7661
7612
  }
7662
7613
  throw new Error('加载销售详情需要 lookup');
@@ -7665,21 +7616,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7665
7616
  if (lookup.startsWith('LOCAL_')) {
7666
7617
  params.forceRemote = false;
7667
7618
  }
7668
- _context49.next = 6;
7619
+ _context48.next = 6;
7669
7620
  return loadSalesOrderSnapshot(this.request, {
7670
7621
  lookup: lookup,
7671
7622
  transport: 'os-server',
7672
7623
  forceRemote: params.forceRemote
7673
7624
  });
7674
7625
  case 6:
7675
- res = _context49.sent;
7626
+ res = _context48.sent;
7676
7627
  if (res.code === 200) {
7677
7628
  this.store.lastOrderInfo = res.data;
7678
7629
  }
7679
- return _context49.abrupt("return", res);
7630
+ return _context48.abrupt("return", res);
7680
7631
  case 9:
7681
7632
  case "end":
7682
- return _context49.stop();
7633
+ return _context48.stop();
7683
7634
  }
7684
7635
  }, _callee46, this);
7685
7636
  }));
@@ -7700,8 +7651,8 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7700
7651
  var _hydrateTempOrderFromRecord = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(record, options) {
7701
7652
  var _sourceRaw$_extend, _this$store$discount26;
7702
7653
  var sourceRaw, duplicateProductIdentityRepair, duplicateIdentityReadySource, identityReadySource, normalizedCollections, raw, hasIdentityChanges, identityLogMetadata, hasIdentityWarnings, isSessionStorageHydrate, isMergedSalesDetailHydrate, nextTempOrder, _this$store$discount24, _this$store$discount25, restoredSessionDiscounts, nextExtend, sourceLastOrderInfo, isDraftOrder, syntheticIdentityOptions, rawSummary, historicalDepositSnapshot, summarySurcharges, hadSyntheticDraftOrderId, hydratedEditDiscounts, currentDiscounts, currentScanDiscounts, hydratedDiscountIds, retainedScanDiscounts, nextDiscounts, shouldSkipEmptyDiscountSync, _this$store$discount27, _this$store$discount28;
7703
- return _regeneratorRuntime().wrap(function _callee47$(_context50) {
7704
- while (1) switch (_context50.prev = _context50.next) {
7654
+ return _regeneratorRuntime().wrap(function _callee47$(_context49) {
7655
+ while (1) switch (_context49.prev = _context49.next) {
7705
7656
  case 0:
7706
7657
  sourceRaw = record && _typeof(record) === 'object' && record.data && record.order_id == null ? record.data : record || {};
7707
7658
  duplicateProductIdentityRepair = repairDuplicateOrderProductLineIdentities(Array.isArray(sourceRaw.products) ? sourceRaw.products : [], (_sourceRaw$_extend = sourceRaw._extend) === null || _sourceRaw$_extend === void 0 ? void 0 : _sourceRaw$_extend.productsByUid);
@@ -7743,7 +7694,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7743
7694
  this.store.tempOrder = nextTempOrder;
7744
7695
  this.clearCustomerWalletRuntimeState();
7745
7696
  if (!isSessionStorageHydrate) {
7746
- _context50.next = 31;
7697
+ _context49.next = 31;
7747
7698
  break;
7748
7699
  }
7749
7700
  // 会话快照是未提交购物车,不应获得编辑订单的 saved/edit 标记与服务端基线。
@@ -7759,23 +7710,23 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7759
7710
  nextTempOrder.discount_list = restoredSessionDiscounts;
7760
7711
  this.store.summary = createEmptySummary();
7761
7712
  this.store.lastOrderInfo = undefined;
7762
- _context50.next = 24;
7713
+ _context49.next = 24;
7763
7714
  return (_this$store$discount24 = this.store.discount) === null || _this$store$discount24 === void 0 ? void 0 : _this$store$discount24.setOriginalDiscountList(cloneDeep(restoredSessionDiscounts));
7764
7715
  case 24:
7765
- _context50.next = 26;
7716
+ _context49.next = 26;
7766
7717
  return (_this$store$discount25 = this.store.discount) === null || _this$store$discount25 === void 0 ? void 0 : _this$store$discount25.setDiscountList(cloneDeep(restoredSessionDiscounts));
7767
7718
  case 26:
7768
7719
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
7769
- _context50.next = 29;
7720
+ _context49.next = 29;
7770
7721
  break;
7771
7722
  }
7772
- _context50.next = 29;
7723
+ _context49.next = 29;
7773
7724
  return this.recalculateSummary({
7774
7725
  createIfMissing: false
7775
7726
  });
7776
7727
  case 29:
7777
7728
  this.persistTempOrder();
7778
- return _context50.abrupt("return", nextTempOrder);
7729
+ return _context49.abrupt("return", nextTempOrder);
7779
7730
  case 31:
7780
7731
  // Server list compatibility may synthesize order_id from external_sale_number; tempOrder must not.
7781
7732
  sourceLastOrderInfo = sourceRaw.lastOrderInfo || sourceRaw;
@@ -7828,30 +7779,30 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7828
7779
  nextDiscounts = [].concat(_toConsumableArray(hydratedEditDiscounts), _toConsumableArray(retainedScanDiscounts));
7829
7780
  shouldSkipEmptyDiscountSync = nextDiscounts.length === 0 && currentDiscounts.length === 0;
7830
7781
  if (shouldSkipEmptyDiscountSync) {
7831
- _context50.next = 55;
7782
+ _context49.next = 55;
7832
7783
  break;
7833
7784
  }
7834
7785
  OrderModule.populateSavedAmounts(nextTempOrder.products, nextDiscounts);
7835
- _context50.next = 53;
7786
+ _context49.next = 53;
7836
7787
  return (_this$store$discount27 = this.store.discount) === null || _this$store$discount27 === void 0 ? void 0 : _this$store$discount27.setOriginalDiscountList(nextDiscounts);
7837
7788
  case 53:
7838
- _context50.next = 55;
7789
+ _context49.next = 55;
7839
7790
  return (_this$store$discount28 = this.store.discount) === null || _this$store$discount28 === void 0 ? void 0 : _this$store$discount28.setDiscountList(nextDiscounts);
7840
7791
  case 55:
7841
7792
  if (!(options !== null && options !== void 0 && options.recalcOnHydrate)) {
7842
- _context50.next = 58;
7793
+ _context49.next = 58;
7843
7794
  break;
7844
7795
  }
7845
- _context50.next = 58;
7796
+ _context49.next = 58;
7846
7797
  return this.recalculateSummary({
7847
7798
  createIfMissing: false
7848
7799
  });
7849
7800
  case 58:
7850
7801
  this.persistTempOrder();
7851
- return _context50.abrupt("return", nextTempOrder);
7802
+ return _context49.abrupt("return", nextTempOrder);
7852
7803
  case 60:
7853
7804
  case "end":
7854
- return _context50.stop();
7805
+ return _context49.stop();
7855
7806
  }
7856
7807
  }, _callee47, this);
7857
7808
  }));
@@ -7969,7 +7920,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7969
7920
  }, {
7970
7921
  key: "normalizeTempOrderForRuntime",
7971
7922
  value: function normalizeTempOrderForRuntime(raw, options) {
7972
- var _this42 = this,
7923
+ var _this41 = this,
7973
7924
  _raw$_extend;
7974
7925
  var runtimeRaw = this.withoutSyntheticDraftOrderIdForRuntime(raw);
7975
7926
  var nextTempOrder = _objectSpread(_objectSpread({}, this.createDefaultTempOrderInstance()), runtimeRaw || {});
@@ -7997,12 +7948,12 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
7997
7948
  nextTempOrder.holder = raw.holder && _typeof(raw.holder) === 'object' ? _objectSpread({}, raw.holder) : null;
7998
7949
  var rawProducts = Array.isArray(raw.products) ? raw.products : [];
7999
7950
  nextTempOrder.products = rawProducts.length > 0 ? rawProducts.map(function (p) {
8000
- return _this42.normalizeHydratedOrderProduct(p, {
7951
+ return _this41.normalizeHydratedOrderProduct(p, {
8001
7952
  makeEditMark: options === null || options === void 0 ? void 0 : options.makeEditMark
8002
7953
  });
8003
7954
  }) : [];
8004
7955
  nextTempOrder.bookings = Array.isArray(raw.bookings) ? raw.bookings.map(function (b) {
8005
- var booking = _this42.normalizeHydratedBookingHolder(b || {});
7956
+ var booking = _this41.normalizeHydratedBookingHolder(b || {});
8006
7957
  return _objectSpread(_objectSpread({}, booking), {}, {
8007
7958
  is_all: normalizeBookingIsAll(booking),
8008
7959
  sub_type: normalizeBookingSubType(booking)
@@ -8083,7 +8034,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8083
8034
  tempOrderExtend.productsByUid = productsByUid;
8084
8035
  this.hydrateLinkedBookingIdentity(nextTempOrder);
8085
8036
  nextTempOrder.products.forEach(function (product) {
8086
- return _this42.sanitizeOrderProductForTempOrder(product);
8037
+ return _this41.sanitizeOrderProductForTempOrder(product);
8087
8038
  });
8088
8039
  if ((options === null || options === void 0 ? void 0 : options.ensureIdentity) !== false) {
8089
8040
  this.ensureExternalSaleNumber(nextTempOrder);
@@ -8212,7 +8163,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8212
8163
  }, {
8213
8164
  key: "normalizeHydratedOrderProduct",
8214
8165
  value: function normalizeHydratedOrderProduct(product, options) {
8215
- var _this43 = this;
8166
+ var _this42 = this;
8216
8167
  var row = _objectSpread({}, product || {});
8217
8168
  if (row.num === undefined && row.product_quantity !== undefined) {
8218
8169
  row.num = row.product_quantity;
@@ -8220,7 +8171,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8220
8171
  var productSku = ensureProductSku(row);
8221
8172
  row.product_sku = _objectSpread(_objectSpread({}, productSku), {}, {
8222
8173
  option: normalizeProductSkuOptions(productSku.option.map(function (optionItem) {
8223
- return _this43.normalizeHydratedProductOptionItem(optionItem || {});
8174
+ return _this42.normalizeHydratedProductOptionItem(optionItem || {});
8224
8175
  }))
8225
8176
  });
8226
8177
  delete row["product_".concat('option', "_item")];
@@ -8282,21 +8233,21 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
8282
8233
  value: function () {
8283
8234
  var _getOrderInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(order_id) {
8284
8235
  var res;
8285
- return _regeneratorRuntime().wrap(function _callee48$(_context51) {
8286
- while (1) switch (_context51.prev = _context51.next) {
8236
+ return _regeneratorRuntime().wrap(function _callee48$(_context50) {
8237
+ while (1) switch (_context50.prev = _context50.next) {
8287
8238
  case 0:
8288
- _context51.next = 2;
8239
+ _context50.next = 2;
8289
8240
  return this.request.get("/order/sales/".concat(order_id), {
8290
8241
  with: ['products', 'bookings', 'notes']
8291
8242
  }, {
8292
8243
  osServer: true
8293
8244
  });
8294
8245
  case 2:
8295
- res = _context51.sent;
8296
- return _context51.abrupt("return", res);
8246
+ res = _context50.sent;
8247
+ return _context50.abrupt("return", res);
8297
8248
  case 4:
8298
8249
  case "end":
8299
- return _context51.stop();
8250
+ return _context50.stop();
8300
8251
  }
8301
8252
  }, _callee48, this);
8302
8253
  }));