@pisell/pisellos 0.0.568 → 0.10.1
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 +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +24 -96
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +12 -14
- 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 +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +27 -5
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- 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 +5 -1
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +43 -30
- package/dist/modules/Discount/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +38 -16
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5460 -574
- 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 +573 -746
- package/dist/modules/Payment/types.d.ts +44 -24
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +49 -33
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +182 -81
- package/dist/modules/ProductList/types.d.ts +16 -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 +324 -513
- 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 +804 -165
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -12
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +79 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/Summary/utils.js +22 -43
- 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 +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6168 -680
- 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 +41 -32
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2328 -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 +1416 -521
- 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 +298 -77
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +109 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +145 -106
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +3 -2
- 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 +4009 -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.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2508 -443
- 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 +42 -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 +42 -28
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +30 -14
- 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 +12 -9
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +275 -209
- package/dist/solution/Checkout/utils/index.js +20 -8
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- 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 +519 -444
- 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 +18 -19
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- 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 +32 -51
- package/dist/solution/VenueBooking/index.js +741 -808
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +12 -2
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +233 -382
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +0 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -676
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +50 -29
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +298 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +155 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +222 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -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 +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +261 -309
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +59 -31
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +207 -217
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +133 -119
- package/lib/modules/Discount/types.d.ts +1 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +88 -63
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +4184 -514
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +35 -24
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1085 -414
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +402 -636
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +44 -24
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +50 -52
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +216 -221
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +161 -120
- package/lib/modules/ProductList/types.d.ts +16 -0
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +154 -64
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +960 -1440
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +134 -61
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +814 -233
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +169 -338
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +153 -104
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +109 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +63 -212
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4520 -1162
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +67 -84
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1543 -285
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +32 -107
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +259 -176
- package/lib/server/modules/order/utils/filterOrders.js +293 -94
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +850 -475
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +34 -41
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +254 -75
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +240 -243
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +146 -147
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +140 -197
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +904 -0
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2533 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +43 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1004 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +289 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +256 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +244 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1374 -184
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +79 -40
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +184 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -64
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -82
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +109 -91
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1169 -1463
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +462 -503
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +498 -238
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +936 -864
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +422 -385
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +32 -51
- package/lib/solution/VenueBooking/index.js +1008 -984
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +109 -90
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +41 -102
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +12 -2
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
|
+
*
|
|
4
|
+
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
5
|
+
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
|
+
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
|
+
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
8
|
+
* - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
|
|
9
|
+
*
|
|
10
|
+
* 设计原则(与 BookingTicket 现状对齐):
|
|
11
|
+
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
12
|
+
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
|
+
*/
|
|
14
|
+
/** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
|
|
15
|
+
export interface LoadBookingConfigParams {
|
|
16
|
+
item_type?: string;
|
|
17
|
+
sub_type?: string;
|
|
18
|
+
source_type?: string;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
22
|
+
export interface LoadBookingResourcesParams {
|
|
23
|
+
/** 查询日期,`YYYY-MM-DD`;缺省用 store 内已 set 的 date,再缺省为当天。 */
|
|
24
|
+
date?: string;
|
|
25
|
+
/** 编辑态排除容量占用用的 booking id 列表。 */
|
|
26
|
+
bookingIds?: number[];
|
|
27
|
+
}
|
|
28
|
+
/** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
|
|
29
|
+
export interface InitBookingContextParams {
|
|
30
|
+
bookingConfigParams?: LoadBookingConfigParams;
|
|
31
|
+
date?: BookingContextDateInput;
|
|
32
|
+
/** 是否拉资源列表,默认 true。 */
|
|
33
|
+
loadResources?: boolean;
|
|
34
|
+
bookingIds?: number[];
|
|
35
|
+
/** 为 true 时忽略内存命中,强制重新请求(默认 false)。 */
|
|
36
|
+
forceRefresh?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
|
|
40
|
+
* 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
|
|
41
|
+
*/
|
|
42
|
+
export type BookingContextResource = Record<string, any>;
|
|
43
|
+
export type BookingContextResourceMap = Record<string, BookingContextResource>;
|
|
44
|
+
/**
|
|
45
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
46
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
47
|
+
*/
|
|
48
|
+
export type BookingContextConfig = Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
51
|
+
*/
|
|
52
|
+
export type BookingContextDateInput = string | Date | {
|
|
53
|
+
format?: (fmt?: string) => string;
|
|
54
|
+
} | null | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
|
|
57
|
+
*/
|
|
58
|
+
export interface BookingContextState {
|
|
59
|
+
bookingConfig: BookingContextConfig | null;
|
|
60
|
+
resourcesOrigin: BookingContextResource[];
|
|
61
|
+
resourcesOriginMap: BookingContextResourceMap;
|
|
62
|
+
/**
|
|
63
|
+
* 当前选择的日期,统一 ISO 字符串('YYYY-MM-DD HH:mm:ss' 或 'YYYY-MM-DD')。
|
|
64
|
+
* UI 取出后可自行 dayjs 解析;OS 内的计算 helper 都接受 string,不做 dayjs 依赖。
|
|
65
|
+
*/
|
|
66
|
+
date: string | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
|
|
70
|
+
*/
|
|
71
|
+
export interface BookingContextModuleAPI {
|
|
72
|
+
setBookingConfig(config: BookingContextConfig | null): void;
|
|
73
|
+
getBookingConfig(): BookingContextConfig | null;
|
|
74
|
+
setResources(resources: BookingContextResource[] | null | undefined): void;
|
|
75
|
+
getResourcesOrigin(): BookingContextResource[];
|
|
76
|
+
getResourcesOriginMap(): BookingContextResourceMap;
|
|
77
|
+
setDate(date: BookingContextDateInput): void;
|
|
78
|
+
getDate(): string | null;
|
|
79
|
+
/** 当前 store 的浅克隆,调试 / 测试用。 */
|
|
80
|
+
getState(): BookingContextState;
|
|
81
|
+
/** 一键清空,destroy / 切租户场景用。 */
|
|
82
|
+
clear(): void;
|
|
83
|
+
/** 拉取 board config 并写入 store(`/core/board/management/config`)。 */
|
|
84
|
+
loadBookingConfig(params?: LoadBookingConfigParams): Promise<BookingContextConfig | null>;
|
|
85
|
+
/** 拉取资源全集并写入 store(`/schedule/resource/list`)。 */
|
|
86
|
+
loadResources(params?: LoadBookingResourcesParams): Promise<BookingContextResource[]>;
|
|
87
|
+
/**
|
|
88
|
+
* 依次 setDate → loadBookingConfig → loadResources。
|
|
89
|
+
* SalesSdkProvider 挂载时默认调用 BookingTicket.initBookingContext。
|
|
90
|
+
*/
|
|
91
|
+
initBookingContext(params?: InitBookingContextParams): Promise<BookingContextState>;
|
|
92
|
+
/** store 是否已具备与入参等价的 config / resources(无需再请求)。 */
|
|
93
|
+
isBookingContextReady(params?: InitBookingContextParams): boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
|
|
97
|
+
*/
|
|
98
|
+
export declare enum BookingContextEvent {
|
|
99
|
+
OnBookingConfigChange = "onBookingConfigChange",
|
|
100
|
+
OnResourcesChange = "onResourcesChange",
|
|
101
|
+
OnDateChange = "onDateChange"
|
|
102
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
3
|
+
*
|
|
4
|
+
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
5
|
+
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
6
|
+
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
7
|
+
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
8
|
+
* - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
|
|
9
|
+
*
|
|
10
|
+
* 设计原则(与 BookingTicket 现状对齐):
|
|
11
|
+
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
12
|
+
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
|
|
16
|
+
|
|
17
|
+
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
18
|
+
|
|
19
|
+
/** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
|
|
23
|
+
* 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
28
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
|
|
45
|
+
*/
|
|
46
|
+
export var BookingContextEvent = /*#__PURE__*/function (BookingContextEvent) {
|
|
47
|
+
BookingContextEvent["OnBookingConfigChange"] = "onBookingConfigChange";
|
|
48
|
+
BookingContextEvent["OnResourcesChange"] = "onResourcesChange";
|
|
49
|
+
BookingContextEvent["OnDateChange"] = "onDateChange";
|
|
50
|
+
return BookingContextEvent;
|
|
51
|
+
}({});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OrderProduct } from '../../Order/types';
|
|
2
|
+
export interface BuildCacheItemFromOrderLineInput {
|
|
3
|
+
/** tempOrder.products 中的一行 */
|
|
4
|
+
product: OrderProduct;
|
|
5
|
+
/** 与该行 product_uid 关联的 tempOrder.bookings 项 */
|
|
6
|
+
booking: Record<string, any>;
|
|
7
|
+
/** 商品 catalog / 详情,用于 capacity、duration、product_resource 等模板字段 */
|
|
8
|
+
sourceProduct?: Record<string, any> | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
|
|
12
|
+
*
|
|
13
|
+
* 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
|
|
14
|
+
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildCacheItemFromOrderLine(input: BuildCacheItemFromOrderLineInput): Record<string, any>;
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
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); }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
import dayjs from 'dayjs';
|
|
14
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
15
|
+
import { resolveManualDiscountMessage } from "../../Order/utils/manualProductDiscount";
|
|
16
|
+
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
17
|
+
function safeFormat(value, fmt) {
|
|
18
|
+
if (value === undefined || value === null) return undefined;
|
|
19
|
+
var d = dayjs(value);
|
|
20
|
+
if (!d.isValid()) return undefined;
|
|
21
|
+
return d.format(fmt);
|
|
22
|
+
}
|
|
23
|
+
function normalizeTimeString(value) {
|
|
24
|
+
if (value === undefined || value === null) return undefined;
|
|
25
|
+
if (typeof value === 'string') {
|
|
26
|
+
var t = value.trim();
|
|
27
|
+
var hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
|
|
28
|
+
if (hhmmFromHhmmss) return hhmmFromHhmmss[1];
|
|
29
|
+
if (/^\d{1,2}:\d{2}$/.test(t)) return t;
|
|
30
|
+
}
|
|
31
|
+
var d = dayjs(value);
|
|
32
|
+
if (d.isValid()) return d.format('HH:mm');
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* bookings[].resources[] → cacheItem._extend.resource(与 cacheItemToBookingInput.flattenResources 互逆)。
|
|
38
|
+
*/
|
|
39
|
+
function unflattenResourceMap(resources) {
|
|
40
|
+
var map = {};
|
|
41
|
+
if (!Array.isArray(resources)) return map;
|
|
42
|
+
resources.forEach(function (r) {
|
|
43
|
+
var formId = r === null || r === void 0 ? void 0 : r.form_id;
|
|
44
|
+
if (formId === undefined || formId === null) return;
|
|
45
|
+
var key = String(formId);
|
|
46
|
+
if (!map[key]) map[key] = [];
|
|
47
|
+
map[key].push({
|
|
48
|
+
form_id: formId,
|
|
49
|
+
relation_id: r.relation_id,
|
|
50
|
+
relation_type: r.relation_type || 'form',
|
|
51
|
+
like_status: r.like_status || 'common',
|
|
52
|
+
metadata: r.metadata ? _objectSpread({}, r.metadata) : undefined,
|
|
53
|
+
children: r.children
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return map;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 从 booking.metadata.capacity 还原 `_extend.capacity`(与 info2 ticketBooking getCapacity 对齐)。
|
|
61
|
+
* 勿用 resources[].relation_id 反推人数维度 id。
|
|
62
|
+
*/
|
|
63
|
+
function resolveCapacityFromBooking(booking) {
|
|
64
|
+
var _booking$metadata;
|
|
65
|
+
var metaCap = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.capacity;
|
|
66
|
+
if (Array.isArray(metaCap) && metaCap.length > 0) {
|
|
67
|
+
return metaCap.map(function (item) {
|
|
68
|
+
var _item$value;
|
|
69
|
+
if (!item || _typeof(item) !== 'object') return null;
|
|
70
|
+
if (item.id === undefined || item.id === null) return null;
|
|
71
|
+
var row = {
|
|
72
|
+
id: item.id,
|
|
73
|
+
value: Number((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : 0)
|
|
74
|
+
};
|
|
75
|
+
if (item.name !== undefined) row.name = item.name;
|
|
76
|
+
return row;
|
|
77
|
+
}).filter(function (item) {
|
|
78
|
+
return item != null;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (typeof metaCap === 'number' && Number.isFinite(metaCap)) {
|
|
82
|
+
return [{
|
|
83
|
+
id: 0,
|
|
84
|
+
value: metaCap,
|
|
85
|
+
name: ''
|
|
86
|
+
}];
|
|
87
|
+
}
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
function resolveDurationForExtend(booking) {
|
|
91
|
+
var duration = booking.duration;
|
|
92
|
+
if (booking.sub_type === 'days' || booking.is_all === 1) {
|
|
93
|
+
return duration;
|
|
94
|
+
}
|
|
95
|
+
if (typeof duration === 'number' && Number.isFinite(duration)) {
|
|
96
|
+
return duration;
|
|
97
|
+
}
|
|
98
|
+
return duration;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** booking.duration → catalog 顶层 duration 结构(供 isNormalProductByDurationSchedule 识别)。 */
|
|
102
|
+
function resolveTopLevelDuration(booking, sourceProduct) {
|
|
103
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.duration) !== undefined) {
|
|
104
|
+
return sourceProduct.duration;
|
|
105
|
+
}
|
|
106
|
+
var raw = booking.duration;
|
|
107
|
+
if (raw == null || raw === '') return undefined;
|
|
108
|
+
if (_typeof(raw) === 'object' && raw.type) {
|
|
109
|
+
return raw;
|
|
110
|
+
}
|
|
111
|
+
var subType = booking.sub_type === 'days' ? 'days' : 'minutes';
|
|
112
|
+
var value = Number(raw);
|
|
113
|
+
if (!Number.isFinite(value) || value <= 0) return undefined;
|
|
114
|
+
return {
|
|
115
|
+
type: subType,
|
|
116
|
+
value: value
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function resolveProductTitle(product, booking, sourceProduct) {
|
|
120
|
+
var _ref, _ref2, _ref3, _ref4, _ref5, _title, _booking$product, _booking$detail;
|
|
121
|
+
var metadata = product.metadata || {};
|
|
122
|
+
return (_ref = (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.name) !== null && _ref5 !== void 0 ? _ref5 : metadata.product_title) !== null && _ref4 !== void 0 ? _ref4 : metadata.product_name) !== null && _ref3 !== void 0 ? _ref3 : booking === null || booking === void 0 || (_booking$product = booking.product) === null || _booking$product === void 0 ? void 0 : _booking$product.title) !== null && _ref2 !== void 0 ? _ref2 : booking === null || booking === void 0 || (_booking$detail = booking.detail) === null || _booking$detail === void 0 ? void 0 : _booking$detail.product_title) !== null && _ref !== void 0 ? _ref : '';
|
|
123
|
+
}
|
|
124
|
+
function resolveProductCover(product, booking, sourceProduct) {
|
|
125
|
+
var _ref6, _cover;
|
|
126
|
+
return (_ref6 = (_cover = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover) !== null && _cover !== void 0 ? _cover : product.product_cover) !== null && _ref6 !== void 0 ? _ref6 : '';
|
|
127
|
+
}
|
|
128
|
+
function resolveMainProductPrice(product, fallback) {
|
|
129
|
+
var _metadata$main_produc;
|
|
130
|
+
var metadata = product.metadata || {};
|
|
131
|
+
var value = (_metadata$main_produc = metadata.main_product_original_price) !== null && _metadata$main_produc !== void 0 ? _metadata$main_produc : metadata.source_product_price;
|
|
132
|
+
var parsed = Number(value);
|
|
133
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
134
|
+
}
|
|
135
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
136
|
+
return bundle.map(function (item) {
|
|
137
|
+
var _ref7, _item$original_price;
|
|
138
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
139
|
+
original_price: (_ref7 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.bundle_selling_price) !== null && _ref7 !== void 0 ? _ref7 : item.price
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
|
|
146
|
+
* 供 getResourceByIds / formatResources 渲染资源编辑 UI。
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* synthesizeProductResourceFromBooking({ resources: [{ form_id: 35, relation_id: 41077 }] });
|
|
150
|
+
*/
|
|
151
|
+
function synthesizeProductResourceFromBooking(booking) {
|
|
152
|
+
var rows = booking === null || booking === void 0 ? void 0 : booking.resources;
|
|
153
|
+
if (!Array.isArray(rows) || rows.length === 0) return undefined;
|
|
154
|
+
var relationIdsByForm = new Map();
|
|
155
|
+
rows.forEach(function (row) {
|
|
156
|
+
var _relationIdsByForm$ge;
|
|
157
|
+
var formId = row === null || row === void 0 ? void 0 : row.form_id;
|
|
158
|
+
var relationId = Number(row === null || row === void 0 ? void 0 : row.relation_id);
|
|
159
|
+
if (formId == null || formId === '' || !Number.isFinite(relationId) || relationId <= 0) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
var list = (_relationIdsByForm$ge = relationIdsByForm.get(formId)) !== null && _relationIdsByForm$ge !== void 0 ? _relationIdsByForm$ge : [];
|
|
163
|
+
if (!list.includes(relationId)) {
|
|
164
|
+
list.push(relationId);
|
|
165
|
+
}
|
|
166
|
+
relationIdsByForm.set(formId, list);
|
|
167
|
+
});
|
|
168
|
+
if (relationIdsByForm.size === 0) return undefined;
|
|
169
|
+
return {
|
|
170
|
+
resources: Array.from(relationIdsByForm.entries()).map(function (_ref8) {
|
|
171
|
+
var _ref9 = _slicedToArray(_ref8, 2),
|
|
172
|
+
formId = _ref9[0],
|
|
173
|
+
relationIds = _ref9[1];
|
|
174
|
+
return {
|
|
175
|
+
id: formId,
|
|
176
|
+
status: 1,
|
|
177
|
+
type: 'form',
|
|
178
|
+
code: '',
|
|
179
|
+
optional_resource: relationIds,
|
|
180
|
+
default_resource: []
|
|
181
|
+
};
|
|
182
|
+
})
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
|
|
188
|
+
*
|
|
189
|
+
* 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
|
|
190
|
+
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
191
|
+
*/
|
|
192
|
+
export function buildCacheItemFromOrderLine(input) {
|
|
193
|
+
var _product$product_id, _product$selling_pric, _product$original_pri, _booking$metadata$hol, _booking$metadata2, _product$product_vari, _product$num, _ref10, _product$note, _booking$detail2, _product$metadata, _product$metadata2, _ref11, _extension_type, _booking$product2, _booking$product3, _price, _product$order_detail, _ref12, _booking$id;
|
|
194
|
+
var product = input.product,
|
|
195
|
+
booking = input.booking,
|
|
196
|
+
sourceProduct = input.sourceProduct;
|
|
197
|
+
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
198
|
+
var selling = Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
199
|
+
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
200
|
+
var mainProductPrice = resolveMainProductPrice(product, selling);
|
|
201
|
+
var startDate = safeFormat(booking.start_date, 'YYYY-MM-DD');
|
|
202
|
+
var endDate = safeFormat(booking.end_date, 'YYYY-MM-DD');
|
|
203
|
+
var startTime = normalizeTimeString(booking.start_time);
|
|
204
|
+
var endTime = normalizeTimeString(booking.end_time);
|
|
205
|
+
var resource = unflattenResourceMap(booking.resources);
|
|
206
|
+
var capacity = resolveCapacityFromBooking(booking);
|
|
207
|
+
var holderId = (_booking$metadata$hol = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : booking.holder_id;
|
|
208
|
+
var productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
209
|
+
var productCover = resolveProductCover(product, booking, sourceProduct);
|
|
210
|
+
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
211
|
+
var other = {
|
|
212
|
+
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
213
|
+
option: getProductSkuOptions(product),
|
|
214
|
+
bundle: mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : [])
|
|
215
|
+
};
|
|
216
|
+
var extend = _objectSpread({
|
|
217
|
+
start_date: startDate ? dayjs(startDate) : undefined,
|
|
218
|
+
end_date: endDate ? dayjs(endDate) : undefined,
|
|
219
|
+
startDate: startDate ? dayjs(startDate) : undefined,
|
|
220
|
+
endDate: endDate ? dayjs(endDate) : undefined,
|
|
221
|
+
start_time: startTime,
|
|
222
|
+
end_time: endTime,
|
|
223
|
+
duration: resolveDurationForExtend(booking),
|
|
224
|
+
sub_type: booking.sub_type,
|
|
225
|
+
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1,
|
|
226
|
+
product_name: productTitle,
|
|
227
|
+
product_cover: productCover,
|
|
228
|
+
note: (_ref10 = (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : booking === null || booking === void 0 || (_booking$detail2 = booking.detail) === null || _booking$detail2 === void 0 ? void 0 : _booking$detail2.note) !== null && _ref10 !== void 0 ? _ref10 : '',
|
|
229
|
+
price: mainProductPrice,
|
|
230
|
+
total: selling,
|
|
231
|
+
origin_total: original,
|
|
232
|
+
resource: resource,
|
|
233
|
+
capacity: capacity,
|
|
234
|
+
holder_id: holderId,
|
|
235
|
+
other: other,
|
|
236
|
+
like_status: booking.like_status || 'common',
|
|
237
|
+
discount_reason: resolveManualDiscountMessage(product.discount_list, (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.product_discount_reason) || undefined
|
|
238
|
+
}, productOptionString ? {
|
|
239
|
+
product_option_string: productOptionString
|
|
240
|
+
} : {});
|
|
241
|
+
var manualDiscount = (product.discount_list || []).find(function (d) {
|
|
242
|
+
return (d === null || d === void 0 ? void 0 : d.type) === 'product';
|
|
243
|
+
});
|
|
244
|
+
if (manualDiscount && extend.origin_total === selling) {
|
|
245
|
+
var _manualDiscount$amoun;
|
|
246
|
+
var manualAmount = Number((_manualDiscount$amoun = manualDiscount.amount) !== null && _manualDiscount$amoun !== void 0 ? _manualDiscount$amoun : 0);
|
|
247
|
+
if (Number.isFinite(manualAmount) && manualAmount > 0) {
|
|
248
|
+
extend.origin_total = selling + manualAmount;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.price_override) != null || manualDiscount) {
|
|
252
|
+
extend.priceOverride = selling;
|
|
253
|
+
}
|
|
254
|
+
if (booking.holder !== undefined) {
|
|
255
|
+
extend.holder = booking.holder;
|
|
256
|
+
}
|
|
257
|
+
if (Array.isArray(booking.relation_forms)) {
|
|
258
|
+
extend.relation_forms = booking.relation_forms;
|
|
259
|
+
}
|
|
260
|
+
var base = _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
261
|
+
id: resolvedId,
|
|
262
|
+
product_id: resolvedId,
|
|
263
|
+
extension_type: (_ref11 = (_extension_type = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type) !== null && _extension_type !== void 0 ? _extension_type : booking === null || booking === void 0 || (_booking$product2 = booking.product) === null || _booking$product2 === void 0 ? void 0 : _booking$product2.extension_type) !== null && _ref11 !== void 0 ? _ref11 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.extension_type,
|
|
264
|
+
title: productTitle || (sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) || (booking === null || booking === void 0 || (_booking$product3 = booking.product) === null || _booking$product3 === void 0 ? void 0 : _booking$product3.title),
|
|
265
|
+
price: (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : selling,
|
|
266
|
+
selling_price: product.selling_price,
|
|
267
|
+
original_price: product.original_price
|
|
268
|
+
}, productOptionString ? {
|
|
269
|
+
product_option_string: productOptionString
|
|
270
|
+
} : {}), {}, {
|
|
271
|
+
_extend: extend,
|
|
272
|
+
new: 0,
|
|
273
|
+
autoClose: false,
|
|
274
|
+
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
275
|
+
booking_id: (_ref12 = (_booking$id = booking.id) !== null && _booking$id !== void 0 ? _booking$id : booking.booking_id) !== null && _ref12 !== void 0 ? _ref12 : 0
|
|
276
|
+
});
|
|
277
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.capacity) !== undefined) {
|
|
278
|
+
base.capacity = sourceProduct.capacity;
|
|
279
|
+
}
|
|
280
|
+
var topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
|
|
281
|
+
if (topLevelDuration !== undefined) {
|
|
282
|
+
base.duration = topLevelDuration;
|
|
283
|
+
}
|
|
284
|
+
if ((sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.product_resource) !== undefined) {
|
|
285
|
+
base.product_resource = sourceProduct.product_resource;
|
|
286
|
+
} else {
|
|
287
|
+
var synthesized = synthesizeProductResourceFromBooking(booking);
|
|
288
|
+
if (synthesized) {
|
|
289
|
+
base.product_resource = synthesized;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.schedules) && sourceProduct.schedules.length) {
|
|
293
|
+
base.schedules = sourceProduct.schedules;
|
|
294
|
+
}
|
|
295
|
+
if (Array.isArray(sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct['schedule.ids']) && sourceProduct['schedule.ids'].length) {
|
|
296
|
+
base['schedule.ids'] = sourceProduct['schedule.ids'];
|
|
297
|
+
}
|
|
298
|
+
if (booking.schedule_event_id !== undefined) {
|
|
299
|
+
base.schedule_event_id = booking.schedule_event_id;
|
|
300
|
+
}
|
|
301
|
+
return base;
|
|
302
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrderProduct } from '../../Order/types';
|
|
2
|
+
export interface BuildNormalProductCacheItemFromOrderLineInput {
|
|
3
|
+
/** tempOrder.products 中的一行(普通商品,无关联 booking) */
|
|
4
|
+
product: OrderProduct;
|
|
5
|
+
/** 商品 catalog / 详情,用于 variant / option / bundle 模板字段 */
|
|
6
|
+
sourceProduct?: Record<string, any> | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildNormalProductCacheItemFromOrderLine(input: BuildNormalProductCacheItemFromOrderLineInput): Record<string, any>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["bundle_selling_price"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import { getProductSkuOptions } from "../../Order/utils";
|
|
11
|
+
import { buildProductOptionStringFromOrderLine } from "./orderLineDisplay";
|
|
12
|
+
/**
|
|
13
|
+
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
14
|
+
*
|
|
15
|
+
* 与 `buildCacheItemFromOrderLine`(预约行 + booking)并列;不含 resource / duration / holder 等预约字段。
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* 解析 v2 主商品 source 价(不含 option、不含 bundle),供 SkuDetailModal / transform 使用。
|
|
19
|
+
*/
|
|
20
|
+
function resolveSourceProductPrice(product, sourceProduct) {
|
|
21
|
+
var _price, _price2, _metadata$origin2, _metadata$origin3, _product$selling_pric;
|
|
22
|
+
var metadata = product.metadata || {};
|
|
23
|
+
if (metadata.source_product_price !== undefined && metadata.source_product_price !== null) {
|
|
24
|
+
var parsed = Number(metadata.source_product_price);
|
|
25
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
26
|
+
}
|
|
27
|
+
var variantId = Number(product.product_variant_id || 0);
|
|
28
|
+
if (variantId > 0) {
|
|
29
|
+
var _variant, _metadata$origin;
|
|
30
|
+
var variantList = (_variant = (_metadata$origin = metadata.origin) === null || _metadata$origin === void 0 ? void 0 : _metadata$origin.variant) !== null && _variant !== void 0 ? _variant : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.variant;
|
|
31
|
+
if (Array.isArray(variantList)) {
|
|
32
|
+
var _matched$price;
|
|
33
|
+
var matched = variantList.find(function (v) {
|
|
34
|
+
return Number(v === null || v === void 0 ? void 0 : v.id) === variantId;
|
|
35
|
+
});
|
|
36
|
+
var variantPrice = (_matched$price = matched === null || matched === void 0 ? void 0 : matched.price) !== null && _matched$price !== void 0 ? _matched$price : matched === null || matched === void 0 ? void 0 : matched.base_price;
|
|
37
|
+
if (variantPrice !== undefined && variantPrice !== null) {
|
|
38
|
+
var _parsed = Number(variantPrice);
|
|
39
|
+
if (Number.isFinite(_parsed)) return _parsed;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
var catalogPrice = (_price = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price !== void 0 ? _price : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
|
|
44
|
+
if (catalogPrice !== undefined && catalogPrice !== null) {
|
|
45
|
+
var _parsed2 = Number(catalogPrice);
|
|
46
|
+
if (Number.isFinite(_parsed2)) return _parsed2;
|
|
47
|
+
}
|
|
48
|
+
var originPrice = (_price2 = (_metadata$origin2 = metadata.origin) === null || _metadata$origin2 === void 0 ? void 0 : _metadata$origin2.price) !== null && _price2 !== void 0 ? _price2 : (_metadata$origin3 = metadata.origin) === null || _metadata$origin3 === void 0 ? void 0 : _metadata$origin3.base_price;
|
|
49
|
+
if (originPrice !== undefined && originPrice !== null) {
|
|
50
|
+
var _parsed3 = Number(originPrice);
|
|
51
|
+
if (Number.isFinite(_parsed3)) return _parsed3;
|
|
52
|
+
}
|
|
53
|
+
return Number((_product$selling_pric = product.selling_price) !== null && _product$selling_pric !== void 0 ? _product$selling_pric : 0);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 订单行 bundle → booking other.bundle(保留 original_price 供 setProductPrice 按比例分摊) */
|
|
57
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
58
|
+
return bundle.map(function (item) {
|
|
59
|
+
var _ref, _ref2, _item$original_price, _ref3, _item$bundle_selling_, _item$original_total, _ref4, _item$num, _ref5, _item$quantity;
|
|
60
|
+
var catalogOriginal = (_ref = (_ref2 = (_item$original_price = item.original_price) !== null && _item$original_price !== void 0 ? _item$original_price : item.product_price) !== null && _ref2 !== void 0 ? _ref2 : item.price) !== null && _ref !== void 0 ? _ref : item.bundle_selling_price;
|
|
61
|
+
var selling = (_ref3 = (_item$bundle_selling_ = item.bundle_selling_price) !== null && _item$bundle_selling_ !== void 0 ? _item$bundle_selling_ : item.price) !== null && _ref3 !== void 0 ? _ref3 : catalogOriginal;
|
|
62
|
+
var _omitBundleSelling = item.bundle_selling_price,
|
|
63
|
+
rest = _objectWithoutProperties(item, _excluded);
|
|
64
|
+
var isMarkupOrMarkdown = (item.price_type === 'markdown' || item.price_type === 'markup') && (item.price_type_ext === '' || item.price_type_ext === undefined || item.price_type_ext === null);
|
|
65
|
+
if (isMarkupOrMarkdown) delete rest.original_total;
|
|
66
|
+
return _objectSpread(_objectSpread(_objectSpread({}, rest), {}, {
|
|
67
|
+
price: selling,
|
|
68
|
+
original_price: catalogOriginal
|
|
69
|
+
}, isMarkupOrMarkdown ? {} : {
|
|
70
|
+
original_total: (_item$original_total = item.original_total) !== null && _item$original_total !== void 0 ? _item$original_total : catalogOriginal
|
|
71
|
+
}), {}, {
|
|
72
|
+
num: (_ref4 = (_item$num = item.num) !== null && _item$num !== void 0 ? _item$num : item.quantity) !== null && _ref4 !== void 0 ? _ref4 : 1,
|
|
73
|
+
quantity: (_ref5 = (_item$quantity = item.quantity) !== null && _item$quantity !== void 0 ? _item$quantity : item.num) !== null && _ref5 !== void 0 ? _ref5 : 1
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export function buildNormalProductCacheItemFromOrderLine(input) {
|
|
78
|
+
var _product$product_id, _product$selling_pric2, _product$original_pri, _product$metadata, _product$metadata2, _product$product_vari, _originExtend$other, _product$num, _product$product_vari2, _product$num2, _title, _product$note, _originExtend$price, _originExtend$total, _originExtend$origin_, _product$metadata3, _ref6, _title2, _ref7, _cover, _price3, _product$order_detail;
|
|
79
|
+
var product = input.product,
|
|
80
|
+
sourceProduct = input.sourceProduct;
|
|
81
|
+
var resolvedId = (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.id;
|
|
82
|
+
var sourcePrice = resolveSourceProductPrice(product, sourceProduct);
|
|
83
|
+
var selling = Number((_product$selling_pric2 = product.selling_price) !== null && _product$selling_pric2 !== void 0 ? _product$selling_pric2 : 0);
|
|
84
|
+
var original = Number((_product$original_pri = product.original_price) !== null && _product$original_pri !== void 0 ? _product$original_pri : selling);
|
|
85
|
+
var uid = (_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number;
|
|
86
|
+
var option = getProductSkuOptions(product);
|
|
87
|
+
var bundle = mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : []);
|
|
88
|
+
var originExtend = (_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 || (_product$metadata2 = _product$metadata2.origin) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2._extend;
|
|
89
|
+
var productOptionString = buildProductOptionStringFromOrderLine(product);
|
|
90
|
+
var discountList = product.discount_list || [];
|
|
91
|
+
var other = {
|
|
92
|
+
product_id: resolvedId,
|
|
93
|
+
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
94
|
+
option: option,
|
|
95
|
+
bundle: originExtend !== null && originExtend !== void 0 && (_originExtend$other = originExtend.other) !== null && _originExtend$other !== void 0 && _originExtend$other.bundle ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
|
|
96
|
+
quantity: (_product$num = product.num) !== null && _product$num !== void 0 ? _product$num : 1
|
|
97
|
+
};
|
|
98
|
+
var skuValue = {
|
|
99
|
+
product_id: resolvedId,
|
|
100
|
+
product_variant_id: (_product$product_vari2 = product.product_variant_id) !== null && _product$product_vari2 !== void 0 ? _product$product_vari2 : 0,
|
|
101
|
+
option: other.option,
|
|
102
|
+
bundle: other.bundle
|
|
103
|
+
};
|
|
104
|
+
var extend = _objectSpread(_objectSpread(_objectSpread({
|
|
105
|
+
quantity: (_product$num2 = product.num) !== null && _product$num2 !== void 0 ? _product$num2 : 1,
|
|
106
|
+
product_name: (_title = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title !== void 0 ? _title : '',
|
|
107
|
+
note: (_product$note = product.note) !== null && _product$note !== void 0 ? _product$note : '',
|
|
108
|
+
// v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
|
|
109
|
+
price: (_originExtend$price = originExtend === null || originExtend === void 0 ? void 0 : originExtend.price) !== null && _originExtend$price !== void 0 ? _originExtend$price : sourcePrice,
|
|
110
|
+
total: (_originExtend$total = originExtend === null || originExtend === void 0 ? void 0 : originExtend.total) !== null && _originExtend$total !== void 0 ? _originExtend$total : selling,
|
|
111
|
+
origin_total: (_originExtend$origin_ = originExtend === null || originExtend === void 0 ? void 0 : originExtend.origin_total) !== null && _originExtend$origin_ !== void 0 ? _originExtend$origin_ : original,
|
|
112
|
+
other: other,
|
|
113
|
+
skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
114
|
+
_skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
115
|
+
isNormalProduct: true,
|
|
116
|
+
metadata: {
|
|
117
|
+
product_add_schedule_time: (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3.product_add_schedule_time
|
|
118
|
+
}
|
|
119
|
+
}, productOptionString ? {
|
|
120
|
+
product_option_string: productOptionString
|
|
121
|
+
} : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.priceOverride) !== undefined ? {
|
|
122
|
+
priceOverride: originExtend.priceOverride
|
|
123
|
+
} : {}), (originExtend === null || originExtend === void 0 ? void 0 : originExtend.bundle_edit) !== undefined ? {
|
|
124
|
+
bundle_edit: originExtend.bundle_edit
|
|
125
|
+
} : {});
|
|
126
|
+
if (originExtend !== null && originExtend !== void 0 && originExtend.skuValue || originExtend !== null && originExtend !== void 0 && originExtend._skuValue) {
|
|
127
|
+
extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
|
|
128
|
+
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
129
|
+
}
|
|
130
|
+
return _objectSpread(_objectSpread(_objectSpread({}, sourceProduct || {}), {}, {
|
|
131
|
+
id: resolvedId,
|
|
132
|
+
product_id: resolvedId,
|
|
133
|
+
_id: uid,
|
|
134
|
+
title: (_ref6 = (_title2 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.title) !== null && _title2 !== void 0 ? _title2 : product.product_title) !== null && _ref6 !== void 0 ? _ref6 : '',
|
|
135
|
+
cover: (_ref7 = (_cover = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.cover) !== null && _cover !== void 0 ? _cover : product.product_cover) !== null && _ref7 !== void 0 ? _ref7 : '',
|
|
136
|
+
price: (_price3 = sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _price3 !== void 0 ? _price3 : sourcePrice,
|
|
137
|
+
selling_price: product.selling_price,
|
|
138
|
+
original_price: product.original_price
|
|
139
|
+
}, productOptionString ? {
|
|
140
|
+
product_option_string: productOptionString
|
|
141
|
+
} : {}), {}, {
|
|
142
|
+
note: product.note,
|
|
143
|
+
order_detail_id: (_product$order_detail = product.order_detail_id) !== null && _product$order_detail !== void 0 ? _product$order_detail : null,
|
|
144
|
+
discount_list: discountList,
|
|
145
|
+
new: 0,
|
|
146
|
+
autoClose: true,
|
|
147
|
+
_extend: extend
|
|
148
|
+
});
|
|
149
|
+
}
|