@pisell/pisellos 0.0.568 → 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/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- 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/utils/cartProduct.js +26 -5
- 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/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -9
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +36 -16
- package/dist/modules/Order/index.d.ts +448 -23
- package/dist/modules/Order/index.js +5417 -561
- 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 +465 -703
- 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 +44 -29
- 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 +221 -109
- 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/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/server/index.d.ts +462 -8
- package/dist/server/index.js +6112 -656
- 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/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 +1393 -516
- 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 +278 -66
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +108 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +116 -85
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -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 +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.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +394 -25
- package/dist/solution/BookingTicket/index.js +2506 -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 +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 +11 -3
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- 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/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +25 -34
- package/dist/solution/Checkout/utils/index.js +4 -4
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- 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 +499 -434
- 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 +4 -4
- 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 +29 -20
- package/dist/solution/VenueBooking/index.js +301 -213
- 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/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +4 -4
- 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/utils/cartProduct.js +27 -5
- package/lib/modules/Cart/utils/changePrice.js +20 -14
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +63 -10
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +18 -2
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +21 -3
- package/lib/modules/Order/index.d.ts +448 -23
- package/lib/modules/Order/index.js +3641 -308
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +55 -1
- 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 +974 -138
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +30 -124
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +4 -3
- package/lib/modules/Payment/walletpass.js +16 -6
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +92 -51
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +76 -20
- package/lib/modules/Quotation/types.d.ts +19 -0
- 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 +152 -60
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +84 -16
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +616 -111
- package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +49 -14
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Summary/index.js +2 -2
- 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 +33 -0
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +3901 -205
- 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 +21 -0
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1324 -141
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +11 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +119 -11
- package/lib/server/modules/order/utils/filterOrders.js +238 -13
- 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 +588 -97
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +145 -1
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +71 -45
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +55 -44
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/utils/product.js +2 -2
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- 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.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +394 -25
- package/lib/solution/BookingTicket/index.js +1350 -76
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +71 -10
- 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 +24 -3
- 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 +4 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
- 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/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +18 -19
- package/lib/solution/Checkout/utils/index.js +4 -4
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +296 -39
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +144 -103
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +4 -5
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +98 -26
- package/lib/solution/ShopDiscount/index.js +3 -3
- 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 +29 -20
- package/lib/solution/VenueBooking/index.js +169 -94
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +22 -0
- package/lib/types/index.d.ts +11 -1
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BookingContextEvent = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* BookingContext 子模块:承载「预约 UI 上下文」三件套。
|
|
9
|
+
*
|
|
10
|
+
* - bookingConfig:来自 `/core/board/management/config` 的整套预约配置(service_time / resource_tab /
|
|
11
|
+
* appointment_subject / subject_require / stock_setting / basic / capacity 等)。
|
|
12
|
+
* - resourcesOrigin / resourcesOriginMap:来自 `/schedule/resource/list` 的资源全集,含 times / event_list /
|
|
13
|
+
* combined_resource 等运行态信息,是 getResourceByIds / getResourceTimeIsUsable 的输入。
|
|
14
|
+
* - date:当前选择的日期(dayjs 或 ISO 字符串,迁移后内部统一存原始 ISO 字符串,UI 可自行解析)。
|
|
15
|
+
*
|
|
16
|
+
* 设计原则(与 BookingTicket 现状对齐):
|
|
17
|
+
* - 默认由 `loadBookingConfig` / `loadResources` 拉取并写入 store;也支持消费方 `set*` 直接灌入(复用 ticketBooking 已拉到的数据)。
|
|
18
|
+
* - 所有读 API 返回浅克隆(数组)或原引用(map / config),避免 UI 写穿。
|
|
19
|
+
*/
|
|
20
|
+
/** `loadBookingConfig` 入参,与 ticketBooking `getBookingConfig` 一致。 */
|
|
21
|
+
/** `loadResources` 入参,与 info2 `getResourceList` 一致。 */
|
|
22
|
+
/** `initBookingContext` 入参(BookingTicket 聚合入口)。 */
|
|
23
|
+
/**
|
|
24
|
+
* 资源全集 map:key 为资源 id(数字),value 为资源原始对象,含 times / event_list 等运行态。
|
|
25
|
+
* 这里只声明 Record 形态;具体字段保留 `any`,与 ticketBooking 现网传入的数据形状兼容。
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
29
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* 内部 store 形态。`resourcesOriginMap` 由 `setResources` 派生,不允许外部直接 set。
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* BookingContextModule 对外 API(给 BookingTicket / SDK Provider 透传消费)。
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* BookingContextModule 事件名常量(采用 `${this.name}:` 前缀,与现有模块一致)。
|
|
42
|
+
*/
|
|
43
|
+
let BookingContextEvent = exports.BookingContextEvent = /*#__PURE__*/function (BookingContextEvent) {
|
|
44
|
+
BookingContextEvent["OnBookingConfigChange"] = "onBookingConfigChange";
|
|
45
|
+
BookingContextEvent["OnResourcesChange"] = "onResourcesChange";
|
|
46
|
+
BookingContextEvent["OnDateChange"] = "onDateChange";
|
|
47
|
+
return BookingContextEvent;
|
|
48
|
+
}({});
|
|
@@ -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,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildCacheItemFromOrderLine = buildCacheItemFromOrderLine;
|
|
7
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
+
var _utils = require("../../Order/utils");
|
|
9
|
+
var _manualProductDiscount = require("../../Order/utils/manualProductDiscount");
|
|
10
|
+
var _orderLineDisplay = require("./orderLineDisplay");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function safeFormat(value, fmt) {
|
|
13
|
+
if (value === undefined || value === null) return undefined;
|
|
14
|
+
const d = (0, _dayjs.default)(value);
|
|
15
|
+
if (!d.isValid()) return undefined;
|
|
16
|
+
return d.format(fmt);
|
|
17
|
+
}
|
|
18
|
+
function normalizeTimeString(value) {
|
|
19
|
+
if (value === undefined || value === null) return undefined;
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
const t = value.trim();
|
|
22
|
+
const hhmmFromHhmmss = t.match(/^(\d{1,2}:\d{2}):\d{2}$/);
|
|
23
|
+
if (hhmmFromHhmmss) return hhmmFromHhmmss[1];
|
|
24
|
+
if (/^\d{1,2}:\d{2}$/.test(t)) return t;
|
|
25
|
+
}
|
|
26
|
+
const d = (0, _dayjs.default)(value);
|
|
27
|
+
if (d.isValid()) return d.format('HH:mm');
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* bookings[].resources[] → cacheItem._extend.resource(与 cacheItemToBookingInput.flattenResources 互逆)。
|
|
33
|
+
*/
|
|
34
|
+
function unflattenResourceMap(resources) {
|
|
35
|
+
const map = {};
|
|
36
|
+
if (!Array.isArray(resources)) return map;
|
|
37
|
+
resources.forEach(r => {
|
|
38
|
+
const formId = r?.form_id;
|
|
39
|
+
if (formId === undefined || formId === null) return;
|
|
40
|
+
const key = String(formId);
|
|
41
|
+
if (!map[key]) map[key] = [];
|
|
42
|
+
map[key].push({
|
|
43
|
+
form_id: formId,
|
|
44
|
+
relation_id: r.relation_id,
|
|
45
|
+
relation_type: r.relation_type || 'form',
|
|
46
|
+
like_status: r.like_status || 'common',
|
|
47
|
+
metadata: r.metadata ? {
|
|
48
|
+
...r.metadata
|
|
49
|
+
} : undefined,
|
|
50
|
+
children: r.children
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return map;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 从 booking.metadata.capacity 还原 `_extend.capacity`(与 info2 ticketBooking getCapacity 对齐)。
|
|
58
|
+
* 勿用 resources[].relation_id 反推人数维度 id。
|
|
59
|
+
*/
|
|
60
|
+
function resolveCapacityFromBooking(booking) {
|
|
61
|
+
const metaCap = booking.metadata?.capacity;
|
|
62
|
+
if (Array.isArray(metaCap) && metaCap.length > 0) {
|
|
63
|
+
return metaCap.map(item => {
|
|
64
|
+
if (!item || typeof item !== 'object') return null;
|
|
65
|
+
if (item.id === undefined || item.id === null) return null;
|
|
66
|
+
const row = {
|
|
67
|
+
id: item.id,
|
|
68
|
+
value: Number(item.value ?? 0)
|
|
69
|
+
};
|
|
70
|
+
if (item.name !== undefined) row.name = item.name;
|
|
71
|
+
return row;
|
|
72
|
+
}).filter(item => item != null);
|
|
73
|
+
}
|
|
74
|
+
if (typeof metaCap === 'number' && Number.isFinite(metaCap)) {
|
|
75
|
+
return [{
|
|
76
|
+
id: 0,
|
|
77
|
+
value: metaCap,
|
|
78
|
+
name: ''
|
|
79
|
+
}];
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
function resolveDurationForExtend(booking) {
|
|
84
|
+
const duration = booking.duration;
|
|
85
|
+
if (booking.sub_type === 'days' || booking.is_all === 1) {
|
|
86
|
+
return duration;
|
|
87
|
+
}
|
|
88
|
+
if (typeof duration === 'number' && Number.isFinite(duration)) {
|
|
89
|
+
return duration;
|
|
90
|
+
}
|
|
91
|
+
return duration;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** booking.duration → catalog 顶层 duration 结构(供 isNormalProductByDurationSchedule 识别)。 */
|
|
95
|
+
function resolveTopLevelDuration(booking, sourceProduct) {
|
|
96
|
+
if (sourceProduct?.duration !== undefined) {
|
|
97
|
+
return sourceProduct.duration;
|
|
98
|
+
}
|
|
99
|
+
const raw = booking.duration;
|
|
100
|
+
if (raw == null || raw === '') return undefined;
|
|
101
|
+
if (typeof raw === 'object' && raw.type) {
|
|
102
|
+
return raw;
|
|
103
|
+
}
|
|
104
|
+
const subType = booking.sub_type === 'days' ? 'days' : 'minutes';
|
|
105
|
+
const value = Number(raw);
|
|
106
|
+
if (!Number.isFinite(value) || value <= 0) return undefined;
|
|
107
|
+
return {
|
|
108
|
+
type: subType,
|
|
109
|
+
value
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function resolveProductTitle(product, booking, sourceProduct) {
|
|
113
|
+
const metadata = product.metadata || {};
|
|
114
|
+
return sourceProduct?.title ?? sourceProduct?.name ?? metadata.product_title ?? metadata.product_name ?? booking?.product?.title ?? booking?.detail?.product_title ?? '';
|
|
115
|
+
}
|
|
116
|
+
function resolveProductCover(product, booking, sourceProduct) {
|
|
117
|
+
return sourceProduct?.cover ?? product.product_cover ?? '';
|
|
118
|
+
}
|
|
119
|
+
function resolveMainProductPrice(product, fallback) {
|
|
120
|
+
const metadata = product.metadata || {};
|
|
121
|
+
const value = metadata.main_product_original_price ?? metadata.source_product_price;
|
|
122
|
+
const parsed = Number(value);
|
|
123
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
124
|
+
}
|
|
125
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
126
|
+
return bundle.map(item => {
|
|
127
|
+
return {
|
|
128
|
+
...item,
|
|
129
|
+
original_price: item.original_price ?? item.bundle_selling_price ?? item.price
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* catalog 缺 product_resource 时,从 booking.resources 反推最小 product_resource 结构,
|
|
136
|
+
* 供 getResourceByIds / formatResources 渲染资源编辑 UI。
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* synthesizeProductResourceFromBooking({ resources: [{ form_id: 35, relation_id: 41077 }] });
|
|
140
|
+
*/
|
|
141
|
+
function synthesizeProductResourceFromBooking(booking) {
|
|
142
|
+
const rows = booking?.resources;
|
|
143
|
+
if (!Array.isArray(rows) || rows.length === 0) return undefined;
|
|
144
|
+
const relationIdsByForm = new Map();
|
|
145
|
+
rows.forEach(row => {
|
|
146
|
+
const formId = row?.form_id;
|
|
147
|
+
const relationId = Number(row?.relation_id);
|
|
148
|
+
if (formId == null || formId === '' || !Number.isFinite(relationId) || relationId <= 0) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const list = relationIdsByForm.get(formId) ?? [];
|
|
152
|
+
if (!list.includes(relationId)) {
|
|
153
|
+
list.push(relationId);
|
|
154
|
+
}
|
|
155
|
+
relationIdsByForm.set(formId, list);
|
|
156
|
+
});
|
|
157
|
+
if (relationIdsByForm.size === 0) return undefined;
|
|
158
|
+
return {
|
|
159
|
+
resources: Array.from(relationIdsByForm.entries()).map(([formId, relationIds]) => ({
|
|
160
|
+
id: formId,
|
|
161
|
+
status: 1,
|
|
162
|
+
type: 'form',
|
|
163
|
+
code: '',
|
|
164
|
+
optional_resource: relationIds,
|
|
165
|
+
default_resource: []
|
|
166
|
+
}))
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 从已加车的 order line + booking 反查 editService 所需的 cacheItem。
|
|
172
|
+
*
|
|
173
|
+
* 与 `buildCacheItemFromCartDetail` / `buildCacheItemFromDetail` 正向拼装互逆(在 getProductExtend 之前调用)。
|
|
174
|
+
* 调用方须传入与该行关联的 booking(通常 bookings[].product_uid === product.metadata.unique_identification_number)。
|
|
175
|
+
*/
|
|
176
|
+
function buildCacheItemFromOrderLine(input) {
|
|
177
|
+
const {
|
|
178
|
+
product,
|
|
179
|
+
booking,
|
|
180
|
+
sourceProduct
|
|
181
|
+
} = input;
|
|
182
|
+
const resolvedId = product.product_id ?? sourceProduct?.id;
|
|
183
|
+
const selling = Number(product.selling_price ?? 0);
|
|
184
|
+
const original = Number(product.original_price ?? selling);
|
|
185
|
+
const mainProductPrice = resolveMainProductPrice(product, selling);
|
|
186
|
+
const startDate = safeFormat(booking.start_date, 'YYYY-MM-DD');
|
|
187
|
+
const endDate = safeFormat(booking.end_date, 'YYYY-MM-DD');
|
|
188
|
+
const startTime = normalizeTimeString(booking.start_time);
|
|
189
|
+
const endTime = normalizeTimeString(booking.end_time);
|
|
190
|
+
const resource = unflattenResourceMap(booking.resources);
|
|
191
|
+
const capacity = resolveCapacityFromBooking(booking);
|
|
192
|
+
const holderId = booking.metadata?.holder_id ?? booking.holder_id;
|
|
193
|
+
const productTitle = resolveProductTitle(product, booking, sourceProduct);
|
|
194
|
+
const productCover = resolveProductCover(product, booking, sourceProduct);
|
|
195
|
+
const productOptionString = (0, _orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
196
|
+
const other = {
|
|
197
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
198
|
+
option: (0, _utils.getProductSkuOptions)(product),
|
|
199
|
+
bundle: mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : [])
|
|
200
|
+
};
|
|
201
|
+
const extend = {
|
|
202
|
+
start_date: startDate ? (0, _dayjs.default)(startDate) : undefined,
|
|
203
|
+
end_date: endDate ? (0, _dayjs.default)(endDate) : undefined,
|
|
204
|
+
startDate: startDate ? (0, _dayjs.default)(startDate) : undefined,
|
|
205
|
+
endDate: endDate ? (0, _dayjs.default)(endDate) : undefined,
|
|
206
|
+
start_time: startTime,
|
|
207
|
+
end_time: endTime,
|
|
208
|
+
duration: resolveDurationForExtend(booking),
|
|
209
|
+
sub_type: booking.sub_type,
|
|
210
|
+
quantity: product.num ?? 1,
|
|
211
|
+
product_name: productTitle,
|
|
212
|
+
product_cover: productCover,
|
|
213
|
+
note: product.note ?? booking?.detail?.note ?? '',
|
|
214
|
+
price: mainProductPrice,
|
|
215
|
+
total: selling,
|
|
216
|
+
origin_total: original,
|
|
217
|
+
resource,
|
|
218
|
+
capacity,
|
|
219
|
+
holder_id: holderId,
|
|
220
|
+
other,
|
|
221
|
+
like_status: booking.like_status || 'common',
|
|
222
|
+
discount_reason: (0, _manualProductDiscount.resolveManualDiscountMessage)(product.discount_list, product.metadata?.product_discount_reason) || undefined,
|
|
223
|
+
...(productOptionString ? {
|
|
224
|
+
product_option_string: productOptionString
|
|
225
|
+
} : {})
|
|
226
|
+
};
|
|
227
|
+
const manualDiscount = (product.discount_list || []).find(d => d?.type === 'product');
|
|
228
|
+
if (manualDiscount && extend.origin_total === selling) {
|
|
229
|
+
const manualAmount = Number(manualDiscount.amount ?? 0);
|
|
230
|
+
if (Number.isFinite(manualAmount) && manualAmount > 0) {
|
|
231
|
+
extend.origin_total = selling + manualAmount;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (product.metadata?.price_override != null || manualDiscount) {
|
|
235
|
+
extend.priceOverride = selling;
|
|
236
|
+
}
|
|
237
|
+
if (booking.holder !== undefined) {
|
|
238
|
+
extend.holder = booking.holder;
|
|
239
|
+
}
|
|
240
|
+
if (Array.isArray(booking.relation_forms)) {
|
|
241
|
+
extend.relation_forms = booking.relation_forms;
|
|
242
|
+
}
|
|
243
|
+
const base = {
|
|
244
|
+
...(sourceProduct || {}),
|
|
245
|
+
id: resolvedId,
|
|
246
|
+
product_id: resolvedId,
|
|
247
|
+
extension_type: sourceProduct?.extension_type ?? booking?.product?.extension_type ?? sourceProduct?.extension_type,
|
|
248
|
+
title: productTitle || sourceProduct?.title || booking?.product?.title,
|
|
249
|
+
price: sourceProduct?.price ?? selling,
|
|
250
|
+
selling_price: product.selling_price,
|
|
251
|
+
original_price: product.original_price,
|
|
252
|
+
...(productOptionString ? {
|
|
253
|
+
product_option_string: productOptionString
|
|
254
|
+
} : {}),
|
|
255
|
+
_extend: extend,
|
|
256
|
+
new: 0,
|
|
257
|
+
autoClose: false,
|
|
258
|
+
order_detail_id: product.order_detail_id ?? null,
|
|
259
|
+
booking_id: booking.id ?? booking.booking_id ?? 0
|
|
260
|
+
};
|
|
261
|
+
if (sourceProduct?.capacity !== undefined) {
|
|
262
|
+
base.capacity = sourceProduct.capacity;
|
|
263
|
+
}
|
|
264
|
+
const topLevelDuration = resolveTopLevelDuration(booking, sourceProduct);
|
|
265
|
+
if (topLevelDuration !== undefined) {
|
|
266
|
+
base.duration = topLevelDuration;
|
|
267
|
+
}
|
|
268
|
+
if (sourceProduct?.product_resource !== undefined) {
|
|
269
|
+
base.product_resource = sourceProduct.product_resource;
|
|
270
|
+
} else {
|
|
271
|
+
const synthesized = synthesizeProductResourceFromBooking(booking);
|
|
272
|
+
if (synthesized) {
|
|
273
|
+
base.product_resource = synthesized;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
if (Array.isArray(sourceProduct?.schedules) && sourceProduct.schedules.length) {
|
|
277
|
+
base.schedules = sourceProduct.schedules;
|
|
278
|
+
}
|
|
279
|
+
if (Array.isArray(sourceProduct?.['schedule.ids']) && sourceProduct['schedule.ids'].length) {
|
|
280
|
+
base['schedule.ids'] = sourceProduct['schedule.ids'];
|
|
281
|
+
}
|
|
282
|
+
if (booking.schedule_event_id !== undefined) {
|
|
283
|
+
base.schedule_event_id = booking.schedule_event_id;
|
|
284
|
+
}
|
|
285
|
+
return base;
|
|
286
|
+
}
|
|
@@ -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,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buildNormalProductCacheItemFromOrderLine = buildNormalProductCacheItemFromOrderLine;
|
|
7
|
+
var _utils = require("../../Order/utils");
|
|
8
|
+
var _orderLineDisplay = require("./orderLineDisplay");
|
|
9
|
+
/**
|
|
10
|
+
* 从已加车的普通商品 order line 反查 SkuDetailModal edit 所需的 cacheItem。
|
|
11
|
+
*
|
|
12
|
+
* 与 `buildCacheItemFromOrderLine`(预约行 + booking)并列;不含 resource / duration / holder 等预约字段。
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* 解析 v2 主商品 source 价(不含 option、不含 bundle),供 SkuDetailModal / transform 使用。
|
|
16
|
+
*/
|
|
17
|
+
function resolveSourceProductPrice(product, sourceProduct) {
|
|
18
|
+
const metadata = product.metadata || {};
|
|
19
|
+
if (metadata.source_product_price !== undefined && metadata.source_product_price !== null) {
|
|
20
|
+
const parsed = Number(metadata.source_product_price);
|
|
21
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
22
|
+
}
|
|
23
|
+
const variantId = Number(product.product_variant_id || 0);
|
|
24
|
+
if (variantId > 0) {
|
|
25
|
+
const variantList = metadata.origin?.variant ?? sourceProduct?.variant;
|
|
26
|
+
if (Array.isArray(variantList)) {
|
|
27
|
+
const matched = variantList.find(v => Number(v?.id) === variantId);
|
|
28
|
+
const variantPrice = matched?.price ?? matched?.base_price;
|
|
29
|
+
if (variantPrice !== undefined && variantPrice !== null) {
|
|
30
|
+
const parsed = Number(variantPrice);
|
|
31
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const catalogPrice = sourceProduct?.price ?? sourceProduct?.base_price;
|
|
36
|
+
if (catalogPrice !== undefined && catalogPrice !== null) {
|
|
37
|
+
const parsed = Number(catalogPrice);
|
|
38
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
39
|
+
}
|
|
40
|
+
const originPrice = metadata.origin?.price ?? metadata.origin?.base_price;
|
|
41
|
+
if (originPrice !== undefined && originPrice !== null) {
|
|
42
|
+
const parsed = Number(originPrice);
|
|
43
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
44
|
+
}
|
|
45
|
+
return Number(product.selling_price ?? 0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** 订单行 bundle → booking other.bundle(保留 original_price 供 setProductPrice 按比例分摊) */
|
|
49
|
+
function mapOrderBundleToOtherBundle(bundle) {
|
|
50
|
+
return bundle.map(item => {
|
|
51
|
+
const catalogOriginal = item.original_price ?? item.product_price ?? item.price ?? item.bundle_selling_price;
|
|
52
|
+
const selling = item.bundle_selling_price ?? item.price ?? catalogOriginal;
|
|
53
|
+
const {
|
|
54
|
+
bundle_selling_price: _omitBundleSelling,
|
|
55
|
+
...rest
|
|
56
|
+
} = item;
|
|
57
|
+
const isMarkupOrMarkdown = (item.price_type === 'markdown' || item.price_type === 'markup') && (item.price_type_ext === '' || item.price_type_ext === undefined || item.price_type_ext === null);
|
|
58
|
+
if (isMarkupOrMarkdown) delete rest.original_total;
|
|
59
|
+
return {
|
|
60
|
+
...rest,
|
|
61
|
+
price: selling,
|
|
62
|
+
original_price: catalogOriginal,
|
|
63
|
+
...(isMarkupOrMarkdown ? {} : {
|
|
64
|
+
original_total: item.original_total ?? catalogOriginal
|
|
65
|
+
}),
|
|
66
|
+
num: item.num ?? item.quantity ?? 1,
|
|
67
|
+
quantity: item.quantity ?? item.num ?? 1
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function buildNormalProductCacheItemFromOrderLine(input) {
|
|
72
|
+
const {
|
|
73
|
+
product,
|
|
74
|
+
sourceProduct
|
|
75
|
+
} = input;
|
|
76
|
+
const resolvedId = product.product_id ?? sourceProduct?.id;
|
|
77
|
+
const sourcePrice = resolveSourceProductPrice(product, sourceProduct);
|
|
78
|
+
const selling = Number(product.selling_price ?? 0);
|
|
79
|
+
const original = Number(product.original_price ?? selling);
|
|
80
|
+
const uid = product.metadata?.unique_identification_number;
|
|
81
|
+
const option = (0, _utils.getProductSkuOptions)(product);
|
|
82
|
+
const bundle = mapOrderBundleToOtherBundle(Array.isArray(product.product_bundle) ? product.product_bundle : []);
|
|
83
|
+
const originExtend = product.metadata?.origin?._extend;
|
|
84
|
+
const productOptionString = (0, _orderLineDisplay.buildProductOptionStringFromOrderLine)(product);
|
|
85
|
+
const discountList = product.discount_list || [];
|
|
86
|
+
const other = {
|
|
87
|
+
product_id: resolvedId,
|
|
88
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
89
|
+
option,
|
|
90
|
+
bundle: originExtend?.other?.bundle ? JSON.parse(JSON.stringify(originExtend.other.bundle)) : bundle,
|
|
91
|
+
quantity: product.num ?? 1
|
|
92
|
+
};
|
|
93
|
+
const skuValue = {
|
|
94
|
+
product_id: resolvedId,
|
|
95
|
+
product_variant_id: product.product_variant_id ?? 0,
|
|
96
|
+
option: other.option,
|
|
97
|
+
bundle: other.bundle
|
|
98
|
+
};
|
|
99
|
+
const extend = {
|
|
100
|
+
quantity: product.num ?? 1,
|
|
101
|
+
product_name: sourceProduct?.title ?? '',
|
|
102
|
+
note: product.note ?? '',
|
|
103
|
+
// v2:_extend.price 为主商品 source 价;行 composite 用 total / origin_total 展示
|
|
104
|
+
price: originExtend?.price ?? sourcePrice,
|
|
105
|
+
total: originExtend?.total ?? selling,
|
|
106
|
+
origin_total: originExtend?.origin_total ?? original,
|
|
107
|
+
other,
|
|
108
|
+
skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
109
|
+
_skuValue: JSON.parse(JSON.stringify(skuValue)),
|
|
110
|
+
isNormalProduct: true,
|
|
111
|
+
metadata: {
|
|
112
|
+
product_add_schedule_time: product.metadata?.product_add_schedule_time
|
|
113
|
+
},
|
|
114
|
+
...(productOptionString ? {
|
|
115
|
+
product_option_string: productOptionString
|
|
116
|
+
} : {}),
|
|
117
|
+
...(originExtend?.priceOverride !== undefined ? {
|
|
118
|
+
priceOverride: originExtend.priceOverride
|
|
119
|
+
} : {}),
|
|
120
|
+
...(originExtend?.bundle_edit !== undefined ? {
|
|
121
|
+
bundle_edit: originExtend.bundle_edit
|
|
122
|
+
} : {})
|
|
123
|
+
};
|
|
124
|
+
if (originExtend?.skuValue || originExtend?._skuValue) {
|
|
125
|
+
extend.skuValue = JSON.parse(JSON.stringify(originExtend.skuValue || originExtend._skuValue));
|
|
126
|
+
extend._skuValue = JSON.parse(JSON.stringify(extend.skuValue));
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
...(sourceProduct || {}),
|
|
130
|
+
id: resolvedId,
|
|
131
|
+
product_id: resolvedId,
|
|
132
|
+
_id: uid,
|
|
133
|
+
title: sourceProduct?.title ?? product.product_title ?? '',
|
|
134
|
+
cover: sourceProduct?.cover ?? product.product_cover ?? '',
|
|
135
|
+
price: sourceProduct?.price ?? sourcePrice,
|
|
136
|
+
selling_price: product.selling_price,
|
|
137
|
+
original_price: product.original_price,
|
|
138
|
+
...(productOptionString ? {
|
|
139
|
+
product_option_string: productOptionString
|
|
140
|
+
} : {}),
|
|
141
|
+
note: product.note,
|
|
142
|
+
order_detail_id: product.order_detail_id ?? null,
|
|
143
|
+
discount_list: discountList,
|
|
144
|
+
new: 0,
|
|
145
|
+
autoClose: true,
|
|
146
|
+
_extend: extend
|
|
147
|
+
};
|
|
148
|
+
}
|