@pisell/pisellos 2.2.322 → 2.2.324
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/BookingContext/index.d.ts +2 -2
- package/dist/modules/BookingContext/index.js +55 -25
- package/dist/modules/BookingContext/types.d.ts +2 -0
- package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
- package/dist/modules/BookingContext/utils/index.d.ts +1 -0
- package/dist/modules/BookingContext/utils/index.js +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/dist/modules/BookingContext/utils/productExtend.js +122 -29
- package/dist/modules/Date/index.d.ts +1 -1
- package/dist/modules/Date/index.js +60 -14
- package/dist/modules/Date/types.d.ts +5 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/OpenData/index.d.ts +1 -0
- package/dist/modules/OpenData/index.js +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts +32 -0
- package/dist/modules/OpenData/salesSettings.js +80 -0
- package/dist/modules/OpenData/types.d.ts +16 -0
- package/dist/modules/OpenData/utils.d.ts +1 -1
- package/dist/modules/OpenData/utils.js +3 -2
- package/dist/modules/Order/index.d.ts +54 -11
- package/dist/modules/Order/index.js +2699 -1411
- package/dist/modules/Order/types.d.ts +43 -5
- package/dist/modules/Order/types.js +4 -0
- package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/dist/modules/Order/unpaidAmountGap.js +72 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +18 -3
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/types.d.ts +5 -0
- package/dist/modules/ProductList/clientDataVariants.js +6 -2
- package/dist/modules/ProductList/index.d.ts +2 -0
- package/dist/modules/ProductList/index.js +161 -51
- package/dist/modules/ResourcePlanner/planner.js +58 -2
- package/dist/modules/ResourcePlanner/types.d.ts +13 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.js +58 -39
- package/dist/modules/Schedule/index.d.ts +7 -1
- package/dist/modules/Schedule/index.js +155 -39
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/bookingReadValidation.d.ts +6 -0
- package/dist/modules/bookingReadValidation.js +72 -0
- package/dist/plugins/request.d.ts +2 -0
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1312 -1154
- package/dist/server/modules/order/index.js +2 -1
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/dist/shared/receipt/small-ticket.d.ts +4 -0
- package/dist/shared/receipt/small-ticket.js +70 -12
- package/dist/solution/BaseSales/index.d.ts +40 -5
- package/dist/solution/BaseSales/index.js +1939 -1484
- package/dist/solution/BaseSales/types.d.ts +4 -0
- package/dist/solution/BaseSales/types.js +1 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
- package/dist/solution/BookingByStep/index.d.ts +16 -2
- package/dist/solution/BookingByStep/index.js +676 -361
- package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/dist/solution/BookingByStep/utils/resources.js +117 -76
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/BookingTicket/index.js +249 -135
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/OrderInvoicePreview/index.js +14 -8
- package/dist/solution/ScanOrder/index.d.ts +2 -0
- package/dist/solution/ScanOrder/index.js +166 -67
- package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/dist/solution/ScanOrder/menuAvailability.js +363 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/dist/solution/UnifiedBookingSales/index.js +3391 -1176
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/dist/solution/UnifiedBookingSales/types.js +7 -1
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/BookingContext/index.d.ts +2 -2
- package/lib/modules/BookingContext/index.js +42 -10
- package/lib/modules/BookingContext/types.d.ts +2 -0
- package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
- package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
- package/lib/modules/BookingContext/utils/index.d.ts +1 -0
- package/lib/modules/BookingContext/utils/index.js +11 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
- package/lib/modules/BookingContext/utils/productExtend.js +96 -7
- package/lib/modules/Date/index.d.ts +1 -1
- package/lib/modules/Date/index.js +28 -5
- package/lib/modules/Date/types.d.ts +5 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/OpenData/index.d.ts +1 -0
- package/lib/modules/OpenData/index.js +12 -0
- package/lib/modules/OpenData/salesSettings.d.ts +32 -0
- package/lib/modules/OpenData/salesSettings.js +70 -0
- package/lib/modules/OpenData/types.d.ts +16 -0
- package/lib/modules/OpenData/utils.d.ts +1 -1
- package/lib/modules/OpenData/utils.js +3 -2
- package/lib/modules/Order/index.d.ts +54 -11
- package/lib/modules/Order/index.js +659 -80
- package/lib/modules/Order/types.d.ts +43 -5
- package/lib/modules/Order/types.js +2 -0
- package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
- package/lib/modules/Order/unpaidAmountGap.js +60 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +19 -2
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/Product/types.d.ts +5 -0
- package/lib/modules/ProductList/clientDataVariants.js +6 -2
- package/lib/modules/ProductList/index.d.ts +2 -0
- package/lib/modules/ProductList/index.js +74 -0
- package/lib/modules/ResourcePlanner/planner.js +52 -1
- package/lib/modules/ResourcePlanner/types.d.ts +13 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +25 -9
- package/lib/modules/Schedule/index.d.ts +7 -1
- package/lib/modules/Schedule/index.js +68 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/bookingReadValidation.d.ts +6 -0
- package/lib/modules/bookingReadValidation.js +56 -0
- package/lib/plugins/request.d.ts +2 -0
- package/lib/server/index.d.ts +5 -0
- package/lib/server/index.js +124 -16
- package/lib/server/modules/order/index.js +2 -1
- package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
- package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
- package/lib/shared/receipt/small-ticket.d.ts +4 -0
- package/lib/shared/receipt/small-ticket.js +63 -8
- package/lib/solution/BaseSales/index.d.ts +40 -5
- package/lib/solution/BaseSales/index.js +296 -43
- package/lib/solution/BaseSales/types.d.ts +4 -0
- package/lib/solution/BaseSales/types.js +1 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
- package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +16 -2
- package/lib/solution/BookingByStep/index.js +222 -14
- package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
- package/lib/solution/BookingByStep/utils/resources.js +25 -15
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/BookingTicket/index.js +47 -4
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/OrderInvoicePreview/index.js +7 -1
- package/lib/solution/ScanOrder/index.d.ts +2 -0
- package/lib/solution/ScanOrder/index.js +72 -2
- package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
- package/lib/solution/ScanOrder/menuAvailability.js +203 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
- package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
- package/lib/solution/UnifiedBookingSales/index.js +1339 -74
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
- package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
- package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
- package/lib/solution/UnifiedBookingSales/types.js +4 -1
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
- package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -39,6 +39,7 @@ import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule"
|
|
|
39
39
|
import { composeLinePrice, buildSubmitPayload, createUuidV4, getProductSkuOptions, normalizeSubmitBooking, normalizeSubmitCollectPaxValue, resolveTableOccupancyDuration, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
40
40
|
import dayjs from 'dayjs';
|
|
41
41
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
42
|
+
import { prepareScanOrderMenuAvailability, ScanOrderMenuAvailabilityError } from "./menuAvailability";
|
|
42
43
|
export * from "./types";
|
|
43
44
|
function isItemRewardProductDiscount(discount) {
|
|
44
45
|
var _discount$metadata, _discount$metadata2;
|
|
@@ -1554,12 +1555,47 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1554
1555
|
return _submitScanOrderMore.apply(this, arguments);
|
|
1555
1556
|
}
|
|
1556
1557
|
return submitScanOrderMore;
|
|
1557
|
-
}()
|
|
1558
|
+
}() /** Read both current and legacy cart snapshots without changing the product catalog. */
|
|
1559
|
+
}, {
|
|
1560
|
+
key: "getMenuAvailabilityProductSources",
|
|
1561
|
+
value: function getMenuAvailabilityProductSources(tempOrder) {
|
|
1562
|
+
var _this$store$products, _this$store$products$;
|
|
1563
|
+
var products = tempOrder.products || [];
|
|
1564
|
+
var sources = _toConsumableArray(this.enabledReservationRuleProducts);
|
|
1565
|
+
var _iterator5 = _createForOfIteratorHelper(products),
|
|
1566
|
+
_step5;
|
|
1567
|
+
try {
|
|
1568
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
1569
|
+
var _product$metadata3, _product$metadata4, _tempOrder$_extend;
|
|
1570
|
+
var product = _step5.value;
|
|
1571
|
+
var uid = (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.unique_identification_number;
|
|
1572
|
+
var origins = [product._origin, (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.origin, uid ? (_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend.productsByUid) === null || _tempOrder$_extend === void 0 || (_tempOrder$_extend = _tempOrder$_extend[String(uid)]) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.origin : undefined];
|
|
1573
|
+
for (var _i3 = 0, _origins = origins; _i3 < _origins.length; _i3++) {
|
|
1574
|
+
var origin = _origins[_i3];
|
|
1575
|
+
if (origin && _typeof(origin) === 'object' && !Array.isArray(origin)) {
|
|
1576
|
+
sources.push(_objectSpread(_objectSpread({}, origin), {}, {
|
|
1577
|
+
product_id: product.product_id
|
|
1578
|
+
}));
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
} catch (err) {
|
|
1583
|
+
_iterator5.e(err);
|
|
1584
|
+
} finally {
|
|
1585
|
+
_iterator5.f();
|
|
1586
|
+
}
|
|
1587
|
+
var cachedSources = (_this$store$products = this.store.products) === null || _this$store$products === void 0 || (_this$store$products$ = _this$store$products.getRawProductPriceSources) === null || _this$store$products$ === void 0 ? void 0 : _this$store$products$.call(_this$store$products, products.map(function (product) {
|
|
1588
|
+
return Number(product.product_id);
|
|
1589
|
+
}));
|
|
1590
|
+
if (cachedSources) sources.push.apply(sources, _toConsumableArray(cachedSources.values()));
|
|
1591
|
+
return sources;
|
|
1592
|
+
}
|
|
1558
1593
|
}, {
|
|
1559
1594
|
key: "submitScanOrder",
|
|
1560
1595
|
value: function () {
|
|
1561
1596
|
var _submitScanOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1562
|
-
var
|
|
1597
|
+
var _this6 = this;
|
|
1598
|
+
var _this$store$resource2, _resource$relationId, _this$otherParams13, _this$getPickupTiming, _tempOrder$products, pax, tempOrderForSubmit, resourceTableName, isAdditionalOrder, enhanceBookingPayload, ruleProduct, resource, willAppendRuleProduct, productsToPrepare, associatedMenus, validateMenuAvailability, enhancePayload, result, tempOrder;
|
|
1563
1599
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1564
1600
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1565
1601
|
case 0:
|
|
@@ -1588,44 +1624,102 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1588
1624
|
delete tempOrderForSubmit.table_number;
|
|
1589
1625
|
}
|
|
1590
1626
|
this.store.order.persistTempOrder();
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1627
|
+
isAdditionalOrder = this.isScanOrderMoreMode(tempOrderForSubmit);
|
|
1628
|
+
enhanceBookingPayload = this.buildSubmitPayloadEnhancer();
|
|
1629
|
+
ruleProduct = this.enabledReservationRuleProducts[0];
|
|
1630
|
+
resource = this.store.resource;
|
|
1631
|
+
willAppendRuleProduct = !tempOrderForSubmit.order_id && ruleProduct && String((_resource$relationId = resource === null || resource === void 0 ? void 0 : resource.relationId) !== null && _resource$relationId !== void 0 ? _resource$relationId : '').trim() && (resource === null || resource === void 0 ? void 0 : resource.tableFormId);
|
|
1632
|
+
productsToPrepare = isAdditionalOrder ? tempOrderForSubmit.products.filter(function (product) {
|
|
1633
|
+
var _product$metadata5;
|
|
1634
|
+
return ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.is_rule) !== true;
|
|
1635
|
+
}) : [].concat(_toConsumableArray(tempOrderForSubmit.products), _toConsumableArray(willAppendRuleProduct ? [{
|
|
1636
|
+
product_id: ruleProduct.id,
|
|
1637
|
+
metadata: {
|
|
1638
|
+
is_rule: true
|
|
1639
|
+
}
|
|
1640
|
+
}] : []));
|
|
1641
|
+
associatedMenus = (_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'];
|
|
1642
|
+
if (Array.isArray(associatedMenus)) {
|
|
1643
|
+
_context18.next = 23;
|
|
1644
|
+
break;
|
|
1645
|
+
}
|
|
1646
|
+
throw new ScanOrderMenuAvailabilityError('SCAN_ORDER_MENU_VALIDATION_FAILED');
|
|
1647
|
+
case 23:
|
|
1648
|
+
_context18.next = 25;
|
|
1649
|
+
return prepareScanOrderMenuAvailability({
|
|
1650
|
+
request: this.request,
|
|
1651
|
+
menuIds: associatedMenus.map(function (menu) {
|
|
1652
|
+
return menu === null || menu === void 0 ? void 0 : menu.value;
|
|
1653
|
+
}),
|
|
1654
|
+
timezone: String((_this$getPickupTiming = this.getPickupTimingContextData('timezone')) !== null && _this$getPickupTiming !== void 0 ? _this$getPickupTiming : ''),
|
|
1655
|
+
products: productsToPrepare,
|
|
1656
|
+
productSources: this.getMenuAvailabilityProductSources(tempOrderForSubmit)
|
|
1657
|
+
});
|
|
1658
|
+
case 25:
|
|
1659
|
+
validateMenuAvailability = _context18.sent;
|
|
1660
|
+
enhancePayload = function enhancePayload(payload, context) {
|
|
1661
|
+
var enhancedPayload = enhanceBookingPayload(payload, context);
|
|
1662
|
+
var originalByUid = new Map(context.tempOrder.products.filter(function (product) {
|
|
1663
|
+
var _product$metadata6;
|
|
1664
|
+
return (_product$metadata6 = product.metadata) === null || _product$metadata6 === void 0 ? void 0 : _product$metadata6.unique_identification_number;
|
|
1665
|
+
}).map(function (product) {
|
|
1666
|
+
return [String(product.metadata.unique_identification_number), product];
|
|
1667
|
+
}));
|
|
1668
|
+
var outgoingProducts = isAdditionalOrder ? filterProductsForScanOrderMore(enhancedPayload.products) : enhancedPayload.products;
|
|
1669
|
+
// Serialization strips the prefill marker. Restore it only on validation
|
|
1670
|
+
// copies, by line UID, so a manually added row of the same product stays checked.
|
|
1671
|
+
var validationProducts = outgoingProducts.map(function (product) {
|
|
1672
|
+
var _product$metadata7, _original$metadata;
|
|
1673
|
+
var uid = (_product$metadata7 = product.metadata) === null || _product$metadata7 === void 0 ? void 0 : _product$metadata7.unique_identification_number;
|
|
1674
|
+
var original = uid ? originalByUid.get(String(uid)) : undefined;
|
|
1675
|
+
return (original === null || original === void 0 || (_original$metadata = original.metadata) === null || _original$metadata === void 0 ? void 0 : _original$metadata.item_rule_prefill) === true ? _objectSpread(_objectSpread({}, product), {}, {
|
|
1676
|
+
metadata: _objectSpread(_objectSpread({}, product.metadata), {}, {
|
|
1677
|
+
item_rule_prefill: true
|
|
1678
|
+
})
|
|
1679
|
+
}) : product;
|
|
1680
|
+
});
|
|
1681
|
+
// Both checkout and add-on build their payload after async quotation. Check
|
|
1682
|
+
// the actual outgoing lines using a fresh clock, never the draft schedule_date.
|
|
1683
|
+
validateMenuAvailability(validationProducts, _this6.getMenuAvailabilityProductSources(context.tempOrder));
|
|
1684
|
+
return enhancedPayload;
|
|
1685
|
+
};
|
|
1686
|
+
if (!isAdditionalOrder) {
|
|
1687
|
+
_context18.next = 33;
|
|
1594
1688
|
break;
|
|
1595
1689
|
}
|
|
1596
|
-
_context18.next =
|
|
1690
|
+
_context18.next = 30;
|
|
1597
1691
|
return this.submitScanOrderMore({
|
|
1598
1692
|
tempOrder: tempOrderForSubmit,
|
|
1599
1693
|
enhancePayload: enhancePayload
|
|
1600
1694
|
});
|
|
1601
|
-
case
|
|
1695
|
+
case 30:
|
|
1602
1696
|
_context18.t0 = _context18.sent;
|
|
1603
|
-
_context18.next =
|
|
1697
|
+
_context18.next = 36;
|
|
1604
1698
|
break;
|
|
1605
|
-
case
|
|
1606
|
-
_context18.next =
|
|
1699
|
+
case 33:
|
|
1700
|
+
_context18.next = 35;
|
|
1607
1701
|
return this.submitSalesOrder({
|
|
1608
1702
|
enhancePayload: enhancePayload
|
|
1609
1703
|
});
|
|
1610
|
-
case
|
|
1704
|
+
case 35:
|
|
1611
1705
|
_context18.t0 = _context18.sent;
|
|
1612
|
-
case
|
|
1706
|
+
case 36:
|
|
1613
1707
|
result = _context18.t0;
|
|
1614
1708
|
tempOrder = this.store.order.getTempOrder();
|
|
1615
1709
|
this.logMethodSuccess('submitScanOrder', {
|
|
1616
1710
|
productCount: (tempOrder === null || tempOrder === void 0 || (_tempOrder$products = tempOrder.products) === null || _tempOrder$products === void 0 ? void 0 : _tempOrder$products.length) || 0
|
|
1617
1711
|
});
|
|
1618
1712
|
return _context18.abrupt("return", result);
|
|
1619
|
-
case
|
|
1620
|
-
_context18.prev =
|
|
1713
|
+
case 42:
|
|
1714
|
+
_context18.prev = 42;
|
|
1621
1715
|
_context18.t1 = _context18["catch"](1);
|
|
1622
1716
|
this.logMethodError('submitScanOrder', _context18.t1);
|
|
1623
1717
|
throw _context18.t1;
|
|
1624
|
-
case
|
|
1718
|
+
case 46:
|
|
1625
1719
|
case "end":
|
|
1626
1720
|
return _context18.stop();
|
|
1627
1721
|
}
|
|
1628
|
-
}, _callee18, this, [[1,
|
|
1722
|
+
}, _callee18, this, [[1, 42]]);
|
|
1629
1723
|
}));
|
|
1630
1724
|
function submitScanOrder() {
|
|
1631
1725
|
return _submitScanOrder.apply(this, arguments);
|
|
@@ -1993,17 +2087,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
1993
2087
|
if (visited.has(value)) return;
|
|
1994
2088
|
visited.add(value);
|
|
1995
2089
|
if (Array.isArray(value)) {
|
|
1996
|
-
var
|
|
1997
|
-
|
|
2090
|
+
var _iterator6 = _createForOfIteratorHelper(value),
|
|
2091
|
+
_step6;
|
|
1998
2092
|
try {
|
|
1999
|
-
for (
|
|
2000
|
-
var item =
|
|
2093
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
2094
|
+
var item = _step6.value;
|
|
2001
2095
|
collectFromValue(item);
|
|
2002
2096
|
}
|
|
2003
2097
|
} catch (err) {
|
|
2004
|
-
|
|
2098
|
+
_iterator6.e(err);
|
|
2005
2099
|
} finally {
|
|
2006
|
-
|
|
2100
|
+
_iterator6.f();
|
|
2007
2101
|
}
|
|
2008
2102
|
return;
|
|
2009
2103
|
}
|
|
@@ -2019,8 +2113,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2019
2113
|
sourceMap.set(key, node);
|
|
2020
2114
|
}
|
|
2021
2115
|
}
|
|
2022
|
-
for (var
|
|
2023
|
-
var childValue = _Object$values[
|
|
2116
|
+
for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
|
|
2117
|
+
var childValue = _Object$values[_i4];
|
|
2024
2118
|
if (childValue && _typeof(childValue) === 'object') {
|
|
2025
2119
|
collectFromValue(childValue);
|
|
2026
2120
|
}
|
|
@@ -2049,17 +2143,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2049
2143
|
}, {
|
|
2050
2144
|
key: "getItemRuleRuntimeConfig",
|
|
2051
2145
|
value: function getItemRuleRuntimeConfig() {
|
|
2052
|
-
var _ref7, _runtimeConfig$channe, _runtimeConfig$custom, _this$
|
|
2146
|
+
var _ref7, _runtimeConfig$channe, _runtimeConfig$custom, _this$otherParams14;
|
|
2053
2147
|
var runtimeConfig = this.itemRuleRuntimeConfig || {};
|
|
2054
2148
|
return _objectSpread(_objectSpread({}, runtimeConfig), {}, {
|
|
2055
|
-
channel: (_ref7 = (_runtimeConfig$channe = runtimeConfig.channel) !== null && _runtimeConfig$channe !== void 0 ? _runtimeConfig$channe : (_runtimeConfig$custom = runtimeConfig.custom) === null || _runtimeConfig$custom === void 0 ? void 0 : _runtimeConfig$custom.channel) !== null && _ref7 !== void 0 ? _ref7 : (_this$
|
|
2149
|
+
channel: (_ref7 = (_runtimeConfig$channe = runtimeConfig.channel) !== null && _runtimeConfig$channe !== void 0 ? _runtimeConfig$channe : (_runtimeConfig$custom = runtimeConfig.custom) === null || _runtimeConfig$custom === void 0 ? void 0 : _runtimeConfig$custom.channel) !== null && _ref7 !== void 0 ? _ref7 : (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.channel
|
|
2056
2150
|
});
|
|
2057
2151
|
}
|
|
2058
2152
|
}, {
|
|
2059
2153
|
key: "ensureItemRuleConfigsLoaded",
|
|
2060
2154
|
value: function () {
|
|
2061
2155
|
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
2062
|
-
var
|
|
2156
|
+
var _this7 = this;
|
|
2063
2157
|
var loadedConfigs;
|
|
2064
2158
|
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2065
2159
|
while (1) switch (_context28.prev = _context28.next) {
|
|
@@ -2081,19 +2175,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2081
2175
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2082
2176
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2083
2177
|
case 0:
|
|
2084
|
-
runtimeConfig =
|
|
2178
|
+
runtimeConfig = _this7.getItemRuleRuntimeConfig();
|
|
2085
2179
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
2086
2180
|
if (!(staticConfigs.length > 0)) {
|
|
2087
2181
|
_context27.next = 6;
|
|
2088
2182
|
break;
|
|
2089
2183
|
}
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
return _context27.abrupt("return",
|
|
2184
|
+
_this7.itemRuleConfigs = staticConfigs;
|
|
2185
|
+
_this7.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
2186
|
+
return _context27.abrupt("return", _this7.itemRuleConfigs);
|
|
2093
2187
|
case 6:
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
return _context27.abrupt("return",
|
|
2188
|
+
_this7.itemRuleConfigs = [];
|
|
2189
|
+
_this7.itemRuleEvaluator.setStrategyConfigs([]);
|
|
2190
|
+
return _context27.abrupt("return", _this7.itemRuleConfigs);
|
|
2097
2191
|
case 9:
|
|
2098
2192
|
case "end":
|
|
2099
2193
|
return _context27.stop();
|
|
@@ -2168,7 +2262,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2168
2262
|
key: "applyPrefillByItemRule",
|
|
2169
2263
|
value: function () {
|
|
2170
2264
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2171
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2265
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator7, _step7, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, sourceTitle, productTitle, displayFields, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasTitleChanged, hasOriginChanged;
|
|
2172
2266
|
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2173
2267
|
while (1) switch (_context30.prev = _context30.next) {
|
|
2174
2268
|
case 0:
|
|
@@ -2213,15 +2307,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2213
2307
|
productSourceMap = _context30.sent;
|
|
2214
2308
|
tempOrder = this.ensureScanOrderTempOrder();
|
|
2215
2309
|
hasChanges = false;
|
|
2216
|
-
|
|
2310
|
+
_iterator7 = _createForOfIteratorHelper(prefillItems);
|
|
2217
2311
|
_context30.prev = 20;
|
|
2218
|
-
|
|
2312
|
+
_iterator7.s();
|
|
2219
2313
|
case 22:
|
|
2220
|
-
if ((
|
|
2314
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
2221
2315
|
_context30.next = 51;
|
|
2222
2316
|
break;
|
|
2223
2317
|
}
|
|
2224
|
-
prefillItem =
|
|
2318
|
+
prefillItem = _step7.value;
|
|
2225
2319
|
productId = Number(prefillItem.product_id);
|
|
2226
2320
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2227
2321
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2300,10 +2394,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2300
2394
|
case 53:
|
|
2301
2395
|
_context30.prev = 53;
|
|
2302
2396
|
_context30.t0 = _context30["catch"](20);
|
|
2303
|
-
|
|
2397
|
+
_iterator7.e(_context30.t0);
|
|
2304
2398
|
case 56:
|
|
2305
2399
|
_context30.prev = 56;
|
|
2306
|
-
|
|
2400
|
+
_iterator7.f();
|
|
2307
2401
|
return _context30.finish(56);
|
|
2308
2402
|
case 59:
|
|
2309
2403
|
if (!hasChanges) {
|
|
@@ -2548,14 +2642,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2548
2642
|
}, {
|
|
2549
2643
|
key: "normalizeResourceState",
|
|
2550
2644
|
value: function normalizeResourceState(detail, resourceSelectType, hasOrderId) {
|
|
2551
|
-
var _detail$form_record, _this$
|
|
2645
|
+
var _detail$form_record, _this$otherParams15, _detail$resource_capa, _detail$resource_capa2;
|
|
2552
2646
|
var currentOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.order_id);
|
|
2553
2647
|
var lastOrderId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.last_order_id);
|
|
2554
2648
|
var relationId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_record_id);
|
|
2555
2649
|
var tableFormId = toPositiveString(detail === null || detail === void 0 ? void 0 : detail.form_id);
|
|
2556
2650
|
var formRecord = (_detail$form_record = detail === null || detail === void 0 ? void 0 : detail.form_record) !== null && _detail$form_record !== void 0 ? _detail$form_record : null;
|
|
2557
2651
|
// 是否允许加餐
|
|
2558
|
-
var allowSnack = ((_this$
|
|
2652
|
+
var allowSnack = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 || (_this$otherParams15 = _this$otherParams15.dineInConfig) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15['sale.allow_add_items']) || false;
|
|
2559
2653
|
// 开启同桌验证 - 本期没有这个配置,默认关掉
|
|
2560
2654
|
var deskmateValid = false;
|
|
2561
2655
|
var isExclusive = resourceSelectType === 'single';
|
|
@@ -2638,7 +2732,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2638
2732
|
key: "fetchResourceOccupyDetailsByResourceId",
|
|
2639
2733
|
value: function () {
|
|
2640
2734
|
var _fetchResourceOccupyDetailsByResourceId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId) {
|
|
2641
|
-
var _this$
|
|
2735
|
+
var _this$otherParams16, _this$otherParams16$g, _response$data$occupy, _response$data;
|
|
2642
2736
|
var formRecordId, shopId, response;
|
|
2643
2737
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2644
2738
|
while (1) switch (_context36.prev = _context36.next) {
|
|
@@ -2650,7 +2744,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2650
2744
|
}
|
|
2651
2745
|
throw new Error("[ScanOrder] \u975E\u6CD5\u684C\u53F0 resourceId: ".concat(resourceId));
|
|
2652
2746
|
case 3:
|
|
2653
|
-
shopId = (_this$
|
|
2747
|
+
shopId = (_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16$g = _this$otherParams16.getStateData) === null || _this$otherParams16$g === void 0 ? void 0 : _this$otherParams16$g.call(_this$otherParams16, 'shop_id');
|
|
2654
2748
|
if (shopId) {
|
|
2655
2749
|
_context36.next = 6;
|
|
2656
2750
|
break;
|
|
@@ -2744,18 +2838,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2744
2838
|
var hasOrderId,
|
|
2745
2839
|
normalizedResourceId,
|
|
2746
2840
|
_this$otherParams$bus,
|
|
2747
|
-
_this$otherParams16,
|
|
2748
|
-
_this$otherParams$cha,
|
|
2749
2841
|
_this$otherParams17,
|
|
2842
|
+
_this$otherParams$cha,
|
|
2750
2843
|
_this$otherParams18,
|
|
2751
|
-
_this$
|
|
2844
|
+
_this$otherParams19,
|
|
2845
|
+
_this$otherParams19$g,
|
|
2752
2846
|
_occupyDetails$,
|
|
2753
2847
|
_occupyDetail$form_re,
|
|
2754
2848
|
_occupyDetail$form_re2,
|
|
2755
2849
|
_this$store$order6,
|
|
2756
2850
|
_this$store$order7,
|
|
2757
2851
|
_this$store$order7$ge,
|
|
2758
|
-
_this$
|
|
2852
|
+
_this$otherParams20,
|
|
2759
2853
|
_this$store$resource3,
|
|
2760
2854
|
_this$store$resource4,
|
|
2761
2855
|
businessCode,
|
|
@@ -2813,11 +2907,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
2813
2907
|
resourceId: normalizedResourceId
|
|
2814
2908
|
});
|
|
2815
2909
|
_context37.prev = 3;
|
|
2816
|
-
businessCode = String((_this$otherParams$bus = (_this$
|
|
2817
|
-
channel = String((_this$otherParams$cha = (_this$
|
|
2910
|
+
businessCode = String((_this$otherParams$bus = (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
|
|
2911
|
+
channel = String((_this$otherParams$cha = (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
|
|
2818
2912
|
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2819
2913
|
_context37.next = 9;
|
|
2820
|
-
return (_this$
|
|
2914
|
+
return (_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 || (_this$otherParams19$g = _this$otherParams19.getOpenData) === null || _this$otherParams19$g === void 0 ? void 0 : _this$otherParams19$g.call(_this$otherParams19, {
|
|
2821
2915
|
scope: 'board',
|
|
2822
2916
|
target: openDataTarget,
|
|
2823
2917
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
@@ -3081,7 +3175,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3081
3175
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
3082
3176
|
_context37.next = 79;
|
|
3083
3177
|
return this.setItemRuleRuntimeConfig({
|
|
3084
|
-
serviceType: (_this$
|
|
3178
|
+
serviceType: (_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.businessCode,
|
|
3085
3179
|
submissionIndex: isAdditionalOrderMode ? 1 : 0,
|
|
3086
3180
|
historicalItems: historicalItems
|
|
3087
3181
|
});
|
|
@@ -3207,14 +3301,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3207
3301
|
key: "getProductList",
|
|
3208
3302
|
value: function () {
|
|
3209
3303
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3210
|
-
var _this$
|
|
3304
|
+
var _this$otherParams21;
|
|
3211
3305
|
var associatedMenus, menu_list_ids, res, productList, formattedRes;
|
|
3212
3306
|
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3213
3307
|
while (1) switch (_context40.prev = _context40.next) {
|
|
3214
3308
|
case 0:
|
|
3215
3309
|
this.logMethodStart('getProductList');
|
|
3216
3310
|
// 可以直接通过配置里的 menu 读取
|
|
3217
|
-
associatedMenus = (_this$
|
|
3311
|
+
associatedMenus = (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 || (_this$otherParams21 = _this$otherParams21.dineInConfig) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21['menu.associated_menus'];
|
|
3218
3312
|
menu_list_ids = associatedMenus.map(function (n) {
|
|
3219
3313
|
return Number(n.value);
|
|
3220
3314
|
}) || [];
|
|
@@ -3431,8 +3525,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3431
3525
|
key: "syncAdditionalOrderFromResource",
|
|
3432
3526
|
value: function () {
|
|
3433
3527
|
var _syncAdditionalOrderFromResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(resourceId) {
|
|
3434
|
-
var _ref10, _ref11, _ref12, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$
|
|
3435
|
-
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result;
|
|
3528
|
+
var _ref10, _ref11, _ref12, _this$store$resource5, _this$store$resource6, _occupyDetails$2, _this$store$resource7, _this$otherParams22, _this$store$resource8, _this$store$order8;
|
|
3529
|
+
var tempOrder, normalizedResourceId, _result, occupyDetails, occupyDetail, resourceSelectType, allowAddItems, result, resourceState;
|
|
3436
3530
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3437
3531
|
while (1) switch (_context43.prev = _context43.next) {
|
|
3438
3532
|
case 0:
|
|
@@ -3464,7 +3558,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3464
3558
|
occupyDetails = _context43.sent;
|
|
3465
3559
|
occupyDetail = (_occupyDetails$2 = occupyDetails[0]) !== null && _occupyDetails$2 !== void 0 ? _occupyDetails$2 : null;
|
|
3466
3560
|
resourceSelectType = ((_this$store$resource7 = this.store.resource) === null || _this$store$resource7 === void 0 ? void 0 : _this$store$resource7.resourceSelectType) || this.resolveResourceSelectType(toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id));
|
|
3467
|
-
allowAddItems = toBoolean((_this$
|
|
3561
|
+
allowAddItems = toBoolean((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 || (_this$otherParams22 = _this$otherParams22.dineInConfig) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22['sale.allow_add_items']);
|
|
3468
3562
|
result = this.resolveAdditionalOrderFromOccupyDetail(occupyDetail, resourceSelectType, allowAddItems);
|
|
3469
3563
|
if (!(!result.matched || !result.order_id)) {
|
|
3470
3564
|
_context43.next = 19;
|
|
@@ -3481,6 +3575,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3481
3575
|
tempOrder.resource_id = normalizedResourceId;
|
|
3482
3576
|
tempOrder.relation_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_record_id) || normalizedResourceId || tempOrder.relation_id;
|
|
3483
3577
|
tempOrder.table_form_id = toPositiveString(occupyDetail === null || occupyDetail === void 0 ? void 0 : occupyDetail.form_id) || tempOrder.table_form_id;
|
|
3578
|
+
// 冲突后转加餐需同步模式,否则重试仍会携带整单数据走 checkout。
|
|
3579
|
+
resourceState = (_this$store$resource8 = this.store.resource) !== null && _this$store$resource8 !== void 0 ? _this$store$resource8 : this.normalizeResourceState(occupyDetail, resourceSelectType, true);
|
|
3580
|
+
resourceState.mode = 'additional_order';
|
|
3581
|
+
resourceState.order_id = result.order_id;
|
|
3582
|
+
this.store.resource = resourceState;
|
|
3484
3583
|
(_this$store$order8 = this.store.order) === null || _this$store$order8 === void 0 || _this$store$order8.persistTempOrder();
|
|
3485
3584
|
this.logMethodSuccess('syncAdditionalOrderFromResource', _objectSpread(_objectSpread({}, result), {}, {
|
|
3486
3585
|
resourceId: normalizedResourceId,
|
|
@@ -3488,7 +3587,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3488
3587
|
allowAddItems: allowAddItems
|
|
3489
3588
|
}));
|
|
3490
3589
|
return _context43.abrupt("return", result);
|
|
3491
|
-
case
|
|
3590
|
+
case 30:
|
|
3492
3591
|
case "end":
|
|
3493
3592
|
return _context43.stop();
|
|
3494
3593
|
}
|
|
@@ -3503,9 +3602,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3503
3602
|
}, {
|
|
3504
3603
|
key: "getReservationResourceSelectType",
|
|
3505
3604
|
value: function getReservationResourceSelectType() {
|
|
3506
|
-
var _this$store$
|
|
3605
|
+
var _this$store$resource9;
|
|
3507
3606
|
this.logMethodStart('getReservationResourceSelectType');
|
|
3508
|
-
var resourceSelectType = (_this$store$
|
|
3607
|
+
var resourceSelectType = (_this$store$resource9 = this.store.resource) === null || _this$store$resource9 === void 0 ? void 0 : _this$store$resource9.resourceSelectType;
|
|
3509
3608
|
var result = _objectSpread(_objectSpread({}, resourceSelectType ? {
|
|
3510
3609
|
resourceSelectType: resourceSelectType
|
|
3511
3610
|
} : {}), {}, {
|
|
@@ -3522,9 +3621,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3522
3621
|
}, {
|
|
3523
3622
|
key: "checkAllowAddItems",
|
|
3524
3623
|
value: function checkAllowAddItems() {
|
|
3525
|
-
var _this$
|
|
3624
|
+
var _this$otherParams23;
|
|
3526
3625
|
this.logMethodStart('checkAllowAddItems');
|
|
3527
|
-
var dineInConfig = ((_this$
|
|
3626
|
+
var dineInConfig = ((_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.dineInConfig) || {};
|
|
3528
3627
|
var result = {
|
|
3529
3628
|
enabled: toBoolean(dineInConfig['sale.allow_add_items'])
|
|
3530
3629
|
};
|
|
@@ -3537,9 +3636,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3537
3636
|
}, {
|
|
3538
3637
|
key: "getFulfillmentModes",
|
|
3539
3638
|
value: function getFulfillmentModes() {
|
|
3540
|
-
var _this$
|
|
3639
|
+
var _this$otherParams24;
|
|
3541
3640
|
this.logMethodStart('getFulfillmentModes');
|
|
3542
|
-
var dineInConfig = ((_this$
|
|
3641
|
+
var dineInConfig = ((_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.dineInConfig) || {};
|
|
3543
3642
|
var result = {
|
|
3544
3643
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
3545
3644
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -3553,9 +3652,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
|
3553
3652
|
}, {
|
|
3554
3653
|
key: "checkManualPickupRef",
|
|
3555
3654
|
value: function checkManualPickupRef() {
|
|
3556
|
-
var _this$
|
|
3655
|
+
var _this$otherParams25;
|
|
3557
3656
|
this.logMethodStart('checkManualPickupRef');
|
|
3558
|
-
var dineInConfig = ((_this$
|
|
3657
|
+
var dineInConfig = ((_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.dineInConfig) || {};
|
|
3559
3658
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3560
3659
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3561
3660
|
var enabled = refMode === 'manual_input';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Product = Record<string, any>;
|
|
2
|
+
type Request = {
|
|
3
|
+
get: (url: string, data?: any, options?: any) => Promise<any>;
|
|
4
|
+
post: (url: string, data?: any, options?: any) => Promise<any>;
|
|
5
|
+
};
|
|
6
|
+
export type ScanOrderMenuAvailabilityErrorCode = 'SCAN_ORDER_MENU_UNAVAILABLE' | 'SCAN_ORDER_MENU_VALIDATION_FAILED';
|
|
7
|
+
export declare class ScanOrderMenuAvailabilityError extends Error {
|
|
8
|
+
readonly code: ScanOrderMenuAvailabilityErrorCode;
|
|
9
|
+
readonly productIds: number[];
|
|
10
|
+
constructor(code: ScanOrderMenuAvailabilityErrorCode, productIds?: number[]);
|
|
11
|
+
}
|
|
12
|
+
export type ScanOrderMenuAvailabilityValidator = (products: Product[], productSources?: Product[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Prepare fresh menu definitions without changing ProductList or the cart. The
|
|
15
|
+
* returned validator reads the shop's current time again at the submission boundary.
|
|
16
|
+
*/
|
|
17
|
+
export declare function prepareScanOrderMenuAvailability({ request, menuIds, timezone, products, productSources, }: {
|
|
18
|
+
request: Request;
|
|
19
|
+
menuIds: Array<number | string>;
|
|
20
|
+
timezone: string;
|
|
21
|
+
products: Product[];
|
|
22
|
+
productSources?: Product[];
|
|
23
|
+
}): Promise<ScanOrderMenuAvailabilityValidator>;
|
|
24
|
+
export {};
|