@pisell/pisellos 2.2.243 → 2.2.244
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/model/strategy/adapter/promotion/evaluator.js +2 -3
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/walletPass/utils.js +4 -7
- package/dist/modules/Cart/utils/cartProduct.js +3 -24
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +0 -20
- package/dist/modules/Customer/index.js +83 -172
- package/dist/modules/Customer/types.d.ts +0 -2
- package/dist/modules/Discount/index.js +3 -4
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.d.ts +0 -8
- package/dist/modules/OpenData/index.js +17 -37
- package/dist/modules/Order/index.d.ts +18 -268
- package/dist/modules/Order/index.js +757 -3306
- package/dist/modules/Order/types.d.ts +31 -279
- package/dist/modules/Order/types.js +0 -38
- package/dist/modules/Order/utils.d.ts +5 -147
- package/dist/modules/Order/utils.js +103 -746
- package/dist/modules/Payment/index.d.ts +13 -10
- package/dist/modules/Payment/index.js +837 -467
- package/dist/modules/Payment/types.d.ts +0 -2
- package/dist/modules/Payment/utils.js +1 -2
- package/dist/modules/Payment/walletpass.js +7 -14
- package/dist/modules/ProductList/index.d.ts +12 -16
- package/dist/modules/ProductList/index.js +59 -133
- package/dist/modules/ProductList/types.d.ts +0 -14
- package/dist/modules/Quotation/index.d.ts +1 -0
- package/dist/modules/Quotation/index.js +22 -25
- package/dist/modules/Rules/index.d.ts +0 -4
- package/dist/modules/Rules/index.js +69 -93
- package/dist/modules/Rules/types.d.ts +0 -1
- package/dist/modules/SalesSummary/index.d.ts +25 -8
- package/dist/modules/SalesSummary/index.js +35 -86
- package/dist/modules/SalesSummary/types.d.ts +1 -4
- package/dist/modules/SalesSummary/utils.d.ts +25 -2
- package/dist/modules/SalesSummary/utils.js +162 -794
- package/dist/modules/Schedule/index.d.ts +0 -7
- package/dist/modules/Schedule/index.js +2 -24
- package/dist/modules/Summary/index.js +3 -4
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/request.d.ts +0 -1
- package/dist/server/index.d.ts +1 -204
- package/dist/server/index.js +928 -3658
- package/dist/server/modules/index.d.ts +0 -2
- package/dist/server/modules/index.js +0 -2
- package/dist/server/modules/order/index.d.ts +4 -120
- package/dist/server/modules/order/index.js +483 -1779
- package/dist/server/modules/order/types.d.ts +3 -32
- package/dist/server/modules/order/types.js +0 -8
- package/dist/server/modules/order/utils/filterBookings.js +3 -26
- package/dist/server/modules/order/utils/filterOrders.js +8 -23
- package/dist/server/modules/products/index.d.ts +7 -34
- package/dist/server/modules/products/index.js +317 -631
- package/dist/server/modules/resource/index.d.ts +0 -2
- package/dist/server/modules/resource/index.js +3 -29
- package/dist/server/modules/schedule/index.d.ts +4 -4
- package/dist/server/modules/schedule/index.js +88 -111
- package/dist/solution/BaseSales/index.d.ts +9 -131
- package/dist/solution/BaseSales/index.js +447 -1944
- package/dist/solution/BaseSales/types.d.ts +6 -76
- package/dist/solution/BaseSales/types.js +4 -5
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +24 -105
- package/dist/solution/BaseSales/utils.d.ts +1 -1
- package/dist/solution/BaseSales/utils.js +21 -62
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +10 -270
- package/dist/solution/BookingTicket/index.js +237 -1772
- package/dist/solution/BookingTicket/types.d.ts +1 -118
- package/dist/solution/BookingTicket/types.js +2 -41
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/dist/solution/BookingTicket/utils/bookingStatus.js +0 -70
- package/dist/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/dist/solution/BookingTicket/utils/cartView.js +7 -94
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/scan/index.js +8 -20
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +0 -1
- package/dist/solution/Checkout/index.js +9 -10
- package/dist/solution/RegisterAndLogin/config.js +10 -2
- package/dist/solution/ScanOrder/index.d.ts +3 -9
- package/dist/solution/ScanOrder/index.js +134 -241
- package/dist/solution/ScanOrder/types.d.ts +5 -9
- package/dist/solution/ScanOrder/types.js +3 -2
- package/dist/solution/ScanOrder/utils.d.ts +1 -1
- package/dist/solution/ScanOrder/utils.js +22 -84
- package/dist/solution/VenueBooking/index.d.ts +2 -5
- package/dist/solution/VenueBooking/index.js +59 -110
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/dist/types/index.d.ts +0 -10
- package/lib/model/strategy/adapter/promotion/evaluator.js +1 -2
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/model/strategy/adapter/walletPass/utils.js +2 -3
- package/lib/modules/Cart/utils/cartProduct.js +3 -20
- package/lib/modules/Cart/utils/changePrice.js +20 -12
- package/lib/modules/Customer/index.d.ts +0 -20
- package/lib/modules/Customer/index.js +11 -64
- package/lib/modules/Customer/types.d.ts +0 -2
- package/lib/modules/Discount/index.js +1 -5
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.d.ts +0 -8
- package/lib/modules/OpenData/index.js +5 -19
- package/lib/modules/Order/index.d.ts +18 -268
- package/lib/modules/Order/index.js +344 -2149
- package/lib/modules/Order/types.d.ts +31 -279
- package/lib/modules/Order/types.js +0 -1
- package/lib/modules/Order/utils.d.ts +5 -147
- package/lib/modules/Order/utils.js +46 -614
- package/lib/modules/Payment/index.d.ts +13 -10
- package/lib/modules/Payment/index.js +150 -18
- package/lib/modules/Payment/types.d.ts +0 -2
- package/lib/modules/Payment/utils.js +1 -2
- package/lib/modules/Payment/walletpass.js +3 -7
- package/lib/modules/ProductList/index.d.ts +12 -16
- package/lib/modules/ProductList/index.js +4 -41
- package/lib/modules/ProductList/types.d.ts +0 -14
- package/lib/modules/Quotation/index.d.ts +1 -0
- package/lib/modules/Quotation/index.js +16 -19
- package/lib/modules/Rules/index.d.ts +0 -4
- package/lib/modules/Rules/index.js +120 -136
- package/lib/modules/Rules/types.d.ts +0 -1
- package/lib/modules/SalesSummary/index.d.ts +25 -8
- package/lib/modules/SalesSummary/index.js +4 -30
- package/lib/modules/SalesSummary/types.d.ts +1 -4
- package/lib/modules/SalesSummary/utils.d.ts +25 -2
- package/lib/modules/SalesSummary/utils.js +91 -645
- package/lib/modules/Schedule/index.d.ts +0 -7
- package/lib/modules/Schedule/index.js +1 -17
- package/lib/modules/Summary/index.js +4 -5
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/request.d.ts +0 -1
- package/lib/server/index.d.ts +1 -204
- package/lib/server/index.js +57 -1888
- package/lib/server/modules/index.d.ts +0 -2
- package/lib/server/modules/index.js +0 -3
- package/lib/server/modules/order/index.d.ts +4 -120
- package/lib/server/modules/order/index.js +142 -919
- package/lib/server/modules/order/types.d.ts +3 -32
- package/lib/server/modules/order/utils/filterBookings.js +5 -24
- package/lib/server/modules/order/utils/filterOrders.js +6 -15
- package/lib/server/modules/products/index.d.ts +7 -34
- package/lib/server/modules/products/index.js +54 -189
- package/lib/server/modules/resource/index.d.ts +0 -2
- package/lib/server/modules/resource/index.js +3 -27
- package/lib/server/modules/schedule/index.d.ts +4 -4
- package/lib/server/modules/schedule/index.js +40 -47
- package/lib/solution/BaseSales/index.d.ts +9 -131
- package/lib/solution/BaseSales/index.js +63 -1106
- package/lib/solution/BaseSales/types.d.ts +6 -76
- package/lib/solution/BaseSales/types.js +1 -3
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +0 -1
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +18 -106
- package/lib/solution/BaseSales/utils.d.ts +1 -1
- package/lib/solution/BaseSales/utils.js +10 -54
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +10 -270
- package/lib/solution/BookingTicket/index.js +29 -922
- package/lib/solution/BookingTicket/types.d.ts +1 -118
- package/lib/solution/BookingTicket/types.js +0 -11
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +0 -40
- package/lib/solution/BookingTicket/utils/bookingStatus.js +2 -44
- package/lib/solution/BookingTicket/utils/cartView.d.ts +1 -9
- package/lib/solution/BookingTicket/utils/cartView.js +6 -61
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/scan/index.js +3 -17
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +0 -1
- package/lib/solution/Checkout/index.js +2 -1
- package/lib/solution/RegisterAndLogin/config.js +10 -2
- package/lib/solution/ScanOrder/index.d.ts +3 -9
- package/lib/solution/ScanOrder/index.js +70 -153
- package/lib/solution/ScanOrder/types.d.ts +5 -9
- package/lib/solution/ScanOrder/utils.d.ts +1 -1
- package/lib/solution/ScanOrder/utils.js +17 -83
- package/lib/solution/VenueBooking/index.d.ts +2 -5
- package/lib/solution/VenueBooking/index.js +17 -54
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +2 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +0 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +0 -10
- package/lib/types/index.d.ts +0 -10
- package/package.json +1 -1
- package/dist/modules/BookingContext/index.d.ts +0 -48
- package/dist/modules/BookingContext/index.js +0 -566
- package/dist/modules/BookingContext/types.d.ts +0 -102
- package/dist/modules/BookingContext/types.js +0 -51
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -284
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -145
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -218
- package/dist/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/dist/modules/BookingContext/utils/flexible.js +0 -56
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/dist/modules/BookingContext/utils/formatResourceList.js +0 -38
- package/dist/modules/BookingContext/utils/index.d.ts +0 -11
- package/dist/modules/BookingContext/utils/index.js +0 -11
- package/dist/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/dist/modules/BookingContext/utils/noResource.js +0 -77
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +0 -36
- package/dist/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/dist/modules/BookingContext/utils/productExtend.js +0 -339
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/dist/modules/BookingContext/utils/resourceErrors.js +0 -74
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/dist/modules/BookingContext/utils/resourceSelection.js +0 -24
- package/dist/modules/BookingContext/utils/resources.d.ts +0 -80
- package/dist/modules/BookingContext/utils/resources.js +0 -486
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/dist/modules/BookingContext/utils/serviceTimes.js +0 -151
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/dist/modules/BookingContext/utils/timeSlices.js +0 -100
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/dist/modules/Order/utils/manualProductDiscount.js +0 -210
- package/dist/modules/SurchargeList/index.d.ts +0 -16
- package/dist/modules/SurchargeList/index.js +0 -162
- package/dist/modules/SurchargeList/types.d.ts +0 -11
- package/dist/modules/SurchargeList/types.js +0 -1
- package/dist/server/modules/payment/index.d.ts +0 -28
- package/dist/server/modules/payment/index.js +0 -305
- package/dist/server/modules/payment/types.d.ts +0 -9
- package/dist/server/modules/payment/types.js +0 -1
- package/dist/server/test.json +0 -713
- package/dist/server/utils/small-ticket.d.ts +0 -71
- package/dist/server/utils/small-ticket.js +0 -830
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/dist/solution/BaseSales/utils/cartPromotion.js +0 -1438
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/dist/solution/BaseSales/utils/quotationPrice.js +0 -237
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -346
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +0 -95
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/dist/solution/BookingTicket/utils/exampleData.js +0 -183
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -438
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -399
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -56
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +0 -150
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +0 -78
- package/lib/modules/BookingContext/index.d.ts +0 -48
- package/lib/modules/BookingContext/index.js +0 -368
- package/lib/modules/BookingContext/types.d.ts +0 -102
- package/lib/modules/BookingContext/types.js +0 -34
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +0 -16
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +0 -276
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +0 -8
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +0 -151
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +0 -76
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +0 -201
- package/lib/modules/BookingContext/utils/flexible.d.ts +0 -28
- package/lib/modules/BookingContext/utils/flexible.js +0 -80
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +0 -8
- package/lib/modules/BookingContext/utils/formatResourceList.js +0 -50
- package/lib/modules/BookingContext/utils/index.d.ts +0 -11
- package/lib/modules/BookingContext/utils/index.js +0 -43
- package/lib/modules/BookingContext/utils/noResource.d.ts +0 -13
- package/lib/modules/BookingContext/utils/noResource.js +0 -90
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +0 -1
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +0 -56
- package/lib/modules/BookingContext/utils/productExtend.d.ts +0 -72
- package/lib/modules/BookingContext/utils/productExtend.js +0 -283
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +0 -41
- package/lib/modules/BookingContext/utils/resourceErrors.js +0 -80
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +0 -7
- package/lib/modules/BookingContext/utils/resourceSelection.js +0 -46
- package/lib/modules/BookingContext/utils/resources.d.ts +0 -80
- package/lib/modules/BookingContext/utils/resources.js +0 -377
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +0 -55
- package/lib/modules/BookingContext/utils/serviceTimes.js +0 -162
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +0 -42
- package/lib/modules/BookingContext/utils/timeSlices.js +0 -124
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +0 -106
- package/lib/modules/Order/utils/manualProductDiscount.js +0 -206
- package/lib/modules/SurchargeList/index.d.ts +0 -16
- package/lib/modules/SurchargeList/index.js +0 -89
- package/lib/modules/SurchargeList/types.d.ts +0 -11
- package/lib/modules/SurchargeList/types.js +0 -17
- package/lib/server/modules/payment/index.d.ts +0 -28
- package/lib/server/modules/payment/index.js +0 -192
- package/lib/server/modules/payment/types.d.ts +0 -9
- package/lib/server/modules/payment/types.js +0 -17
- package/lib/server/test.json +0 -713
- package/lib/server/utils/small-ticket.d.ts +0 -71
- package/lib/server/utils/small-ticket.js +0 -781
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +0 -287
- package/lib/solution/BaseSales/utils/cartPromotion.js +0 -992
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +0 -7
- package/lib/solution/BaseSales/utils/quotationPrice.js +0 -277
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +0 -117
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -318
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +0 -35
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +0 -125
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +0 -123
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +0 -185
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +0 -254
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -36
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +0 -168
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +0 -32
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +0 -51
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +0 -21
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +0 -127
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +0 -23
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +0 -85
|
@@ -2,15 +2,15 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
2
2
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
4
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
5
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
6
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
9
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
-
function
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
13
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
15
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -37,7 +37,7 @@ import { createModule } from "../BookingByStep/types";
|
|
|
37
37
|
import { ProductList } from "../../modules/ProductList";
|
|
38
38
|
import { ScheduleModule } from "../../modules/Schedule";
|
|
39
39
|
import { getDateIsInSchedule } from "../../modules/Schedule/getDateIsInSchedule";
|
|
40
|
-
import { composeLinePrice, createUuidV4,
|
|
40
|
+
import { composeLinePrice, createUuidV4, normalizeSubmitCollectPaxValue, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
41
41
|
import dayjs from 'dayjs';
|
|
42
42
|
import { ItemRuleEvaluator } from "../../model/strategy/adapter/itemRule";
|
|
43
43
|
export * from "./types";
|
|
@@ -94,50 +94,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
94
94
|
moduleName: 'scanOrder'
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "safeStringify",
|
|
99
|
-
value: function safeStringify(value) {
|
|
100
|
-
try {
|
|
101
|
-
return JSON.stringify(value);
|
|
102
|
-
} catch (_unused) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "pickErrorMessage",
|
|
108
|
-
value: function pickErrorMessage(error) {
|
|
109
|
-
var _error$data, _error$response, _error$error;
|
|
110
|
-
var candidates = [error.message, (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.message, (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message];
|
|
111
|
-
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
112
|
-
var candidate = _candidates[_i];
|
|
113
|
-
if (typeof candidate === 'string' && candidate.trim()) return candidate;
|
|
114
|
-
}
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
97
|
}, {
|
|
118
98
|
key: "serializeError",
|
|
119
99
|
value: function serializeError(error) {
|
|
120
100
|
if (error instanceof Error) {
|
|
121
|
-
return {
|
|
101
|
+
return JSON.stringify({
|
|
122
102
|
name: error.name,
|
|
123
103
|
message: error.message,
|
|
124
104
|
stack: error.stack
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
if (error && _typeof(error) === 'object') {
|
|
128
|
-
var raw = error;
|
|
129
|
-
var message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
|
|
130
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof raw.name === 'string' ? {
|
|
131
|
-
name: raw.name
|
|
132
|
-
} : {}), {}, {
|
|
133
|
-
message: message
|
|
134
|
-
}, 'code' in raw ? {
|
|
135
|
-
code: raw.code
|
|
136
|
-
} : {}), 'status' in raw ? {
|
|
137
|
-
status: raw.status
|
|
138
|
-
} : {}), this.safeStringify(raw) ? {
|
|
139
|
-
raw: this.safeStringify(raw)
|
|
140
|
-
} : {});
|
|
105
|
+
});
|
|
141
106
|
}
|
|
142
107
|
return {
|
|
143
108
|
message: String(error)
|
|
@@ -227,16 +192,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
227
192
|
})
|
|
228
193
|
});
|
|
229
194
|
}
|
|
230
|
-
}, {
|
|
231
|
-
key: "assertProductListLoaded",
|
|
232
|
-
value: function assertProductListLoaded(method, result) {
|
|
233
|
-
var payload = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
234
|
-
if (Array.isArray(result)) return result;
|
|
235
|
-
var error = result instanceof Error ? result : new Error('商品列表接口返回异常');
|
|
236
|
-
this.logMethodError(method, error, payload);
|
|
237
|
-
error.__scanOrderLogged = true;
|
|
238
|
-
throw error;
|
|
239
|
-
}
|
|
240
195
|
}, {
|
|
241
196
|
key: "addLog",
|
|
242
197
|
value: function () {
|
|
@@ -273,8 +228,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
273
228
|
value: function resolveCustomerIdFromLoginPayload(payload) {
|
|
274
229
|
var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
|
|
275
230
|
var candidates = [payload === null || payload === void 0 ? void 0 : payload.customerId, payload === null || payload === void 0 ? void 0 : payload.customer_id, payload === null || payload === void 0 ? void 0 : payload.id, payload === null || payload === void 0 || (_payload$user = payload.user) === null || _payload$user === void 0 ? void 0 : _payload$user.customerId, payload === null || payload === void 0 || (_payload$user2 = payload.user) === null || _payload$user2 === void 0 ? void 0 : _payload$user2.customer_id, payload === null || payload === void 0 || (_payload$user3 = payload.user) === null || _payload$user3 === void 0 ? void 0 : _payload$user3.id, payload === null || payload === void 0 || (_payload$user4 = payload.user) === null || _payload$user4 === void 0 || (_payload$user4 = _payload$user4._origin) === null || _payload$user4 === void 0 ? void 0 : _payload$user4.customer_id, payload === null || payload === void 0 || (_payload$account = payload.account) === null || _payload$account === void 0 ? void 0 : _payload$account.customerId, payload === null || payload === void 0 || (_payload$account2 = payload.account) === null || _payload$account2 === void 0 ? void 0 : _payload$account2.customer_id, payload === null || payload === void 0 || (_payload$account3 = payload.account) === null || _payload$account3 === void 0 ? void 0 : _payload$account3.id, payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.customer_id];
|
|
276
|
-
for (var
|
|
277
|
-
var candidate =
|
|
231
|
+
for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
|
|
232
|
+
var candidate = _candidates[_i];
|
|
278
233
|
var customerId = this.normalizeCustomerId(candidate);
|
|
279
234
|
if (customerId) return customerId;
|
|
280
235
|
}
|
|
@@ -444,18 +399,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
444
399
|
key: "destroyRegisteredChildModules",
|
|
445
400
|
value: function () {
|
|
446
401
|
var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
447
|
-
var modules,
|
|
402
|
+
var modules, _i2, _modules, mod;
|
|
448
403
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
449
404
|
while (1) switch (_context6.prev = _context6.next) {
|
|
450
405
|
case 0:
|
|
451
406
|
modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
|
|
452
|
-
|
|
407
|
+
_i2 = 0, _modules = modules;
|
|
453
408
|
case 2:
|
|
454
|
-
if (!(
|
|
409
|
+
if (!(_i2 < _modules.length)) {
|
|
455
410
|
_context6.next = 10;
|
|
456
411
|
break;
|
|
457
412
|
}
|
|
458
|
-
mod = _modules[
|
|
413
|
+
mod = _modules[_i2];
|
|
459
414
|
if (!(mod && typeof mod.destroy === 'function')) {
|
|
460
415
|
_context6.next = 7;
|
|
461
416
|
break;
|
|
@@ -463,7 +418,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
463
418
|
_context6.next = 7;
|
|
464
419
|
return Promise.resolve(mod.destroy());
|
|
465
420
|
case 7:
|
|
466
|
-
|
|
421
|
+
_i2++;
|
|
467
422
|
_context6.next = 2;
|
|
468
423
|
break;
|
|
469
424
|
case 10:
|
|
@@ -537,13 +492,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
537
492
|
var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
|
|
538
493
|
_this4.store[step] = targetModule;
|
|
539
494
|
var initialState = step === 'salesSummary' ? {
|
|
495
|
+
// TODO(Order types): ScanOrder runtime should read OrderState.summary instead of tempOrder.summary.
|
|
540
496
|
summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
|
|
541
497
|
} : {};
|
|
542
498
|
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
|
|
543
499
|
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
|
|
544
500
|
feishu: {
|
|
545
|
-
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed'
|
|
546
|
-
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
|
|
501
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed'
|
|
547
502
|
}
|
|
548
503
|
};
|
|
549
504
|
_this4.core.registerModule(targetModule, {
|
|
@@ -1198,7 +1153,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1198
1153
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
1199
1154
|
return sum + (pd.amount || 0);
|
|
1200
1155
|
}, 0);
|
|
1201
|
-
optionSum = sumOptionUnitPrice(
|
|
1156
|
+
optionSum = sumOptionUnitPrice(product.product_option_item);
|
|
1202
1157
|
sourcePrice = (_product$metadata$sou = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.main_product_original_price) != null ? new Decimal(Number(product.metadata.main_product_original_price) || 0).minus(optionSum).toFixed(2) : (_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : '0';
|
|
1203
1158
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
1204
1159
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
@@ -1293,50 +1248,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1293
1248
|
return _onCustomerLogin.apply(this, arguments);
|
|
1294
1249
|
}
|
|
1295
1250
|
return onCustomerLogin;
|
|
1296
|
-
}()
|
|
1297
|
-
}, {
|
|
1298
|
-
key: "findReservationRuleResource",
|
|
1299
|
-
value: function findReservationRuleResource(formId) {
|
|
1300
|
-
if (formId == null) return undefined;
|
|
1301
|
-
var numericFormId = Number(formId);
|
|
1302
|
-
if (!Number.isFinite(numericFormId) || numericFormId <= 0) return undefined;
|
|
1303
|
-
var _iterator4 = _createForOfIteratorHelper(this.enabledReservationRuleProducts),
|
|
1304
|
-
_step4;
|
|
1305
|
-
try {
|
|
1306
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1307
|
-
var _product$product_reso;
|
|
1308
|
-
var product = _step4.value;
|
|
1309
|
-
var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
|
|
1310
|
-
if (!Array.isArray(resources)) continue;
|
|
1311
|
-
var matched = resources.find(function (resource) {
|
|
1312
|
-
return Number(resource === null || resource === void 0 ? void 0 : resource.id) === numericFormId;
|
|
1313
|
-
});
|
|
1314
|
-
if (matched) return matched;
|
|
1315
|
-
}
|
|
1316
|
-
} catch (err) {
|
|
1317
|
-
_iterator4.e(err);
|
|
1318
|
-
} finally {
|
|
1319
|
-
_iterator4.f();
|
|
1320
|
-
}
|
|
1321
|
-
return undefined;
|
|
1322
|
-
}
|
|
1323
|
-
}, {
|
|
1324
|
-
key: "buildScanOrderResourceMetadata",
|
|
1325
|
-
value: function buildScanOrderResourceMetadata(params) {
|
|
1326
|
-
var _ruleResource$title;
|
|
1327
|
-
var resourceState = params.resourceState,
|
|
1328
|
-
resourceName = params.resourceName;
|
|
1329
|
-
var ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
|
|
1330
|
-
var combined = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.combined_resource;
|
|
1331
|
-
var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
|
|
1332
|
-
return {
|
|
1333
|
-
form_name: (_ruleResource$title = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.title) !== null && _ruleResource$title !== void 0 ? _ruleResource$title : '',
|
|
1334
|
-
resource_name: resourceName,
|
|
1335
|
-
combined_resource: isCombined ? combined : null
|
|
1336
|
-
};
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
// ScanOrder 提交 payload enhancer:
|
|
1251
|
+
}() // ScanOrder 提交 payload enhancer:
|
|
1340
1252
|
// - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
|
|
1341
1253
|
// - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
|
|
1342
1254
|
// - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
|
|
@@ -1349,7 +1261,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1349
1261
|
var resourceState = this.store.resource;
|
|
1350
1262
|
var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
|
|
1351
1263
|
|
|
1352
|
-
//
|
|
1264
|
+
// single 预约独占整张桌台,capacity 取 form_record.capacity;其他情况(multiple / capacity / undefined)占 1 个容量位
|
|
1353
1265
|
var resolveResourceCapacity = function resolveResourceCapacity() {
|
|
1354
1266
|
if (resourceSelectType === 'single') {
|
|
1355
1267
|
var _resourceState$table_;
|
|
@@ -1361,13 +1273,11 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1361
1273
|
return 1;
|
|
1362
1274
|
};
|
|
1363
1275
|
return function (payload, _ref3) {
|
|
1364
|
-
var _resource_id,
|
|
1276
|
+
var _resource_id, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _tempOrder$metadata, _pickFirstCustomCapac;
|
|
1365
1277
|
var bookingUuid = _ref3.bookingUuid,
|
|
1366
1278
|
tempOrder = _ref3.tempOrder;
|
|
1279
|
+
// TODO(Order types): ScanOrder resource runtime should come from ScanOrder store only.
|
|
1367
1280
|
var resourceId = (_resource_id = tempOrder.resource_id) !== null && _resource_id !== void 0 ? _resource_id : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
|
|
1368
|
-
var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
|
|
1369
|
-
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1370
|
-
var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1371
1281
|
var pickOriginal = function pickOriginal(value) {
|
|
1372
1282
|
if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
|
|
1373
1283
|
var original = value.original;
|
|
@@ -1383,21 +1293,22 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1383
1293
|
main_field: mainField,
|
|
1384
1294
|
form_id: resourceState.tableFormId,
|
|
1385
1295
|
relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
|
|
1386
|
-
capacity:
|
|
1387
|
-
metadata:
|
|
1388
|
-
resourceState: resourceState,
|
|
1389
|
-
resourceName: mainField
|
|
1390
|
-
})
|
|
1296
|
+
capacity: resolveResourceCapacity(),
|
|
1297
|
+
metadata: {}
|
|
1391
1298
|
} : undefined;
|
|
1392
1299
|
var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
|
|
1393
|
-
//
|
|
1394
|
-
var
|
|
1300
|
+
// 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax 时 value 优先用人数
|
|
1301
|
+
var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
|
|
1302
|
+
var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
|
|
1303
|
+
var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
|
|
1395
1304
|
var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
|
|
1396
1305
|
var nextBookings = (payload.bookings || []).map(function (booking, idx) {
|
|
1306
|
+
var _booking$metadata$hol, _booking$metadata;
|
|
1397
1307
|
return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
|
|
1398
|
-
number: bookingCapacityValue,
|
|
1399
1308
|
appointment_status: 'started',
|
|
1400
|
-
metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}),
|
|
1309
|
+
metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), {}, {
|
|
1310
|
+
holder_id: (_booking$metadata$hol = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : null
|
|
1311
|
+
}, resourceSelectType ? {
|
|
1401
1312
|
resource_select_type: resourceSelectType
|
|
1402
1313
|
} : {}), resourceSelectType ? {
|
|
1403
1314
|
capacity: [{
|
|
@@ -1413,7 +1324,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1413
1324
|
} : {});
|
|
1414
1325
|
});
|
|
1415
1326
|
var nextProducts = _toConsumableArray(payload.products || []);
|
|
1416
|
-
//
|
|
1327
|
+
// 编辑已有订单时,后端会通过 order_id 判断更新;原单已含 booking 规则行,勿再追加虚拟规则商品
|
|
1417
1328
|
if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
|
|
1418
1329
|
var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
|
|
1419
1330
|
var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
|
|
@@ -1426,9 +1337,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1426
1337
|
original_price: originalPrice,
|
|
1427
1338
|
payment_price: sellingPrice,
|
|
1428
1339
|
is_charge_tax: (_ruleProduct$is_gst = ruleProduct.is_gst) !== null && _ruleProduct$is_gst !== void 0 ? _ruleProduct$is_gst : 0,
|
|
1429
|
-
|
|
1430
|
-
option: []
|
|
1431
|
-
},
|
|
1340
|
+
product_option_item: [],
|
|
1432
1341
|
discount_list: [],
|
|
1433
1342
|
product_bundle: [],
|
|
1434
1343
|
booking_uid: bookingUuid,
|
|
@@ -1561,14 +1470,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1561
1470
|
return addProductToOrder;
|
|
1562
1471
|
}()
|
|
1563
1472
|
}, {
|
|
1564
|
-
key: "
|
|
1473
|
+
key: "updateProductInOrder",
|
|
1565
1474
|
value: function () {
|
|
1566
|
-
var
|
|
1475
|
+
var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
|
|
1567
1476
|
var products;
|
|
1568
1477
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1569
1478
|
while (1) switch (_context19.prev = _context19.next) {
|
|
1570
1479
|
case 0:
|
|
1571
|
-
this.logMethodStart('
|
|
1480
|
+
this.logMethodStart('updateProductInOrder', {
|
|
1572
1481
|
product_id: params.product_id,
|
|
1573
1482
|
product_variant_id: params.product_variant_id
|
|
1574
1483
|
});
|
|
@@ -1580,7 +1489,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1580
1489
|
throw new Error('order 模块未初始化');
|
|
1581
1490
|
case 4:
|
|
1582
1491
|
_context19.next = 6;
|
|
1583
|
-
return this.store.order.
|
|
1492
|
+
return this.store.order.updateProductInOrder(params);
|
|
1584
1493
|
case 6:
|
|
1585
1494
|
products = _context19.sent;
|
|
1586
1495
|
_context19.next = 9;
|
|
@@ -1589,14 +1498,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1589
1498
|
_context19.next = 11;
|
|
1590
1499
|
return this.refreshCartValidationPassed();
|
|
1591
1500
|
case 11:
|
|
1592
|
-
this.logMethodSuccess('
|
|
1501
|
+
this.logMethodSuccess('updateProductInOrder', {
|
|
1593
1502
|
productCount: products.length
|
|
1594
1503
|
});
|
|
1595
1504
|
return _context19.abrupt("return", products);
|
|
1596
1505
|
case 15:
|
|
1597
1506
|
_context19.prev = 15;
|
|
1598
1507
|
_context19.t0 = _context19["catch"](1);
|
|
1599
|
-
this.logMethodError('
|
|
1508
|
+
this.logMethodError('updateProductInOrder', _context19.t0);
|
|
1600
1509
|
throw _context19.t0;
|
|
1601
1510
|
case 19:
|
|
1602
1511
|
case "end":
|
|
@@ -1604,10 +1513,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1604
1513
|
}
|
|
1605
1514
|
}, _callee19, this, [[1, 15]]);
|
|
1606
1515
|
}));
|
|
1607
|
-
function
|
|
1608
|
-
return
|
|
1516
|
+
function updateProductInOrder(_x11) {
|
|
1517
|
+
return _updateProductInOrder.apply(this, arguments);
|
|
1609
1518
|
}
|
|
1610
|
-
return
|
|
1519
|
+
return updateProductInOrder;
|
|
1611
1520
|
}()
|
|
1612
1521
|
/**
|
|
1613
1522
|
* 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
|
|
@@ -1633,13 +1542,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1633
1542
|
note: String(note || '')
|
|
1634
1543
|
}
|
|
1635
1544
|
};
|
|
1636
|
-
if (identity.identity_key !== undefined)
|
|
1637
|
-
|
|
1638
|
-
params.
|
|
1545
|
+
if (identity.identity_key !== undefined) {
|
|
1546
|
+
// TODO(Order types): ScanOrder identity callers should pass unique_identification_number.
|
|
1547
|
+
params.identity_key = identity.identity_key;
|
|
1548
|
+
}
|
|
1549
|
+
if (identity.product_option_item !== undefined) {
|
|
1550
|
+
params.product_option_item = identity.product_option_item;
|
|
1639
1551
|
}
|
|
1640
1552
|
if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
|
|
1641
1553
|
_context20.next = 8;
|
|
1642
|
-
return this.
|
|
1554
|
+
return this.updateProductInOrder(params);
|
|
1643
1555
|
case 8:
|
|
1644
1556
|
products = _context20.sent;
|
|
1645
1557
|
this.logMethodSuccess('setOrderProductLineNote', {
|
|
@@ -1872,17 +1784,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1872
1784
|
if (visited.has(value)) return;
|
|
1873
1785
|
visited.add(value);
|
|
1874
1786
|
if (Array.isArray(value)) {
|
|
1875
|
-
var
|
|
1876
|
-
|
|
1787
|
+
var _iterator4 = _createForOfIteratorHelper(value),
|
|
1788
|
+
_step4;
|
|
1877
1789
|
try {
|
|
1878
|
-
for (
|
|
1879
|
-
var item =
|
|
1790
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
1791
|
+
var item = _step4.value;
|
|
1880
1792
|
collectFromValue(item);
|
|
1881
1793
|
}
|
|
1882
1794
|
} catch (err) {
|
|
1883
|
-
|
|
1795
|
+
_iterator4.e(err);
|
|
1884
1796
|
} finally {
|
|
1885
|
-
|
|
1797
|
+
_iterator4.f();
|
|
1886
1798
|
}
|
|
1887
1799
|
return;
|
|
1888
1800
|
}
|
|
@@ -1898,8 +1810,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1898
1810
|
sourceMap.set(key, node);
|
|
1899
1811
|
}
|
|
1900
1812
|
}
|
|
1901
|
-
for (var
|
|
1902
|
-
var childValue = _Object$values[
|
|
1813
|
+
for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
|
|
1814
|
+
var childValue = _Object$values[_i3];
|
|
1903
1815
|
if (childValue && _typeof(childValue) === 'object') {
|
|
1904
1816
|
collectFromValue(childValue);
|
|
1905
1817
|
}
|
|
@@ -2043,7 +1955,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2043
1955
|
key: "applyPrefillByItemRule",
|
|
2044
1956
|
value: function () {
|
|
2045
1957
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
2046
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
1958
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator5, _step5, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
|
|
2047
1959
|
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2048
1960
|
while (1) switch (_context29.prev = _context29.next) {
|
|
2049
1961
|
case 0:
|
|
@@ -2088,15 +2000,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2088
2000
|
productSourceMap = _context29.sent;
|
|
2089
2001
|
tempOrder = this.ensureTempOrder();
|
|
2090
2002
|
hasChanges = false;
|
|
2091
|
-
|
|
2003
|
+
_iterator5 = _createForOfIteratorHelper(prefillItems);
|
|
2092
2004
|
_context29.prev = 20;
|
|
2093
|
-
|
|
2005
|
+
_iterator5.s();
|
|
2094
2006
|
case 22:
|
|
2095
|
-
if ((
|
|
2007
|
+
if ((_step5 = _iterator5.n()).done) {
|
|
2096
2008
|
_context29.next = 47;
|
|
2097
2009
|
break;
|
|
2098
2010
|
}
|
|
2099
|
-
prefillItem =
|
|
2011
|
+
prefillItem = _step5.value;
|
|
2100
2012
|
productId = Number(prefillItem.product_id);
|
|
2101
2013
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2102
2014
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2150,6 +2062,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2150
2062
|
item_rule_prefill: true,
|
|
2151
2063
|
item_rule_id: prefillItem.ruleId
|
|
2152
2064
|
}),
|
|
2065
|
+
// TODO(Order types): migrate ScanOrder prefill origin runtime into tempOrder._extend.
|
|
2153
2066
|
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
2154
2067
|
});
|
|
2155
2068
|
hasQuantityChanged = delta > 0;
|
|
@@ -2167,10 +2080,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2167
2080
|
case 49:
|
|
2168
2081
|
_context29.prev = 49;
|
|
2169
2082
|
_context29.t0 = _context29["catch"](20);
|
|
2170
|
-
|
|
2083
|
+
_iterator5.e(_context29.t0);
|
|
2171
2084
|
case 52:
|
|
2172
2085
|
_context29.prev = 52;
|
|
2173
|
-
|
|
2086
|
+
_iterator5.f();
|
|
2174
2087
|
return _context29.finish(52);
|
|
2175
2088
|
case 55:
|
|
2176
2089
|
if (!hasChanges) {
|
|
@@ -2558,7 +2471,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2558
2471
|
key: "checkResourceAvailable",
|
|
2559
2472
|
value: function () {
|
|
2560
2473
|
var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
|
|
2561
|
-
var _this$
|
|
2474
|
+
var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
|
|
2562
2475
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2563
2476
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2564
2477
|
case 0:
|
|
@@ -2566,28 +2479,25 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2566
2479
|
resourceId: resourceId
|
|
2567
2480
|
});
|
|
2568
2481
|
_context36.prev = 1;
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
|
|
2572
|
-
_context36.next = 7;
|
|
2573
|
-
return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
|
|
2482
|
+
_context36.next = 4;
|
|
2483
|
+
return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
|
|
2574
2484
|
scope: 'board',
|
|
2575
|
-
target:
|
|
2485
|
+
target: 'dine_in+scan_to_order',
|
|
2576
2486
|
section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
|
|
2577
2487
|
});
|
|
2578
|
-
case
|
|
2488
|
+
case 4:
|
|
2579
2489
|
openData = _context36.sent;
|
|
2580
2490
|
if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
|
|
2581
|
-
_context36.next =
|
|
2491
|
+
_context36.next = 7;
|
|
2582
2492
|
break;
|
|
2583
2493
|
}
|
|
2584
2494
|
throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
|
|
2585
|
-
case
|
|
2495
|
+
case 7:
|
|
2586
2496
|
dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
|
|
2587
2497
|
this.otherParams.dineInConfig = dineInConfig;
|
|
2588
|
-
_context36.next =
|
|
2498
|
+
_context36.next = 11;
|
|
2589
2499
|
return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
|
|
2590
|
-
case
|
|
2500
|
+
case 11:
|
|
2591
2501
|
closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
|
|
2592
2502
|
closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
|
|
2593
2503
|
basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
|
|
@@ -2604,21 +2514,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2604
2514
|
};
|
|
2605
2515
|
}; // 1. 基础开关 basic.enable 关闭
|
|
2606
2516
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
|
|
2607
|
-
_context36.next =
|
|
2517
|
+
_context36.next = 18;
|
|
2608
2518
|
break;
|
|
2609
2519
|
}
|
|
2610
2520
|
return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
|
|
2611
|
-
case
|
|
2521
|
+
case 18:
|
|
2612
2522
|
if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
|
|
2613
|
-
_context36.next =
|
|
2523
|
+
_context36.next = 21;
|
|
2614
2524
|
break;
|
|
2615
2525
|
}
|
|
2616
2526
|
if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
|
|
2617
|
-
_context36.next =
|
|
2527
|
+
_context36.next = 21;
|
|
2618
2528
|
break;
|
|
2619
2529
|
}
|
|
2620
2530
|
return _context36.abrupt("return", makeShopClosed(pauseMessage));
|
|
2621
|
-
case
|
|
2531
|
+
case 21:
|
|
2622
2532
|
// 3. 营业时间 operating_hours 闸门
|
|
2623
2533
|
operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
|
|
2624
2534
|
return Number(id);
|
|
@@ -2634,27 +2544,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2634
2544
|
}
|
|
2635
2545
|
}
|
|
2636
2546
|
if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
|
|
2637
|
-
_context36.next =
|
|
2547
|
+
_context36.next = 26;
|
|
2638
2548
|
break;
|
|
2639
2549
|
}
|
|
2640
2550
|
return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
|
|
2641
|
-
case
|
|
2551
|
+
case 26:
|
|
2642
2552
|
// Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
|
|
2643
2553
|
// (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
|
|
2644
2554
|
tempOrder = this.ensureTempOrder();
|
|
2645
2555
|
reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
|
|
2646
2556
|
if (!(reservationLinkIds.length === 0)) {
|
|
2647
|
-
_context36.next =
|
|
2557
|
+
_context36.next = 32;
|
|
2648
2558
|
break;
|
|
2649
2559
|
}
|
|
2650
2560
|
this.enabledReservationRuleProducts = [];
|
|
2651
|
-
_context36.next =
|
|
2561
|
+
_context36.next = 43;
|
|
2652
2562
|
break;
|
|
2653
|
-
case
|
|
2563
|
+
case 32:
|
|
2654
2564
|
tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
|
|
2655
2565
|
delete tempOrder.metadata.table_occupancy_duration;
|
|
2656
2566
|
reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
|
|
2657
|
-
_context36.next =
|
|
2567
|
+
_context36.next = 37;
|
|
2658
2568
|
return reservationProductList.initialize(this.core, {
|
|
2659
2569
|
store: {
|
|
2660
2570
|
list: [],
|
|
@@ -2666,17 +2576,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2666
2576
|
cacheId: this.cacheId
|
|
2667
2577
|
})
|
|
2668
2578
|
});
|
|
2669
|
-
case
|
|
2579
|
+
case 37:
|
|
2670
2580
|
scheduleDate = dayjs().format('YYYY-MM-DD');
|
|
2671
2581
|
scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
2672
|
-
_context36.next =
|
|
2582
|
+
_context36.next = 41;
|
|
2673
2583
|
return reservationProductList.loadProducts({
|
|
2674
2584
|
product_ids: reservationLinkIds,
|
|
2675
2585
|
schedule_date: scheduleDate,
|
|
2676
2586
|
schedule_datetime: scheduleDatetime,
|
|
2677
2587
|
cacheId: this.cacheId
|
|
2678
2588
|
});
|
|
2679
|
-
case
|
|
2589
|
+
case 41:
|
|
2680
2590
|
loaded = _context36.sent;
|
|
2681
2591
|
if (Array.isArray(loaded)) {
|
|
2682
2592
|
this.enabledReservationRuleProducts = loaded;
|
|
@@ -2692,19 +2602,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2692
2602
|
}
|
|
2693
2603
|
} else {
|
|
2694
2604
|
this.enabledReservationRuleProducts = [];
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2605
|
+
void this.addScanOrderLog({
|
|
2606
|
+
level: 'error',
|
|
2607
|
+
title: '[ScanOrder] enabled_reservation_rules product query failed',
|
|
2608
|
+
payload: {
|
|
2609
|
+
linkIds: reservationLinkIds,
|
|
2610
|
+
error: this.serializeError(loaded)
|
|
2611
|
+
}
|
|
2702
2612
|
});
|
|
2703
2613
|
}
|
|
2704
|
-
case
|
|
2705
|
-
_context36.next =
|
|
2614
|
+
case 43:
|
|
2615
|
+
_context36.next = 45;
|
|
2706
2616
|
return this.fetchResourceOccupyDetailByResourceId(resourceId);
|
|
2707
|
-
case
|
|
2617
|
+
case 45:
|
|
2708
2618
|
occupyDetail = _context36.sent;
|
|
2709
2619
|
// Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
|
|
2710
2620
|
// 计算当前桌台的 resourceSelectType(single/multiple/capacity)
|
|
@@ -2737,33 +2647,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2737
2647
|
requestPaxMin: this.store.resource.requestPaxMin
|
|
2738
2648
|
} : {}), this.store.resource.requestPaxMax !== undefined ? {
|
|
2739
2649
|
requestPaxMax: this.store.resource.requestPaxMax
|
|
2740
|
-
} : {});
|
|
2741
|
-
tempOrder.relation_id = resourceId || ((_this$
|
|
2650
|
+
} : {}); // TODO(Order types): keep ScanOrder resource runtime out of OrderTempOrder root.
|
|
2651
|
+
tempOrder.relation_id = resourceId || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.relation_id);
|
|
2742
2652
|
tempOrder.table_form_id = resourceState.tableFormId;
|
|
2743
2653
|
tempOrder.resource_id = resourceId;
|
|
2744
2654
|
(_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
|
|
2745
2655
|
|
|
2746
2656
|
// 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
|
|
2747
2657
|
if (!(availabilityInfo.mode === 'idle')) {
|
|
2748
|
-
_context36.next =
|
|
2658
|
+
_context36.next = 60;
|
|
2749
2659
|
break;
|
|
2750
2660
|
}
|
|
2751
|
-
_context36.next =
|
|
2661
|
+
_context36.next = 60;
|
|
2752
2662
|
return this.addNewOrder();
|
|
2753
|
-
case
|
|
2754
|
-
// 如果是加单模式,tempOrder
|
|
2663
|
+
case 60:
|
|
2664
|
+
// 如果是加单模式,tempOrder 里需要记录 lastOrderId;提交仍走统一 sales checkout 接口
|
|
2755
2665
|
if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
|
|
2756
2666
|
tempOrder.order_id = resourceState.lastOrderId;
|
|
2757
2667
|
}
|
|
2758
2668
|
if (!tempOrder.order_id) {
|
|
2759
|
-
_context36.next =
|
|
2669
|
+
_context36.next = 69;
|
|
2760
2670
|
break;
|
|
2761
2671
|
}
|
|
2762
|
-
_context36.next =
|
|
2763
|
-
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.
|
|
2764
|
-
|
|
2765
|
-
});
|
|
2766
|
-
case 67:
|
|
2672
|
+
_context36.next = 64;
|
|
2673
|
+
return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
|
|
2674
|
+
case 64:
|
|
2767
2675
|
res = _context36.sent;
|
|
2768
2676
|
// 找到下单的时候输入的 entryPaxNumber
|
|
2769
2677
|
entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
|
|
@@ -2771,12 +2679,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2771
2679
|
return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
|
|
2772
2680
|
})) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
|
|
2773
2681
|
if (!entryPaxNumber) {
|
|
2774
|
-
_context36.next =
|
|
2682
|
+
_context36.next = 69;
|
|
2775
2683
|
break;
|
|
2776
2684
|
}
|
|
2777
|
-
_context36.next =
|
|
2685
|
+
_context36.next = 69;
|
|
2778
2686
|
return this.setEntryPaxNumber(entryPaxNumber);
|
|
2779
|
-
case
|
|
2687
|
+
case 69:
|
|
2780
2688
|
lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
|
|
2781
2689
|
historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
|
|
2782
2690
|
if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
|
|
@@ -2788,13 +2696,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2788
2696
|
} : {}));
|
|
2789
2697
|
return acc;
|
|
2790
2698
|
}, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
|
|
2791
|
-
_context36.next =
|
|
2699
|
+
_context36.next = 73;
|
|
2792
2700
|
return this.setItemRuleRuntimeConfig({
|
|
2793
|
-
serviceType: (_this$
|
|
2701
|
+
serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
|
|
2794
2702
|
submissionIndex: hasOrderId ? 1 : 0,
|
|
2795
2703
|
historicalItems: historicalItems
|
|
2796
2704
|
});
|
|
2797
|
-
case
|
|
2705
|
+
case 73:
|
|
2798
2706
|
// operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
|
|
2799
2707
|
// 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
|
|
2800
2708
|
if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
|
|
@@ -2816,18 +2724,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2816
2724
|
isFull: resourceState.isFull
|
|
2817
2725
|
});
|
|
2818
2726
|
return _context36.abrupt("return", availabilityInfo);
|
|
2819
|
-
case
|
|
2820
|
-
_context36.prev =
|
|
2727
|
+
case 78:
|
|
2728
|
+
_context36.prev = 78;
|
|
2821
2729
|
_context36.t0 = _context36["catch"](1);
|
|
2822
2730
|
this.logMethodError('checkResourceAvailable', _context36.t0.message, {
|
|
2823
2731
|
resourceId: resourceId
|
|
2824
2732
|
});
|
|
2825
2733
|
throw _context36.t0;
|
|
2826
|
-
case
|
|
2734
|
+
case 82:
|
|
2827
2735
|
case "end":
|
|
2828
2736
|
return _context36.stop();
|
|
2829
2737
|
}
|
|
2830
|
-
}, _callee36, this, [[1,
|
|
2738
|
+
}, _callee36, this, [[1, 78]]);
|
|
2831
2739
|
}));
|
|
2832
2740
|
function checkResourceAvailable(_x18, _x19) {
|
|
2833
2741
|
return _checkResourceAvailable.apply(this, arguments);
|
|
@@ -2870,56 +2778,41 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2870
2778
|
key: "getProductList",
|
|
2871
2779
|
value: function () {
|
|
2872
2780
|
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
2873
|
-
var _this$
|
|
2874
|
-
var menu_list_ids,
|
|
2781
|
+
var _this$otherParams13;
|
|
2782
|
+
var menu_list_ids, _this$store$products, res, formattedRes;
|
|
2875
2783
|
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
2876
2784
|
while (1) switch (_context38.prev = _context38.next) {
|
|
2877
2785
|
case 0:
|
|
2878
2786
|
this.logMethodStart('getProductList');
|
|
2879
2787
|
// 可以直接通过配置里的 menu 读取
|
|
2880
|
-
menu_list_ids = ((_this$
|
|
2788
|
+
menu_list_ids = ((_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'].map(function (n) {
|
|
2881
2789
|
return Number(n.value);
|
|
2882
2790
|
})) || [];
|
|
2883
2791
|
_context38.prev = 2;
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
break;
|
|
2887
|
-
}
|
|
2888
|
-
throw new Error('products 模块未初始化');
|
|
2889
|
-
case 5:
|
|
2890
|
-
_context38.next = 7;
|
|
2891
|
-
return this.store.products.loadProducts({
|
|
2792
|
+
_context38.next = 5;
|
|
2793
|
+
return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
|
|
2892
2794
|
menu_list_ids: menu_list_ids,
|
|
2893
2795
|
cacheId: this.cacheId,
|
|
2894
2796
|
schedule_date: dayjs().format('YYYY-MM-DD'),
|
|
2895
2797
|
schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
2896
2798
|
});
|
|
2897
|
-
case
|
|
2799
|
+
case 5:
|
|
2898
2800
|
res = _context38.sent;
|
|
2899
|
-
|
|
2900
|
-
menu_list_ids: menu_list_ids,
|
|
2901
|
-
cacheId: this.cacheId
|
|
2902
|
-
});
|
|
2903
|
-
formattedRes = attachItemRuleLimitsToTopLevelProducts(productList, this.store.itemRuleQuantityLimits || []);
|
|
2801
|
+
formattedRes = attachItemRuleLimitsToTopLevelProducts(res, this.store.itemRuleQuantityLimits || []);
|
|
2904
2802
|
this.logMethodSuccess('getProductList', {
|
|
2905
2803
|
menuCount: menu_list_ids.length
|
|
2906
2804
|
});
|
|
2907
2805
|
return _context38.abrupt("return", formattedRes);
|
|
2908
|
-
case
|
|
2909
|
-
_context38.prev =
|
|
2806
|
+
case 11:
|
|
2807
|
+
_context38.prev = 11;
|
|
2910
2808
|
_context38.t0 = _context38["catch"](2);
|
|
2911
|
-
|
|
2912
|
-
this.logMethodError('getProductList', _context38.t0, {
|
|
2913
|
-
menu_list_ids: menu_list_ids,
|
|
2914
|
-
cacheId: this.cacheId
|
|
2915
|
-
});
|
|
2916
|
-
}
|
|
2809
|
+
this.logMethodError('getProductList', _context38.t0.message);
|
|
2917
2810
|
throw _context38.t0;
|
|
2918
|
-
case
|
|
2811
|
+
case 15:
|
|
2919
2812
|
case "end":
|
|
2920
2813
|
return _context38.stop();
|
|
2921
2814
|
}
|
|
2922
|
-
}, _callee38, this, [[2,
|
|
2815
|
+
}, _callee38, this, [[2, 11]]);
|
|
2923
2816
|
}));
|
|
2924
2817
|
function getProductList() {
|
|
2925
2818
|
return _getProductList.apply(this, arguments);
|
|
@@ -2986,7 +2879,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2986
2879
|
var raw = this.window.localStorage.getItem(key) || '{}';
|
|
2987
2880
|
var parsed = JSON.parse(raw);
|
|
2988
2881
|
return parsed && _typeof(parsed) === 'object' ? parsed : {};
|
|
2989
|
-
} catch (
|
|
2882
|
+
} catch (_unused) {
|
|
2990
2883
|
return {};
|
|
2991
2884
|
}
|
|
2992
2885
|
}
|
|
@@ -3095,9 +2988,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3095
2988
|
}, {
|
|
3096
2989
|
key: "getFulfillmentModes",
|
|
3097
2990
|
value: function getFulfillmentModes() {
|
|
3098
|
-
var _this$
|
|
2991
|
+
var _this$otherParams14;
|
|
3099
2992
|
this.logMethodStart('getFulfillmentModes');
|
|
3100
|
-
var dineInConfig = ((_this$
|
|
2993
|
+
var dineInConfig = ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig) || {};
|
|
3101
2994
|
var result = {
|
|
3102
2995
|
enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
|
|
3103
2996
|
enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
|
|
@@ -3111,9 +3004,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3111
3004
|
}, {
|
|
3112
3005
|
key: "checkManualPickupRef",
|
|
3113
3006
|
value: function checkManualPickupRef() {
|
|
3114
|
-
var _this$
|
|
3007
|
+
var _this$otherParams15;
|
|
3115
3008
|
this.logMethodStart('checkManualPickupRef');
|
|
3116
|
-
var dineInConfig = ((_this$
|
|
3009
|
+
var dineInConfig = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.dineInConfig) || {};
|
|
3117
3010
|
var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
|
|
3118
3011
|
var manualInputType = dineInConfig['fulfillment.manual_input_type'];
|
|
3119
3012
|
var enabled = refMode === 'manual_input';
|