@pisell/pisellos 2.2.317 → 2.2.318

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