@pisell/pisellos 0.0.568 → 0.0.570
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/effects/index.d.ts +2 -2
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +3 -3
- package/dist/model/strategy/adapter/itemRule/type.d.ts +6 -6
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/promotion/type.d.ts +5 -5
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/model/strategy/type.d.ts +1 -1
- 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 +3 -1
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -9
- package/dist/modules/Discount/types.d.ts +2 -1
- package/dist/modules/Holder/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +36 -16
- package/dist/modules/OpenData/types.d.ts +1 -1
- 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 +47 -23
- 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/index.d.ts +1 -1
- 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 +222 -109
- package/dist/modules/Rules/types.d.ts +15 -4
- 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/ScanOrderLogger/types.d.ts +2 -2
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- 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/type.d.ts +7 -7
- package/dist/modules/Schedule/types.d.ts +11 -9
- 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 +3 -2
- 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/menu/types.d.ts +1 -1
- 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 +91 -20
- 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 +35 -2
- 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/resource/types.d.ts +1 -1
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +116 -85
- package/dist/server/modules/schedule/utils.d.ts +1 -1
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +6 -4
- 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 +2 -2
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +382 -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 +29 -5
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +499 -434
- package/dist/solution/ScanOrder/types.d.ts +38 -16
- 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/ShopDiscount/types.d.ts +1 -1
- package/dist/solution/ShopDiscount/utils.d.ts +2 -2
- 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/types.d.ts +1 -1
- 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 +12 -2
- package/dist/utils/task.d.ts +2 -2
- package/dist/utils/watch.d.ts +2 -2
- package/lib/effects/index.d.ts +2 -2
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +3 -3
- package/lib/model/strategy/adapter/itemRule/type.d.ts +6 -6
- package/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +5 -5
- package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
- package/lib/model/strategy/type.d.ts +1 -1
- 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 +3 -1
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +18 -2
- package/lib/modules/Discount/types.d.ts +2 -1
- package/lib/modules/Holder/types.d.ts +1 -1
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +21 -3
- package/lib/modules/OpenData/types.d.ts +1 -1
- 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 +47 -23
- 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/index.d.ts +1 -1
- 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 +153 -61
- package/lib/modules/Rules/types.d.ts +15 -4
- 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/ScanOrderLogger/types.d.ts +2 -2
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +1 -1
- 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/type.d.ts +7 -7
- package/lib/modules/Schedule/types.d.ts +11 -9
- 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 +3 -2
- 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/menu/types.d.ts +1 -1
- 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 +91 -20
- 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 +35 -2
- 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/resource/types.d.ts +1 -1
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +55 -44
- package/lib/server/modules/schedule/utils.d.ts +1 -1
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +6 -4
- 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 +2 -2
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +382 -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 +29 -5
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +144 -103
- package/lib/solution/ScanOrder/types.d.ts +38 -16
- 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/ShopDiscount/types.d.ts +1 -1
- package/lib/solution/ShopDiscount/utils.d.ts +2 -2
- 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/types.d.ts +1 -1
- 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 +12 -2
- package/lib/utils/task.d.ts +2 -2
- package/lib/utils/watch.d.ts +2 -2
- package/package.json +18 -19
- package/dist/model/strategy/adapter/promotion/index.d.ts +0 -4
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/model/strategy/adapter/promotion/index.d.ts +0 -4
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
__clearBookingContextSharedCacheForTest: true,
|
|
8
|
+
buildBookingConfigQueryKey: true,
|
|
9
|
+
buildBookingResourcesQueryKey: true,
|
|
10
|
+
BookingContextModule: true
|
|
11
|
+
};
|
|
12
|
+
exports.BookingContextModule = void 0;
|
|
13
|
+
exports.__clearBookingContextSharedCacheForTest = __clearBookingContextSharedCacheForTest;
|
|
14
|
+
exports.buildBookingConfigQueryKey = buildBookingConfigQueryKey;
|
|
15
|
+
exports.buildBookingResourcesQueryKey = buildBookingResourcesQueryKey;
|
|
16
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
17
|
+
var _BaseModule = require("../BaseModule");
|
|
18
|
+
var _request = require("../../plugins/request");
|
|
19
|
+
var _types = require("./types");
|
|
20
|
+
Object.keys(_types).forEach(function (key) {
|
|
21
|
+
if (key === "default" || key === "__esModule") return;
|
|
22
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
23
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
24
|
+
Object.defineProperty(exports, key, {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _types[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var _formatResourceList = require("./utils/formatResourceList");
|
|
32
|
+
var _utils = require("./utils");
|
|
33
|
+
Object.keys(_utils).forEach(function (key) {
|
|
34
|
+
if (key === "default" || key === "__esModule") return;
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
36
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
37
|
+
Object.defineProperty(exports, key, {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _utils[key];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
45
|
+
const EMPTY_STATE = {
|
|
46
|
+
bookingConfig: null,
|
|
47
|
+
resourcesOrigin: [],
|
|
48
|
+
resourcesOriginMap: {},
|
|
49
|
+
date: null
|
|
50
|
+
};
|
|
51
|
+
const DEFAULT_BOOKING_CONFIG_PARAMS = {
|
|
52
|
+
item_type: 'appointment_booking',
|
|
53
|
+
sub_type: 'ticket'
|
|
54
|
+
};
|
|
55
|
+
const BOARD_CONFIG_CACHE = {
|
|
56
|
+
useCache: true,
|
|
57
|
+
cache: {
|
|
58
|
+
mode: _request.RequestModeENUM.REMOTE_LOCAL,
|
|
59
|
+
type: 'indexDB',
|
|
60
|
+
updateCache: true
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const RESOURCE_LIST_CACHE = {
|
|
64
|
+
useCache: true,
|
|
65
|
+
cache: {
|
|
66
|
+
mode: _request.RequestModeENUM.REMOTE_LOCAL,
|
|
67
|
+
type: 'memory'
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const requestScopeIds = new WeakMap();
|
|
71
|
+
let nextRequestScopeId = 1;
|
|
72
|
+
const sharedBookingConfigCache = new Map();
|
|
73
|
+
const sharedBookingConfigPending = new Map();
|
|
74
|
+
const sharedResourcesCache = new Map();
|
|
75
|
+
const sharedResourcesPending = new Map();
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 为 request 插件生成稳定作用域,避免不同 request 客户端之间共享缓存数据。
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const scopedKey = buildSharedCacheKey(requestPlugin, '{"sub_type":"ticket"}');
|
|
82
|
+
*/
|
|
83
|
+
function getRequestScopeId(request) {
|
|
84
|
+
const key = request;
|
|
85
|
+
const existed = requestScopeIds.get(key);
|
|
86
|
+
if (existed) return existed;
|
|
87
|
+
const id = nextRequestScopeId++;
|
|
88
|
+
requestScopeIds.set(key, id);
|
|
89
|
+
return id;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 共享缓存 key = request 作用域 + 已稳定序列化的业务参数。
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* const cacheKey = buildSharedCacheKey(requestPlugin, '2026-06-10|1,2');
|
|
97
|
+
*/
|
|
98
|
+
function buildSharedCacheKey(request, queryKey) {
|
|
99
|
+
return `${getRequestScopeId(request)}:${queryKey}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* 清理跨实例共享缓存,仅供单元测试隔离使用。
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* __clearBookingContextSharedCacheForTest();
|
|
107
|
+
*/
|
|
108
|
+
function __clearBookingContextSharedCacheForTest() {
|
|
109
|
+
sharedBookingConfigCache.clear();
|
|
110
|
+
sharedBookingConfigPending.clear();
|
|
111
|
+
sharedResourcesCache.clear();
|
|
112
|
+
sharedResourcesPending.clear();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 把多形态 date 入参 normalize 成字符串。
|
|
117
|
+
* - dayjs 实例:调用 format()(无参 ISO)。
|
|
118
|
+
* - Date 实例:toISOString()。
|
|
119
|
+
* - 字符串:原样保留。
|
|
120
|
+
* - null/undefined/空串:→ null。
|
|
121
|
+
*/
|
|
122
|
+
function normalizeDate(input) {
|
|
123
|
+
if (input === null || input === undefined) return null;
|
|
124
|
+
if (typeof input === 'string') return input || null;
|
|
125
|
+
if (input instanceof Date) return input.toISOString();
|
|
126
|
+
if (typeof input.format === 'function') {
|
|
127
|
+
try {
|
|
128
|
+
return input.format() || null;
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 资源接口使用的 `YYYY-MM-DD` 日期串。 */
|
|
137
|
+
function toScheduleQueryDate(input) {
|
|
138
|
+
const normalized = normalizeDate(input);
|
|
139
|
+
if (!normalized) return (0, _dayjs.default)().format('YYYY-MM-DD');
|
|
140
|
+
const parsed = (0, _dayjs.default)(normalized);
|
|
141
|
+
return parsed.isValid() ? parsed.format('YYYY-MM-DD') : (0, _dayjs.default)().format('YYYY-MM-DD');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 由 resources 数组派生出以 id 为 key 的 map,便于 `getResourceByIds` 直接命中。
|
|
146
|
+
*/
|
|
147
|
+
function buildResourcesMap(resources) {
|
|
148
|
+
const map = {};
|
|
149
|
+
resources.forEach(resource => {
|
|
150
|
+
if (resource && resource.id !== undefined && resource.id !== null) {
|
|
151
|
+
map[String(resource.id)] = resource;
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return map;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** 稳定序列化 config 查询参数,用于判断是否与上次 loadBookingConfig 一致。 */
|
|
158
|
+
function buildBookingConfigQueryKey(params = {}) {
|
|
159
|
+
const merged = {
|
|
160
|
+
...DEFAULT_BOOKING_CONFIG_PARAMS,
|
|
161
|
+
...params
|
|
162
|
+
};
|
|
163
|
+
const keys = Object.keys(merged).sort();
|
|
164
|
+
const sorted = {};
|
|
165
|
+
keys.forEach(k => {
|
|
166
|
+
sorted[k] = merged[k];
|
|
167
|
+
});
|
|
168
|
+
return JSON.stringify(sorted);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** 稳定序列化资源列表查询(date + bookingIds),用于跳过重复 loadResources。 */
|
|
172
|
+
function buildBookingResourcesQueryKey(params = {}) {
|
|
173
|
+
const date = toScheduleQueryDate(params.date);
|
|
174
|
+
const ids = (params.bookingIds || []).filter(id => typeof id === 'number' && Number.isFinite(id)).sort((a, b) => a - b);
|
|
175
|
+
return `${date}|${ids.join(',')}`;
|
|
176
|
+
}
|
|
177
|
+
class BookingContextModule extends _BaseModule.BaseModule {
|
|
178
|
+
defaultName = 'bookingContext';
|
|
179
|
+
defaultVersion = '1.0.0';
|
|
180
|
+
request;
|
|
181
|
+
store = {
|
|
182
|
+
...EMPTY_STATE
|
|
183
|
+
};
|
|
184
|
+
/** 上次成功 loadBookingConfig 的 query key;命中则不再请求。 */
|
|
185
|
+
lastConfigQueryKey = null;
|
|
186
|
+
/** 上次成功 loadResources 的 query key(date|bookingIds);命中则不再请求。 */
|
|
187
|
+
lastResourcesQueryKey = null;
|
|
188
|
+
constructor(name, version) {
|
|
189
|
+
super(name, version);
|
|
190
|
+
}
|
|
191
|
+
async initialize(core, options = {}) {
|
|
192
|
+
this.core = core;
|
|
193
|
+
this.request = core.getPlugin('request');
|
|
194
|
+
if (!this.request) {
|
|
195
|
+
throw new Error('BookingContextModule 需要 request 插件支持');
|
|
196
|
+
}
|
|
197
|
+
this.store = {
|
|
198
|
+
bookingConfig: null,
|
|
199
|
+
resourcesOrigin: [],
|
|
200
|
+
resourcesOriginMap: {},
|
|
201
|
+
date: null
|
|
202
|
+
};
|
|
203
|
+
const initialState = options.initialState || {};
|
|
204
|
+
if (initialState.bookingConfig) {
|
|
205
|
+
this.store.bookingConfig = initialState.bookingConfig;
|
|
206
|
+
}
|
|
207
|
+
if (Array.isArray(initialState.resourcesOrigin)) {
|
|
208
|
+
this.store.resourcesOrigin = initialState.resourcesOrigin;
|
|
209
|
+
this.store.resourcesOriginMap = buildResourcesMap(initialState.resourcesOrigin);
|
|
210
|
+
}
|
|
211
|
+
if (initialState.date) {
|
|
212
|
+
this.store.date = initialState.date;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async loadBookingConfig(params = {}, options = {}) {
|
|
216
|
+
const configKey = buildBookingConfigQueryKey(params);
|
|
217
|
+
if (!options.forceRefresh && this.store.bookingConfig != null && this.lastConfigQueryKey === configKey) {
|
|
218
|
+
return this.store.bookingConfig;
|
|
219
|
+
}
|
|
220
|
+
const query = {
|
|
221
|
+
...DEFAULT_BOOKING_CONFIG_PARAMS,
|
|
222
|
+
...params
|
|
223
|
+
};
|
|
224
|
+
const sharedKey = buildSharedCacheKey(this.request, configKey);
|
|
225
|
+
if (!options.forceRefresh && sharedBookingConfigCache.has(sharedKey)) {
|
|
226
|
+
const cached = sharedBookingConfigCache.get(sharedKey) ?? null;
|
|
227
|
+
this.setBookingConfig(cached);
|
|
228
|
+
this.lastConfigQueryKey = configKey;
|
|
229
|
+
return cached;
|
|
230
|
+
}
|
|
231
|
+
let pending = !options.forceRefresh ? sharedBookingConfigPending.get(sharedKey) : undefined;
|
|
232
|
+
if (!pending) {
|
|
233
|
+
const requestPromise = (async () => {
|
|
234
|
+
try {
|
|
235
|
+
const res = await this.request.get('/core/board/management/config', query, BOARD_CONFIG_CACHE);
|
|
236
|
+
const config = res?.data ?? null;
|
|
237
|
+
sharedBookingConfigCache.set(sharedKey, config);
|
|
238
|
+
return config;
|
|
239
|
+
} finally {
|
|
240
|
+
sharedBookingConfigPending.delete(sharedKey);
|
|
241
|
+
}
|
|
242
|
+
})();
|
|
243
|
+
pending = requestPromise;
|
|
244
|
+
sharedBookingConfigPending.set(sharedKey, requestPromise);
|
|
245
|
+
}
|
|
246
|
+
const config = await pending;
|
|
247
|
+
this.setBookingConfig(config);
|
|
248
|
+
this.lastConfigQueryKey = configKey;
|
|
249
|
+
return config;
|
|
250
|
+
}
|
|
251
|
+
async loadResources(params = {}, options = {}) {
|
|
252
|
+
const date = toScheduleQueryDate(params.date ?? this.store.date);
|
|
253
|
+
const resourcesKey = buildBookingResourcesQueryKey({
|
|
254
|
+
date,
|
|
255
|
+
bookingIds: params.bookingIds
|
|
256
|
+
});
|
|
257
|
+
if (!options.forceRefresh && this.lastResourcesQueryKey === resourcesKey) {
|
|
258
|
+
return this.getResourcesOrigin();
|
|
259
|
+
}
|
|
260
|
+
const sharedKey = buildSharedCacheKey(this.request, resourcesKey);
|
|
261
|
+
if (!options.forceRefresh && sharedResourcesCache.has(sharedKey)) {
|
|
262
|
+
const cached = sharedResourcesCache.get(sharedKey) ?? [];
|
|
263
|
+
this.setResources(cached);
|
|
264
|
+
this.lastResourcesQueryKey = resourcesKey;
|
|
265
|
+
return this.getResourcesOrigin();
|
|
266
|
+
}
|
|
267
|
+
let pending = !options.forceRefresh ? sharedResourcesPending.get(sharedKey) : undefined;
|
|
268
|
+
if (!pending) {
|
|
269
|
+
const requestPromise = (async () => {
|
|
270
|
+
try {
|
|
271
|
+
const res = await this.request.get('/schedule/resource/list', {
|
|
272
|
+
date
|
|
273
|
+
}, RESOURCE_LIST_CACHE);
|
|
274
|
+
const {
|
|
275
|
+
list
|
|
276
|
+
} = (0, _formatResourceList.formatResourceListAndMap)(res?.data, params.bookingIds || []);
|
|
277
|
+
sharedResourcesCache.set(sharedKey, list);
|
|
278
|
+
return list;
|
|
279
|
+
} finally {
|
|
280
|
+
sharedResourcesPending.delete(sharedKey);
|
|
281
|
+
}
|
|
282
|
+
})();
|
|
283
|
+
pending = requestPromise;
|
|
284
|
+
sharedResourcesPending.set(sharedKey, requestPromise);
|
|
285
|
+
}
|
|
286
|
+
const list = await pending;
|
|
287
|
+
this.setResources(list);
|
|
288
|
+
this.lastResourcesQueryKey = resourcesKey;
|
|
289
|
+
return this.getResourcesOrigin();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* store 内是否已具备与本次 init 入参等价的 config / resources(不再打接口)。
|
|
294
|
+
*/
|
|
295
|
+
isBookingContextReady(params = {}) {
|
|
296
|
+
const configKey = buildBookingConfigQueryKey(params.bookingConfigParams);
|
|
297
|
+
const dateInput = params.date ?? this.store.date ?? (0, _dayjs.default)();
|
|
298
|
+
const queryDate = toScheduleQueryDate(dateInput);
|
|
299
|
+
const resourcesKey = buildBookingResourcesQueryKey({
|
|
300
|
+
date: queryDate,
|
|
301
|
+
bookingIds: params.bookingIds
|
|
302
|
+
});
|
|
303
|
+
const configReady = this.store.bookingConfig != null && this.lastConfigQueryKey === configKey;
|
|
304
|
+
const resourcesReady = params.loadResources === false || this.lastResourcesQueryKey === resourcesKey;
|
|
305
|
+
return configReady && resourcesReady;
|
|
306
|
+
}
|
|
307
|
+
async initBookingContext(params = {}) {
|
|
308
|
+
const dateInput = params.date ?? this.store.date ?? (0, _dayjs.default)();
|
|
309
|
+
const queryDate = toScheduleQueryDate(dateInput);
|
|
310
|
+
this.setDate(dateInput);
|
|
311
|
+
if (!params.forceRefresh && this.isBookingContextReady(params)) {
|
|
312
|
+
return this.getState();
|
|
313
|
+
}
|
|
314
|
+
const configKey = buildBookingConfigQueryKey(params.bookingConfigParams);
|
|
315
|
+
const resourcesKey = buildBookingResourcesQueryKey({
|
|
316
|
+
date: queryDate,
|
|
317
|
+
bookingIds: params.bookingIds
|
|
318
|
+
});
|
|
319
|
+
const needConfig = params.forceRefresh || this.store.bookingConfig == null || this.lastConfigQueryKey !== configKey;
|
|
320
|
+
const needResources = params.loadResources !== false && (params.forceRefresh || this.lastResourcesQueryKey !== resourcesKey);
|
|
321
|
+
if (needConfig) {
|
|
322
|
+
await this.loadBookingConfig(params.bookingConfigParams, {
|
|
323
|
+
forceRefresh: params.forceRefresh
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
if (needResources) {
|
|
327
|
+
await this.loadResources({
|
|
328
|
+
date: queryDate,
|
|
329
|
+
bookingIds: params.bookingIds
|
|
330
|
+
}, {
|
|
331
|
+
forceRefresh: params.forceRefresh
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
return this.getState();
|
|
335
|
+
}
|
|
336
|
+
setBookingConfig(config) {
|
|
337
|
+
this.store.bookingConfig = config || null;
|
|
338
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnBookingConfigChange}`, this.store.bookingConfig);
|
|
339
|
+
}
|
|
340
|
+
getBookingConfig() {
|
|
341
|
+
return this.store.bookingConfig;
|
|
342
|
+
}
|
|
343
|
+
setResources(resources) {
|
|
344
|
+
const list = Array.isArray(resources) ? resources : [];
|
|
345
|
+
this.store.resourcesOrigin = list;
|
|
346
|
+
this.store.resourcesOriginMap = buildResourcesMap(list);
|
|
347
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnResourcesChange}`, {
|
|
348
|
+
resourcesOrigin: this.store.resourcesOrigin,
|
|
349
|
+
resourcesOriginMap: this.store.resourcesOriginMap
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
getResourcesOrigin() {
|
|
353
|
+
return [...this.store.resourcesOrigin];
|
|
354
|
+
}
|
|
355
|
+
getResourcesOriginMap() {
|
|
356
|
+
return this.store.resourcesOriginMap;
|
|
357
|
+
}
|
|
358
|
+
setDate(date) {
|
|
359
|
+
this.store.date = normalizeDate(date);
|
|
360
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnDateChange}`, this.store.date);
|
|
361
|
+
}
|
|
362
|
+
getDate() {
|
|
363
|
+
return this.store.date;
|
|
364
|
+
}
|
|
365
|
+
getState() {
|
|
366
|
+
return {
|
|
367
|
+
bookingConfig: this.store.bookingConfig,
|
|
368
|
+
resourcesOrigin: [...this.store.resourcesOrigin],
|
|
369
|
+
resourcesOriginMap: this.store.resourcesOriginMap,
|
|
370
|
+
date: this.store.date
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
clear() {
|
|
374
|
+
this.lastConfigQueryKey = null;
|
|
375
|
+
this.lastResourcesQueryKey = null;
|
|
376
|
+
this.store = {
|
|
377
|
+
bookingConfig: null,
|
|
378
|
+
resourcesOrigin: [],
|
|
379
|
+
resourcesOriginMap: {},
|
|
380
|
+
date: null
|
|
381
|
+
};
|
|
382
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnBookingConfigChange}`, null);
|
|
383
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnResourcesChange}`, {
|
|
384
|
+
resourcesOrigin: [],
|
|
385
|
+
resourcesOriginMap: {}
|
|
386
|
+
});
|
|
387
|
+
this.core.effects.emit(`${this.name}:${_types.BookingContextEvent.OnDateChange}`, null);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
exports.BookingContextModule = BookingContextModule;
|
|
@@ -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 declare type BookingContextResource = Record<string, any>;
|
|
43
|
+
export declare type BookingContextResourceMap = Record<string, BookingContextResource>;
|
|
44
|
+
/**
|
|
45
|
+
* 形参 booking_config(结构来自 `/core/board/management/config` 接口)。
|
|
46
|
+
* OS 不强制 schema,保留 `Record<string, any>` 兼容现网;常用路径文档化在 SDK docs。
|
|
47
|
+
*/
|
|
48
|
+
export declare type BookingContextConfig = Record<string, any>;
|
|
49
|
+
/**
|
|
50
|
+
* 日期入参:接受 dayjs 实例、ISO 字符串、Date 实例;内部统一 normalize 为 ISO 字符串保存。
|
|
51
|
+
*/
|
|
52
|
+
export declare 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>;
|