@pisell/pisellos 0.0.567 → 0.0.569
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/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +26 -6
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -12
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +35 -17
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5437 -608
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +508 -874
- package/dist/modules/Payment/types.d.ts +40 -16
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +48 -34
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +219 -114
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +803 -163
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6137 -714
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1397 -540
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +289 -86
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +105 -84
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +137 -114
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -3
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2506 -445
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +36 -34
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +199 -277
- package/dist/solution/Checkout/utils/index.js +8 -20
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +509 -454
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +6 -11
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +34 -20
- package/dist/solution/VenueBooking/index.js +630 -505
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +11 -1
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +26 -49
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +331 -244
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +37 -67
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +270 -154
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +133 -113
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +81 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +3834 -489
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +78 -33
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1247 -345
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +542 -502
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +53 -49
- package/lib/modules/Payment/walletpass.js +231 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +160 -118
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +123 -89
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +1286 -894
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +130 -71
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +738 -250
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +139 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +245 -57
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4668 -713
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +106 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1463 -316
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +117 -32
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +288 -146
- package/lib/server/modules/order/utils/filterOrders.js +318 -64
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +969 -383
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +220 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +269 -214
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +158 -132
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +197 -140
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1459 -160
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +101 -66
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +85 -80
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -80
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1461 -1169
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -159
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +495 -470
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +495 -220
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +908 -904
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +457 -344
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +34 -20
- package/lib/solution/VenueBooking/index.js +982 -950
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +124 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.d.ts +11 -1
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
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; } } }; }
|
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
4
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
5
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
-
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
6
|
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; }
|
|
7
7
|
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); } }
|
|
8
8
|
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); }); }; }
|
|
9
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
10
|
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); } }
|
|
11
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
13
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
12
14
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
15
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -28,7 +30,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
28
30
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
31
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
32
|
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); }
|
|
31
|
-
import {
|
|
33
|
+
import { BaseSalesImpl } from "../BaseSales";
|
|
32
34
|
import { DEFAULT_SLOT_CONFIG, VenueBookingHooks } from "./types";
|
|
33
35
|
import { attachItemRuleLimitsToTopLevelProducts, buildProductKey, buildItemRuleBusinessData, createEmptySummary, getProductIdentityIndex, getSafeProductNum, normalizeOrderProduct, normalizeItemRuleStrategies, toNonNegativeInt, toPriceString } from "./utils";
|
|
34
36
|
import { createModule } from "../BookingByStep/types";
|
|
@@ -46,7 +48,7 @@ import { buildTimeSlotGrid, isBusinessHoursCrossDay, generateTimeLabels } from "
|
|
|
46
48
|
import { buildDateRangeSummary } from "./utils/dateSummary";
|
|
47
49
|
import { mergeConsecutiveSlots, expandMergedSlotToIndividual, buildVenueIdentityKey, buildVenueBookingEntry, buildVenueResourceMetadata, buildPriceBreakdown } from "./utils/slotMerge";
|
|
48
50
|
import { buildSlotPriceMapByScheduleSegments, formatProductsWithDataVariant, getPriceForProductAtDatetime, getSlotPriceFromMap } from "./utils/smartPricing";
|
|
49
|
-
import { composeLinePrice, createUuidV4, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
51
|
+
import { composeLinePrice, createUuidV4, getProductSkuOptions, sumOptionUnitPrice } from "../../modules/Order/utils";
|
|
50
52
|
import { OrderModule } from "../../modules/Order";
|
|
51
53
|
import { RegisterAndLoginHooks } from "../RegisterAndLogin/types";
|
|
52
54
|
import Decimal from 'decimal.js';
|
|
@@ -62,8 +64,8 @@ function cloneCustomDepositData(customDepositData) {
|
|
|
62
64
|
deposit_policy_data: Array.isArray(customDepositData.deposit_policy_data) ? _toConsumableArray(customDepositData.deposit_policy_data) : []
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
|
-
export var VenueBookingImpl = /*#__PURE__*/function (
|
|
66
|
-
_inherits(VenueBookingImpl,
|
|
67
|
+
export var VenueBookingImpl = /*#__PURE__*/function (_BaseSalesImpl) {
|
|
68
|
+
_inherits(VenueBookingImpl, _BaseSalesImpl);
|
|
67
69
|
var _super = _createSuper(VenueBookingImpl);
|
|
68
70
|
function VenueBookingImpl(name, version) {
|
|
69
71
|
var _this;
|
|
@@ -192,12 +194,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
192
194
|
payload: payload,
|
|
193
195
|
extra: extra
|
|
194
196
|
});
|
|
195
|
-
} else {
|
|
196
|
-
console.log('[VenueBooking][log-fallback]', params.title, {
|
|
197
|
-
payload: payload,
|
|
198
|
-
extra: extra
|
|
199
|
-
});
|
|
200
|
-
}
|
|
197
|
+
} else {}
|
|
201
198
|
return _context.abrupt("return");
|
|
202
199
|
case 6:
|
|
203
200
|
_context.next = 8;
|
|
@@ -278,6 +275,76 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
278
275
|
}
|
|
279
276
|
return addLog;
|
|
280
277
|
}()
|
|
278
|
+
}, {
|
|
279
|
+
key: "getRegisteredModuleNames",
|
|
280
|
+
value: function getRegisteredModuleNames() {
|
|
281
|
+
return ['scanOrderLogger', 'products', 'order', 'salesSummary', 'venueProducts', 'addonProducts', 'date', 'schedule', 'quotation', 'openData'];
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "createSubModule",
|
|
285
|
+
value: function createSubModule(moduleName) {
|
|
286
|
+
switch (moduleName) {
|
|
287
|
+
case 'scanOrderLogger':
|
|
288
|
+
return createModule('scanOrderLogger', this.name);
|
|
289
|
+
case 'venueProducts':
|
|
290
|
+
return new ProductList("".concat(this.name, "_venueProducts"));
|
|
291
|
+
case 'addonProducts':
|
|
292
|
+
return new ProductList("".concat(this.name, "_addonProducts"));
|
|
293
|
+
case 'date':
|
|
294
|
+
return new DateModule("".concat(this.name, "_date"));
|
|
295
|
+
case 'openData':
|
|
296
|
+
return new OpenDataModule("".concat(this.name, "_openData"));
|
|
297
|
+
default:
|
|
298
|
+
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "attachProductOriginToTempOrder",
|
|
303
|
+
value: function attachProductOriginToTempOrder(tempOrder, productUid, origin) {
|
|
304
|
+
var _tempOrder$_extend, _tempOrder$_extend2;
|
|
305
|
+
if (!productUid || !origin) return;
|
|
306
|
+
tempOrder._extend = _objectSpread(_objectSpread({}, tempOrder._extend || {}), {}, {
|
|
307
|
+
productsByUid: _objectSpread(_objectSpread({}, ((_tempOrder$_extend = tempOrder._extend) === null || _tempOrder$_extend === void 0 ? void 0 : _tempOrder$_extend.productsByUid) || {}), {}, _defineProperty({}, productUid, _objectSpread(_objectSpread({}, ((_tempOrder$_extend2 = tempOrder._extend) === null || _tempOrder$_extend2 === void 0 || (_tempOrder$_extend2 = _tempOrder$_extend2.productsByUid) === null || _tempOrder$_extend2 === void 0 ? void 0 : _tempOrder$_extend2[productUid]) || {}), {}, {
|
|
308
|
+
origin: origin
|
|
309
|
+
})))
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
313
|
+
key: "readProductOriginFromTempOrder",
|
|
314
|
+
value: function readProductOriginFromTempOrder(tempOrder, product) {
|
|
315
|
+
var _product$metadata, _tempOrder$_extend3;
|
|
316
|
+
var uid = ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.identity_key;
|
|
317
|
+
if (uid && (_tempOrder$_extend3 = tempOrder._extend) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) !== null && _tempOrder$_extend3 !== void 0 && (_tempOrder$_extend3 = _tempOrder$_extend3[uid]) !== null && _tempOrder$_extend3 !== void 0 && _tempOrder$_extend3.origin) {
|
|
318
|
+
return tempOrder._extend.productsByUid[uid].origin;
|
|
319
|
+
}
|
|
320
|
+
return product._origin;
|
|
321
|
+
}
|
|
322
|
+
}, {
|
|
323
|
+
key: "normalizeVenueProductTitle",
|
|
324
|
+
value: function normalizeVenueProductTitle(value) {
|
|
325
|
+
if (typeof value === 'string') {
|
|
326
|
+
var text = value.trim();
|
|
327
|
+
return text ? {
|
|
328
|
+
auto: text
|
|
329
|
+
} : undefined;
|
|
330
|
+
}
|
|
331
|
+
if (!value || _typeof(value) !== 'object' || Array.isArray(value)) return undefined;
|
|
332
|
+
var source = value;
|
|
333
|
+
var normalized = {};
|
|
334
|
+
Object.entries(source).forEach(function (_ref) {
|
|
335
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
336
|
+
key = _ref2[0],
|
|
337
|
+
text = _ref2[1];
|
|
338
|
+
if (typeof text === 'string') normalized[key] = text;
|
|
339
|
+
});
|
|
340
|
+
if (!normalized.auto) {
|
|
341
|
+
var fallback = normalized.original || normalized.en || normalized['zh-CN'] || normalized['zh-HK'];
|
|
342
|
+
if (fallback) normalized.auto = fallback;
|
|
343
|
+
}
|
|
344
|
+
return Object.values(normalized).some(function (text) {
|
|
345
|
+
return String(text || '').trim();
|
|
346
|
+
}) ? normalized : undefined;
|
|
347
|
+
}
|
|
281
348
|
}, {
|
|
282
349
|
key: "normalizeCustomerId",
|
|
283
350
|
value: function normalizeCustomerId(value) {
|
|
@@ -429,7 +496,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
429
496
|
this.clearLoginEffectListeners();
|
|
430
497
|
var createHandleLogin = function createHandleLogin() {
|
|
431
498
|
return /*#__PURE__*/function () {
|
|
432
|
-
var
|
|
499
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(payload) {
|
|
433
500
|
var customerId;
|
|
434
501
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
435
502
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -452,7 +519,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
452
519
|
}, _callee4);
|
|
453
520
|
}));
|
|
454
521
|
return function (_x4) {
|
|
455
|
-
return
|
|
522
|
+
return _ref3.apply(this, arguments);
|
|
456
523
|
};
|
|
457
524
|
}();
|
|
458
525
|
};
|
|
@@ -588,12 +655,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
588
655
|
_this$otherParams2,
|
|
589
656
|
_this$otherParams3,
|
|
590
657
|
_this4 = this,
|
|
591
|
-
_this$otherParams4,
|
|
592
|
-
_this$otherParams5,
|
|
593
658
|
_this$otherParams6,
|
|
594
659
|
_this$otherParams7,
|
|
595
|
-
_this$otherParams8
|
|
660
|
+
_this$otherParams8,
|
|
661
|
+
_this$otherParams9,
|
|
662
|
+
_this$otherParams10;
|
|
596
663
|
var options,
|
|
664
|
+
_this$otherParams4,
|
|
665
|
+
_this$otherParams5,
|
|
597
666
|
baseModules,
|
|
598
667
|
venueProductsModule,
|
|
599
668
|
addonProductsModule,
|
|
@@ -614,8 +683,6 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
614
683
|
case 0:
|
|
615
684
|
options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
|
|
616
685
|
this.logMethodStart('initialize');
|
|
617
|
-
this.core = core;
|
|
618
|
-
this.initializeOptions = options || {};
|
|
619
686
|
this.store = _objectSpread(_objectSpread({}, this.store), options.store);
|
|
620
687
|
this.smartPricingCustomerId = undefined;
|
|
621
688
|
this.store.entryContext = ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.entryContext) || this.store.entryContext;
|
|
@@ -635,22 +702,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
635
702
|
passed: null,
|
|
636
703
|
failures: []
|
|
637
704
|
};
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
705
|
+
_context7.next = 20;
|
|
706
|
+
return _get(_getPrototypeOf(VenueBookingImpl.prototype), "initialize", this).call(this, core, options);
|
|
707
|
+
case 20:
|
|
708
|
+
if (this.store.scanOrderLogger) {
|
|
709
|
+
this.store.scanOrderLogger.setProvider(((_this$otherParams4 = this.otherParams) === null || _this$otherParams4 === void 0 ? void 0 : _this$otherParams4.loggerProvider) || 'feishu');
|
|
710
|
+
this.store.scanOrderLogger.setProviderConfig(((_this$otherParams5 = this.otherParams) === null || _this$otherParams5 === void 0 ? void 0 : _this$otherParams5.loggerConfig) || {
|
|
711
|
+
feishu: {
|
|
712
|
+
webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
713
|
+
errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d'
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
650
717
|
}
|
|
651
|
-
this.logMethodError('initialize', 'request plugin missing');
|
|
652
|
-
throw new Error('venueBooking解决方案需要 request 插件支持');
|
|
653
|
-
case 28:
|
|
654
718
|
// 注册基础模块(order, salesSummary, products, logger)
|
|
655
719
|
baseModules = ['scanOrderLogger', 'products', 'order', 'salesSummary'];
|
|
656
720
|
baseModules.forEach(function (step) {
|
|
@@ -663,10 +727,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
663
727
|
} : {};
|
|
664
728
|
var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.loggerProvider) || 'feishu';
|
|
665
729
|
var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.loggerConfig) || {
|
|
666
|
-
feishu: {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
}
|
|
730
|
+
// feishu: {
|
|
731
|
+
// webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/8f069b14-9d39-4728-8f78-b56f393bfde8',
|
|
732
|
+
// errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/bdefae5e-f233-4705-8688-946887d9543d',
|
|
733
|
+
// },
|
|
670
734
|
};
|
|
671
735
|
_this4.core.registerModule(targetModule, {
|
|
672
736
|
initialState: initialState,
|
|
@@ -738,11 +802,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
738
802
|
this.core.registerModule(openDataModule, {
|
|
739
803
|
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
740
804
|
fatherModule: this.name,
|
|
741
|
-
openCache: !!((_this$
|
|
742
|
-
cacheId: (_this$
|
|
805
|
+
openCache: !!((_this$otherParams6 = this.otherParams) !== null && _this$otherParams6 !== void 0 && _this$otherParams6.cacheId),
|
|
806
|
+
cacheId: (_this$otherParams7 = this.otherParams) === null || _this$otherParams7 === void 0 ? void 0 : _this$otherParams7.cacheId
|
|
743
807
|
})
|
|
744
808
|
});
|
|
745
|
-
if ((_this$
|
|
809
|
+
if ((_this$otherParams8 = this.otherParams) !== null && _this$otherParams8 !== void 0 && _this$otherParams8.cacheId) {
|
|
746
810
|
sessionData = this.window.sessionStorage.getItem(this.name);
|
|
747
811
|
if (sessionData) {
|
|
748
812
|
try {
|
|
@@ -759,50 +823,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
759
823
|
initialState: holderCacheState,
|
|
760
824
|
otherParams: _objectSpread(_objectSpread({}, this.otherParams), {}, {
|
|
761
825
|
fatherModule: this.name,
|
|
762
|
-
openCache: !!((_this$
|
|
763
|
-
cacheId: (_this$
|
|
826
|
+
openCache: !!((_this$otherParams9 = this.otherParams) !== null && _this$otherParams9 !== void 0 && _this$otherParams9.cacheId),
|
|
827
|
+
cacheId: (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.cacheId
|
|
764
828
|
})
|
|
765
829
|
});
|
|
766
|
-
if (this.store.scanOrderLogger) {
|
|
767
|
-
this.store.scanOrderLogger.setContext(this.getLoggerContext());
|
|
768
|
-
}
|
|
769
830
|
this.registerCustomerLoginListeners();
|
|
770
|
-
|
|
771
|
-
_context7.
|
|
772
|
-
_context7.next = 58;
|
|
831
|
+
_context7.prev = 46;
|
|
832
|
+
_context7.next = 49;
|
|
773
833
|
return (_this$store$order = this.store.order) === null || _this$store$order === void 0 ? void 0 : _this$store$order.recalculateSummary({
|
|
774
834
|
createIfMissing: false
|
|
775
835
|
});
|
|
776
|
-
case
|
|
836
|
+
case 49:
|
|
777
837
|
(_this$store$order2 = this.store.order) === null || _this$store$order2 === void 0 || _this$store$order2.persistTempOrder();
|
|
778
|
-
_context7.next =
|
|
838
|
+
_context7.next = 52;
|
|
779
839
|
return this.loadRuntimeConfigs();
|
|
780
|
-
case
|
|
840
|
+
case 52:
|
|
781
841
|
if (!this.store.schedule) {
|
|
782
|
-
_context7.next =
|
|
842
|
+
_context7.next = 55;
|
|
783
843
|
break;
|
|
784
844
|
}
|
|
785
|
-
_context7.next =
|
|
845
|
+
_context7.next = 55;
|
|
786
846
|
return this.store.schedule.loadAllSchedule();
|
|
787
|
-
case
|
|
788
|
-
_context7.next =
|
|
847
|
+
case 55:
|
|
848
|
+
_context7.next = 57;
|
|
789
849
|
return this.refreshItemRuleQuantityLimits();
|
|
790
|
-
case
|
|
850
|
+
case 57:
|
|
791
851
|
this.store.status = 'ready';
|
|
792
|
-
|
|
793
|
-
_context7.next = 70;
|
|
852
|
+
_context7.next = 60;
|
|
794
853
|
return this.core.effects.emit(VenueBookingHooks.onInited, {
|
|
795
854
|
status: this.store.status
|
|
796
855
|
});
|
|
797
|
-
case
|
|
856
|
+
case 60:
|
|
798
857
|
this.logMethodSuccess('initialize', {
|
|
799
858
|
status: this.store.status
|
|
800
859
|
});
|
|
801
|
-
_context7.next =
|
|
860
|
+
_context7.next = 70;
|
|
802
861
|
break;
|
|
803
|
-
case
|
|
804
|
-
_context7.prev =
|
|
805
|
-
_context7.t0 = _context7["catch"](
|
|
862
|
+
case 63:
|
|
863
|
+
_context7.prev = 63;
|
|
864
|
+
_context7.t0 = _context7["catch"](46);
|
|
806
865
|
this.store.status = 'error';
|
|
807
866
|
this.store.error = _context7.t0 instanceof Error ? _context7.t0.message : '初始化失败';
|
|
808
867
|
console.error('[VenueBooking] 初始化失败', _context7.t0);
|
|
@@ -810,11 +869,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
810
869
|
status: this.store.status
|
|
811
870
|
});
|
|
812
871
|
throw _context7.t0;
|
|
813
|
-
case
|
|
872
|
+
case 70:
|
|
814
873
|
case "end":
|
|
815
874
|
return _context7.stop();
|
|
816
875
|
}
|
|
817
|
-
}, _callee7, this, [[
|
|
876
|
+
}, _callee7, this, [[46, 63]]);
|
|
818
877
|
}));
|
|
819
878
|
function initialize(_x6) {
|
|
820
879
|
return _initialize.apply(this, arguments);
|
|
@@ -833,9 +892,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
833
892
|
_context8.next = 4;
|
|
834
893
|
return this.core.effects.emit(VenueBookingHooks.onDestroy, {});
|
|
835
894
|
case 4:
|
|
836
|
-
console.log('[VenueBooking] 已销毁');
|
|
837
895
|
this.logMethodSuccess('destroy');
|
|
838
|
-
case
|
|
896
|
+
case 5:
|
|
839
897
|
case "end":
|
|
840
898
|
return _context8.stop();
|
|
841
899
|
}
|
|
@@ -854,27 +912,26 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
854
912
|
while (1) switch (_context9.prev = _context9.next) {
|
|
855
913
|
case 0:
|
|
856
914
|
this.logMethodStart('retryInit');
|
|
857
|
-
|
|
858
|
-
_context9.next = 4;
|
|
915
|
+
_context9.next = 3;
|
|
859
916
|
return this.core.effects.emit(VenueBookingHooks.onRetryInit, {});
|
|
860
|
-
case
|
|
861
|
-
_context9.prev =
|
|
862
|
-
_context9.next =
|
|
917
|
+
case 3:
|
|
918
|
+
_context9.prev = 3;
|
|
919
|
+
_context9.next = 6;
|
|
863
920
|
return this.initialize(this.core, this.initializeOptions);
|
|
864
|
-
case
|
|
921
|
+
case 6:
|
|
865
922
|
this.logMethodSuccess('retryInit');
|
|
866
|
-
_context9.next =
|
|
923
|
+
_context9.next = 13;
|
|
867
924
|
break;
|
|
868
|
-
case
|
|
869
|
-
_context9.prev =
|
|
870
|
-
_context9.t0 = _context9["catch"](
|
|
925
|
+
case 9:
|
|
926
|
+
_context9.prev = 9;
|
|
927
|
+
_context9.t0 = _context9["catch"](3);
|
|
871
928
|
this.logMethodError('retryInit', _context9.t0);
|
|
872
929
|
throw _context9.t0;
|
|
873
|
-
case
|
|
930
|
+
case 13:
|
|
874
931
|
case "end":
|
|
875
932
|
return _context9.stop();
|
|
876
933
|
}
|
|
877
|
-
}, _callee9, this, [[
|
|
934
|
+
}, _callee9, this, [[3, 9]]);
|
|
878
935
|
}));
|
|
879
936
|
function retryInit() {
|
|
880
937
|
return _retryInit.apply(this, arguments);
|
|
@@ -889,36 +946,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
889
946
|
while (1) switch (_context10.prev = _context10.next) {
|
|
890
947
|
case 0:
|
|
891
948
|
this.logMethodStart('refresh');
|
|
892
|
-
|
|
893
|
-
_context10.prev = 2;
|
|
949
|
+
_context10.prev = 1;
|
|
894
950
|
this.store.status = 'initializing';
|
|
895
|
-
_context10.next =
|
|
951
|
+
_context10.next = 5;
|
|
896
952
|
return this.loadRuntimeConfigs();
|
|
897
|
-
case
|
|
898
|
-
_context10.next =
|
|
953
|
+
case 5:
|
|
954
|
+
_context10.next = 7;
|
|
899
955
|
return this.refreshItemRuleQuantityLimits();
|
|
900
|
-
case
|
|
956
|
+
case 7:
|
|
901
957
|
this.store.status = 'ready';
|
|
902
|
-
_context10.next =
|
|
958
|
+
_context10.next = 10;
|
|
903
959
|
return this.core.effects.emit(VenueBookingHooks.onRefresh, {
|
|
904
960
|
status: this.store.status
|
|
905
961
|
});
|
|
906
|
-
case
|
|
962
|
+
case 10:
|
|
907
963
|
this.logMethodSuccess('refresh', {
|
|
908
964
|
status: this.store.status
|
|
909
965
|
});
|
|
910
|
-
_context10.next =
|
|
966
|
+
_context10.next = 17;
|
|
911
967
|
break;
|
|
912
|
-
case
|
|
913
|
-
_context10.prev =
|
|
914
|
-
_context10.t0 = _context10["catch"](
|
|
968
|
+
case 13:
|
|
969
|
+
_context10.prev = 13;
|
|
970
|
+
_context10.t0 = _context10["catch"](1);
|
|
915
971
|
this.logMethodError('refresh', _context10.t0);
|
|
916
972
|
throw _context10.t0;
|
|
917
|
-
case
|
|
973
|
+
case 17:
|
|
918
974
|
case "end":
|
|
919
975
|
return _context10.stop();
|
|
920
976
|
}
|
|
921
|
-
}, _callee10, this, [[
|
|
977
|
+
}, _callee10, this, [[1, 13]]);
|
|
922
978
|
}));
|
|
923
979
|
function refresh() {
|
|
924
980
|
return _refresh.apply(this, arguments);
|
|
@@ -979,9 +1035,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
979
1035
|
}, {
|
|
980
1036
|
key: "resolveAvailableWalletIdsForSmartPricing",
|
|
981
1037
|
value: function resolveAvailableWalletIdsForSmartPricing() {
|
|
982
|
-
var _this$store$order3, _this$store$order3$ge, _this$
|
|
1038
|
+
var _this$store$order3, _this$store$order3$ge, _this$otherParams11, _this$otherParams12, _this$otherParams13, _this$otherParams14;
|
|
983
1039
|
var orderWalletIds = (_this$store$order3 = this.store.order) === null || _this$store$order3 === void 0 || (_this$store$order3$ge = _this$store$order3.getAvailableWalletIds) === null || _this$store$order3$ge === void 0 ? void 0 : _this$store$order3$ge.call(_this$store$order3);
|
|
984
|
-
var fallbackWalletIds = ((_this$
|
|
1040
|
+
var fallbackWalletIds = ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.available_wallet_ids) || ((_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.availableWalletIds) || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.strategy_context) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.available_wallet_ids) || ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 || (_this$otherParams14 = _this$otherParams14.strategy_context) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.availableWalletIds);
|
|
985
1041
|
var source = Array.isArray(orderWalletIds) && orderWalletIds.length ? orderWalletIds : fallbackWalletIds;
|
|
986
1042
|
if (!Array.isArray(source)) return [];
|
|
987
1043
|
var ids = source.map(function (item) {
|
|
@@ -1006,18 +1062,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1006
1062
|
}, {
|
|
1007
1063
|
key: "buildSmartPricingContext",
|
|
1008
1064
|
value: function buildSmartPricingContext(customerId) {
|
|
1009
|
-
var _this$core3, _this$
|
|
1065
|
+
var _this$core3, _this$otherParams15, _this$otherParams16, _this$otherParams17, _this$otherParams18, _this$otherParams19, _this$otherParams20, _this$otherParams21;
|
|
1010
1066
|
var evaluator = (_this$core3 = this.core) === null || _this$core3 === void 0 || (_this$core3 = _this$core3.context) === null || _this$core3 === void 0 ? void 0 : _this$core3.dataVariantEvaluator;
|
|
1011
1067
|
return {
|
|
1012
1068
|
evaluator: evaluator,
|
|
1013
1069
|
scheduleList: this.getScheduleListForSmartPricing(),
|
|
1014
|
-
menuList: ((_this$
|
|
1070
|
+
menuList: ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.menuList) || ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 || (_this$otherParams16 = _this$otherParams16.openData) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.menuList) || [],
|
|
1015
1071
|
customerId: customerId !== null && customerId !== void 0 ? customerId : this.resolveCustomerIdForSmartPricing(),
|
|
1016
1072
|
availableWalletIds: this.resolveAvailableWalletIdsForSmartPricing(),
|
|
1017
|
-
channel: (_this$
|
|
1018
|
-
businessCode: (_this$
|
|
1019
|
-
orderType: ((_this$
|
|
1020
|
-
strategy_context: (_this$
|
|
1073
|
+
channel: (_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.channel,
|
|
1074
|
+
businessCode: (_this$otherParams18 = this.otherParams) === null || _this$otherParams18 === void 0 ? void 0 : _this$otherParams18.businessCode,
|
|
1075
|
+
orderType: ((_this$otherParams19 = this.otherParams) === null || _this$otherParams19 === void 0 ? void 0 : _this$otherParams19.orderType) || ((_this$otherParams20 = this.otherParams) === null || _this$otherParams20 === void 0 ? void 0 : _this$otherParams20.type),
|
|
1076
|
+
strategy_context: (_this$otherParams21 = this.otherParams) === null || _this$otherParams21 === void 0 ? void 0 : _this$otherParams21.strategy_context
|
|
1021
1077
|
};
|
|
1022
1078
|
}
|
|
1023
1079
|
|
|
@@ -1096,7 +1152,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1096
1152
|
key: "_doLoadAllProducts",
|
|
1097
1153
|
value: function () {
|
|
1098
1154
|
var _doLoadAllProducts2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1099
|
-
var _this$
|
|
1155
|
+
var _this$otherParams22, _this$store$venueProd, associatedMenus, menuListIds, allProducts, rawList, list, venueList, addonList, venueStore, _this$store$order4, _this$store$order4$ge, products;
|
|
1100
1156
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1101
1157
|
while (1) switch (_context12.prev = _context12.next) {
|
|
1102
1158
|
case 0:
|
|
@@ -1117,7 +1173,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1117
1173
|
_context12.next = 8;
|
|
1118
1174
|
return this.loadOpenDataConfig();
|
|
1119
1175
|
case 8:
|
|
1120
|
-
associatedMenus = ((_this$
|
|
1176
|
+
associatedMenus = ((_this$otherParams22 = this.otherParams) === null || _this$otherParams22 === void 0 || (_this$otherParams22 = _this$otherParams22.openData) === null || _this$otherParams22 === void 0 ? void 0 : _this$otherParams22['menu.associated_menus']) || [];
|
|
1121
1177
|
if (associatedMenus.length) {
|
|
1122
1178
|
_context12.next = 12;
|
|
1123
1179
|
break;
|
|
@@ -1802,9 +1858,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1802
1858
|
_step10;
|
|
1803
1859
|
try {
|
|
1804
1860
|
var _loop2 = function _loop2() {
|
|
1805
|
-
var _product$
|
|
1861
|
+
var _product$metadata2;
|
|
1806
1862
|
var product = _step10.value;
|
|
1807
|
-
var resourceId = (_product$
|
|
1863
|
+
var resourceId = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.resource_id;
|
|
1808
1864
|
if (resourceId == null) return 1; // continue
|
|
1809
1865
|
var productId = Number(product.product_id);
|
|
1810
1866
|
var existing = result.get(resourceId) || [];
|
|
@@ -1852,7 +1908,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1852
1908
|
value: (function () {
|
|
1853
1909
|
var _reconcileOrderForResourceProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(resourceId, productId, slots) {
|
|
1854
1910
|
var _this$store$order7, _this$store$order7$ge;
|
|
1855
|
-
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, resourceEntry, booking, products;
|
|
1911
|
+
var mappings, mapping, tempOrder, matchesCurrent, merged, rawResource, childRawResources, venueProduct, i, _rawResource$form_id, _venueProduct$is_char, group, identityKey, bookingUuid, startMoment, endMoment, duration, customDepositData, productTitle, resourceEntry, venueProductOrigin, normalizedVenueOrderProduct, venueOrderProduct, booking, products;
|
|
1856
1912
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1857
1913
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1858
1914
|
case 0:
|
|
@@ -1917,6 +1973,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1917
1973
|
endMoment = dayjs(group.endTime, 'YYYY-MM-DD HH:mm');
|
|
1918
1974
|
duration = endMoment.diff(startMoment, 'minute');
|
|
1919
1975
|
customDepositData = cloneCustomDepositData(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.custom_deposit_data);
|
|
1976
|
+
productTitle = this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.product_title) || this.normalizeVenueProductTitle(venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.title) || this.normalizeVenueProductTitle(mapping.productTitle);
|
|
1920
1977
|
resourceEntry = {
|
|
1921
1978
|
relation_type: 'form',
|
|
1922
1979
|
like_status: 'common',
|
|
@@ -1945,7 +2002,45 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1945
2002
|
};
|
|
1946
2003
|
});
|
|
1947
2004
|
}
|
|
1948
|
-
|
|
2005
|
+
venueProductOrigin = {
|
|
2006
|
+
name: mapping.productTitle,
|
|
2007
|
+
product_title: productTitle,
|
|
2008
|
+
cover: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.cover) || '',
|
|
2009
|
+
custom_deposit_data: customDepositData,
|
|
2010
|
+
id: 0,
|
|
2011
|
+
number: 1,
|
|
2012
|
+
registration_type: 'all',
|
|
2013
|
+
relation_products: [],
|
|
2014
|
+
is_all: false,
|
|
2015
|
+
product: {
|
|
2016
|
+
product_id: mapping.productId,
|
|
2017
|
+
product_variant_id: 0,
|
|
2018
|
+
num: 1,
|
|
2019
|
+
product_bundle: [],
|
|
2020
|
+
product_sku: {
|
|
2021
|
+
option: []
|
|
2022
|
+
},
|
|
2023
|
+
discount_list: [],
|
|
2024
|
+
custom_deposit_data: customDepositData,
|
|
2025
|
+
metadata: {}
|
|
2026
|
+
},
|
|
2027
|
+
sub_type: 'minutes',
|
|
2028
|
+
duration: duration,
|
|
2029
|
+
like_status: 'common',
|
|
2030
|
+
resources: [resourceEntry],
|
|
2031
|
+
schedule_id: 0,
|
|
2032
|
+
select_date: startMoment.format('YYYY-MM-DD'),
|
|
2033
|
+
start_date: startMoment.format('YYYY-MM-DD'),
|
|
2034
|
+
start_time: startMoment.format('HH:mm'),
|
|
2035
|
+
end_date: endMoment.format('YYYY-MM-DD'),
|
|
2036
|
+
end_time: endMoment.format('HH:mm'),
|
|
2037
|
+
metadata: {
|
|
2038
|
+
venue_booking: true,
|
|
2039
|
+
slot_count: group.slotCount
|
|
2040
|
+
},
|
|
2041
|
+
holder: null
|
|
2042
|
+
};
|
|
2043
|
+
normalizedVenueOrderProduct = normalizeOrderProduct({
|
|
1949
2044
|
product_id: mapping.productId,
|
|
1950
2045
|
product_variant_id: 0,
|
|
1951
2046
|
identity_key: identityKey,
|
|
@@ -1953,8 +2048,11 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1953
2048
|
selling_price: group.totalPrice,
|
|
1954
2049
|
original_price: group.totalPrice,
|
|
1955
2050
|
is_charge_tax: (_venueProduct$is_char = venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.is_charge_tax) !== null && _venueProduct$is_char !== void 0 ? _venueProduct$is_char : 0,
|
|
1956
|
-
metadata: {
|
|
1957
|
-
venue_booking: true
|
|
2051
|
+
metadata: _objectSpread(_objectSpread({
|
|
2052
|
+
venue_booking: true
|
|
2053
|
+
}, productTitle ? {
|
|
2054
|
+
product_title: productTitle
|
|
2055
|
+
} : {}), {}, {
|
|
1958
2056
|
resource_id: resourceId,
|
|
1959
2057
|
resource_form_id: mapping.formId,
|
|
1960
2058
|
resource_name: mapping.resourceName,
|
|
@@ -1964,48 +2062,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1964
2062
|
booking_uid: bookingUuid,
|
|
1965
2063
|
price_breakdown: buildPriceBreakdown({
|
|
1966
2064
|
group: group,
|
|
1967
|
-
productId: mapping.productId
|
|
2065
|
+
productId: mapping.productId,
|
|
2066
|
+
quotation: this.store.quotation
|
|
1968
2067
|
})
|
|
1969
|
-
},
|
|
1970
|
-
_origin:
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
relation_products: [],
|
|
1978
|
-
is_all: false,
|
|
1979
|
-
product: {
|
|
1980
|
-
product_id: mapping.productId,
|
|
1981
|
-
product_variant_id: 0,
|
|
1982
|
-
num: 1,
|
|
1983
|
-
product_bundle: [],
|
|
1984
|
-
product_option_item: [],
|
|
1985
|
-
discount_list: [],
|
|
1986
|
-
custom_deposit_data: customDepositData,
|
|
1987
|
-
metadata: {},
|
|
1988
|
-
holder_config: venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.holder_config,
|
|
1989
|
-
bookingUuid: bookingUuid,
|
|
1990
|
-
shop_id: (venueProduct === null || venueProduct === void 0 ? void 0 : venueProduct.shop_id) || 0
|
|
1991
|
-
},
|
|
1992
|
-
sub_type: 'minutes',
|
|
1993
|
-
duration: duration,
|
|
1994
|
-
like_status: 'common',
|
|
1995
|
-
resources: [resourceEntry],
|
|
1996
|
-
schedule_id: 0,
|
|
1997
|
-
select_date: startMoment.format('YYYY-MM-DD'),
|
|
1998
|
-
start_date: startMoment.format('YYYY-MM-DD'),
|
|
1999
|
-
start_time: startMoment.format('HH:mm'),
|
|
2000
|
-
end_date: endMoment.format('YYYY-MM-DD'),
|
|
2001
|
-
end_time: endMoment.format('HH:mm'),
|
|
2002
|
-
metadata: {
|
|
2003
|
-
venue_booking: true,
|
|
2004
|
-
slot_count: group.slotCount
|
|
2005
|
-
},
|
|
2006
|
-
holder: null
|
|
2007
|
-
}
|
|
2008
|
-
}));
|
|
2068
|
+
}),
|
|
2069
|
+
_origin: venueProductOrigin
|
|
2070
|
+
});
|
|
2071
|
+
venueOrderProduct = productTitle ? _objectSpread(_objectSpread({}, normalizedVenueOrderProduct), {}, {
|
|
2072
|
+
product_title: productTitle
|
|
2073
|
+
}) : normalizedVenueOrderProduct;
|
|
2074
|
+
this.attachProductOriginToTempOrder(tempOrder, identityKey, venueProductOrigin);
|
|
2075
|
+
tempOrder.products.push(venueOrderProduct);
|
|
2009
2076
|
booking = buildVenueBookingEntry({
|
|
2010
2077
|
group: group,
|
|
2011
2078
|
resourceId: resourceId,
|
|
@@ -2141,8 +2208,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2141
2208
|
}, {
|
|
2142
2209
|
key: "updateTempOrderNote",
|
|
2143
2210
|
value: function updateTempOrderNote(note) {
|
|
2211
|
+
var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2144
2212
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2145
|
-
return this.store.order.updateTempOrderNote(note);
|
|
2213
|
+
return this.store.order.updateTempOrderNote(note, sync);
|
|
2146
2214
|
}
|
|
2147
2215
|
}, {
|
|
2148
2216
|
key: "updateTempOrderContactsInfo",
|
|
@@ -2151,8 +2219,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2151
2219
|
return this.store.order.updateTempOrderContactsInfo(contactsInfo);
|
|
2152
2220
|
}
|
|
2153
2221
|
}, {
|
|
2154
|
-
key: "
|
|
2155
|
-
value: function
|
|
2222
|
+
key: "ensureVenueTempOrder",
|
|
2223
|
+
value: function ensureVenueTempOrder() {
|
|
2156
2224
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2157
2225
|
return this.store.order.ensureTempOrder();
|
|
2158
2226
|
}
|
|
@@ -2208,9 +2276,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2208
2276
|
_step13;
|
|
2209
2277
|
try {
|
|
2210
2278
|
var _loop4 = function _loop4() {
|
|
2211
|
-
var _product$
|
|
2279
|
+
var _product$metadata3;
|
|
2212
2280
|
var product = _step13.value;
|
|
2213
|
-
if ((_product$
|
|
2281
|
+
if ((_product$metadata3 = product.metadata) !== null && _product$metadata3 !== void 0 && _product$metadata3.venue_booking) {
|
|
2214
2282
|
var mappings = _this9.resourceProductMap.get(product.metadata.resource_id);
|
|
2215
2283
|
if (!mappings || !mappings.length) return 0; // continue
|
|
2216
2284
|
var mapping = mappings.find(function (m) {
|
|
@@ -2344,7 +2412,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2344
2412
|
key: "setDiscountSelected",
|
|
2345
2413
|
value: (function () {
|
|
2346
2414
|
var _setDiscountSelected = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(params) {
|
|
2347
|
-
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator15, _step15, d, selectedResourceIds, _iterator16, _step16, _product$
|
|
2415
|
+
var _tempOrder$holder, _this$store$order$get, _this$store$order$get2, list, beforeTarget, updated, updatedTarget, tempOrder, orderStore, discountModule, rulesModule, holders, nextDiscountList, _tempOrder$holder2, result, beforeSelectedIds, _iterator15, _step15, d, selectedResourceIds, _iterator16, _step16, _product$metadata$sou, _product$metadata4, _product$metadata5, _product$original_pri, product, origin, totalPerUnitDiscount, optionSum, sourcePrice, newSourceSellingPrice, newMainSellingPrice, afterApplyTarget, finalSummary, finalProduct, finalTarget;
|
|
2348
2416
|
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
2349
2417
|
while (1) switch (_context22.prev = _context22.next) {
|
|
2350
2418
|
case 0:
|
|
@@ -2433,16 +2501,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2433
2501
|
_iterator16.s();
|
|
2434
2502
|
case 21:
|
|
2435
2503
|
if ((_step16 = _iterator16.n()).done) {
|
|
2436
|
-
_context22.next =
|
|
2504
|
+
_context22.next = 36;
|
|
2437
2505
|
break;
|
|
2438
2506
|
}
|
|
2439
2507
|
product = _step16.value;
|
|
2440
|
-
|
|
2441
|
-
|
|
2508
|
+
origin = this.readProductOriginFromTempOrder(tempOrder, product);
|
|
2509
|
+
if (!(origin !== null && origin !== void 0 && origin.isManualDiscount)) {
|
|
2510
|
+
_context22.next = 26;
|
|
2442
2511
|
break;
|
|
2443
2512
|
}
|
|
2444
|
-
return _context22.abrupt("continue",
|
|
2445
|
-
case
|
|
2513
|
+
return _context22.abrupt("continue", 34);
|
|
2514
|
+
case 26:
|
|
2446
2515
|
// 1. 把 product.discount_list 和当前选中的 discount 对齐(剔除已取消的券)
|
|
2447
2516
|
product.discount_list = (product.discount_list || []).filter(function (pd) {
|
|
2448
2517
|
var _pd$discount$resource, _pd$discount;
|
|
@@ -2455,8 +2524,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2455
2524
|
totalPerUnitDiscount = (product.discount_list || []).reduce(function (sum, pd) {
|
|
2456
2525
|
return sum + (pd.amount || 0);
|
|
2457
2526
|
}, 0);
|
|
2458
|
-
optionSum = sumOptionUnitPrice(product
|
|
2459
|
-
sourcePrice = (_product$metadata$sou = (_product$
|
|
2527
|
+
optionSum = sumOptionUnitPrice(getProductSkuOptions(product));
|
|
2528
|
+
sourcePrice = (_product$metadata$sou = (_product$metadata4 = product.metadata) === null || _product$metadata4 === void 0 ? void 0 : _product$metadata4.source_product_price) !== null && _product$metadata$sou !== void 0 ? _product$metadata$sou : ((_product$metadata5 = product.metadata) === null || _product$metadata5 === void 0 ? void 0 : _product$metadata5.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';
|
|
2460
2529
|
newSourceSellingPrice = new Decimal(Number(sourcePrice) || 0).minus(totalPerUnitDiscount).toDecimalPlaces(2).toString();
|
|
2461
2530
|
newMainSellingPrice = new Decimal(Number(newSourceSellingPrice) || 0).plus(optionSum).toDecimalPlaces(2).toFixed(2);
|
|
2462
2531
|
if (product.metadata) {
|
|
@@ -2467,36 +2536,36 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2467
2536
|
mainPrice: newMainSellingPrice,
|
|
2468
2537
|
bundle: product.product_bundle
|
|
2469
2538
|
});
|
|
2470
|
-
case
|
|
2539
|
+
case 34:
|
|
2471
2540
|
_context22.next = 21;
|
|
2472
2541
|
break;
|
|
2473
|
-
case
|
|
2474
|
-
_context22.next =
|
|
2542
|
+
case 36:
|
|
2543
|
+
_context22.next = 41;
|
|
2475
2544
|
break;
|
|
2476
|
-
case
|
|
2477
|
-
_context22.prev =
|
|
2545
|
+
case 38:
|
|
2546
|
+
_context22.prev = 38;
|
|
2478
2547
|
_context22.t0 = _context22["catch"](19);
|
|
2479
2548
|
_iterator16.e(_context22.t0);
|
|
2480
|
-
case
|
|
2481
|
-
_context22.prev =
|
|
2549
|
+
case 41:
|
|
2550
|
+
_context22.prev = 41;
|
|
2482
2551
|
_iterator16.f();
|
|
2483
|
-
return _context22.finish(
|
|
2484
|
-
case
|
|
2552
|
+
return _context22.finish(41);
|
|
2553
|
+
case 44:
|
|
2485
2554
|
OrderModule.populateSavedAmounts(tempOrder.products, nextDiscountList);
|
|
2486
|
-
_context22.next =
|
|
2555
|
+
_context22.next = 47;
|
|
2487
2556
|
return discountModule === null || discountModule === void 0 ? void 0 : discountModule.setDiscountList(nextDiscountList);
|
|
2488
|
-
case
|
|
2557
|
+
case 47:
|
|
2489
2558
|
tempOrder.discount_list = (nextDiscountList || []).filter(function (d) {
|
|
2490
2559
|
return d.isSelected;
|
|
2491
2560
|
});
|
|
2492
2561
|
afterApplyTarget = this.store.order.getDiscountList().find(function (d) {
|
|
2493
2562
|
return d.id === params.discountId;
|
|
2494
2563
|
}) || null;
|
|
2495
|
-
_context22.next =
|
|
2564
|
+
_context22.next = 51;
|
|
2496
2565
|
return this.store.order.recalculateSummary({
|
|
2497
2566
|
createIfMissing: true
|
|
2498
2567
|
});
|
|
2499
|
-
case
|
|
2568
|
+
case 51:
|
|
2500
2569
|
this.store.order.persistTempOrder();
|
|
2501
2570
|
finalSummary = ((_this$store$order$get = this.store.order.getTempOrder()) === null || _this$store$order$get === void 0 ? void 0 : _this$store$order$get.summary) || null;
|
|
2502
2571
|
finalProduct = ((_this$store$order$get2 = this.store.order.getTempOrder()) === null || _this$store$order$get2 === void 0 || (_this$store$order$get2 = _this$store$order$get2.products) === null || _this$store$order$get2 === void 0 ? void 0 : _this$store$order$get2[0]) || null;
|
|
@@ -2505,16 +2574,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2505
2574
|
return d.id === params.discountId;
|
|
2506
2575
|
}) || null;
|
|
2507
2576
|
return _context22.abrupt("return", this.store.order.getDiscountList());
|
|
2508
|
-
case
|
|
2509
|
-
_context22.prev =
|
|
2577
|
+
case 59:
|
|
2578
|
+
_context22.prev = 59;
|
|
2510
2579
|
_context22.t1 = _context22["catch"](1);
|
|
2511
2580
|
this.logMethodError('setDiscountSelected', _context22.t1);
|
|
2512
2581
|
throw _context22.t1;
|
|
2513
|
-
case
|
|
2582
|
+
case 63:
|
|
2514
2583
|
case "end":
|
|
2515
2584
|
return _context22.stop();
|
|
2516
2585
|
}
|
|
2517
|
-
}, _callee22, this, [[1,
|
|
2586
|
+
}, _callee22, this, [[1, 59], [19, 38, 41, 44]]);
|
|
2518
2587
|
}));
|
|
2519
2588
|
function setDiscountSelected(_x16) {
|
|
2520
2589
|
return _setDiscountSelected.apply(this, arguments);
|
|
@@ -2565,7 +2634,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2565
2634
|
key: "getOrderProducts",
|
|
2566
2635
|
value: function getOrderProducts() {
|
|
2567
2636
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2568
|
-
|
|
2637
|
+
var products = this.store.order.getOrderProducts();
|
|
2638
|
+
return products;
|
|
2569
2639
|
}
|
|
2570
2640
|
}, {
|
|
2571
2641
|
key: "getSummary",
|
|
@@ -2584,7 +2654,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2584
2654
|
throw new Error('order 模块未初始化');
|
|
2585
2655
|
case 4:
|
|
2586
2656
|
_context24.next = 6;
|
|
2587
|
-
return this.store.order.
|
|
2657
|
+
return this.store.order.getOrderSummary();
|
|
2588
2658
|
case 6:
|
|
2589
2659
|
summary = _context24.sent;
|
|
2590
2660
|
this.logMethodSuccess('getSummary', {
|
|
@@ -2611,7 +2681,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2611
2681
|
key: "submitOrder",
|
|
2612
2682
|
value: function () {
|
|
2613
2683
|
var _submitOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
2614
|
-
var _this$
|
|
2684
|
+
var _this$otherParams23, _this$otherParams24, _this$otherParams25, _this$otherParams26, _tempOrder$products2, result, tempOrder;
|
|
2615
2685
|
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
2616
2686
|
while (1) switch (_context25.prev = _context25.next) {
|
|
2617
2687
|
case 0:
|
|
@@ -2629,10 +2699,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2629
2699
|
_context25.next = 8;
|
|
2630
2700
|
return this.store.order.submitTempOrder({
|
|
2631
2701
|
cacheId: this.cacheId,
|
|
2632
|
-
platform: (_this$
|
|
2633
|
-
businessCode: (_this$
|
|
2634
|
-
channel: (_this$
|
|
2635
|
-
type: (_this$
|
|
2702
|
+
platform: (_this$otherParams23 = this.otherParams) === null || _this$otherParams23 === void 0 ? void 0 : _this$otherParams23.platform,
|
|
2703
|
+
businessCode: (_this$otherParams24 = this.otherParams) === null || _this$otherParams24 === void 0 ? void 0 : _this$otherParams24.businessCode,
|
|
2704
|
+
channel: (_this$otherParams25 = this.otherParams) === null || _this$otherParams25 === void 0 ? void 0 : _this$otherParams25.channel,
|
|
2705
|
+
type: (_this$otherParams26 = this.otherParams) === null || _this$otherParams26 === void 0 ? void 0 : _this$otherParams26.type
|
|
2636
2706
|
});
|
|
2637
2707
|
case 8:
|
|
2638
2708
|
result = _context25.sent;
|
|
@@ -2657,26 +2727,73 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2657
2727
|
}
|
|
2658
2728
|
return submitOrder;
|
|
2659
2729
|
}()
|
|
2730
|
+
/**
|
|
2731
|
+
* 0 元订单免费领取(非定金场景)
|
|
2732
|
+
* 与 appointment getFreeProduct 同接口:POST /pay/order/free-pay/:id
|
|
2733
|
+
*/
|
|
2660
2734
|
}, {
|
|
2661
|
-
key: "
|
|
2662
|
-
value: function () {
|
|
2663
|
-
var
|
|
2664
|
-
var
|
|
2735
|
+
key: "submitFreeOrder",
|
|
2736
|
+
value: (function () {
|
|
2737
|
+
var _submitFreeOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(id) {
|
|
2738
|
+
var res;
|
|
2665
2739
|
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
2666
2740
|
while (1) switch (_context26.prev = _context26.next) {
|
|
2741
|
+
case 0:
|
|
2742
|
+
this.logMethodStart('submitFreeOrder', {
|
|
2743
|
+
id: id
|
|
2744
|
+
});
|
|
2745
|
+
_context26.prev = 1;
|
|
2746
|
+
if (id) {
|
|
2747
|
+
_context26.next = 4;
|
|
2748
|
+
break;
|
|
2749
|
+
}
|
|
2750
|
+
throw new Error('订单 ID 不能为空');
|
|
2751
|
+
case 4:
|
|
2752
|
+
_context26.next = 6;
|
|
2753
|
+
return this.request.post("/pay/order/free-pay/".concat(id));
|
|
2754
|
+
case 6:
|
|
2755
|
+
res = _context26.sent;
|
|
2756
|
+
this.logMethodSuccess('submitFreeOrder', {
|
|
2757
|
+
id: id,
|
|
2758
|
+
status: res === null || res === void 0 ? void 0 : res.status
|
|
2759
|
+
});
|
|
2760
|
+
return _context26.abrupt("return", res);
|
|
2761
|
+
case 11:
|
|
2762
|
+
_context26.prev = 11;
|
|
2763
|
+
_context26.t0 = _context26["catch"](1);
|
|
2764
|
+
this.logMethodError('submitFreeOrder', _context26.t0);
|
|
2765
|
+
throw _context26.t0;
|
|
2766
|
+
case 15:
|
|
2767
|
+
case "end":
|
|
2768
|
+
return _context26.stop();
|
|
2769
|
+
}
|
|
2770
|
+
}, _callee26, this, [[1, 11]]);
|
|
2771
|
+
}));
|
|
2772
|
+
function submitFreeOrder(_x17) {
|
|
2773
|
+
return _submitFreeOrder.apply(this, arguments);
|
|
2774
|
+
}
|
|
2775
|
+
return submitFreeOrder;
|
|
2776
|
+
}())
|
|
2777
|
+
}, {
|
|
2778
|
+
key: "addProductToOrder",
|
|
2779
|
+
value: function () {
|
|
2780
|
+
var _addProductToOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(product) {
|
|
2781
|
+
var _product$metadata6, _product$metadata7, smartPrice, products;
|
|
2782
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2783
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
2667
2784
|
case 0:
|
|
2668
2785
|
this.logMethodStart('addProductToOrder', {
|
|
2669
2786
|
product_id: product.product_id,
|
|
2670
2787
|
product_variant_id: product.product_variant_id
|
|
2671
2788
|
});
|
|
2672
|
-
|
|
2789
|
+
_context27.prev = 1;
|
|
2673
2790
|
if (this.store.order) {
|
|
2674
|
-
|
|
2791
|
+
_context27.next = 4;
|
|
2675
2792
|
break;
|
|
2676
2793
|
}
|
|
2677
2794
|
throw new Error('order 模块未初始化');
|
|
2678
2795
|
case 4:
|
|
2679
|
-
if (!((_product$
|
|
2796
|
+
if (!((_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) && product.product_id != null) {
|
|
2680
2797
|
smartPrice = getPriceForProductAtDatetime({
|
|
2681
2798
|
products: this.getAllProductsForSmartPricing(),
|
|
2682
2799
|
context: this.buildSmartPricingContext(),
|
|
@@ -2686,151 +2803,151 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2686
2803
|
});
|
|
2687
2804
|
product.selling_price = smartPrice;
|
|
2688
2805
|
product.original_price = smartPrice;
|
|
2689
|
-
} else if (product.selling_price != null && !((_product$
|
|
2806
|
+
} else if (product.selling_price != null && !((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.venue_booking)) {
|
|
2690
2807
|
product.original_price = product.selling_price;
|
|
2691
2808
|
}
|
|
2692
|
-
|
|
2809
|
+
_context27.next = 7;
|
|
2693
2810
|
return this.store.order.addProductToOrder(product);
|
|
2694
2811
|
case 7:
|
|
2695
|
-
products =
|
|
2696
|
-
|
|
2812
|
+
products = _context27.sent;
|
|
2813
|
+
_context27.next = 10;
|
|
2697
2814
|
return this.refreshItemRuleQuantityLimits();
|
|
2698
2815
|
case 10:
|
|
2699
|
-
|
|
2816
|
+
_context27.next = 12;
|
|
2700
2817
|
return this.refreshCartValidationPassed();
|
|
2701
2818
|
case 12:
|
|
2702
2819
|
this.logMethodSuccess('addProductToOrder', {
|
|
2703
2820
|
productCount: products.length
|
|
2704
2821
|
});
|
|
2705
|
-
return
|
|
2822
|
+
return _context27.abrupt("return", products);
|
|
2706
2823
|
case 16:
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
this.logMethodError('addProductToOrder',
|
|
2710
|
-
throw
|
|
2824
|
+
_context27.prev = 16;
|
|
2825
|
+
_context27.t0 = _context27["catch"](1);
|
|
2826
|
+
this.logMethodError('addProductToOrder', _context27.t0);
|
|
2827
|
+
throw _context27.t0;
|
|
2711
2828
|
case 20:
|
|
2712
2829
|
case "end":
|
|
2713
|
-
return
|
|
2830
|
+
return _context27.stop();
|
|
2714
2831
|
}
|
|
2715
|
-
},
|
|
2832
|
+
}, _callee27, this, [[1, 16]]);
|
|
2716
2833
|
}));
|
|
2717
|
-
function addProductToOrder(
|
|
2834
|
+
function addProductToOrder(_x18) {
|
|
2718
2835
|
return _addProductToOrder.apply(this, arguments);
|
|
2719
2836
|
}
|
|
2720
2837
|
return addProductToOrder;
|
|
2721
2838
|
}()
|
|
2722
2839
|
}, {
|
|
2723
|
-
key: "
|
|
2840
|
+
key: "updateOrderProduct",
|
|
2724
2841
|
value: function () {
|
|
2725
|
-
var
|
|
2842
|
+
var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(params) {
|
|
2726
2843
|
var products;
|
|
2727
|
-
return _regeneratorRuntime().wrap(function
|
|
2728
|
-
while (1) switch (
|
|
2844
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
2845
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
2729
2846
|
case 0:
|
|
2730
|
-
this.logMethodStart('
|
|
2847
|
+
this.logMethodStart('updateOrderProduct', {
|
|
2731
2848
|
product_id: params.product_id,
|
|
2732
2849
|
product_variant_id: params.product_variant_id
|
|
2733
2850
|
});
|
|
2734
|
-
|
|
2851
|
+
_context28.prev = 1;
|
|
2735
2852
|
if (this.store.order) {
|
|
2736
|
-
|
|
2853
|
+
_context28.next = 4;
|
|
2737
2854
|
break;
|
|
2738
2855
|
}
|
|
2739
2856
|
throw new Error('order 模块未初始化');
|
|
2740
2857
|
case 4:
|
|
2741
|
-
|
|
2742
|
-
return this.store.order.
|
|
2858
|
+
_context28.next = 6;
|
|
2859
|
+
return this.store.order.updateOrderProduct(params);
|
|
2743
2860
|
case 6:
|
|
2744
|
-
products =
|
|
2745
|
-
|
|
2861
|
+
products = _context28.sent;
|
|
2862
|
+
_context28.next = 9;
|
|
2746
2863
|
return this.refreshItemRuleQuantityLimits();
|
|
2747
2864
|
case 9:
|
|
2748
|
-
|
|
2865
|
+
_context28.next = 11;
|
|
2749
2866
|
return this.refreshCartValidationPassed();
|
|
2750
2867
|
case 11:
|
|
2751
|
-
this.logMethodSuccess('
|
|
2868
|
+
this.logMethodSuccess('updateOrderProduct', {
|
|
2752
2869
|
productCount: products.length
|
|
2753
2870
|
});
|
|
2754
|
-
return
|
|
2871
|
+
return _context28.abrupt("return", products);
|
|
2755
2872
|
case 15:
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
this.logMethodError('
|
|
2759
|
-
throw
|
|
2873
|
+
_context28.prev = 15;
|
|
2874
|
+
_context28.t0 = _context28["catch"](1);
|
|
2875
|
+
this.logMethodError('updateOrderProduct', _context28.t0);
|
|
2876
|
+
throw _context28.t0;
|
|
2760
2877
|
case 19:
|
|
2761
2878
|
case "end":
|
|
2762
|
-
return
|
|
2879
|
+
return _context28.stop();
|
|
2763
2880
|
}
|
|
2764
|
-
},
|
|
2881
|
+
}, _callee28, this, [[1, 15]]);
|
|
2765
2882
|
}));
|
|
2766
|
-
function
|
|
2767
|
-
return
|
|
2883
|
+
function updateOrderProduct(_x19) {
|
|
2884
|
+
return _updateOrderProduct.apply(this, arguments);
|
|
2768
2885
|
}
|
|
2769
|
-
return
|
|
2886
|
+
return updateOrderProduct;
|
|
2770
2887
|
}()
|
|
2771
2888
|
}, {
|
|
2772
2889
|
key: "removeProductFromOrder",
|
|
2773
2890
|
value: function () {
|
|
2774
|
-
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2775
|
-
var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$
|
|
2776
|
-
return _regeneratorRuntime().wrap(function
|
|
2777
|
-
while (1) switch (
|
|
2891
|
+
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(identity) {
|
|
2892
|
+
var _this$store$order$get3, _this$store$order9, _this$store$order$ens, _this$store$order10, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator17, _step17, _product$metadata8, _product$metadata9, product, beforeBookingCount, _this$store$order$per, _this$store$order11;
|
|
2893
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
2894
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
2778
2895
|
case 0:
|
|
2779
2896
|
this.logMethodStart('removeProductFromOrder', {
|
|
2780
2897
|
product_id: identity.product_id,
|
|
2781
2898
|
product_variant_id: identity.product_variant_id
|
|
2782
2899
|
});
|
|
2783
|
-
|
|
2900
|
+
_context29.prev = 1;
|
|
2784
2901
|
if (this.store.order) {
|
|
2785
|
-
|
|
2902
|
+
_context29.next = 4;
|
|
2786
2903
|
break;
|
|
2787
2904
|
}
|
|
2788
2905
|
throw new Error('order 模块未初始化');
|
|
2789
2906
|
case 4:
|
|
2790
2907
|
tempOrder = ((_this$store$order$get3 = (_this$store$order9 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order9)) || ((_this$store$order$ens = (_this$store$order10 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order10));
|
|
2791
|
-
|
|
2908
|
+
_context29.next = 7;
|
|
2792
2909
|
return this.store.order.removeProductFromOrder(identity);
|
|
2793
2910
|
case 7:
|
|
2794
|
-
products =
|
|
2911
|
+
products = _context29.sent;
|
|
2795
2912
|
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2796
|
-
|
|
2913
|
+
_context29.next = 33;
|
|
2797
2914
|
break;
|
|
2798
2915
|
}
|
|
2799
2916
|
venueProductUids = new Set();
|
|
2800
2917
|
venueBookingUids = new Set();
|
|
2801
2918
|
_iterator17 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2802
|
-
|
|
2919
|
+
_context29.prev = 12;
|
|
2803
2920
|
_iterator17.s();
|
|
2804
2921
|
case 14:
|
|
2805
2922
|
if ((_step17 = _iterator17.n()).done) {
|
|
2806
|
-
|
|
2923
|
+
_context29.next = 22;
|
|
2807
2924
|
break;
|
|
2808
2925
|
}
|
|
2809
2926
|
product = _step17.value;
|
|
2810
|
-
if (product !== null && product !== void 0 && (_product$
|
|
2811
|
-
|
|
2927
|
+
if (product !== null && product !== void 0 && (_product$metadata8 = product.metadata) !== null && _product$metadata8 !== void 0 && _product$metadata8.venue_booking) {
|
|
2928
|
+
_context29.next = 18;
|
|
2812
2929
|
break;
|
|
2813
2930
|
}
|
|
2814
|
-
return
|
|
2931
|
+
return _context29.abrupt("continue", 20);
|
|
2815
2932
|
case 18:
|
|
2816
2933
|
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2817
|
-
if ((_product$
|
|
2934
|
+
if ((_product$metadata9 = product.metadata) !== null && _product$metadata9 !== void 0 && _product$metadata9.booking_uid) {
|
|
2818
2935
|
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2819
2936
|
}
|
|
2820
2937
|
case 20:
|
|
2821
|
-
|
|
2938
|
+
_context29.next = 14;
|
|
2822
2939
|
break;
|
|
2823
2940
|
case 22:
|
|
2824
|
-
|
|
2941
|
+
_context29.next = 27;
|
|
2825
2942
|
break;
|
|
2826
2943
|
case 24:
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
_iterator17.e(
|
|
2944
|
+
_context29.prev = 24;
|
|
2945
|
+
_context29.t0 = _context29["catch"](12);
|
|
2946
|
+
_iterator17.e(_context29.t0);
|
|
2830
2947
|
case 27:
|
|
2831
|
-
|
|
2948
|
+
_context29.prev = 27;
|
|
2832
2949
|
_iterator17.f();
|
|
2833
|
-
return
|
|
2950
|
+
return _context29.finish(27);
|
|
2834
2951
|
case 30:
|
|
2835
2952
|
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2836
2953
|
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
@@ -2847,28 +2964,28 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2847
2964
|
(_this$store$order$per = (_this$store$order11 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order11);
|
|
2848
2965
|
}
|
|
2849
2966
|
case 33:
|
|
2850
|
-
|
|
2967
|
+
_context29.next = 35;
|
|
2851
2968
|
return this.refreshItemRuleQuantityLimits();
|
|
2852
2969
|
case 35:
|
|
2853
|
-
|
|
2970
|
+
_context29.next = 37;
|
|
2854
2971
|
return this.refreshCartValidationPassed();
|
|
2855
2972
|
case 37:
|
|
2856
2973
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2857
2974
|
productCount: products.length
|
|
2858
2975
|
});
|
|
2859
|
-
return
|
|
2976
|
+
return _context29.abrupt("return", products);
|
|
2860
2977
|
case 41:
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
this.logMethodError('removeProductFromOrder',
|
|
2864
|
-
throw
|
|
2978
|
+
_context29.prev = 41;
|
|
2979
|
+
_context29.t1 = _context29["catch"](1);
|
|
2980
|
+
this.logMethodError('removeProductFromOrder', _context29.t1);
|
|
2981
|
+
throw _context29.t1;
|
|
2865
2982
|
case 45:
|
|
2866
2983
|
case "end":
|
|
2867
|
-
return
|
|
2984
|
+
return _context29.stop();
|
|
2868
2985
|
}
|
|
2869
|
-
},
|
|
2986
|
+
}, _callee29, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2870
2987
|
}));
|
|
2871
|
-
function removeProductFromOrder(
|
|
2988
|
+
function removeProductFromOrder(_x20) {
|
|
2872
2989
|
return _removeProductFromOrder.apply(this, arguments);
|
|
2873
2990
|
}
|
|
2874
2991
|
return removeProductFromOrder;
|
|
@@ -2876,27 +2993,27 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2876
2993
|
}, {
|
|
2877
2994
|
key: "getProductList",
|
|
2878
2995
|
value: function () {
|
|
2879
|
-
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2996
|
+
var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
2880
2997
|
var result;
|
|
2881
|
-
return _regeneratorRuntime().wrap(function
|
|
2882
|
-
while (1) switch (
|
|
2998
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
2999
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
2883
3000
|
case 0:
|
|
2884
3001
|
if (!this.productsLoaded) {
|
|
2885
|
-
|
|
3002
|
+
_context30.next = 2;
|
|
2886
3003
|
break;
|
|
2887
3004
|
}
|
|
2888
|
-
return
|
|
3005
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(this.getAddonProductsList(), this.store.itemRuleQuantityLimits || []));
|
|
2889
3006
|
case 2:
|
|
2890
|
-
|
|
3007
|
+
_context30.next = 4;
|
|
2891
3008
|
return this.loadAllProducts();
|
|
2892
3009
|
case 4:
|
|
2893
|
-
result =
|
|
2894
|
-
return
|
|
3010
|
+
result = _context30.sent;
|
|
3011
|
+
return _context30.abrupt("return", attachItemRuleLimitsToTopLevelProducts(result.addonProducts, this.store.itemRuleQuantityLimits || []));
|
|
2895
3012
|
case 6:
|
|
2896
3013
|
case "end":
|
|
2897
|
-
return
|
|
3014
|
+
return _context30.stop();
|
|
2898
3015
|
}
|
|
2899
|
-
},
|
|
3016
|
+
}, _callee30, this);
|
|
2900
3017
|
}));
|
|
2901
3018
|
function getProductList() {
|
|
2902
3019
|
return _getProductList.apply(this, arguments);
|
|
@@ -2906,13 +3023,13 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2906
3023
|
}, {
|
|
2907
3024
|
key: "loadOpenDataConfig",
|
|
2908
3025
|
value: function () {
|
|
2909
|
-
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3026
|
+
var _loadOpenDataConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
2910
3027
|
var lastFetchedAt, cachedData, openDataConfig;
|
|
2911
|
-
return _regeneratorRuntime().wrap(function
|
|
2912
|
-
while (1) switch (
|
|
3028
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
3029
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
2913
3030
|
case 0:
|
|
2914
3031
|
if (this.store.openData) {
|
|
2915
|
-
|
|
3032
|
+
_context31.next = 2;
|
|
2916
3033
|
break;
|
|
2917
3034
|
}
|
|
2918
3035
|
throw new Error('openData 模块未初始化');
|
|
@@ -2920,42 +3037,42 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2920
3037
|
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
2921
3038
|
cachedData = this.store.openData.getOpenData();
|
|
2922
3039
|
if (!(cachedData && lastFetchedAt && Date.now() - lastFetchedAt < VenueBookingImpl.OPEN_DATA_CACHE_TTL)) {
|
|
2923
|
-
|
|
3040
|
+
_context31.next = 7;
|
|
2924
3041
|
break;
|
|
2925
3042
|
}
|
|
2926
3043
|
this.otherParams.openData = cachedData;
|
|
2927
|
-
return
|
|
3044
|
+
return _context31.abrupt("return", cachedData);
|
|
2928
3045
|
case 7:
|
|
2929
3046
|
if (!this.loadOpenDataConfigInFlight) {
|
|
2930
|
-
|
|
3047
|
+
_context31.next = 11;
|
|
2931
3048
|
break;
|
|
2932
3049
|
}
|
|
2933
|
-
|
|
3050
|
+
_context31.next = 10;
|
|
2934
3051
|
return this.loadOpenDataConfigInFlight;
|
|
2935
3052
|
case 10:
|
|
2936
|
-
return
|
|
3053
|
+
return _context31.abrupt("return", _context31.sent);
|
|
2937
3054
|
case 11:
|
|
2938
3055
|
this.loadOpenDataConfigInFlight = this.store.openData.fetchOpenData({
|
|
2939
3056
|
scope: 'board',
|
|
2940
3057
|
target: 'venue_booking+online_store',
|
|
2941
3058
|
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
2942
3059
|
});
|
|
2943
|
-
|
|
2944
|
-
|
|
3060
|
+
_context31.prev = 12;
|
|
3061
|
+
_context31.next = 15;
|
|
2945
3062
|
return this.loadOpenDataConfigInFlight;
|
|
2946
3063
|
case 15:
|
|
2947
|
-
openDataConfig =
|
|
3064
|
+
openDataConfig = _context31.sent;
|
|
2948
3065
|
this.otherParams.openData = openDataConfig;
|
|
2949
|
-
return
|
|
3066
|
+
return _context31.abrupt("return", openDataConfig);
|
|
2950
3067
|
case 18:
|
|
2951
|
-
|
|
3068
|
+
_context31.prev = 18;
|
|
2952
3069
|
this.loadOpenDataConfigInFlight = null;
|
|
2953
|
-
return
|
|
3070
|
+
return _context31.finish(18);
|
|
2954
3071
|
case 21:
|
|
2955
3072
|
case "end":
|
|
2956
|
-
return
|
|
3073
|
+
return _context31.stop();
|
|
2957
3074
|
}
|
|
2958
|
-
},
|
|
3075
|
+
}, _callee31, this, [[12,, 18, 21]]);
|
|
2959
3076
|
}));
|
|
2960
3077
|
function loadOpenDataConfig() {
|
|
2961
3078
|
return _loadOpenDataConfig.apply(this, arguments);
|
|
@@ -2965,29 +3082,29 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2965
3082
|
}, {
|
|
2966
3083
|
key: "loadRuntimeConfigs",
|
|
2967
3084
|
value: function () {
|
|
2968
|
-
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3085
|
+
var _loadRuntimeConfigs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
2969
3086
|
var itemRuleConfigs;
|
|
2970
|
-
return _regeneratorRuntime().wrap(function
|
|
2971
|
-
while (1) switch (
|
|
3087
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
3088
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
2972
3089
|
case 0:
|
|
2973
|
-
|
|
3090
|
+
_context32.next = 2;
|
|
2974
3091
|
return this.loadOpenDataConfig();
|
|
2975
3092
|
case 2:
|
|
2976
|
-
|
|
3093
|
+
_context32.next = 4;
|
|
2977
3094
|
return this.ensureItemRuleConfigsLoaded();
|
|
2978
3095
|
case 4:
|
|
2979
|
-
itemRuleConfigs =
|
|
3096
|
+
itemRuleConfigs = _context32.sent;
|
|
2980
3097
|
this.logMethodSuccess('loadRuntimeConfigs', {
|
|
2981
3098
|
itemRuleCount: itemRuleConfigs.length
|
|
2982
3099
|
});
|
|
2983
|
-
return
|
|
3100
|
+
return _context32.abrupt("return", {
|
|
2984
3101
|
itemRuleConfigs: itemRuleConfigs
|
|
2985
3102
|
});
|
|
2986
3103
|
case 7:
|
|
2987
3104
|
case "end":
|
|
2988
|
-
return
|
|
3105
|
+
return _context32.stop();
|
|
2989
3106
|
}
|
|
2990
|
-
},
|
|
3107
|
+
}, _callee32, this);
|
|
2991
3108
|
}));
|
|
2992
3109
|
function loadRuntimeConfigs() {
|
|
2993
3110
|
return _loadRuntimeConfigs.apply(this, arguments);
|
|
@@ -2997,22 +3114,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2997
3114
|
}, {
|
|
2998
3115
|
key: "fetchItemRuleConfigsByModelIds",
|
|
2999
3116
|
value: function () {
|
|
3000
|
-
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3117
|
+
var _fetchItemRuleConfigsByModelIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(strategyModelIds) {
|
|
3001
3118
|
var result, configs;
|
|
3002
|
-
return _regeneratorRuntime().wrap(function
|
|
3003
|
-
while (1) switch (
|
|
3119
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
3120
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
3004
3121
|
case 0:
|
|
3005
3122
|
this.logMethodStart('fetchItemRuleConfigsByModelIds', {
|
|
3006
3123
|
strategyModelIds: strategyModelIds
|
|
3007
3124
|
});
|
|
3008
3125
|
if (strategyModelIds.length) {
|
|
3009
|
-
|
|
3126
|
+
_context33.next = 3;
|
|
3010
3127
|
break;
|
|
3011
3128
|
}
|
|
3012
|
-
return
|
|
3129
|
+
return _context33.abrupt("return", []);
|
|
3013
3130
|
case 3:
|
|
3014
|
-
|
|
3015
|
-
|
|
3131
|
+
_context33.prev = 3;
|
|
3132
|
+
_context33.next = 6;
|
|
3016
3133
|
return this.request.get('/promotion', {
|
|
3017
3134
|
skip: 1,
|
|
3018
3135
|
num: 99,
|
|
@@ -3020,7 +3137,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3020
3137
|
ids: strategyModelIds
|
|
3021
3138
|
});
|
|
3022
3139
|
case 6:
|
|
3023
|
-
result =
|
|
3140
|
+
result = _context33.sent;
|
|
3024
3141
|
configs = [];
|
|
3025
3142
|
if (result.code === 200) {
|
|
3026
3143
|
configs = result.data.list.map(function (item) {
|
|
@@ -3031,21 +3148,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3031
3148
|
strategyModelIds: strategyModelIds,
|
|
3032
3149
|
strategyCount: configs.length
|
|
3033
3150
|
});
|
|
3034
|
-
return
|
|
3151
|
+
return _context33.abrupt("return", configs);
|
|
3035
3152
|
case 13:
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
this.logMethodError('fetchItemRuleConfigsByModelIds',
|
|
3153
|
+
_context33.prev = 13;
|
|
3154
|
+
_context33.t0 = _context33["catch"](3);
|
|
3155
|
+
this.logMethodError('fetchItemRuleConfigsByModelIds', _context33.t0, {
|
|
3039
3156
|
strategyModelIds: strategyModelIds
|
|
3040
3157
|
});
|
|
3041
|
-
return
|
|
3158
|
+
return _context33.abrupt("return", []);
|
|
3042
3159
|
case 17:
|
|
3043
3160
|
case "end":
|
|
3044
|
-
return
|
|
3161
|
+
return _context33.stop();
|
|
3045
3162
|
}
|
|
3046
|
-
},
|
|
3163
|
+
}, _callee33, this, [[3, 13]]);
|
|
3047
3164
|
}));
|
|
3048
|
-
function fetchItemRuleConfigsByModelIds(
|
|
3165
|
+
function fetchItemRuleConfigsByModelIds(_x21) {
|
|
3049
3166
|
return _fetchItemRuleConfigsByModelIds.apply(this, arguments);
|
|
3050
3167
|
}
|
|
3051
3168
|
return fetchItemRuleConfigsByModelIds;
|
|
@@ -3053,22 +3170,22 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3053
3170
|
}, {
|
|
3054
3171
|
key: "buildPrefillProductSourceMap",
|
|
3055
3172
|
value: function () {
|
|
3056
|
-
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3173
|
+
var _buildPrefillProductSourceMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
3057
3174
|
var sourceMap, productList, visited, collectFromValue;
|
|
3058
|
-
return _regeneratorRuntime().wrap(function
|
|
3059
|
-
while (1) switch (
|
|
3175
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
3176
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
3060
3177
|
case 0:
|
|
3061
3178
|
sourceMap = new Map();
|
|
3062
|
-
|
|
3063
|
-
|
|
3179
|
+
_context34.prev = 1;
|
|
3180
|
+
_context34.next = 4;
|
|
3064
3181
|
return this.getProductList();
|
|
3065
3182
|
case 4:
|
|
3066
|
-
productList =
|
|
3183
|
+
productList = _context34.sent;
|
|
3067
3184
|
if (Array.isArray(productList)) {
|
|
3068
|
-
|
|
3185
|
+
_context34.next = 7;
|
|
3069
3186
|
break;
|
|
3070
3187
|
}
|
|
3071
|
-
return
|
|
3188
|
+
return _context34.abrupt("return", sourceMap);
|
|
3072
3189
|
case 7:
|
|
3073
3190
|
visited = new Set();
|
|
3074
3191
|
collectFromValue = function collectFromValue(value) {
|
|
@@ -3095,8 +3212,8 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3095
3212
|
var rawProductId = (_node$product_id = node.product_id) !== null && _node$product_id !== void 0 ? _node$product_id : node.id;
|
|
3096
3213
|
var productId = Number(rawProductId);
|
|
3097
3214
|
if (Number.isFinite(productId) && productId > 0) {
|
|
3098
|
-
var
|
|
3099
|
-
var productVariantId = Number((
|
|
3215
|
+
var _ref5, _node$product_variant;
|
|
3216
|
+
var productVariantId = Number((_ref5 = (_node$product_variant = node.product_variant_id) !== null && _node$product_variant !== void 0 ? _node$product_variant : node.variant_id) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
3100
3217
|
var normalizedVariantId = Number.isNaN(productVariantId) ? 0 : productVariantId;
|
|
3101
3218
|
var key = buildProductKey(productId, normalizedVariantId);
|
|
3102
3219
|
if (!sourceMap.has(key)) sourceMap.set(key, node);
|
|
@@ -3107,19 +3224,19 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3107
3224
|
}
|
|
3108
3225
|
};
|
|
3109
3226
|
collectFromValue(productList);
|
|
3110
|
-
|
|
3227
|
+
_context34.next = 15;
|
|
3111
3228
|
break;
|
|
3112
3229
|
case 12:
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
this.logMethodError('buildPrefillProductSourceMap',
|
|
3230
|
+
_context34.prev = 12;
|
|
3231
|
+
_context34.t0 = _context34["catch"](1);
|
|
3232
|
+
this.logMethodError('buildPrefillProductSourceMap', _context34.t0);
|
|
3116
3233
|
case 15:
|
|
3117
|
-
return
|
|
3234
|
+
return _context34.abrupt("return", sourceMap);
|
|
3118
3235
|
case 16:
|
|
3119
3236
|
case "end":
|
|
3120
|
-
return
|
|
3237
|
+
return _context34.stop();
|
|
3121
3238
|
}
|
|
3122
|
-
},
|
|
3239
|
+
}, _callee34, this, [[1, 12]]);
|
|
3123
3240
|
}));
|
|
3124
3241
|
function buildPrefillProductSourceMap() {
|
|
3125
3242
|
return _buildPrefillProductSourceMap.apply(this, arguments);
|
|
@@ -3134,56 +3251,56 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3134
3251
|
}, {
|
|
3135
3252
|
key: "ensureItemRuleConfigsLoaded",
|
|
3136
3253
|
value: function () {
|
|
3137
|
-
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3254
|
+
var _ensureItemRuleConfigsLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
3138
3255
|
var _this10 = this;
|
|
3139
|
-
return _regeneratorRuntime().wrap(function
|
|
3140
|
-
while (1) switch (
|
|
3256
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
3257
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
3141
3258
|
case 0:
|
|
3142
3259
|
if (!(this.itemRuleConfigs.length > 0)) {
|
|
3143
|
-
|
|
3260
|
+
_context36.next = 2;
|
|
3144
3261
|
break;
|
|
3145
3262
|
}
|
|
3146
|
-
return
|
|
3263
|
+
return _context36.abrupt("return", this.itemRuleConfigs);
|
|
3147
3264
|
case 2:
|
|
3148
3265
|
if (!this.itemRuleConfigsPromise) {
|
|
3149
|
-
|
|
3266
|
+
_context36.next = 4;
|
|
3150
3267
|
break;
|
|
3151
3268
|
}
|
|
3152
|
-
return
|
|
3269
|
+
return _context36.abrupt("return", this.itemRuleConfigsPromise);
|
|
3153
3270
|
case 4:
|
|
3154
|
-
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3271
|
+
this.itemRuleConfigsPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
3155
3272
|
var runtimeConfig, staticConfigs;
|
|
3156
|
-
return _regeneratorRuntime().wrap(function
|
|
3157
|
-
while (1) switch (
|
|
3273
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
3274
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
3158
3275
|
case 0:
|
|
3159
3276
|
runtimeConfig = _this10.getItemRuleRuntimeConfig();
|
|
3160
3277
|
staticConfigs = normalizeItemRuleStrategies(runtimeConfig.strategyConfigs);
|
|
3161
3278
|
if (!(staticConfigs.length > 0)) {
|
|
3162
|
-
|
|
3279
|
+
_context35.next = 6;
|
|
3163
3280
|
break;
|
|
3164
3281
|
}
|
|
3165
3282
|
_this10.itemRuleConfigs = staticConfigs;
|
|
3166
3283
|
_this10.itemRuleEvaluator.setStrategyConfigs(staticConfigs);
|
|
3167
|
-
return
|
|
3284
|
+
return _context35.abrupt("return", _this10.itemRuleConfigs);
|
|
3168
3285
|
case 6:
|
|
3169
3286
|
_this10.itemRuleConfigs = [];
|
|
3170
3287
|
_this10.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3171
|
-
return
|
|
3288
|
+
return _context35.abrupt("return", _this10.itemRuleConfigs);
|
|
3172
3289
|
case 9:
|
|
3173
3290
|
case "end":
|
|
3174
|
-
return
|
|
3291
|
+
return _context35.stop();
|
|
3175
3292
|
}
|
|
3176
|
-
},
|
|
3293
|
+
}, _callee35);
|
|
3177
3294
|
}))();
|
|
3178
|
-
|
|
3295
|
+
_context36.next = 7;
|
|
3179
3296
|
return this.itemRuleConfigsPromise;
|
|
3180
3297
|
case 7:
|
|
3181
|
-
return
|
|
3298
|
+
return _context36.abrupt("return", _context36.sent);
|
|
3182
3299
|
case 8:
|
|
3183
3300
|
case "end":
|
|
3184
|
-
return
|
|
3301
|
+
return _context36.stop();
|
|
3185
3302
|
}
|
|
3186
|
-
},
|
|
3303
|
+
}, _callee36, this);
|
|
3187
3304
|
}));
|
|
3188
3305
|
function ensureItemRuleConfigsLoaded() {
|
|
3189
3306
|
return _ensureItemRuleConfigsLoaded.apply(this, arguments);
|
|
@@ -3193,25 +3310,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3193
3310
|
}, {
|
|
3194
3311
|
key: "refreshItemRuleQuantityLimits",
|
|
3195
3312
|
value: function () {
|
|
3196
|
-
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3313
|
+
var _refreshItemRuleQuantityLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
3197
3314
|
var strategyConfigs, businessData, limits;
|
|
3198
|
-
return _regeneratorRuntime().wrap(function
|
|
3199
|
-
while (1) switch (
|
|
3315
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
3316
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
3200
3317
|
case 0:
|
|
3201
|
-
|
|
3202
|
-
|
|
3318
|
+
_context37.prev = 0;
|
|
3319
|
+
_context37.next = 3;
|
|
3203
3320
|
return this.ensureItemRuleConfigsLoaded();
|
|
3204
3321
|
case 3:
|
|
3205
|
-
strategyConfigs =
|
|
3322
|
+
strategyConfigs = _context37.sent;
|
|
3206
3323
|
if (strategyConfigs.length) {
|
|
3207
|
-
|
|
3324
|
+
_context37.next = 7;
|
|
3208
3325
|
break;
|
|
3209
3326
|
}
|
|
3210
3327
|
this.store.itemRuleQuantityLimits = [];
|
|
3211
|
-
return
|
|
3328
|
+
return _context37.abrupt("return", []);
|
|
3212
3329
|
case 7:
|
|
3213
3330
|
businessData = buildItemRuleBusinessData({
|
|
3214
|
-
tempOrder: this.
|
|
3331
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
3215
3332
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3216
3333
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3217
3334
|
});
|
|
@@ -3220,18 +3337,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3220
3337
|
this.logMethodSuccess('refreshItemRuleQuantityLimits', {
|
|
3221
3338
|
limitCount: limits.length
|
|
3222
3339
|
});
|
|
3223
|
-
return
|
|
3340
|
+
return _context37.abrupt("return", limits);
|
|
3224
3341
|
case 14:
|
|
3225
|
-
|
|
3226
|
-
|
|
3342
|
+
_context37.prev = 14;
|
|
3343
|
+
_context37.t0 = _context37["catch"](0);
|
|
3227
3344
|
this.store.itemRuleQuantityLimits = [];
|
|
3228
|
-
this.logMethodError('refreshItemRuleQuantityLimits',
|
|
3229
|
-
return
|
|
3345
|
+
this.logMethodError('refreshItemRuleQuantityLimits', _context37.t0);
|
|
3346
|
+
return _context37.abrupt("return", []);
|
|
3230
3347
|
case 19:
|
|
3231
3348
|
case "end":
|
|
3232
|
-
return
|
|
3349
|
+
return _context37.stop();
|
|
3233
3350
|
}
|
|
3234
|
-
},
|
|
3351
|
+
}, _callee37, this, [[0, 14]]);
|
|
3235
3352
|
}));
|
|
3236
3353
|
function refreshItemRuleQuantityLimits() {
|
|
3237
3354
|
return _refreshItemRuleQuantityLimits.apply(this, arguments);
|
|
@@ -3241,58 +3358,58 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3241
3358
|
}, {
|
|
3242
3359
|
key: "applyPrefillByItemRule",
|
|
3243
3360
|
value: function () {
|
|
3244
|
-
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3245
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_,
|
|
3246
|
-
return _regeneratorRuntime().wrap(function
|
|
3247
|
-
while (1) switch (
|
|
3361
|
+
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
3362
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator19, _step19, _prefillItem$product_, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, _product$metadata10, sellingPrice, origin, product, productUid, targetProduct, previousOrigin, nextOrigin, existedQuantity, delta, nextProduct, _nextProduct$metadata, _productUid;
|
|
3363
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
3364
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
3248
3365
|
case 0:
|
|
3249
3366
|
if (!this.itemRulePrefillApplied) {
|
|
3250
|
-
|
|
3367
|
+
_context38.next = 2;
|
|
3251
3368
|
break;
|
|
3252
3369
|
}
|
|
3253
|
-
return
|
|
3370
|
+
return _context38.abrupt("return");
|
|
3254
3371
|
case 2:
|
|
3255
3372
|
if (this.store.order) {
|
|
3256
|
-
|
|
3373
|
+
_context38.next = 4;
|
|
3257
3374
|
break;
|
|
3258
3375
|
}
|
|
3259
|
-
return
|
|
3376
|
+
return _context38.abrupt("return");
|
|
3260
3377
|
case 4:
|
|
3261
|
-
|
|
3378
|
+
_context38.next = 6;
|
|
3262
3379
|
return this.ensureItemRuleConfigsLoaded();
|
|
3263
3380
|
case 6:
|
|
3264
|
-
strategyConfigs =
|
|
3381
|
+
strategyConfigs = _context38.sent;
|
|
3265
3382
|
if (strategyConfigs.length) {
|
|
3266
|
-
|
|
3383
|
+
_context38.next = 9;
|
|
3267
3384
|
break;
|
|
3268
3385
|
}
|
|
3269
|
-
return
|
|
3386
|
+
return _context38.abrupt("return");
|
|
3270
3387
|
case 9:
|
|
3271
3388
|
businessData = buildItemRuleBusinessData({
|
|
3272
|
-
tempOrder: this.
|
|
3389
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
3273
3390
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3274
3391
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3275
3392
|
});
|
|
3276
3393
|
prefillItems = this.itemRuleEvaluator.getPrefillItems(businessData);
|
|
3277
3394
|
if (prefillItems.length) {
|
|
3278
|
-
|
|
3395
|
+
_context38.next = 14;
|
|
3279
3396
|
break;
|
|
3280
3397
|
}
|
|
3281
3398
|
this.itemRulePrefillApplied = true;
|
|
3282
|
-
return
|
|
3399
|
+
return _context38.abrupt("return");
|
|
3283
3400
|
case 14:
|
|
3284
|
-
|
|
3401
|
+
_context38.next = 16;
|
|
3285
3402
|
return this.buildPrefillProductSourceMap();
|
|
3286
3403
|
case 16:
|
|
3287
|
-
productSourceMap =
|
|
3288
|
-
tempOrder = this.
|
|
3404
|
+
productSourceMap = _context38.sent;
|
|
3405
|
+
tempOrder = this.ensureVenueTempOrder();
|
|
3289
3406
|
hasChanges = false;
|
|
3290
3407
|
_iterator19 = _createForOfIteratorHelper(prefillItems);
|
|
3291
|
-
|
|
3408
|
+
_context38.prev = 20;
|
|
3292
3409
|
_iterator19.s();
|
|
3293
3410
|
case 22:
|
|
3294
3411
|
if ((_step19 = _iterator19.n()).done) {
|
|
3295
|
-
|
|
3412
|
+
_context38.next = 51;
|
|
3296
3413
|
break;
|
|
3297
3414
|
}
|
|
3298
3415
|
prefillItem = _step19.value;
|
|
@@ -3300,16 +3417,16 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3300
3417
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
3301
3418
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
3302
3419
|
if (!(!Number.isFinite(productId) || targetQuantity <= 0)) {
|
|
3303
|
-
|
|
3420
|
+
_context38.next = 29;
|
|
3304
3421
|
break;
|
|
3305
3422
|
}
|
|
3306
|
-
return
|
|
3423
|
+
return _context38.abrupt("continue", 49);
|
|
3307
3424
|
case 29:
|
|
3308
3425
|
if (!Number.isNaN(productVariantId)) {
|
|
3309
|
-
|
|
3426
|
+
_context38.next = 31;
|
|
3310
3427
|
break;
|
|
3311
3428
|
}
|
|
3312
|
-
return
|
|
3429
|
+
return _context38.abrupt("continue", 49);
|
|
3313
3430
|
case 31:
|
|
3314
3431
|
sourceItem = productSourceMap.get(buildProductKey(productId, productVariantId)) || productSourceMap.get(buildProductKey(productId, 0)) || null;
|
|
3315
3432
|
productIndex = getProductIdentityIndex(tempOrder.products, {
|
|
@@ -3317,11 +3434,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3317
3434
|
product_variant_id: productVariantId
|
|
3318
3435
|
});
|
|
3319
3436
|
if (!(productIndex === -1)) {
|
|
3320
|
-
|
|
3437
|
+
_context38.next = 42;
|
|
3321
3438
|
break;
|
|
3322
3439
|
}
|
|
3323
3440
|
sellingPrice = toPriceString((_sourceItem$price = sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price) !== null && _sourceItem$price !== void 0 ? _sourceItem$price : sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.selling_price, '0.00');
|
|
3324
|
-
|
|
3441
|
+
origin = _objectSpread(_objectSpread({}, sourceItem || {}), {}, {
|
|
3442
|
+
item_rule_prefill: true,
|
|
3443
|
+
item_rule_id: prefillItem.ruleId
|
|
3444
|
+
});
|
|
3445
|
+
product = normalizeOrderProduct({
|
|
3325
3446
|
product_id: productId,
|
|
3326
3447
|
product_variant_id: productVariantId,
|
|
3327
3448
|
num: targetQuantity,
|
|
@@ -3331,15 +3452,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3331
3452
|
item_rule_prefill: true,
|
|
3332
3453
|
item_rule_id: prefillItem.ruleId
|
|
3333
3454
|
},
|
|
3334
|
-
_origin:
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3455
|
+
_origin: origin
|
|
3456
|
+
});
|
|
3457
|
+
productUid = String(((_product$metadata10 = product.metadata) === null || _product$metadata10 === void 0 ? void 0 : _product$metadata10.unique_identification_number) || '');
|
|
3458
|
+
this.attachProductOriginToTempOrder(tempOrder, productUid, origin);
|
|
3459
|
+
tempOrder.products.push(product);
|
|
3339
3460
|
hasChanges = true;
|
|
3340
|
-
return
|
|
3341
|
-
case
|
|
3461
|
+
return _context38.abrupt("continue", 49);
|
|
3462
|
+
case 42:
|
|
3342
3463
|
targetProduct = tempOrder.products[productIndex];
|
|
3464
|
+
previousOrigin = this.readProductOriginFromTempOrder(tempOrder, targetProduct);
|
|
3465
|
+
nextOrigin = sourceItem ? _objectSpread(_objectSpread({}, previousOrigin || {}), sourceItem) : previousOrigin;
|
|
3343
3466
|
existedQuantity = toNonNegativeInt(targetProduct.num);
|
|
3344
3467
|
delta = targetQuantity - existedQuantity;
|
|
3345
3468
|
nextProduct = _objectSpread(_objectSpread(_objectSpread({}, targetProduct), delta > 0 ? {
|
|
@@ -3348,54 +3471,55 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3348
3471
|
metadata: _objectSpread(_objectSpread({}, targetProduct.metadata || {}), {}, {
|
|
3349
3472
|
item_rule_prefill: true,
|
|
3350
3473
|
item_rule_id: prefillItem.ruleId
|
|
3351
|
-
})
|
|
3352
|
-
_origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
|
|
3474
|
+
})
|
|
3353
3475
|
});
|
|
3354
|
-
if (delta > 0 || Boolean(sourceItem && (!
|
|
3476
|
+
if (delta > 0 || Boolean(sourceItem && (!previousOrigin || (previousOrigin === null || previousOrigin === void 0 ? void 0 : previousOrigin.price) !== (sourceItem === null || sourceItem === void 0 ? void 0 : sourceItem.price)))) {
|
|
3477
|
+
_productUid = String(((_nextProduct$metadata = nextProduct.metadata) === null || _nextProduct$metadata === void 0 ? void 0 : _nextProduct$metadata.unique_identification_number) || '');
|
|
3478
|
+
this.attachProductOriginToTempOrder(tempOrder, _productUid, nextOrigin);
|
|
3355
3479
|
tempOrder.products[productIndex] = nextProduct;
|
|
3356
3480
|
hasChanges = true;
|
|
3357
3481
|
}
|
|
3358
|
-
case
|
|
3359
|
-
|
|
3482
|
+
case 49:
|
|
3483
|
+
_context38.next = 22;
|
|
3360
3484
|
break;
|
|
3361
|
-
case
|
|
3362
|
-
|
|
3485
|
+
case 51:
|
|
3486
|
+
_context38.next = 56;
|
|
3363
3487
|
break;
|
|
3364
|
-
case 47:
|
|
3365
|
-
_context37.prev = 47;
|
|
3366
|
-
_context37.t0 = _context37["catch"](20);
|
|
3367
|
-
_iterator19.e(_context37.t0);
|
|
3368
|
-
case 50:
|
|
3369
|
-
_context37.prev = 50;
|
|
3370
|
-
_iterator19.f();
|
|
3371
|
-
return _context37.finish(50);
|
|
3372
3488
|
case 53:
|
|
3489
|
+
_context38.prev = 53;
|
|
3490
|
+
_context38.t0 = _context38["catch"](20);
|
|
3491
|
+
_iterator19.e(_context38.t0);
|
|
3492
|
+
case 56:
|
|
3493
|
+
_context38.prev = 56;
|
|
3494
|
+
_iterator19.f();
|
|
3495
|
+
return _context38.finish(56);
|
|
3496
|
+
case 59:
|
|
3373
3497
|
if (!hasChanges) {
|
|
3374
|
-
|
|
3498
|
+
_context38.next = 64;
|
|
3375
3499
|
break;
|
|
3376
3500
|
}
|
|
3377
3501
|
// Prefill 属于 products CRUD 的一种形式:新增后让 Rules 重算,以支持自动应用可用优惠券。
|
|
3378
3502
|
this.store.order.applyDiscount();
|
|
3379
|
-
|
|
3503
|
+
_context38.next = 63;
|
|
3380
3504
|
return this.store.order.recalculateSummary({
|
|
3381
3505
|
createIfMissing: true
|
|
3382
3506
|
});
|
|
3383
|
-
case
|
|
3507
|
+
case 63:
|
|
3384
3508
|
this.store.order.persistTempOrder();
|
|
3385
|
-
case
|
|
3386
|
-
|
|
3509
|
+
case 64:
|
|
3510
|
+
_context38.next = 66;
|
|
3387
3511
|
return this.refreshItemRuleQuantityLimits();
|
|
3388
|
-
case
|
|
3512
|
+
case 66:
|
|
3389
3513
|
this.itemRulePrefillApplied = true;
|
|
3390
3514
|
this.logMethodSuccess('applyPrefillByItemRule', {
|
|
3391
3515
|
prefillCount: prefillItems.length,
|
|
3392
3516
|
hasChanges: hasChanges
|
|
3393
3517
|
});
|
|
3394
|
-
case
|
|
3518
|
+
case 68:
|
|
3395
3519
|
case "end":
|
|
3396
|
-
return
|
|
3520
|
+
return _context38.stop();
|
|
3397
3521
|
}
|
|
3398
|
-
},
|
|
3522
|
+
}, _callee38, this, [[20, 53, 56, 59]]);
|
|
3399
3523
|
}));
|
|
3400
3524
|
function applyPrefillByItemRule() {
|
|
3401
3525
|
return _applyPrefillByItemRule.apply(this, arguments);
|
|
@@ -3405,24 +3529,24 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3405
3529
|
}, {
|
|
3406
3530
|
key: "applyItemRulePrefill",
|
|
3407
3531
|
value: function () {
|
|
3408
|
-
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3409
|
-
return _regeneratorRuntime().wrap(function
|
|
3410
|
-
while (1) switch (
|
|
3532
|
+
var _applyItemRulePrefill = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
3533
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
3534
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
3411
3535
|
case 0:
|
|
3412
3536
|
this.logMethodStart('applyItemRulePrefill');
|
|
3413
|
-
|
|
3537
|
+
_context39.next = 3;
|
|
3414
3538
|
return this.applyPrefillByItemRule();
|
|
3415
3539
|
case 3:
|
|
3416
|
-
|
|
3540
|
+
_context39.next = 5;
|
|
3417
3541
|
return this.refreshItemRuleQuantityLimits();
|
|
3418
3542
|
case 5:
|
|
3419
|
-
|
|
3543
|
+
_context39.next = 7;
|
|
3420
3544
|
return this.refreshCartValidationPassed();
|
|
3421
3545
|
case 7:
|
|
3422
3546
|
case "end":
|
|
3423
|
-
return
|
|
3547
|
+
return _context39.stop();
|
|
3424
3548
|
}
|
|
3425
|
-
},
|
|
3549
|
+
}, _callee39, this);
|
|
3426
3550
|
}));
|
|
3427
3551
|
function applyItemRulePrefill() {
|
|
3428
3552
|
return _applyItemRulePrefill.apply(this, arguments);
|
|
@@ -3432,35 +3556,35 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3432
3556
|
}, {
|
|
3433
3557
|
key: "evaluateCartValidationByItemRule",
|
|
3434
3558
|
value: function () {
|
|
3435
|
-
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3559
|
+
var _evaluateCartValidationByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
3436
3560
|
var strategyConfigs, businessData;
|
|
3437
|
-
return _regeneratorRuntime().wrap(function
|
|
3438
|
-
while (1) switch (
|
|
3561
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
3562
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
3439
3563
|
case 0:
|
|
3440
|
-
|
|
3564
|
+
_context40.next = 2;
|
|
3441
3565
|
return this.ensureItemRuleConfigsLoaded();
|
|
3442
3566
|
case 2:
|
|
3443
|
-
strategyConfigs =
|
|
3567
|
+
strategyConfigs = _context40.sent;
|
|
3444
3568
|
if (strategyConfigs.length) {
|
|
3445
|
-
|
|
3569
|
+
_context40.next = 5;
|
|
3446
3570
|
break;
|
|
3447
3571
|
}
|
|
3448
|
-
return
|
|
3572
|
+
return _context40.abrupt("return", {
|
|
3449
3573
|
passed: true,
|
|
3450
3574
|
failures: []
|
|
3451
3575
|
});
|
|
3452
3576
|
case 5:
|
|
3453
3577
|
businessData = buildItemRuleBusinessData({
|
|
3454
|
-
tempOrder: this.
|
|
3578
|
+
tempOrder: this.ensureVenueTempOrder(),
|
|
3455
3579
|
runtimeConfig: this.getItemRuleRuntimeConfig(),
|
|
3456
3580
|
itemRuleConfigs: this.itemRuleConfigs
|
|
3457
3581
|
});
|
|
3458
|
-
return
|
|
3582
|
+
return _context40.abrupt("return", this.itemRuleEvaluator.validateCart(businessData));
|
|
3459
3583
|
case 7:
|
|
3460
3584
|
case "end":
|
|
3461
|
-
return
|
|
3585
|
+
return _context40.stop();
|
|
3462
3586
|
}
|
|
3463
|
-
},
|
|
3587
|
+
}, _callee40, this);
|
|
3464
3588
|
}));
|
|
3465
3589
|
function evaluateCartValidationByItemRule() {
|
|
3466
3590
|
return _evaluateCartValidationByItemRule.apply(this, arguments);
|
|
@@ -3470,20 +3594,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3470
3594
|
}, {
|
|
3471
3595
|
key: "validateBeforeSubmitByItemRule",
|
|
3472
3596
|
value: function () {
|
|
3473
|
-
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3597
|
+
var _validateBeforeSubmitByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41() {
|
|
3474
3598
|
var validationResult, firstFailure, errorMessage, error;
|
|
3475
|
-
return _regeneratorRuntime().wrap(function
|
|
3476
|
-
while (1) switch (
|
|
3599
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
|
3600
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
3477
3601
|
case 0:
|
|
3478
|
-
|
|
3602
|
+
_context41.next = 2;
|
|
3479
3603
|
return this.evaluateCartValidationByItemRule();
|
|
3480
3604
|
case 2:
|
|
3481
|
-
validationResult =
|
|
3605
|
+
validationResult = _context41.sent;
|
|
3482
3606
|
if (!validationResult.passed) {
|
|
3483
|
-
|
|
3607
|
+
_context41.next = 5;
|
|
3484
3608
|
break;
|
|
3485
3609
|
}
|
|
3486
|
-
return
|
|
3610
|
+
return _context41.abrupt("return");
|
|
3487
3611
|
case 5:
|
|
3488
3612
|
firstFailure = validationResult.failures[0];
|
|
3489
3613
|
errorMessage = (firstFailure === null || firstFailure === void 0 ? void 0 : firstFailure.validationMessage) || '当前购物车未满足商品规则,请调整后再提交';
|
|
@@ -3492,9 +3616,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3492
3616
|
throw error;
|
|
3493
3617
|
case 10:
|
|
3494
3618
|
case "end":
|
|
3495
|
-
return
|
|
3619
|
+
return _context41.stop();
|
|
3496
3620
|
}
|
|
3497
|
-
},
|
|
3621
|
+
}, _callee41, this);
|
|
3498
3622
|
}));
|
|
3499
3623
|
function validateBeforeSubmitByItemRule() {
|
|
3500
3624
|
return _validateBeforeSubmitByItemRule.apply(this, arguments);
|
|
@@ -3504,10 +3628,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3504
3628
|
}, {
|
|
3505
3629
|
key: "refreshCartValidationPassed",
|
|
3506
3630
|
value: function () {
|
|
3507
|
-
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3631
|
+
var _refreshCartValidationPassed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42() {
|
|
3508
3632
|
var previous, nextState, validationResult, changed;
|
|
3509
|
-
return _regeneratorRuntime().wrap(function
|
|
3510
|
-
while (1) switch (
|
|
3633
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
|
3634
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
3511
3635
|
case 0:
|
|
3512
3636
|
previous = this.store.cartValidation || {
|
|
3513
3637
|
passed: null,
|
|
@@ -3517,20 +3641,20 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3517
3641
|
passed: null,
|
|
3518
3642
|
failures: []
|
|
3519
3643
|
};
|
|
3520
|
-
|
|
3521
|
-
|
|
3644
|
+
_context42.prev = 2;
|
|
3645
|
+
_context42.next = 5;
|
|
3522
3646
|
return this.evaluateCartValidationByItemRule();
|
|
3523
3647
|
case 5:
|
|
3524
|
-
validationResult =
|
|
3648
|
+
validationResult = _context42.sent;
|
|
3525
3649
|
nextState = {
|
|
3526
3650
|
passed: validationResult.passed,
|
|
3527
3651
|
failures: validationResult.failures || []
|
|
3528
3652
|
};
|
|
3529
|
-
|
|
3653
|
+
_context42.next = 12;
|
|
3530
3654
|
break;
|
|
3531
3655
|
case 9:
|
|
3532
|
-
|
|
3533
|
-
|
|
3656
|
+
_context42.prev = 9;
|
|
3657
|
+
_context42.t0 = _context42["catch"](2);
|
|
3534
3658
|
nextState = {
|
|
3535
3659
|
passed: false,
|
|
3536
3660
|
failures: []
|
|
@@ -3539,21 +3663,21 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3539
3663
|
this.store.cartValidation = nextState;
|
|
3540
3664
|
changed = previous.passed !== nextState.passed || previous.failures !== nextState.failures;
|
|
3541
3665
|
if (!changed) {
|
|
3542
|
-
|
|
3666
|
+
_context42.next = 17;
|
|
3543
3667
|
break;
|
|
3544
3668
|
}
|
|
3545
|
-
|
|
3669
|
+
_context42.next = 17;
|
|
3546
3670
|
return this.core.effects.emit(VenueBookingHooks.onCartValidationChanged, {
|
|
3547
3671
|
cartValidation: nextState,
|
|
3548
3672
|
cartValidationPassed: nextState.passed
|
|
3549
3673
|
});
|
|
3550
3674
|
case 17:
|
|
3551
|
-
return
|
|
3675
|
+
return _context42.abrupt("return", nextState.passed);
|
|
3552
3676
|
case 18:
|
|
3553
3677
|
case "end":
|
|
3554
|
-
return
|
|
3678
|
+
return _context42.stop();
|
|
3555
3679
|
}
|
|
3556
|
-
},
|
|
3680
|
+
}, _callee42, this, [[2, 9]]);
|
|
3557
3681
|
}));
|
|
3558
3682
|
function refreshCartValidationPassed() {
|
|
3559
3683
|
return _refreshCartValidationPassed.apply(this, arguments);
|
|
@@ -3563,14 +3687,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3563
3687
|
}, {
|
|
3564
3688
|
key: "setItemRuleRuntimeConfig",
|
|
3565
3689
|
value: function () {
|
|
3566
|
-
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3690
|
+
var _setItemRuleRuntimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43() {
|
|
3567
3691
|
var _this$itemRuleRuntime, _this$itemRuleRuntime2;
|
|
3568
3692
|
var config,
|
|
3569
|
-
|
|
3570
|
-
return _regeneratorRuntime().wrap(function
|
|
3571
|
-
while (1) switch (
|
|
3693
|
+
_args43 = arguments;
|
|
3694
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
3695
|
+
while (1) switch (_context43.prev = _context43.next) {
|
|
3572
3696
|
case 0:
|
|
3573
|
-
config =
|
|
3697
|
+
config = _args43.length > 0 && _args43[0] !== undefined ? _args43[0] : {};
|
|
3574
3698
|
this.logMethodStart('setItemRuleRuntimeConfig');
|
|
3575
3699
|
this.itemRuleRuntimeConfig = _objectSpread(_objectSpread(_objectSpread({}, this.itemRuleRuntimeConfig), config), {}, {
|
|
3576
3700
|
pax: _objectSpread(_objectSpread({}, ((_this$itemRuleRuntime = this.itemRuleRuntimeConfig) === null || _this$itemRuleRuntime === void 0 ? void 0 : _this$itemRuleRuntime.pax) || {}), (config === null || config === void 0 ? void 0 : config.pax) || {}),
|
|
@@ -3582,10 +3706,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3582
3706
|
this.itemRuleEvaluator.setStrategyConfigs([]);
|
|
3583
3707
|
}
|
|
3584
3708
|
this.itemRulePrefillApplied = false;
|
|
3585
|
-
|
|
3709
|
+
_context43.next = 7;
|
|
3586
3710
|
return this.refreshItemRuleQuantityLimits();
|
|
3587
3711
|
case 7:
|
|
3588
|
-
|
|
3712
|
+
_context43.next = 9;
|
|
3589
3713
|
return this.refreshCartValidationPassed();
|
|
3590
3714
|
case 9:
|
|
3591
3715
|
this.logMethodSuccess('setItemRuleRuntimeConfig', {
|
|
@@ -3593,9 +3717,9 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3593
3717
|
});
|
|
3594
3718
|
case 10:
|
|
3595
3719
|
case "end":
|
|
3596
|
-
return
|
|
3720
|
+
return _context43.stop();
|
|
3597
3721
|
}
|
|
3598
|
-
},
|
|
3722
|
+
}, _callee43, this);
|
|
3599
3723
|
}));
|
|
3600
3724
|
function setItemRuleRuntimeConfig() {
|
|
3601
3725
|
return _setItemRuleRuntimeConfig.apply(this, arguments);
|
|
@@ -3683,13 +3807,14 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3683
3807
|
_step20;
|
|
3684
3808
|
try {
|
|
3685
3809
|
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
3686
|
-
var
|
|
3810
|
+
var _runtimeProduct$metad, _runtimeProduct$metad2, _runtimeProduct$_orig;
|
|
3687
3811
|
var product = _step20.value;
|
|
3688
|
-
var
|
|
3812
|
+
var runtimeProduct = product;
|
|
3813
|
+
var productBookingUid = (_runtimeProduct$metad = (_runtimeProduct$metad2 = runtimeProduct.metadata) === null || _runtimeProduct$metad2 === void 0 ? void 0 : _runtimeProduct$metad2.booking_uid) !== null && _runtimeProduct$metad !== void 0 ? _runtimeProduct$metad : (_runtimeProduct$_orig = runtimeProduct._origin) === null || _runtimeProduct$_orig === void 0 || (_runtimeProduct$_orig = _runtimeProduct$_orig.product) === null || _runtimeProduct$_orig === void 0 ? void 0 : _runtimeProduct$_orig.bookingUuid;
|
|
3689
3814
|
if (String(productBookingUid) !== String(bookingUid)) continue;
|
|
3690
|
-
var origin =
|
|
3815
|
+
var origin = runtimeProduct._origin && _typeof(runtimeProduct._origin) === 'object' ? runtimeProduct._origin : {};
|
|
3691
3816
|
origin.holder = holder;
|
|
3692
|
-
|
|
3817
|
+
runtimeProduct._origin = origin;
|
|
3693
3818
|
}
|
|
3694
3819
|
} catch (err) {
|
|
3695
3820
|
_iterator20.e(err);
|
|
@@ -3715,30 +3840,30 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3715
3840
|
}, {
|
|
3716
3841
|
key: "refreshAllHolderFormRecords",
|
|
3717
3842
|
value: (function () {
|
|
3718
|
-
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3843
|
+
var _refreshAllHolderFormRecords = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
3719
3844
|
var _params$customer_id, _params$useCache;
|
|
3720
3845
|
var customer_id;
|
|
3721
|
-
return _regeneratorRuntime().wrap(function
|
|
3722
|
-
while (1) switch (
|
|
3846
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
3847
|
+
while (1) switch (_context44.prev = _context44.next) {
|
|
3723
3848
|
case 0:
|
|
3724
3849
|
if (this.store.holder) {
|
|
3725
|
-
|
|
3850
|
+
_context44.next = 2;
|
|
3726
3851
|
break;
|
|
3727
3852
|
}
|
|
3728
3853
|
throw new Error('[VenueBooking] holder 模块未初始化');
|
|
3729
3854
|
case 2:
|
|
3730
3855
|
customer_id = (_params$customer_id = params === null || params === void 0 ? void 0 : params.customer_id) !== null && _params$customer_id !== void 0 ? _params$customer_id : this.resolveHolderCustomerId();
|
|
3731
|
-
return
|
|
3856
|
+
return _context44.abrupt("return", this.store.holder.refreshAllFormRecords(_objectSpread(_objectSpread({}, params), {}, {
|
|
3732
3857
|
customer_id: customer_id,
|
|
3733
3858
|
useCache: (_params$useCache = params === null || params === void 0 ? void 0 : params.useCache) !== null && _params$useCache !== void 0 ? _params$useCache : false
|
|
3734
3859
|
})));
|
|
3735
3860
|
case 4:
|
|
3736
3861
|
case "end":
|
|
3737
|
-
return
|
|
3862
|
+
return _context44.stop();
|
|
3738
3863
|
}
|
|
3739
|
-
},
|
|
3864
|
+
}, _callee44, this);
|
|
3740
3865
|
}));
|
|
3741
|
-
function refreshAllHolderFormRecords(
|
|
3866
|
+
function refreshAllHolderFormRecords(_x22) {
|
|
3742
3867
|
return _refreshAllHolderFormRecords.apply(this, arguments);
|
|
3743
3868
|
}
|
|
3744
3869
|
return refreshAllHolderFormRecords;
|
|
@@ -3758,25 +3883,25 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3758
3883
|
}, {
|
|
3759
3884
|
key: "checkOpenDataAvailability",
|
|
3760
3885
|
value: function () {
|
|
3761
|
-
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3762
|
-
return _regeneratorRuntime().wrap(function
|
|
3763
|
-
while (1) switch (
|
|
3886
|
+
var _checkOpenDataAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45() {
|
|
3887
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
|
3888
|
+
while (1) switch (_context45.prev = _context45.next) {
|
|
3764
3889
|
case 0:
|
|
3765
3890
|
if (this.store.openData) {
|
|
3766
|
-
|
|
3891
|
+
_context45.next = 2;
|
|
3767
3892
|
break;
|
|
3768
3893
|
}
|
|
3769
3894
|
throw new Error('openData 模块未初始化');
|
|
3770
3895
|
case 2:
|
|
3771
|
-
|
|
3896
|
+
_context45.next = 4;
|
|
3772
3897
|
return this.loadOpenDataConfig();
|
|
3773
3898
|
case 4:
|
|
3774
|
-
return
|
|
3899
|
+
return _context45.abrupt("return", this.store.openData.checkAvailability(this.store.schedule));
|
|
3775
3900
|
case 5:
|
|
3776
3901
|
case "end":
|
|
3777
|
-
return
|
|
3902
|
+
return _context45.stop();
|
|
3778
3903
|
}
|
|
3779
|
-
},
|
|
3904
|
+
}, _callee45, this);
|
|
3780
3905
|
}));
|
|
3781
3906
|
function checkOpenDataAvailability() {
|
|
3782
3907
|
return _checkOpenDataAvailability.apply(this, arguments);
|
|
@@ -3786,15 +3911,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3786
3911
|
}, {
|
|
3787
3912
|
key: "setOtherParams",
|
|
3788
3913
|
value: function () {
|
|
3789
|
-
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3790
|
-
var
|
|
3791
|
-
|
|
3914
|
+
var _setOtherParams = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
3915
|
+
var _ref7,
|
|
3916
|
+
_ref7$cover,
|
|
3792
3917
|
cover,
|
|
3793
|
-
|
|
3794
|
-
return _regeneratorRuntime().wrap(function
|
|
3795
|
-
while (1) switch (
|
|
3918
|
+
_args46 = arguments;
|
|
3919
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
|
3920
|
+
while (1) switch (_context46.prev = _context46.next) {
|
|
3796
3921
|
case 0:
|
|
3797
|
-
|
|
3922
|
+
_ref7 = _args46.length > 1 && _args46[1] !== undefined ? _args46[1] : {}, _ref7$cover = _ref7.cover, cover = _ref7$cover === void 0 ? false : _ref7$cover;
|
|
3798
3923
|
if (cover) {
|
|
3799
3924
|
this.otherParams = params;
|
|
3800
3925
|
} else {
|
|
@@ -3802,18 +3927,18 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
3802
3927
|
}
|
|
3803
3928
|
case 2:
|
|
3804
3929
|
case "end":
|
|
3805
|
-
return
|
|
3930
|
+
return _context46.stop();
|
|
3806
3931
|
}
|
|
3807
|
-
},
|
|
3932
|
+
}, _callee46, this);
|
|
3808
3933
|
}));
|
|
3809
|
-
function setOtherParams(
|
|
3934
|
+
function setOtherParams(_x23) {
|
|
3810
3935
|
return _setOtherParams.apply(this, arguments);
|
|
3811
3936
|
}
|
|
3812
3937
|
return setOtherParams;
|
|
3813
3938
|
}()
|
|
3814
3939
|
}]);
|
|
3815
3940
|
return VenueBookingImpl;
|
|
3816
|
-
}(
|
|
3941
|
+
}(BaseSalesImpl);
|
|
3817
3942
|
_defineProperty(VenueBookingImpl, "OPEN_DATA_CACHE_TTL", 5 * 60 * 1000);
|
|
3818
3943
|
_defineProperty(VenueBookingImpl, "PISELL1_LOGIN_SUCCESS", 'pisell1.login.success');
|
|
3819
3944
|
_defineProperty(VenueBookingImpl, "UI_STATE_KEY_PREFIX", 'pisell.venueBooking.uiState:');
|