@pisell/pisellos 0.0.567 → 0.0.569
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +6 -9
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +0 -2
- package/dist/model/strategy/adapter/walletPass/example.js +3 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -7
- package/dist/model/strategy/strategy-example.js +5 -19
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +0 -3
- package/dist/modules/Cart/utils/cartProduct.js +26 -6
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +1 -5
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -12
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +35 -17
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5437 -608
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +508 -874
- package/dist/modules/Payment/types.d.ts +40 -16
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.js +48 -34
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +184 -74
- package/dist/modules/ProductList/types.d.ts +17 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +219 -114
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +803 -163
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +78 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +0 -1
- package/dist/modules/Step/index.js +0 -1
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +1 -4
- package/dist/plugins/window.js +2 -6
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6137 -714
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +32 -41
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2326 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1397 -540
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +289 -86
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +105 -84
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +137 -114
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -3
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.js +7 -59
- package/dist/solution/BookingByStep/utils/capacity.js +1 -11
- package/dist/solution/BookingByStep/utils/resources.js +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +2 -43
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2506 -445
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +36 -34
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +26 -18
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +9 -12
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +199 -277
- package/dist/solution/Checkout/utils/index.js +8 -20
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +30 -76
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +509 -454
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +6 -11
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +34 -20
- package/dist/solution/VenueBooking/index.js +630 -505
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +11 -1
- package/dist/utils/task.js +15 -18
- package/dist/utils/watch.js +0 -1
- package/lib/apis/picoding.js +2 -0
- package/lib/core/index.js +130 -131
- package/lib/effects/index.js +46 -57
- package/lib/index.js +92 -53
- package/lib/model/index.js +14 -21
- package/lib/model/strategy/adapter/dataVariant/adapter.js +38 -50
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +162 -236
- package/lib/model/strategy/adapter/dataVariant/examples.js +229 -237
- package/lib/model/strategy/adapter/dataVariant/index.js +39 -34
- package/lib/model/strategy/adapter/dataVariant/type.js +57 -28
- package/lib/model/strategy/adapter/index.js +100 -64
- package/lib/model/strategy/adapter/itemRule/adapter.js +156 -144
- package/lib/model/strategy/adapter/itemRule/evaluator.js +36 -48
- package/lib/model/strategy/adapter/itemRule/examples.js +295 -225
- package/lib/model/strategy/adapter/itemRule/index.js +83 -57
- package/lib/model/strategy/adapter/itemRule/type.js +97 -36
- package/lib/model/strategy/adapter/promotion/adapter.js +84 -63
- package/lib/model/strategy/adapter/promotion/evaluator.js +383 -232
- package/lib/model/strategy/adapter/promotion/examples.js +139 -159
- package/lib/model/strategy/adapter/promotion/index.js +1 -49
- package/lib/model/strategy/adapter/promotion/type.js +199 -35
- package/lib/model/strategy/adapter/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/evaluator.js +180 -152
- package/lib/model/strategy/adapter/walletPass/example.js +217 -190
- package/lib/model/strategy/adapter/walletPass/index.js +75 -51
- package/lib/model/strategy/adapter/walletPass/locales.js +36 -58
- package/lib/model/strategy/adapter/walletPass/type.js +4 -16
- package/lib/model/strategy/adapter/walletPass/utils.js +654 -402
- package/lib/model/strategy/engine.js +270 -168
- package/lib/model/strategy/index.js +49 -34
- package/lib/model/strategy/strategy-example.js +243 -239
- package/lib/model/strategy/type.js +100 -40
- package/lib/modules/Account/index.js +39 -53
- package/lib/modules/Account/types.js +20 -33
- package/lib/modules/AccountList/index.js +116 -154
- package/lib/modules/AccountList/types.js +30 -31
- package/lib/modules/AccountList/utils.js +18 -30
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +26 -49
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/index.js +170 -124
- package/lib/modules/Cart/types.js +46 -51
- package/lib/modules/Cart/utils/cartAccount.js +40 -39
- package/lib/modules/Cart/utils/cartDate.js +56 -61
- package/lib/modules/Cart/utils/cartDiscount.js +28 -33
- package/lib/modules/Cart/utils/cartNote.js +27 -32
- package/lib/modules/Cart/utils/cartProduct.js +331 -244
- package/lib/modules/Cart/utils/cartRelationForms.js +29 -35
- package/lib/modules/Cart/utils/cartResource.js +72 -78
- package/lib/modules/Cart/utils/changePrice.js +37 -67
- package/lib/modules/Cart/utils/index.js +106 -48
- package/lib/modules/Customer/constants.js +13 -34
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +270 -154
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +38 -35
- package/lib/modules/Date/index.js +116 -115
- package/lib/modules/Date/types.js +16 -28
- package/lib/modules/Date/utils.js +174 -123
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +133 -113
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Discount/types.js +9 -31
- package/lib/modules/Guests/index.js +30 -56
- package/lib/modules/Guests/types.js +23 -33
- package/lib/modules/Holder/index.js +209 -189
- package/lib/modules/Holder/types.js +4 -16
- package/lib/modules/Holder/utils.js +20 -49
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +81 -74
- package/lib/modules/OpenData/types.js +4 -16
- package/lib/modules/OpenData/utils.js +44 -78
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +3834 -489
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +78 -33
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1247 -345
- package/lib/modules/Payment/cash.js +20 -33
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +145 -76
- package/lib/modules/Payment/eftpos.js +16 -30
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +542 -502
- package/lib/modules/Payment/mx51.js +1 -0
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/types.js +216 -107
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +53 -49
- package/lib/modules/Payment/walletpass.js +231 -203
- package/lib/modules/Product/index.js +51 -46
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +4 -16
- package/lib/modules/Product/utils.js +32 -33
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +160 -118
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/ProductList/types.js +9 -31
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +123 -89
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +4 -16
- package/lib/modules/Resource/index.js +27 -59
- package/lib/modules/Resource/types.js +22 -32
- package/lib/modules/Resource/utils.js +30 -38
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +1286 -894
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +17 -40
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +130 -71
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +4 -16
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +738 -250
- package/lib/modules/ScanOrderLogger/index.js +59 -79
- package/lib/modules/ScanOrderLogger/providers/feishu.js +54 -78
- package/lib/modules/ScanOrderLogger/providers/grafana.js +13 -36
- package/lib/modules/ScanOrderLogger/types.js +4 -16
- package/lib/modules/Schedule/getDateIsInSchedule.js +345 -171
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +139 -114
- package/lib/modules/Schedule/type.js +4 -16
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +4 -16
- package/lib/modules/Schedule/utils.js +433 -291
- package/lib/modules/Step/index.js +40 -52
- package/lib/modules/Step/tyeps.js +4 -16
- package/lib/modules/Summary/index.js +66 -70
- package/lib/modules/Summary/types.js +4 -16
- package/lib/modules/Summary/utils.js +782 -429
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +245 -57
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +4 -16
- package/lib/plugins/index.js +36 -25
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +137 -126
- package/lib/plugins/shopStore.js +4 -16
- package/lib/plugins/user.js +4 -16
- package/lib/plugins/window.js +171 -179
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4668 -713
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +106 -59
- package/lib/server/modules/menu/index.js +146 -122
- package/lib/server/modules/menu/types.js +18 -31
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1463 -316
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +117 -32
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +288 -146
- package/lib/server/modules/order/utils/filterOrders.js +318 -64
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +969 -383
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +44 -34
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +220 -77
- package/lib/server/modules/quotation/types.js +21 -31
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +269 -214
- package/lib/server/modules/resource/types.js +42 -33
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +158 -132
- package/lib/server/modules/schedule/types.js +14 -21
- package/lib/server/modules/schedule/utils.js +334 -163
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +4 -16
- package/lib/server/utils/index.js +25 -23
- package/lib/server/utils/product.js +197 -140
- package/lib/server/utils/schedule.js +34 -41
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/server/utils/time.js +40 -49
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.js +1530 -1343
- package/lib/solution/BookingByStep/types.js +40 -99
- package/lib/solution/BookingByStep/utils/capacity.js +192 -160
- package/lib/solution/BookingByStep/utils/products.js +42 -52
- package/lib/solution/BookingByStep/utils/resources.js +527 -330
- package/lib/solution/BookingByStep/utils/stock.js +65 -44
- package/lib/solution/BookingByStep/utils/timeslots.js +129 -131
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1459 -160
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +101 -66
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +85 -80
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +84 -80
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +103 -95
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +90 -43
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/BuyTickets/index.js +67 -70
- package/lib/solution/BuyTickets/types.js +22 -38
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1461 -1169
- package/lib/solution/Checkout/types.js +91 -61
- package/lib/solution/Checkout/utils/index.js +228 -159
- package/lib/solution/PlaceOrder/index.js +55 -0
- package/lib/solution/RegisterAndLogin/config.js +495 -470
- package/lib/solution/RegisterAndLogin/index.js +633 -630
- package/lib/solution/RegisterAndLogin/types.js +189 -76
- package/lib/solution/RegisterAndLogin/utils.js +183 -125
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +495 -220
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +27 -33
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +908 -904
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +33 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +457 -344
- package/lib/solution/ShopDiscount/index.js +230 -236
- package/lib/solution/ShopDiscount/types.js +15 -37
- package/lib/solution/ShopDiscount/utils.js +309 -172
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +34 -20
- package/lib/solution/VenueBooking/index.js +982 -950
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.js +20 -40
- package/lib/solution/VenueBooking/utils/dateSummary.js +22 -54
- package/lib/solution/VenueBooking/utils/resource.js +31 -54
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +96 -108
- package/lib/solution/VenueBooking/utils/smartPricing.js +112 -100
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -132
- package/lib/solution/VenueBooking/utils.js +130 -67
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +124 -37
- package/lib/store/createStore.js +32 -29
- package/lib/types/index.d.ts +11 -1
- package/lib/types/index.js +4 -16
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +81 -47
- package/package.json +2 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getSumCapacity } from './resources';
|
|
2
|
+
import { TimeSlicesResult, TimeSlice, DurationSlice } from './timeSlices';
|
|
3
|
+
/**
|
|
4
|
+
* 上下文(与 info2 state.bookingConfig / state.service / state.date 一一对应)。
|
|
5
|
+
*
|
|
6
|
+
* 设计原则:所有助手函数都通过 context 显式拿数据,**不读 mini-redux**,
|
|
7
|
+
* 让 OS 这层完全可在 Node 单测下运行(dayjs 在 Node 也是纯函数)。
|
|
8
|
+
*/
|
|
9
|
+
export interface BookingCalcContext {
|
|
10
|
+
/** 来自 `/core/board/management/config` 的整套配置;常用路径见 sliceTimeSlices / appointmentTimingPreference。 */
|
|
11
|
+
bookingConfig?: any;
|
|
12
|
+
/** 资源 origin map(id → resource origin)。 */
|
|
13
|
+
resourcesOriginMap?: Record<string, any>;
|
|
14
|
+
/** 资源全集列表(display_scope=all 时用)。 */
|
|
15
|
+
resourcesOrigin?: any[];
|
|
16
|
+
/** 当前选择的日期(dayjs 或 string)。 */
|
|
17
|
+
date?: any;
|
|
18
|
+
/** 上一个服务行(getServiceStartTimeAndEndTime 拼接续接 start_time 用)。可缺省。 */
|
|
19
|
+
previousService?: any;
|
|
20
|
+
/** 日历选中的资源 id(替代 info2 sessionStorage.serviceParams.resource_id)。 */
|
|
21
|
+
resourceIdFromCalendar?: number;
|
|
22
|
+
/** 资源自动分派开关(替代 info2 localStorage 'resource-auto-allocation');默认全开。 */
|
|
23
|
+
isAutoAllocationOn?: (formId: any) => boolean;
|
|
24
|
+
/** 当前预设开始时间(替代 info2 sessionStorage.serviceParams.start_date 取 HH:mm)。 */
|
|
25
|
+
presetStartTime?: string;
|
|
26
|
+
/** 店铺打烊时间(替代 info2 localStorage shopOpeningHours),默认 23:59。 */
|
|
27
|
+
shopOpeningHours?: string;
|
|
28
|
+
}
|
|
29
|
+
/** 从 BookingContext.date 提取 HH:mm(仅当日期带有效时分时)。 */
|
|
30
|
+
export declare function derivePresetStartTimeFromDate(date: any): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* 时间切片对象(含灵活时长选项)。与 info2 `getTimeObj` 等价。
|
|
33
|
+
*/
|
|
34
|
+
export declare function getTimeObj(params: {
|
|
35
|
+
cacheItem: any;
|
|
36
|
+
useStartTime?: string;
|
|
37
|
+
useDuration?: number | string;
|
|
38
|
+
ctx: BookingCalcContext;
|
|
39
|
+
}): TimeSlicesResult & {
|
|
40
|
+
timeSlices: TimeSlice[];
|
|
41
|
+
durationSlicesBasedOnTime: DurationSlice[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 计算商品行 _extend(包含 start_time / endDate / duration / start_date / end_date / sub_type 等)。
|
|
45
|
+
* 与 info2 `utilsByBooking.ts#getServiceStartTimeAndEndTime` 等价;显著差异:
|
|
46
|
+
* - 不读 `state.service.value` / `mini-redux`,由 ctx.previousService 显式注入。
|
|
47
|
+
* - 不读 `sessionStorage.serviceParams`,由 ctx.presetStartTime / ctx.resourceIdFromCalendar 注入。
|
|
48
|
+
* - cacheItem.isCustomItem → 直接返回 `{ duration: null }`。
|
|
49
|
+
*/
|
|
50
|
+
export declare function getServiceStartTimeAndEndTime(params: {
|
|
51
|
+
cacheItem: any;
|
|
52
|
+
timeObj: TimeSlicesResult;
|
|
53
|
+
ctx: BookingCalcContext;
|
|
54
|
+
}): any;
|
|
55
|
+
/**
|
|
56
|
+
* 综合:把 cacheItem 拼装出完整的 _extend / _data(资源 / 容量 / timeObj),并标记 autoClose。
|
|
57
|
+
* 与 info2 `service/addService/utils.tsx#getProductExtend` 等价;剥 React `console.time` / JSX。
|
|
58
|
+
*
|
|
59
|
+
* 入参 ctx 必须至少给:bookingConfig / resourcesOriginMap / resourcesOrigin / date。
|
|
60
|
+
*/
|
|
61
|
+
export declare function getProductExtend(params: {
|
|
62
|
+
cacheItem: any;
|
|
63
|
+
ctx: BookingCalcContext;
|
|
64
|
+
isDisabledTime?: boolean;
|
|
65
|
+
}): any;
|
|
66
|
+
/**
|
|
67
|
+
* 是否可自动关闭弹窗(不需要用户进 EditService 抽屉)。
|
|
68
|
+
* 与 info2 `service/addService/utils.tsx#getIsAutoClose` 等价;
|
|
69
|
+
* `getAutoAllocationStorage` 抽象为入参 `isAutoAllocationOn(formId)`。
|
|
70
|
+
*/
|
|
71
|
+
export declare function getIsAutoClose(cacheItem: any, isAutoAllocationOn: (formId: any) => boolean): boolean;
|
|
72
|
+
export { getSumCapacity };
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.derivePresetStartTimeFromDate = derivePresetStartTimeFromDate;
|
|
7
|
+
exports.getIsAutoClose = getIsAutoClose;
|
|
8
|
+
exports.getProductExtend = getProductExtend;
|
|
9
|
+
exports.getServiceStartTimeAndEndTime = getServiceStartTimeAndEndTime;
|
|
10
|
+
Object.defineProperty(exports, "getSumCapacity", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _resources.getSumCapacity;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
exports.getTimeObj = getTimeObj;
|
|
17
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
18
|
+
var _resources = require("./resources");
|
|
19
|
+
var _resourceSelection = require("./resourceSelection");
|
|
20
|
+
var _serviceTimes = require("./serviceTimes");
|
|
21
|
+
var _timeSlices = require("./timeSlices");
|
|
22
|
+
var _flexible = require("./flexible");
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
+
/**
|
|
25
|
+
* 上下文(与 info2 state.bookingConfig / state.service / state.date 一一对应)。
|
|
26
|
+
*
|
|
27
|
+
* 设计原则:所有助手函数都通过 context 显式拿数据,**不读 mini-redux**,
|
|
28
|
+
* 让 OS 这层完全可在 Node 单测下运行(dayjs 在 Node 也是纯函数)。
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** 从 BookingContext.date 提取 HH:mm(仅当日期带有效时分时)。 */
|
|
32
|
+
function derivePresetStartTimeFromDate(date) {
|
|
33
|
+
if (date == null) return undefined;
|
|
34
|
+
const d = (0, _dayjs.default)(date);
|
|
35
|
+
if (!d.isValid()) return undefined;
|
|
36
|
+
const hhmm = d.format('HH:mm');
|
|
37
|
+
if (hhmm === '00:00') return undefined;
|
|
38
|
+
return hhmm;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 取预约时间偏好(sequential / parallel);默认 sequential。
|
|
43
|
+
*/
|
|
44
|
+
function getAppointmentTimingPreference(ctx) {
|
|
45
|
+
return ctx?.bookingConfig?.config?.information_tab?.appointment_timing_preference || 'sequential';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 灵活时长选项(cacheItem.duration.type === 'flexible' 时)。
|
|
50
|
+
*/
|
|
51
|
+
function getFlexibleOption(params) {
|
|
52
|
+
const {
|
|
53
|
+
cacheItem,
|
|
54
|
+
useStartTime
|
|
55
|
+
} = params;
|
|
56
|
+
const duration = (0, _flexible.getDurationValue)(cacheItem?.duration);
|
|
57
|
+
if (duration !== 'flexible') return null;
|
|
58
|
+
const startDate = (0, _dayjs.default)(`${(0, _dayjs.default)(cacheItem?._extend?.start_date).format('YYYY-MM-DD')} ${useStartTime || cacheItem?._extend?.start_time || '00:00'}`);
|
|
59
|
+
const usable = (0, _resources.getUsableTime)(cacheItem);
|
|
60
|
+
const usableEndAt = usable?._extend?.usableTime?.end_at ? (0, _dayjs.default)(usable._extend.usableTime.end_at) : null;
|
|
61
|
+
const endDate = (0, _timeSlices.getEndDate)(startDate, 'flexible', usableEndAt, params.ctx?.shopOpeningHours);
|
|
62
|
+
const timeValue = endDate.diff(startDate, 'minute');
|
|
63
|
+
return {
|
|
64
|
+
label: String(timeValue),
|
|
65
|
+
value: _flexible.flexibleObj.create(timeValue)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 时间切片对象(含灵活时长选项)。与 info2 `getTimeObj` 等价。
|
|
71
|
+
*/
|
|
72
|
+
function getTimeObj(params) {
|
|
73
|
+
const {
|
|
74
|
+
cacheItem,
|
|
75
|
+
useStartTime,
|
|
76
|
+
useDuration,
|
|
77
|
+
ctx
|
|
78
|
+
} = params;
|
|
79
|
+
const isMultiDay = (0, _serviceTimes.isMultiDayProduct)(cacheItem);
|
|
80
|
+
const flexibleOption = getFlexibleOption({
|
|
81
|
+
cacheItem,
|
|
82
|
+
useStartTime,
|
|
83
|
+
ctx
|
|
84
|
+
});
|
|
85
|
+
const baseSlices = (0, _timeSlices.sliceDayIntoFiveMinutes)(ctx?.bookingConfig?.config?.basic?.service_time, isMultiDay);
|
|
86
|
+
const timeSlices = [...baseSlices.timeSlices];
|
|
87
|
+
const durationSlicesBasedOnTime = [...baseSlices.durationSlicesBasedOnTime];
|
|
88
|
+
if (flexibleOption) {
|
|
89
|
+
durationSlicesBasedOnTime.unshift(flexibleOption);
|
|
90
|
+
}
|
|
91
|
+
if (useDuration && !durationSlicesBasedOnTime.some(d => d.value === useDuration)) {
|
|
92
|
+
durationSlicesBasedOnTime.unshift({
|
|
93
|
+
label: String(useDuration),
|
|
94
|
+
value: useDuration
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
timeSlices,
|
|
99
|
+
durationSlicesBasedOnTime
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 计算商品行 _extend(包含 start_time / endDate / duration / start_date / end_date / sub_type 等)。
|
|
105
|
+
* 与 info2 `utilsByBooking.ts#getServiceStartTimeAndEndTime` 等价;显著差异:
|
|
106
|
+
* - 不读 `state.service.value` / `mini-redux`,由 ctx.previousService 显式注入。
|
|
107
|
+
* - 不读 `sessionStorage.serviceParams`,由 ctx.presetStartTime / ctx.resourceIdFromCalendar 注入。
|
|
108
|
+
* - cacheItem.isCustomItem → 直接返回 `{ duration: null }`。
|
|
109
|
+
*/
|
|
110
|
+
function getServiceStartTimeAndEndTime(params) {
|
|
111
|
+
const {
|
|
112
|
+
cacheItem,
|
|
113
|
+
timeObj,
|
|
114
|
+
ctx
|
|
115
|
+
} = params;
|
|
116
|
+
if (cacheItem?.isCustomItem) {
|
|
117
|
+
return {
|
|
118
|
+
duration: null
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const appointmentTimingPreference = getAppointmentTimingPreference(ctx);
|
|
122
|
+
const lastServer = ctx.previousService || null;
|
|
123
|
+
const resolveDuration = () => {
|
|
124
|
+
if ((0, _serviceTimes.isMultiDayProduct)(cacheItem)) return (0, _serviceTimes.getDays)(cacheItem, 'days');
|
|
125
|
+
return (0, _timeSlices.findNextDuration)(cacheItem.duration, timeObj.durationSlicesBasedOnTime, cacheItem?.duration?.value);
|
|
126
|
+
};
|
|
127
|
+
let _extend = {
|
|
128
|
+
duration: resolveDuration()
|
|
129
|
+
};
|
|
130
|
+
if (lastServer) {
|
|
131
|
+
const lastStart = lastServer._extend?.startDate;
|
|
132
|
+
const lastEnd = lastServer._extend?.endDate;
|
|
133
|
+
if (appointmentTimingPreference === 'parallel') {
|
|
134
|
+
_extend.start_time = (0, _dayjs.default)(lastStart).format('HH:mm');
|
|
135
|
+
} else if ((0, _dayjs.default)(lastEnd).isAfter((0, _dayjs.default)(lastStart), 'day')) {
|
|
136
|
+
_extend.start_time = timeObj.timeSlices[timeObj.timeSlices.length - 1]?.value;
|
|
137
|
+
} else {
|
|
138
|
+
_extend.start_time = lastEnd ? (0, _dayjs.default)(lastEnd).format('HH:mm') : (0, _dayjs.default)().format('HH:mm');
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
const presetStartTime = ctx.presetStartTime;
|
|
142
|
+
// 与 info2 getServiceStartTimeAndEndTime 一致:日历/顶部日期带 HH:mm 时原样使用,
|
|
143
|
+
// 不做 findNextSlice 栅格对齐(否则 01:47 会被抬到 01:50)。
|
|
144
|
+
if (presetStartTime && presetStartTime !== '00:00') {
|
|
145
|
+
_extend.start_time = presetStartTime;
|
|
146
|
+
} else if (cacheItem.currentDefaultTime) {
|
|
147
|
+
_extend.start_time = cacheItem.currentDefaultTime;
|
|
148
|
+
} else {
|
|
149
|
+
_extend.start_time = (0, _dayjs.default)().format('HH:mm');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
_extend = {
|
|
153
|
+
..._extend,
|
|
154
|
+
...cacheItem._extend
|
|
155
|
+
};
|
|
156
|
+
const {
|
|
157
|
+
startDate,
|
|
158
|
+
endDate
|
|
159
|
+
} = (0, _serviceTimes.getServiceTimes)({
|
|
160
|
+
...cacheItem,
|
|
161
|
+
_extend
|
|
162
|
+
});
|
|
163
|
+
_extend.startDate = startDate;
|
|
164
|
+
_extend.endDate = endDate;
|
|
165
|
+
if ((0, _serviceTimes.isMultiDayProduct)(cacheItem)) {
|
|
166
|
+
_extend.start_time = _extend.start_time || startDate.format('HH:mm');
|
|
167
|
+
_extend.end_time = _extend.end_time || endDate.format('HH:mm');
|
|
168
|
+
_extend.start_date = _extend.start_date ?? startDate;
|
|
169
|
+
_extend.end_date = _extend.end_date ?? endDate;
|
|
170
|
+
}
|
|
171
|
+
const session = cacheItem?._extend?.other?.session;
|
|
172
|
+
if ((0, _serviceTimes.isSessionProduct)(cacheItem) && session) {
|
|
173
|
+
const baseDate = ctx.date ? (0, _dayjs.default)(ctx.date) : (0, _dayjs.default)();
|
|
174
|
+
const startAt = (0, _dayjs.default)(`${baseDate.format('YYYY-MM-DD')} ${(0, _dayjs.default)(session.start_at).format('HH:mm:ss')}`);
|
|
175
|
+
const endAt = (0, _dayjs.default)(`${baseDate.format('YYYY-MM-DD')} ${(0, _dayjs.default)(session.end_at).format('HH:mm:ss')}`);
|
|
176
|
+
_extend.start_date = startAt;
|
|
177
|
+
_extend.startDate = startAt;
|
|
178
|
+
_extend.start_time = session.start_time;
|
|
179
|
+
_extend.end_date = endAt;
|
|
180
|
+
_extend.endDate = endAt;
|
|
181
|
+
_extend.end_time = session.end_time;
|
|
182
|
+
_extend.duration = (0, _serviceTimes.getDays)({
|
|
183
|
+
_extend
|
|
184
|
+
}, 'minutes');
|
|
185
|
+
}
|
|
186
|
+
return _extend;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* 综合:把 cacheItem 拼装出完整的 _extend / _data(资源 / 容量 / timeObj),并标记 autoClose。
|
|
191
|
+
* 与 info2 `service/addService/utils.tsx#getProductExtend` 等价;剥 React `console.time` / JSX。
|
|
192
|
+
*
|
|
193
|
+
* 入参 ctx 必须至少给:bookingConfig / resourcesOriginMap / resourcesOrigin / date。
|
|
194
|
+
*/
|
|
195
|
+
function getProductExtend(params) {
|
|
196
|
+
const {
|
|
197
|
+
cacheItem,
|
|
198
|
+
ctx,
|
|
199
|
+
isDisabledTime
|
|
200
|
+
} = params;
|
|
201
|
+
const isNew = cacheItem.new || !cacheItem._extend?.endDate;
|
|
202
|
+
const _cacheItem = {
|
|
203
|
+
...cacheItem
|
|
204
|
+
};
|
|
205
|
+
const resourcesOriginMap = ctx.resourcesOriginMap || {};
|
|
206
|
+
_cacheItem._data = {};
|
|
207
|
+
if ((0, _serviceTimes.isMultiDayProduct)(cacheItem)) {
|
|
208
|
+
_cacheItem._extend = _cacheItem._extend || {};
|
|
209
|
+
_cacheItem._extend.holder_id = cacheItem?._extend?.holder_id || [];
|
|
210
|
+
_cacheItem._extend.sub_type = 'days';
|
|
211
|
+
}
|
|
212
|
+
if (isNew) {
|
|
213
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
214
|
+
cacheItem,
|
|
215
|
+
ctx
|
|
216
|
+
});
|
|
217
|
+
_cacheItem._extend = getServiceStartTimeAndEndTime({
|
|
218
|
+
cacheItem,
|
|
219
|
+
timeObj: _cacheItem._data.timeObj,
|
|
220
|
+
ctx
|
|
221
|
+
});
|
|
222
|
+
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
223
|
+
_cacheItem._data.resourcesOrigin = (0, _resources.getResourceByIds)(resourcesOriginMap, cacheItem, {
|
|
224
|
+
resourceTab: ctx?.bookingConfig?.config?.resource_tab,
|
|
225
|
+
resourcesOrigin: ctx.resourcesOrigin || []
|
|
226
|
+
});
|
|
227
|
+
_cacheItem._extend.capacity = (0, _resources.setDefaultCapacitys)({
|
|
228
|
+
capacitys: _cacheItem._data.capacitys,
|
|
229
|
+
cacheItem: _cacheItem
|
|
230
|
+
});
|
|
231
|
+
const {
|
|
232
|
+
list,
|
|
233
|
+
maps
|
|
234
|
+
} = (0, _resources.formatResources)({
|
|
235
|
+
cacheItem: _cacheItem,
|
|
236
|
+
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
237
|
+
});
|
|
238
|
+
_cacheItem._data.resources = list;
|
|
239
|
+
_cacheItem._data.resourceMaps = maps;
|
|
240
|
+
_cacheItem._extend.resource = (0, _resources.setDefaultResource)({
|
|
241
|
+
cacheItem: _cacheItem,
|
|
242
|
+
resources: _cacheItem._data.resources,
|
|
243
|
+
resourceIdFromCalendar: ctx.resourceIdFromCalendar,
|
|
244
|
+
isAutoAllocationOn: ctx.isAutoAllocationOn
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
// 灵活时长二次计算(资源默认选中后,按 usableTime 重算 flexible 分钟数)
|
|
248
|
+
if ((0, _flexible.isProductFlexibleDuration)(_cacheItem?.duration)) {
|
|
249
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
250
|
+
cacheItem: _cacheItem,
|
|
251
|
+
useStartTime: _cacheItem._extend.start_time,
|
|
252
|
+
ctx
|
|
253
|
+
});
|
|
254
|
+
_cacheItem._extend.duration = _cacheItem._data.timeObj?.durationSlicesBasedOnTime?.[0]?.value;
|
|
255
|
+
const {
|
|
256
|
+
endDate
|
|
257
|
+
} = (0, _serviceTimes.getServiceTimes)(_cacheItem);
|
|
258
|
+
_cacheItem._extend.endDate = endDate;
|
|
259
|
+
}
|
|
260
|
+
_cacheItem.autoClose = getIsAutoClose(_cacheItem, ctx.isAutoAllocationOn || (() => true));
|
|
261
|
+
if (_cacheItem._extend.bundle_edit !== undefined) {
|
|
262
|
+
_cacheItem._extend.bundle_edit = 1;
|
|
263
|
+
}
|
|
264
|
+
if (!isDisabledTime) {
|
|
265
|
+
_cacheItem._time = new Date().getTime();
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
if (!_cacheItem._data.capacitys) {
|
|
269
|
+
_cacheItem._data.capacitys = cacheItem.capacity;
|
|
270
|
+
}
|
|
271
|
+
if (!_cacheItem._data.resourcesOrigin) {
|
|
272
|
+
const extraResources = [];
|
|
273
|
+
if (Array.isArray(_cacheItem._extend?.event_resources)) {
|
|
274
|
+
_cacheItem._extend.event_resources.forEach(er => {
|
|
275
|
+
extraResources.push({
|
|
276
|
+
form_id: er.form_id,
|
|
277
|
+
id: er.relation_id
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
_cacheItem._data.resourcesOrigin = (0, _resources.getResourceByIds)(resourcesOriginMap, cacheItem, {
|
|
282
|
+
extraResources,
|
|
283
|
+
resourceTab: ctx?.bookingConfig?.config?.resource_tab,
|
|
284
|
+
resourcesOrigin: ctx.resourcesOrigin || []
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if (!_cacheItem._data.resources) {
|
|
288
|
+
const {
|
|
289
|
+
list,
|
|
290
|
+
maps
|
|
291
|
+
} = (0, _resources.formatResources)({
|
|
292
|
+
cacheItem: _cacheItem,
|
|
293
|
+
resourcesOrigin: _cacheItem._data.resourcesOrigin
|
|
294
|
+
});
|
|
295
|
+
_cacheItem._data.resources = list;
|
|
296
|
+
_cacheItem._data.resourceMaps = maps;
|
|
297
|
+
}
|
|
298
|
+
_cacheItem._data.timeObj = getTimeObj({
|
|
299
|
+
cacheItem: _cacheItem,
|
|
300
|
+
useStartTime: _cacheItem._extend?.start_time,
|
|
301
|
+
ctx
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
return _cacheItem;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 是否可自动关闭弹窗(不需要用户进 EditService 抽屉)。
|
|
309
|
+
* 与 info2 `service/addService/utils.tsx#getIsAutoClose` 等价;
|
|
310
|
+
* `getAutoAllocationStorage` 抽象为入参 `isAutoAllocationOn(formId)`。
|
|
311
|
+
*/
|
|
312
|
+
function getIsAutoClose(cacheItem, isAutoAllocationOn) {
|
|
313
|
+
if ((0, _resourceSelection.productNeedsResourceExtend)(cacheItem) && !(0, _resourceSelection.hasActualResourceSelection)(cacheItem)) {
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
if (cacheItem._data?.capacitys?.type !== 'custom') {
|
|
317
|
+
const resources = cacheItem?._data?.resources || [];
|
|
318
|
+
if (resources.length === 1) {
|
|
319
|
+
const first = resources[0];
|
|
320
|
+
if (first.select_type?.type === 'single' && (first.default_resource || []).length > 0) {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
const entries = Object.entries(cacheItem._extend?.resource || {});
|
|
326
|
+
if (entries.length === 0) {
|
|
327
|
+
return !(0, _resourceSelection.productNeedsResourceExtend)(cacheItem);
|
|
328
|
+
}
|
|
329
|
+
return entries.every(([key, value]) => isAutoAllocationOn(key) && Array.isArray(value) && value.length > 0);
|
|
330
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 结构化的「资源不可用」原因(替代 info2 `getErrorList` 输出的 i18n 文案 + type 字段)。
|
|
3
|
+
*
|
|
4
|
+
* 与 info2 type 字段映射:
|
|
5
|
+
* - `no_product` ↔ type='products'
|
|
6
|
+
* - `time_out_of_range` ↔ type='time'
|
|
7
|
+
* - `count_out_of_range` ↔ type='limit'
|
|
8
|
+
* - `resource_unbound` ↔ type='unbound'
|
|
9
|
+
*
|
|
10
|
+
* OS 这边不耦合 i18n 文案,UI 拿到 reason + params 后自行渲染(参考 docs/SDK 中给出的 i18n key 对照表)。
|
|
11
|
+
*/
|
|
12
|
+
export type ResourceUnavailableReason = 'no_product' | 'time_out_of_range' | 'count_out_of_range' | 'resource_unbound';
|
|
13
|
+
export interface ResourceError {
|
|
14
|
+
reason: ResourceUnavailableReason;
|
|
15
|
+
params: {
|
|
16
|
+
/** 资源名(time / limit 用)。 */
|
|
17
|
+
labelText?: string;
|
|
18
|
+
/** 起始时间(time / limit 用,格式 'hh:mm A')。 */
|
|
19
|
+
startText?: string;
|
|
20
|
+
/** 结束时间(time / limit 用,格式 'hh:mm A')。 */
|
|
21
|
+
endText?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 结束时间是否跨到第二天。UI 收到 true 时可在 endText 前加 'tomorrow' / '明天' 前缀。
|
|
24
|
+
* 与 info2 旧实现「endText = locales.getText('pisell1.text.tomorrow') + endText」等价。
|
|
25
|
+
*/
|
|
26
|
+
isCrossDay?: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 替代 info2 `utilsByBooking.ts#getErrorList`,输出结构化错误。
|
|
31
|
+
*
|
|
32
|
+
* 行为对齐:
|
|
33
|
+
* 1. cacheItem 没有 id → `no_product`(与 info2 `!cacheItem?.id` 分支等价)。
|
|
34
|
+
* 2. 资源 null / 无 _extend → 返回 []。
|
|
35
|
+
* 3. resource.usable=false 时:
|
|
36
|
+
* - 没有 _extend.usableTime → `time_out_of_range`
|
|
37
|
+
* - 有 usableTime 但 `_extend.isCountRange=false` → `count_out_of_range`
|
|
38
|
+
* 4. resource.unbound=true → 追加 `resource_unbound`。
|
|
39
|
+
* 5. 不再耦合 `_data.resourceMaps[form_id].type === 'single'` 判断(与 info2 实际未使用此变量一致)。
|
|
40
|
+
*/
|
|
41
|
+
export declare function getResourceErrors(resource: any, cacheItem: any): ResourceError[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getResourceErrors = getResourceErrors;
|
|
7
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
8
|
+
var _serviceTimes = require("./serviceTimes");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
/**
|
|
11
|
+
* 结构化的「资源不可用」原因(替代 info2 `getErrorList` 输出的 i18n 文案 + type 字段)。
|
|
12
|
+
*
|
|
13
|
+
* 与 info2 type 字段映射:
|
|
14
|
+
* - `no_product` ↔ type='products'
|
|
15
|
+
* - `time_out_of_range` ↔ type='time'
|
|
16
|
+
* - `count_out_of_range` ↔ type='limit'
|
|
17
|
+
* - `resource_unbound` ↔ type='unbound'
|
|
18
|
+
*
|
|
19
|
+
* OS 这边不耦合 i18n 文案,UI 拿到 reason + params 后自行渲染(参考 docs/SDK 中给出的 i18n key 对照表)。
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 替代 info2 `utilsByBooking.ts#getErrorList`,输出结构化错误。
|
|
24
|
+
*
|
|
25
|
+
* 行为对齐:
|
|
26
|
+
* 1. cacheItem 没有 id → `no_product`(与 info2 `!cacheItem?.id` 分支等价)。
|
|
27
|
+
* 2. 资源 null / 无 _extend → 返回 []。
|
|
28
|
+
* 3. resource.usable=false 时:
|
|
29
|
+
* - 没有 _extend.usableTime → `time_out_of_range`
|
|
30
|
+
* - 有 usableTime 但 `_extend.isCountRange=false` → `count_out_of_range`
|
|
31
|
+
* 4. resource.unbound=true → 追加 `resource_unbound`。
|
|
32
|
+
* 5. 不再耦合 `_data.resourceMaps[form_id].type === 'single'` 判断(与 info2 实际未使用此变量一致)。
|
|
33
|
+
*/
|
|
34
|
+
function getResourceErrors(resource, cacheItem) {
|
|
35
|
+
if (!cacheItem?.id) {
|
|
36
|
+
return [{
|
|
37
|
+
reason: 'no_product',
|
|
38
|
+
params: {}
|
|
39
|
+
}];
|
|
40
|
+
}
|
|
41
|
+
if (!resource) return [];
|
|
42
|
+
const list = [];
|
|
43
|
+
if (!resource.usable) {
|
|
44
|
+
const {
|
|
45
|
+
startDate,
|
|
46
|
+
endDate
|
|
47
|
+
} = (0, _serviceTimes.getServiceTimes)(cacheItem);
|
|
48
|
+
const startText = startDate.format('hh:mm A');
|
|
49
|
+
const endText = endDate.format('hh:mm A');
|
|
50
|
+
const isCrossDay = (0, _dayjs.default)(endDate).isAfter(startDate, 'day');
|
|
51
|
+
if (!resource._extend?.usableTime) {
|
|
52
|
+
list.push({
|
|
53
|
+
reason: 'time_out_of_range',
|
|
54
|
+
params: {
|
|
55
|
+
labelText: resource.labelText,
|
|
56
|
+
startText,
|
|
57
|
+
endText,
|
|
58
|
+
isCrossDay
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} else if (!resource._extend?.usableTime?._extend?.isCountRange) {
|
|
62
|
+
list.push({
|
|
63
|
+
reason: 'count_out_of_range',
|
|
64
|
+
params: {
|
|
65
|
+
labelText: resource.labelText,
|
|
66
|
+
startText,
|
|
67
|
+
endText,
|
|
68
|
+
isCrossDay
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (resource.unbound) {
|
|
74
|
+
list.push({
|
|
75
|
+
reason: 'resource_unbound',
|
|
76
|
+
params: {}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return list;
|
|
80
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预约商品资源是否「需要补齐 / 已选中」——供 getProductExtend 门禁与 getIsAutoClose 共用。
|
|
3
|
+
*/
|
|
4
|
+
/** 商品是否挂了生效的资源表单(product_resource.resources status=1)。 */
|
|
5
|
+
export declare function productNeedsResourceExtend(cacheItem: any): boolean;
|
|
6
|
+
/** `_extend.resource` 是否至少有一类表单选中了具体资源。 */
|
|
7
|
+
export declare function hasActualResourceSelection(cacheItem: any): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hasActualResourceSelection = hasActualResourceSelection;
|
|
7
|
+
exports.productNeedsResourceExtend = productNeedsResourceExtend;
|
|
8
|
+
/**
|
|
9
|
+
* 预约商品资源是否「需要补齐 / 已选中」——供 getProductExtend 门禁与 getIsAutoClose 共用。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** 商品是否挂了生效的资源表单(product_resource.resources status=1)。 */
|
|
13
|
+
function productNeedsResourceExtend(cacheItem) {
|
|
14
|
+
const forms = cacheItem?.product_resource?.resources;
|
|
15
|
+
if (!Array.isArray(forms)) return false;
|
|
16
|
+
return forms.some(d => Number(d?.status) === 1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** `_extend.resource` 是否至少有一类表单选中了具体资源。 */
|
|
20
|
+
function hasActualResourceSelection(cacheItem) {
|
|
21
|
+
const resource = cacheItem?._extend?.resource;
|
|
22
|
+
if (!resource || typeof resource !== 'object') return false;
|
|
23
|
+
return Object.values(resource).some(rows => Array.isArray(rows) && rows.length > 0);
|
|
24
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 资源运行态计算 helper(搬自 info2 `utilsByBooking.ts` + `service/addService/utils.tsx`)。
|
|
3
|
+
*
|
|
4
|
+
* 本文件输入输出全部为 plain object,不依赖 React / locales / @pisell/icon / mini-redux。
|
|
5
|
+
* 调用方传入:resource origin map(`/form/schedule` 返回) / cacheItem(含 `_extend.duration / _extend.start_date / _extend.start_time` 等)。
|
|
6
|
+
*
|
|
7
|
+
* 三个 info2 独有特性保留:
|
|
8
|
+
* 1. `resource_display_scope='all'`:取全部资源
|
|
9
|
+
* 2. `extraResources`:拖入未绑定资源时兼容渲染
|
|
10
|
+
* 3. `getNoResource2()`:占位"无资源"行
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 从已选资源中取「最早结束」的 usableTime,供灵活时长计算上限。
|
|
14
|
+
* 与 info2 `service/addService/utils.tsx#getUsableTime` 等价。
|
|
15
|
+
*/
|
|
16
|
+
export declare function getUsableTime(cacheItem: any): any | null;
|
|
17
|
+
/** Σ cacheItem._extend.capacity[].value × _extend.quantity。 */
|
|
18
|
+
export declare function getSumCapacity(cacheItem: any, isCalcQuantity?: boolean): number;
|
|
19
|
+
/**
|
|
20
|
+
* 判断单个 time 是否可用,写回 `_extend` 标记位(isDateRange / isCountRange / isUsable / isMaxLimitRange)。
|
|
21
|
+
* 与 info2 `utilsByBooking.ts#getResourceTimeIsUsable` 等价。
|
|
22
|
+
*/
|
|
23
|
+
export declare function getResourceTimeIsUsable(item: any, cacheItem: any, resourceItem: any): any;
|
|
24
|
+
/**
|
|
25
|
+
* 在 resource.times 中找到最佳可用 time,并写回 `_extend.usableTime`。
|
|
26
|
+
* 与 info2 `utilsByBooking.ts#formatTimes` 等价。
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatTimes(resourceItem: any, cacheItem: any): any;
|
|
29
|
+
/**
|
|
30
|
+
* 单个 resource 的整体可用性 + labelText 填充。
|
|
31
|
+
* 与 info2 `utilsByBooking.ts#formatResource` 等价;不再接收 formatLabel 回调(OS 不渲染 JSX)。
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatResource(resourceItem: any, cacheItem?: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* 把单个 resource origin 类型(如「技师」)的 renderList 中每个资源跑一遍 formatResource,
|
|
36
|
+
* 并维护 unbound 标记(拖入未绑定资源时 UI 用)。
|
|
37
|
+
* 与 info2 `service/addService/utils.tsx#formatResources` 等价(剥 JSX)。
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatResources(params: {
|
|
40
|
+
cacheItem: any;
|
|
41
|
+
resourcesOrigin: any[];
|
|
42
|
+
}): {
|
|
43
|
+
list: any[];
|
|
44
|
+
maps: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 计算每类资源的默认值(写入 cacheItem._extend.resource)。
|
|
48
|
+
* 与 info2 `service/addService/utils.tsx#setDefaultResource` 等价;
|
|
49
|
+
* `resourceIdFromCalendar` 替代原版 sessionStorage `serviceParams.resource_id` 读取。
|
|
50
|
+
*/
|
|
51
|
+
export declare function setDefaultResource(params: {
|
|
52
|
+
cacheItem: any;
|
|
53
|
+
resources: any[];
|
|
54
|
+
resourceIdFromCalendar?: number;
|
|
55
|
+
isAutoAllocationOn?: (formId: any) => boolean;
|
|
56
|
+
}): Record<string, any[]>;
|
|
57
|
+
/**
|
|
58
|
+
* 计算默认容量(与 info2 `setDefaultCapacitys` 等价)。
|
|
59
|
+
* package:按 _extend.other.bundle 拆 quantity;custom:按 capacity.custom[].min;其他:[{id:0,value:1}]。
|
|
60
|
+
*/
|
|
61
|
+
export declare function setDefaultCapacitys(params: {
|
|
62
|
+
capacitys: any;
|
|
63
|
+
cacheItem: any;
|
|
64
|
+
}): Array<{
|
|
65
|
+
id: number | string;
|
|
66
|
+
value: number;
|
|
67
|
+
name?: string;
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* 通过商品 `product_resource.resources[]` 关联的 form/resource id,从 resourcesOriginMap 还原资源数据。
|
|
71
|
+
* 与 info2 `service/addService/utils.tsx#getResourceByIds` 等价(保留三特性)。
|
|
72
|
+
*/
|
|
73
|
+
export declare function getResourceByIds(resourcesOriginMap: Record<string, any>, cacheItem: any, extraParams?: {
|
|
74
|
+
extraResources?: Array<{
|
|
75
|
+
form_id: number | string;
|
|
76
|
+
id: number;
|
|
77
|
+
}>;
|
|
78
|
+
resourcesOrigin?: any[];
|
|
79
|
+
resourceTab?: Record<string, any>;
|
|
80
|
+
}): any[];
|