@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
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
exports.ProductList = void 0;
|
|
10
10
|
var _BaseModule = require("../BaseModule");
|
|
11
11
|
var _lodashEs = require("lodash-es");
|
|
12
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
12
13
|
var _types = require("./types");
|
|
13
14
|
Object.keys(_types).forEach(function (key) {
|
|
14
15
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -21,6 +22,7 @@ Object.keys(_types).forEach(function (key) {
|
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
});
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
26
|
class ProductList extends _BaseModule.BaseModule {
|
|
25
27
|
defaultName = 'productList';
|
|
26
28
|
defaultVersion = '1.0.0';
|
|
@@ -43,9 +45,34 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
43
45
|
}
|
|
44
46
|
this.request = core.getPlugin('request');
|
|
45
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 更新运行态参数,供父级解决方案 setOtherParams 后同步查询上下文。
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* productList.updateOtherParams({ channel: 'pos' });
|
|
54
|
+
*/
|
|
55
|
+
updateOtherParams(params) {
|
|
56
|
+
this.otherParams = params || {};
|
|
57
|
+
}
|
|
46
58
|
async storeChange(path, value) {
|
|
47
59
|
// No longer needed - products are stored as plain objects instead of Product instances
|
|
48
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 获取加时商品列表。
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* const products = await productList.getAddTimeProducts({ schedule_date: '2026-06-16' });
|
|
67
|
+
*/
|
|
68
|
+
async getAddTimeProducts(params = {}) {
|
|
69
|
+
return this.loadProducts({
|
|
70
|
+
schedule_date: (0, _dayjs.default)().format('YYYY-MM-DD'),
|
|
71
|
+
status: 'published',
|
|
72
|
+
...params,
|
|
73
|
+
extension_type: ['product_add_time']
|
|
74
|
+
});
|
|
75
|
+
}
|
|
49
76
|
async loadProducts({
|
|
50
77
|
category_ids = [],
|
|
51
78
|
product_ids = [],
|
|
@@ -57,8 +84,11 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
57
84
|
schedule_date,
|
|
58
85
|
cacheId,
|
|
59
86
|
with_schedule,
|
|
87
|
+
extension_type,
|
|
88
|
+
status = 'published',
|
|
89
|
+
strategy_context,
|
|
60
90
|
with_extra = []
|
|
61
|
-
}, options) {
|
|
91
|
+
} = {}, options) {
|
|
62
92
|
// // 如果 schedule_ids 为空,则需要尝试从 schedule 模块里获取
|
|
63
93
|
// if (!schedule_ids?.length) {
|
|
64
94
|
// const schedule_ids_data = this.store.schedule
|
|
@@ -78,58 +108,64 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
78
108
|
} catch (error) {
|
|
79
109
|
console.error(error);
|
|
80
110
|
}
|
|
111
|
+
// 如果没传schedule_date,则从
|
|
81
112
|
const channelMap = {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
'
|
|
85
|
-
|
|
113
|
+
online_store: 'online-store',
|
|
114
|
+
scan_to_order: 'online-store',
|
|
115
|
+
'scan-to-order': 'online-store',
|
|
116
|
+
scan_to_order_2: 'mobile_order',
|
|
117
|
+
scan_to_order_3: 'scantoorder3'
|
|
86
118
|
};
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
category_ids
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
119
|
+
const rawApplicationCode = this.otherParams?.channel;
|
|
120
|
+
const mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
|
|
121
|
+
const queryPayload = {
|
|
122
|
+
open_quotation: 1,
|
|
123
|
+
open_bundle: 0,
|
|
124
|
+
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
|
|
125
|
+
with: ['category', 'collection', 'resourceRelation', ...with_extra],
|
|
126
|
+
status,
|
|
127
|
+
num: 500,
|
|
128
|
+
skip: 1,
|
|
129
|
+
customer_id,
|
|
130
|
+
...(Array.isArray(category_ids) && category_ids.length ? {
|
|
131
|
+
category_ids
|
|
132
|
+
} : {}),
|
|
133
|
+
...(Array.isArray(product_ids) && product_ids.length ? {
|
|
134
|
+
ids: product_ids
|
|
135
|
+
} : {}),
|
|
136
|
+
...(Array.isArray(collection) && collection.length ? {
|
|
137
|
+
collection
|
|
138
|
+
} : {}),
|
|
139
|
+
front_end_cache_id: cacheId,
|
|
140
|
+
...(Array.isArray(menu_list_ids) && menu_list_ids.length ? {
|
|
141
|
+
menu_list_ids
|
|
142
|
+
} : {}),
|
|
143
|
+
with_count,
|
|
144
|
+
// client_schedule_ids: schedule_ids,
|
|
145
|
+
schedule_date,
|
|
146
|
+
application_code: mappedApplicationCode,
|
|
147
|
+
is_eject: 1,
|
|
148
|
+
with_schedule,
|
|
149
|
+
schedule_datetime,
|
|
150
|
+
extension_type,
|
|
151
|
+
strategy_context
|
|
152
|
+
};
|
|
153
|
+
const productsData = await this.request.post(`/product/query`, queryPayload, {
|
|
154
|
+
osServer: true,
|
|
155
|
+
callback: options?.callback,
|
|
156
|
+
subscriberId: options?.subscriberId,
|
|
157
|
+
customToast: () => {}
|
|
158
|
+
});
|
|
159
|
+
const sortedList = (productsData.data.list || []).slice().sort((a, b) => Number(b.sort) - Number(a.sort));
|
|
160
|
+
// if (sortedList.length) {
|
|
161
|
+
// sortedList.forEach((n: any) => {
|
|
162
|
+
// if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
|
|
163
|
+
// n.is_eject = 1
|
|
164
|
+
// }
|
|
165
|
+
// })
|
|
166
|
+
// }
|
|
167
|
+
this.addProduct(sortedList);
|
|
168
|
+
return sortedList;
|
|
133
169
|
}
|
|
134
170
|
async loadProductsPrice({
|
|
135
171
|
ids = [],
|
|
@@ -156,6 +192,11 @@ class ProductList extends _BaseModule.BaseModule {
|
|
|
156
192
|
const product = this.store.list.find(product => product.id === id);
|
|
157
193
|
return product ? (0, _lodashEs.cloneDeep)(product) : undefined;
|
|
158
194
|
}
|
|
195
|
+
async getProductByIds(ids) {
|
|
196
|
+
await this.core.effects.emit(`${this.name}:onGetProductByIds`, this.store.list);
|
|
197
|
+
const products = this.store.list.filter(product => ids.includes(product.id));
|
|
198
|
+
return products;
|
|
199
|
+
}
|
|
159
200
|
async addProduct(products) {
|
|
160
201
|
// list 需要根据 id 去重
|
|
161
202
|
if (!this.store.list) {
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { ProductData } from '../Product/types';
|
|
2
|
+
export interface ProductListLoadProductsParams {
|
|
3
|
+
category_ids?: number[];
|
|
4
|
+
product_ids?: number[];
|
|
5
|
+
collection?: number | string[];
|
|
6
|
+
schedule_date?: string;
|
|
7
|
+
cacheId?: string;
|
|
8
|
+
customer_id?: number;
|
|
9
|
+
menu_list_ids?: number[];
|
|
10
|
+
schedule_datetime?: string;
|
|
11
|
+
with_count?: string[];
|
|
12
|
+
with_schedule?: number;
|
|
13
|
+
extension_type?: string[];
|
|
14
|
+
status?: string;
|
|
15
|
+
/** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
|
|
16
|
+
strategy_context?: Record<string, any>;
|
|
17
|
+
with_extra?: any;
|
|
18
|
+
}
|
|
2
19
|
export interface ProductListData {
|
|
3
20
|
list: ProductData[];
|
|
4
21
|
selectProducts: ProductData[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Module, PisellCore, ModuleOptions } from '../../types';
|
|
2
2
|
import { BaseModule } from '../BaseModule';
|
|
3
3
|
import type { ScheduleItem } from '../Schedule/types';
|
|
4
|
-
import type { QuotationItem } from './types';
|
|
5
|
-
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState } from './types';
|
|
4
|
+
import type { QuotationItem, QuotationCustomerScopeInfo } from './types';
|
|
5
|
+
export type { QuotationItem, QuotationProductData, QuotationSchedule, QuotationState, QuotationCustomer, QuotationCustomerScope, QuotationCustomerScopeInfo, } from './types';
|
|
6
6
|
export declare class QuotationModule extends BaseModule implements Module {
|
|
7
7
|
protected defaultName: string;
|
|
8
8
|
protected defaultVersion: string;
|
|
@@ -13,8 +13,10 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
13
13
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
14
|
loadQuotations(params?: {
|
|
15
15
|
channel?: string;
|
|
16
|
+
customer_id?: number | string;
|
|
16
17
|
}): Promise<void>;
|
|
17
18
|
getQuotationList(): QuotationItem[];
|
|
19
|
+
getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
|
|
18
20
|
/**
|
|
19
21
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
20
22
|
* Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
|
|
@@ -27,11 +29,25 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
27
29
|
productId: number;
|
|
28
30
|
variantId?: number;
|
|
29
31
|
datetime: string;
|
|
32
|
+
channel?: string;
|
|
33
|
+
customer_id?: number | string;
|
|
30
34
|
}): string | null;
|
|
35
|
+
getQuotationMatchForProduct(params: {
|
|
36
|
+
productId: number;
|
|
37
|
+
variantId?: number;
|
|
38
|
+
datetime: string;
|
|
39
|
+
channel?: string;
|
|
40
|
+
customer_id?: number | string;
|
|
41
|
+
}): {
|
|
42
|
+
price: string | null;
|
|
43
|
+
quotationShelfId: number;
|
|
44
|
+
} | null;
|
|
31
45
|
getQuotationShelfId(params: {
|
|
32
46
|
productId: number;
|
|
33
47
|
variantId?: number;
|
|
34
48
|
datetime: string;
|
|
49
|
+
channel?: string;
|
|
50
|
+
customer_id?: number | string;
|
|
35
51
|
}): number;
|
|
36
52
|
/**
|
|
37
53
|
* Batch pre-compute quotation prices for a set of products across multiple time points.
|
|
@@ -41,8 +57,12 @@ export declare class QuotationModule extends BaseModule implements Module {
|
|
|
41
57
|
buildProductPriceMap(params: {
|
|
42
58
|
productIds: number[];
|
|
43
59
|
timePoints: string[];
|
|
60
|
+
customer_id?: number | string;
|
|
44
61
|
}): Map<string, string | null>;
|
|
45
62
|
setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
|
|
63
|
+
private isQuotationVisibleForCustomer;
|
|
64
|
+
private hasValidCustomerId;
|
|
65
|
+
private normalizeCustomerId;
|
|
46
66
|
private isQuotationActiveAt;
|
|
47
67
|
private findProductData;
|
|
48
68
|
}
|
|
@@ -32,7 +32,8 @@ class QuotationModule extends _BaseModule.BaseModule {
|
|
|
32
32
|
query.channel = 'online-store';
|
|
33
33
|
}
|
|
34
34
|
const res = await this.request.get('/quotation/available', query, {
|
|
35
|
-
useCache: false
|
|
35
|
+
useCache: false,
|
|
36
|
+
osServer: true
|
|
36
37
|
});
|
|
37
38
|
const list = res?.data?.list || res?.list || [];
|
|
38
39
|
list.sort((a, b) => b.sort - a.sort);
|
|
@@ -41,6 +42,38 @@ class QuotationModule extends _BaseModule.BaseModule {
|
|
|
41
42
|
getQuotationList() {
|
|
42
43
|
return this.store.list;
|
|
43
44
|
}
|
|
45
|
+
getQuotationCustomerScopeInfo() {
|
|
46
|
+
const customerById = new Map();
|
|
47
|
+
const quotationScopes = this.store.list.filter(quotation => Array.isArray(quotation.customer) && quotation.customer.length > 0).map(quotation => {
|
|
48
|
+
const customerIds = [];
|
|
49
|
+
const customers = [];
|
|
50
|
+
const localSeen = new Set();
|
|
51
|
+
const quotationCustomers = quotation.customer || [];
|
|
52
|
+
quotationCustomers.forEach(customer => {
|
|
53
|
+
const customerId = this.normalizeCustomerId(customer?.id);
|
|
54
|
+
if (!customerId || localSeen.has(customerId)) return;
|
|
55
|
+
localSeen.add(customerId);
|
|
56
|
+
customerIds.push(customerId);
|
|
57
|
+
customers.push(customer);
|
|
58
|
+
if (!customerById.has(customerId)) customerById.set(customerId, customer);
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
quotationId: quotation.id,
|
|
62
|
+
quotationName: quotation.name,
|
|
63
|
+
customerIds,
|
|
64
|
+
customers
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const result = {
|
|
68
|
+
quotationCount: this.store.list.length,
|
|
69
|
+
hasCustomerScopedQuotations: quotationScopes.length > 0,
|
|
70
|
+
allQuotationsCustomerScoped: this.store.list.length > 0 && quotationScopes.length === this.store.list.length,
|
|
71
|
+
customerIds: Array.from(customerById.keys()),
|
|
72
|
+
customers: Array.from(customerById.values()),
|
|
73
|
+
quotationScopes
|
|
74
|
+
};
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
44
77
|
|
|
45
78
|
/**
|
|
46
79
|
* Look up the quotation price for a specific product (+ optional variant) at a given datetime.
|
|
@@ -51,33 +84,32 @@ class QuotationModule extends _BaseModule.BaseModule {
|
|
|
51
84
|
* the requested productId wins.
|
|
52
85
|
*/
|
|
53
86
|
getPriceForProduct(params) {
|
|
87
|
+
return this.getQuotationMatchForProduct(params)?.price ?? null;
|
|
88
|
+
}
|
|
89
|
+
getQuotationMatchForProduct(params) {
|
|
54
90
|
const {
|
|
55
91
|
productId,
|
|
56
92
|
variantId,
|
|
57
|
-
datetime
|
|
93
|
+
datetime,
|
|
94
|
+
customer_id
|
|
58
95
|
} = params;
|
|
59
96
|
for (const quotation of this.store.list) {
|
|
60
|
-
|
|
97
|
+
const visible = this.isQuotationVisibleForCustomer(quotation, customer_id);
|
|
98
|
+
if (!visible) continue;
|
|
99
|
+
const active = this.isQuotationActiveAt(quotation, datetime);
|
|
100
|
+
if (!active) continue;
|
|
61
101
|
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
62
102
|
if (!match) continue;
|
|
63
103
|
if (match.value === 0) continue;
|
|
64
|
-
return
|
|
104
|
+
return {
|
|
105
|
+
price: String(match.value),
|
|
106
|
+
quotationShelfId: quotation.id
|
|
107
|
+
};
|
|
65
108
|
}
|
|
66
109
|
return null;
|
|
67
110
|
}
|
|
68
111
|
getQuotationShelfId(params) {
|
|
69
|
-
|
|
70
|
-
productId,
|
|
71
|
-
variantId,
|
|
72
|
-
datetime
|
|
73
|
-
} = params;
|
|
74
|
-
for (const quotation of this.store.list) {
|
|
75
|
-
if (!this.isQuotationActiveAt(quotation, datetime)) continue;
|
|
76
|
-
const match = this.findProductData(quotation.product_data, productId, variantId);
|
|
77
|
-
if (!match || match.value === 0) continue;
|
|
78
|
-
return quotation.id;
|
|
79
|
-
}
|
|
80
|
-
return 0;
|
|
112
|
+
return this.getQuotationMatchForProduct(params)?.quotationShelfId ?? 0;
|
|
81
113
|
}
|
|
82
114
|
|
|
83
115
|
/**
|
|
@@ -93,7 +125,8 @@ class QuotationModule extends _BaseModule.BaseModule {
|
|
|
93
125
|
const key = `${productId}:${timePoint}`;
|
|
94
126
|
const price = this.getPriceForProduct({
|
|
95
127
|
productId,
|
|
96
|
-
datetime: timePoint
|
|
128
|
+
datetime: timePoint,
|
|
129
|
+
customer_id: params.customer_id
|
|
97
130
|
});
|
|
98
131
|
if (price !== null) {
|
|
99
132
|
map.set(key, price);
|
|
@@ -105,18 +138,41 @@ class QuotationModule extends _BaseModule.BaseModule {
|
|
|
105
138
|
setScheduleResolver(resolver) {
|
|
106
139
|
this.scheduleResolver = resolver;
|
|
107
140
|
}
|
|
141
|
+
isQuotationVisibleForCustomer(quotation, customerId) {
|
|
142
|
+
const customers = quotation.customer || [];
|
|
143
|
+
if (customers.length === 0) return true;
|
|
144
|
+
if (!this.hasValidCustomerId(customerId)) return false;
|
|
145
|
+
return customers.some(customer => String(customer.id) === String(customerId));
|
|
146
|
+
}
|
|
147
|
+
hasValidCustomerId(customerId) {
|
|
148
|
+
if (customerId === undefined || customerId === null || customerId === '') return false;
|
|
149
|
+
return Number(customerId) > 0;
|
|
150
|
+
}
|
|
151
|
+
normalizeCustomerId(customerId) {
|
|
152
|
+
if (customerId === undefined || customerId === null || customerId === '') return null;
|
|
153
|
+
return String(customerId);
|
|
154
|
+
}
|
|
108
155
|
isQuotationActiveAt(quotation, datetime) {
|
|
109
156
|
if (!quotation.schedule?.length) return false;
|
|
110
|
-
const scheduleItems =
|
|
157
|
+
const scheduleItems = [];
|
|
158
|
+
quotation.schedule.forEach(s => {
|
|
111
159
|
const full = this.scheduleResolver?.(s.id);
|
|
112
|
-
if (full)
|
|
113
|
-
|
|
160
|
+
if (full) {
|
|
161
|
+
scheduleItems.push(full);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (this.scheduleResolver) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const fallbackSchedule = {
|
|
114
168
|
...s,
|
|
115
169
|
repeat_type: s.repeat_type || 'none',
|
|
116
170
|
repeat_rule: s.repeat_rule || null,
|
|
117
171
|
time_slot: s.time_slot || []
|
|
118
172
|
};
|
|
173
|
+
scheduleItems.push(fallbackSchedule);
|
|
119
174
|
});
|
|
175
|
+
if (!scheduleItems.length) return false;
|
|
120
176
|
return (0, _getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
|
|
121
177
|
}
|
|
122
178
|
findProductData(productData, productId, variantId) {
|
|
@@ -22,6 +22,10 @@ export interface QuotationSchedule {
|
|
|
22
22
|
}>;
|
|
23
23
|
pivot?: Record<string, any>;
|
|
24
24
|
}
|
|
25
|
+
export interface QuotationCustomer {
|
|
26
|
+
id: number | string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
25
29
|
export interface QuotationItem {
|
|
26
30
|
id: number;
|
|
27
31
|
shop_id: number;
|
|
@@ -34,9 +38,24 @@ export interface QuotationItem {
|
|
|
34
38
|
created_at?: string;
|
|
35
39
|
updated_at?: string;
|
|
36
40
|
deleted_at?: string | null;
|
|
41
|
+
customer?: QuotationCustomer[];
|
|
37
42
|
schedule: QuotationSchedule[];
|
|
38
43
|
product_data: QuotationProductData[];
|
|
39
44
|
}
|
|
40
45
|
export interface QuotationState {
|
|
41
46
|
list: QuotationItem[];
|
|
42
47
|
}
|
|
48
|
+
export interface QuotationCustomerScope {
|
|
49
|
+
quotationId: number;
|
|
50
|
+
quotationName: string;
|
|
51
|
+
customerIds: string[];
|
|
52
|
+
customers: QuotationCustomer[];
|
|
53
|
+
}
|
|
54
|
+
export interface QuotationCustomerScopeInfo {
|
|
55
|
+
quotationCount: number;
|
|
56
|
+
hasCustomerScopedQuotations: boolean;
|
|
57
|
+
allQuotationsCustomerScoped: boolean;
|
|
58
|
+
customerIds: string[];
|
|
59
|
+
customers: QuotationCustomer[];
|
|
60
|
+
quotationScopes: QuotationCustomerScope[];
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseModule } from '../BaseModule';
|
|
2
|
+
import type { Module, ModuleOptions, PisellCore } from '../../types';
|
|
3
|
+
import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerContextInput, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './planner';
|
|
6
|
+
export declare enum ResourcePlannerHooks {
|
|
7
|
+
onContextChanged = "resourcePlanner:onContextChanged",
|
|
8
|
+
onSelectionChanged = "resourcePlanner:onSelectionChanged",
|
|
9
|
+
onProjectionChanged = "resourcePlanner:onProjectionChanged"
|
|
10
|
+
}
|
|
11
|
+
export declare class ResourcePlannerModule extends BaseModule implements Module {
|
|
12
|
+
protected defaultName: string;
|
|
13
|
+
protected defaultVersion: string;
|
|
14
|
+
private store;
|
|
15
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
16
|
+
setContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
|
|
17
|
+
mergeContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
|
|
18
|
+
setSelectionPatch(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
|
|
19
|
+
queryAvailability(query?: ResourcePlannerQuery): ResourcePlannerProjection;
|
|
20
|
+
autoAssign(query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
|
|
21
|
+
resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
|
|
22
|
+
validateSelection(): ResourcePlannerValidationResult;
|
|
23
|
+
getSnapshot(): ResourcePlannerSnapshot;
|
|
24
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
ResourcePlannerHooks: true,
|
|
8
|
+
ResourcePlannerModule: true
|
|
9
|
+
};
|
|
10
|
+
exports.ResourcePlannerModule = exports.ResourcePlannerHooks = void 0;
|
|
11
|
+
var _BaseModule = require("../BaseModule");
|
|
12
|
+
var _planner = require("./planner");
|
|
13
|
+
Object.keys(_planner).forEach(function (key) {
|
|
14
|
+
if (key === "default" || key === "__esModule") return;
|
|
15
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
+
if (key in exports && exports[key] === _planner[key]) return;
|
|
17
|
+
Object.defineProperty(exports, key, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return _planner[key];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _types = require("./types");
|
|
25
|
+
Object.keys(_types).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
28
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
29
|
+
Object.defineProperty(exports, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return _types[key];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
let ResourcePlannerHooks = exports.ResourcePlannerHooks = /*#__PURE__*/function (ResourcePlannerHooks) {
|
|
37
|
+
ResourcePlannerHooks["onContextChanged"] = "resourcePlanner:onContextChanged";
|
|
38
|
+
ResourcePlannerHooks["onSelectionChanged"] = "resourcePlanner:onSelectionChanged";
|
|
39
|
+
ResourcePlannerHooks["onProjectionChanged"] = "resourcePlanner:onProjectionChanged";
|
|
40
|
+
return ResourcePlannerHooks;
|
|
41
|
+
}({});
|
|
42
|
+
class ResourcePlannerModule extends _BaseModule.BaseModule {
|
|
43
|
+
defaultName = 'resourcePlanner';
|
|
44
|
+
defaultVersion = '1.0.0';
|
|
45
|
+
store;
|
|
46
|
+
async initialize(core, options) {
|
|
47
|
+
this.core = core;
|
|
48
|
+
const initialState = options.initialState;
|
|
49
|
+
this.store = {
|
|
50
|
+
context: (0, _planner.normalizePlannerContext)(initialState?.context || _planner.DEFAULT_RESOURCE_PLANNER_CONTEXT),
|
|
51
|
+
selection: initialState?.selection || {
|
|
52
|
+
..._planner.DEFAULT_RESOURCE_PLANNER_SELECTION
|
|
53
|
+
},
|
|
54
|
+
projection: initialState?.projection || null,
|
|
55
|
+
version: initialState?.version || 0
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
setContext(input) {
|
|
59
|
+
this.store.context = (0, _planner.normalizePlannerContext)(input);
|
|
60
|
+
this.store.version += 1;
|
|
61
|
+
this.store.projection = null;
|
|
62
|
+
const snapshot = this.getSnapshot();
|
|
63
|
+
void this.core.effects.emit(`${this.name}:contextChanged`, snapshot);
|
|
64
|
+
return snapshot;
|
|
65
|
+
}
|
|
66
|
+
mergeContext(input) {
|
|
67
|
+
return this.setContext({
|
|
68
|
+
...this.store.context,
|
|
69
|
+
...input,
|
|
70
|
+
products: input.products || this.store.context.products,
|
|
71
|
+
resources: input.resources || this.store.context.resources,
|
|
72
|
+
externalEvents: input.externalEvents || this.store.context.externalEvents
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
setSelectionPatch(patch) {
|
|
76
|
+
const assignments = patch.assignments ? patch.replaceAssignments === false ? [...this.store.selection.assignments, ...patch.assignments] : patch.assignments : this.store.selection.assignments;
|
|
77
|
+
this.store.selection = {
|
|
78
|
+
...this.store.selection,
|
|
79
|
+
...patch,
|
|
80
|
+
productIds: patch.productIds || this.store.selection.productIds,
|
|
81
|
+
resourceIds: patch.resourceIds || this.store.selection.resourceIds,
|
|
82
|
+
assignments
|
|
83
|
+
};
|
|
84
|
+
this.store.version += 1;
|
|
85
|
+
const snapshot = this.getSnapshot();
|
|
86
|
+
void this.core.effects.emit(`${this.name}:selectionChanged`, snapshot);
|
|
87
|
+
return snapshot;
|
|
88
|
+
}
|
|
89
|
+
queryAvailability(query = {}) {
|
|
90
|
+
const mergedQuery = {
|
|
91
|
+
mode: this.store.selection.mode,
|
|
92
|
+
productIds: this.store.selection.productIds,
|
|
93
|
+
date: this.store.selection.date,
|
|
94
|
+
startTime: this.store.selection.startTime,
|
|
95
|
+
endTime: this.store.selection.endTime,
|
|
96
|
+
resourceIds: this.store.selection.resourceIds,
|
|
97
|
+
...query
|
|
98
|
+
};
|
|
99
|
+
const projection = (0, _planner.queryPlannerAvailability)(this.store.context, mergedQuery);
|
|
100
|
+
this.store.projection = projection;
|
|
101
|
+
this.store.version += 1;
|
|
102
|
+
void this.core.effects.emit(`${this.name}:projectionChanged`, this.getSnapshot());
|
|
103
|
+
return projection;
|
|
104
|
+
}
|
|
105
|
+
autoAssign(query = {}) {
|
|
106
|
+
const result = (0, _planner.autoAssignResources)(this.store.context, {
|
|
107
|
+
mode: this.store.selection.mode,
|
|
108
|
+
productIds: this.store.selection.productIds,
|
|
109
|
+
date: this.store.selection.date,
|
|
110
|
+
startTime: this.store.selection.startTime,
|
|
111
|
+
endTime: this.store.selection.endTime,
|
|
112
|
+
resourceIds: this.store.selection.resourceIds,
|
|
113
|
+
...query
|
|
114
|
+
});
|
|
115
|
+
const resourceIds = Array.from(new Map(result.assignments.map(assignment => [String(assignment.resourceId), assignment.resourceId])).values());
|
|
116
|
+
this.setSelectionPatch({
|
|
117
|
+
assignments: result.assignments,
|
|
118
|
+
...(resourceIds.length ? {
|
|
119
|
+
resourceIds
|
|
120
|
+
} : {})
|
|
121
|
+
});
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
resolveAssignableSlots(query = {}) {
|
|
125
|
+
return (0, _planner.resolveAssignableSlots)(this.store.context, {
|
|
126
|
+
mode: this.store.selection.mode,
|
|
127
|
+
productIds: this.store.selection.productIds,
|
|
128
|
+
date: this.store.selection.date,
|
|
129
|
+
startTime: this.store.selection.startTime,
|
|
130
|
+
endTime: this.store.selection.endTime,
|
|
131
|
+
resourceIds: this.store.selection.resourceIds,
|
|
132
|
+
...query
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
validateSelection() {
|
|
136
|
+
return (0, _planner.validateAssignments)(this.store.context, this.store.selection);
|
|
137
|
+
}
|
|
138
|
+
getSnapshot() {
|
|
139
|
+
return {
|
|
140
|
+
context: this.store.context,
|
|
141
|
+
selection: this.store.selection,
|
|
142
|
+
projection: this.store.projection,
|
|
143
|
+
version: this.store.version
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.ResourcePlannerModule = ResourcePlannerModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerAvailabilityCell, ResourcePlannerContextInput, ResourcePlannerDemandInterval, ResourcePlannerProduct, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerResource, ResourcePlannerSelection, ResourcePlannerValidationResult } from './types';
|
|
2
|
+
export declare const DEFAULT_RESOURCE_PLANNER_CONTEXT: Required<ResourcePlannerContextInput>;
|
|
3
|
+
export declare const DEFAULT_RESOURCE_PLANNER_SELECTION: ResourcePlannerSelection;
|
|
4
|
+
export declare function normalizePlannerContext(input?: ResourcePlannerContextInput): Required<ResourcePlannerContextInput>;
|
|
5
|
+
export declare function buildDemandIntervals(products: ResourcePlannerProduct[], query: ResourcePlannerQuery, context?: Required<ResourcePlannerContextInput>): ResourcePlannerDemandInterval[];
|
|
6
|
+
export declare function evaluateResourceForInterval(params: {
|
|
7
|
+
resource: ResourcePlannerResource;
|
|
8
|
+
interval: ResourcePlannerDemandInterval;
|
|
9
|
+
context: Required<ResourcePlannerContextInput>;
|
|
10
|
+
}): ResourcePlannerAvailabilityCell;
|
|
11
|
+
export declare function queryPlannerAvailability(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerProjection;
|
|
12
|
+
export declare function resolveAssignableSlots(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
|
|
13
|
+
export declare function autoAssignResources(contextInput: ResourcePlannerContextInput, query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
|
|
14
|
+
export declare function validateAssignments(contextInput: ResourcePlannerContextInput, selection: ResourcePlannerSelection): ResourcePlannerValidationResult;
|