@pisell/pisellos 0.0.568 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.js +10 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -3
- package/dist/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/evaluator.js +7 -5
- package/dist/model/strategy/adapter/walletPass/example.js +26 -3
- package/dist/model/strategy/adapter/walletPass/index.js +5 -5
- package/dist/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/dist/model/strategy/adapter/walletPass/utils.js +24 -96
- package/dist/model/strategy/strategy-example.js +19 -5
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +12 -14
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/index.js +3 -0
- package/dist/modules/Cart/utils/cartProduct.js +27 -5
- package/dist/modules/Cart/utils/cartResource.js +0 -2
- package/dist/modules/Cart/utils/changePrice.js +11 -11
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Date/index.js +5 -1
- package/dist/modules/Discount/index.d.ts +2 -2
- package/dist/modules/Discount/index.js +43 -30
- package/dist/modules/Discount/types.d.ts +1 -1
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +38 -16
- package/dist/modules/Order/index.d.ts +449 -24
- package/dist/modules/Order/index.js +5460 -574
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +573 -746
- package/dist/modules/Payment/types.d.ts +44 -24
- package/dist/modules/Payment/utils.d.ts +1 -1
- package/dist/modules/Payment/utils.js +4 -3
- package/dist/modules/Payment/walletpass.d.ts +0 -2
- package/dist/modules/Payment/walletpass.js +49 -33
- package/dist/modules/Product/types.d.ts +29 -7
- package/dist/modules/ProductList/index.d.ts +17 -13
- package/dist/modules/ProductList/index.js +182 -81
- package/dist/modules/ProductList/types.d.ts +16 -0
- package/dist/modules/Quotation/index.d.ts +22 -2
- package/dist/modules/Quotation/index.js +108 -42
- package/dist/modules/Quotation/types.d.ts +19 -0
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +8 -10
- package/dist/modules/Rules/index.js +324 -513
- package/dist/modules/Rules/types.d.ts +14 -3
- package/dist/modules/SalesSummary/index.d.ts +23 -26
- package/dist/modules/SalesSummary/index.js +152 -46
- package/dist/modules/SalesSummary/types.d.ts +9 -1
- package/dist/modules/SalesSummary/utils.d.ts +3 -22
- package/dist/modules/SalesSummary/utils.js +804 -165
- package/dist/modules/Schedule/getDateIsInSchedule.js +14 -12
- package/dist/modules/Schedule/index.d.ts +18 -5
- package/dist/modules/Schedule/index.js +79 -24
- package/dist/modules/Schedule/types.d.ts +2 -0
- package/dist/modules/Schedule/utils.js +1 -0
- package/dist/modules/Step/index.js +1 -0
- package/dist/modules/Summary/index.js +4 -3
- package/dist/modules/Summary/utils.js +22 -43
- package/dist/modules/SurchargeList/index.d.ts +18 -0
- package/dist/modules/SurchargeList/index.js +185 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/modules/SurchargeList/types.js +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +4 -1
- package/dist/plugins/app.d.ts +2 -0
- package/dist/plugins/request.d.ts +1 -0
- package/dist/plugins/request.js +4 -1
- package/dist/plugins/window.js +6 -2
- package/dist/server/index.d.ts +462 -8
- package/dist/server/index.js +6168 -680
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/menu/index.js +41 -32
- package/dist/server/modules/order/index.d.ts +207 -14
- package/dist/server/modules/order/index.js +2328 -379
- package/dist/server/modules/order/types.d.ts +76 -5
- package/dist/server/modules/order/types.js +14 -1
- package/dist/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/dist/server/modules/order/utils/filterBookings.js +118 -11
- package/dist/server/modules/order/utils/filterOrders.js +242 -14
- package/dist/server/modules/payment/index.d.ts +28 -0
- package/dist/server/modules/payment/index.js +305 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/payment/types.js +1 -0
- package/dist/server/modules/products/index.d.ts +105 -14
- package/dist/server/modules/products/index.js +1416 -521
- package/dist/server/modules/products/types.d.ts +34 -1
- package/dist/server/modules/products/types.js +4 -0
- package/dist/server/modules/quotation/index.d.ts +39 -0
- package/dist/server/modules/quotation/index.js +298 -77
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +109 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +145 -106
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +3 -2
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4009 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.js +60 -11
- package/dist/solution/BookingByStep/utils/capacity.js +11 -1
- package/dist/solution/BookingByStep/utils/resources.js +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +43 -2
- package/dist/solution/BookingTicket/index.d.ts +393 -24
- package/dist/solution/BookingTicket/index.js +2508 -443
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +42 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +42 -28
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +30 -14
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/BuyTickets/index.js +12 -9
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +275 -209
- package/dist/solution/Checkout/utils/index.js +20 -8
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/RegisterAndLogin/index.js +76 -30
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +519 -444
- package/dist/solution/ScanOrder/types.d.ts +33 -11
- package/dist/solution/ScanOrder/types.js +4 -5
- package/dist/solution/ScanOrder/utils.d.ts +4 -1
- package/dist/solution/ScanOrder/utils.js +109 -34
- package/dist/solution/ShopDiscount/index.js +18 -19
- package/dist/solution/ShopDiscount/types.d.ts +4 -5
- package/dist/solution/ShopDiscount/utils.d.ts +0 -9
- package/dist/solution/ShopDiscount/utils.js +0 -9
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +32 -51
- package/dist/solution/VenueBooking/index.js +741 -808
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/types.d.ts +1 -3
- package/dist/solution/VenueBooking/types.js +0 -1
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/dist/solution/VenueBooking/utils/dateSummary.js +25 -12
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/dist/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/dist/solution/VenueBooking/utils/timeSlot.js +4 -9
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +12 -2
- package/dist/utils/task.js +18 -15
- package/dist/utils/watch.js +1 -0
- package/lib/apis/picoding.js +0 -2
- package/lib/core/index.js +132 -130
- package/lib/effects/index.js +57 -46
- package/lib/index.d.ts +0 -1
- package/lib/index.js +50 -92
- package/lib/model/index.js +21 -14
- package/lib/model/strategy/adapter/dataVariant/adapter.js +50 -38
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +236 -162
- package/lib/model/strategy/adapter/dataVariant/examples.js +237 -229
- package/lib/model/strategy/adapter/dataVariant/index.js +34 -39
- package/lib/model/strategy/adapter/dataVariant/type.js +28 -57
- package/lib/model/strategy/adapter/index.js +64 -100
- package/lib/model/strategy/adapter/itemRule/adapter.js +144 -156
- package/lib/model/strategy/adapter/itemRule/evaluator.js +48 -36
- package/lib/model/strategy/adapter/itemRule/examples.js +225 -295
- package/lib/model/strategy/adapter/itemRule/index.js +57 -83
- package/lib/model/strategy/adapter/itemRule/type.js +36 -97
- package/lib/model/strategy/adapter/promotion/adapter.js +63 -84
- package/lib/model/strategy/adapter/promotion/evaluator.js +233 -382
- package/lib/model/strategy/adapter/promotion/examples.js +159 -139
- package/lib/model/strategy/adapter/promotion/index.js +0 -1
- package/lib/model/strategy/adapter/promotion/type.js +35 -199
- package/lib/model/strategy/adapter/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/evaluator.js +152 -180
- package/lib/model/strategy/adapter/walletPass/example.js +190 -217
- package/lib/model/strategy/adapter/walletPass/index.js +51 -75
- package/lib/model/strategy/adapter/walletPass/locales.js +58 -36
- package/lib/model/strategy/adapter/walletPass/type.d.ts +0 -3
- package/lib/model/strategy/adapter/walletPass/type.js +16 -4
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +0 -26
- package/lib/model/strategy/adapter/walletPass/utils.js +383 -676
- package/lib/model/strategy/engine.js +168 -270
- package/lib/model/strategy/index.js +34 -49
- package/lib/model/strategy/strategy-example.js +239 -243
- package/lib/model/strategy/type.js +40 -100
- package/lib/modules/Account/index.js +53 -39
- package/lib/modules/Account/types.js +33 -20
- package/lib/modules/AccountList/index.js +154 -116
- package/lib/modules/AccountList/types.js +31 -30
- package/lib/modules/AccountList/utils.js +30 -18
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +50 -29
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +368 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +34 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +298 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +155 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +222 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +80 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +43 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +90 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +56 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +283 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +377 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
- package/lib/modules/Cart/index.js +124 -170
- package/lib/modules/Cart/types.js +51 -46
- package/lib/modules/Cart/utils/cartAccount.js +39 -40
- package/lib/modules/Cart/utils/cartDate.js +61 -56
- package/lib/modules/Cart/utils/cartDiscount.js +33 -28
- package/lib/modules/Cart/utils/cartNote.js +32 -27
- package/lib/modules/Cart/utils/cartProduct.js +261 -309
- package/lib/modules/Cart/utils/cartRelationForms.js +35 -29
- package/lib/modules/Cart/utils/cartResource.js +78 -72
- package/lib/modules/Cart/utils/changePrice.js +59 -31
- package/lib/modules/Cart/utils/index.js +48 -106
- package/lib/modules/Customer/constants.js +34 -13
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +207 -217
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Customer/types.js +35 -38
- package/lib/modules/Date/index.js +115 -116
- package/lib/modules/Date/types.js +28 -16
- package/lib/modules/Date/utils.js +123 -174
- package/lib/modules/Discount/index.d.ts +2 -2
- package/lib/modules/Discount/index.js +133 -119
- package/lib/modules/Discount/types.d.ts +1 -1
- package/lib/modules/Discount/types.js +31 -9
- package/lib/modules/Guests/index.js +56 -30
- package/lib/modules/Guests/types.js +33 -23
- package/lib/modules/Holder/index.js +189 -209
- package/lib/modules/Holder/types.js +16 -4
- package/lib/modules/Holder/utils.js +49 -20
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +88 -63
- package/lib/modules/OpenData/types.js +16 -4
- package/lib/modules/OpenData/utils.js +78 -44
- package/lib/modules/Order/index.d.ts +449 -24
- package/lib/modules/Order/index.js +4184 -514
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +35 -24
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +139 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +415 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +1085 -414
- package/lib/modules/Payment/cash.js +33 -20
- package/lib/modules/Payment/cashRecommendationAlgorithm.js +76 -145
- package/lib/modules/Payment/eftpos.js +30 -16
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +402 -636
- package/lib/modules/Payment/mx51.js +0 -1
- package/lib/modules/Payment/types.d.ts +44 -24
- package/lib/modules/Payment/types.js +107 -216
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +50 -52
- package/lib/modules/Payment/walletpass.d.ts +0 -2
- package/lib/modules/Payment/walletpass.js +216 -221
- package/lib/modules/Product/index.js +46 -51
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/Product/types.js +16 -4
- package/lib/modules/Product/utils.js +33 -32
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +161 -120
- package/lib/modules/ProductList/types.d.ts +16 -0
- package/lib/modules/ProductList/types.js +31 -9
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +154 -64
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/Quotation/types.js +16 -4
- package/lib/modules/Resource/index.js +59 -27
- package/lib/modules/Resource/types.js +32 -22
- package/lib/modules/Resource/utils.js +38 -30
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +960 -1440
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/Rules/types.js +40 -17
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +134 -61
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/types.js +16 -4
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +814 -233
- package/lib/modules/ScanOrderLogger/index.js +79 -59
- package/lib/modules/ScanOrderLogger/providers/feishu.js +78 -54
- package/lib/modules/ScanOrderLogger/providers/grafana.js +36 -13
- package/lib/modules/ScanOrderLogger/types.js +16 -4
- package/lib/modules/Schedule/getDateIsInSchedule.js +169 -338
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +153 -104
- package/lib/modules/Schedule/type.js +16 -4
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Schedule/types.js +16 -4
- package/lib/modules/Schedule/utils.js +291 -433
- package/lib/modules/Step/index.js +52 -40
- package/lib/modules/Step/tyeps.js +16 -4
- package/lib/modules/Summary/index.js +71 -66
- package/lib/modules/Summary/types.js +16 -4
- package/lib/modules/Summary/utils.js +418 -791
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +109 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +17 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +63 -212
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/app.js +16 -4
- package/lib/plugins/index.js +25 -36
- package/lib/plugins/request.d.ts +1 -0
- package/lib/plugins/request.js +126 -137
- package/lib/plugins/shopStore.js +16 -4
- package/lib/plugins/user.js +16 -4
- package/lib/plugins/window.js +179 -171
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +4520 -1162
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +327 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +34 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +67 -84
- package/lib/server/modules/menu/index.js +122 -146
- package/lib/server/modules/menu/types.js +31 -18
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1543 -285
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +32 -107
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +259 -176
- package/lib/server/modules/order/utils/filterOrders.js +293 -94
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +192 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +17 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +850 -475
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +34 -41
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +254 -75
- package/lib/server/modules/quotation/types.js +31 -21
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +240 -243
- package/lib/server/modules/resource/types.js +33 -42
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +146 -147
- package/lib/server/modules/schedule/types.js +21 -14
- package/lib/server/modules/schedule/utils.js +163 -334
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/types.js +16 -4
- package/lib/server/utils/index.js +23 -25
- package/lib/server/utils/product.js +140 -197
- package/lib/server/utils/schedule.js +41 -34
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +904 -0
- package/lib/server/utils/time.js +49 -40
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2533 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +43 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1004 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +160 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +289 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +256 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +244 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingByStep/index.js +1340 -1530
- package/lib/solution/BookingByStep/types.js +99 -40
- package/lib/solution/BookingByStep/utils/capacity.js +160 -192
- package/lib/solution/BookingByStep/utils/products.js +52 -42
- package/lib/solution/BookingByStep/utils/resources.js +330 -527
- package/lib/solution/BookingByStep/utils/stock.js +44 -65
- package/lib/solution/BookingByStep/utils/timeslots.js +131 -129
- package/lib/solution/BookingTicket/index.d.ts +393 -24
- package/lib/solution/BookingTicket/index.js +1374 -184
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +79 -40
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +125 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +107 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +184 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +0 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +58 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +254 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +169 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +97 -64
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +51 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +81 -82
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +109 -91
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +43 -90
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +127 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +85 -0
- package/lib/solution/BuyTickets/index.js +70 -67
- package/lib/solution/BuyTickets/types.js +38 -22
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +1169 -1463
- package/lib/solution/Checkout/types.js +61 -91
- package/lib/solution/Checkout/utils/index.js +156 -228
- package/lib/solution/PlaceOrder/index.js +0 -55
- package/lib/solution/RegisterAndLogin/config.js +462 -503
- package/lib/solution/RegisterAndLogin/index.js +630 -633
- package/lib/solution/RegisterAndLogin/types.js +76 -189
- package/lib/solution/RegisterAndLogin/utils.js +125 -183
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +498 -238
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/Sales/types.js +33 -27
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +936 -864
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +34 -34
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +422 -385
- package/lib/solution/ShopDiscount/index.js +233 -235
- package/lib/solution/ShopDiscount/types.d.ts +4 -5
- package/lib/solution/ShopDiscount/types.js +37 -15
- package/lib/solution/ShopDiscount/utils.d.ts +0 -9
- package/lib/solution/ShopDiscount/utils.js +172 -309
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +32 -51
- package/lib/solution/VenueBooking/index.js +1008 -984
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/types.d.ts +1 -3
- package/lib/solution/VenueBooking/types.js +39 -20
- package/lib/solution/VenueBooking/utils/dateSummary.d.ts +2 -2
- package/lib/solution/VenueBooking/utils/dateSummary.js +62 -25
- package/lib/solution/VenueBooking/utils/resource.js +54 -31
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +109 -90
- package/lib/solution/VenueBooking/utils/timeSlot.d.ts +0 -2
- package/lib/solution/VenueBooking/utils/timeSlot.js +133 -138
- package/lib/solution/VenueBooking/utils.js +67 -130
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +41 -102
- package/lib/store/createStore.js +29 -32
- package/lib/types/index.d.ts +12 -2
- package/lib/types/index.js +16 -4
- package/lib/utils/task.js +36 -36
- package/lib/utils/watch.js +47 -81
- package/package.json +2 -4
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/dist/solution/VenueBooking/utils/smartPricing.js +0 -233
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/VenueBooking/utils/smartPricing.d.ts +0 -70
- package/lib/solution/VenueBooking/utils/smartPricing.js +0 -192
|
@@ -1,27 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/modules/Schedule/getDateIsInSchedule.ts
|
|
30
|
+
var getDateIsInSchedule_exports = {};
|
|
31
|
+
__export(getDateIsInSchedule_exports, {
|
|
32
|
+
getDateIsInSchedule: () => getDateIsInSchedule,
|
|
33
|
+
getScheduleStartEndTimePoints: () => getScheduleStartEndTimePoints
|
|
5
34
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var _isSameOrBefore = _interopRequireDefault(require("dayjs/plugin/isSameOrBefore"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
_dayjs.default.extend(_isSameOrAfter.default);
|
|
12
|
-
_dayjs.default.extend(_isSameOrBefore.default);
|
|
13
|
-
|
|
14
|
-
// 获取时间是否在日程范围内
|
|
15
|
-
const getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
35
|
+
module.exports = __toCommonJS(getDateIsInSchedule_exports);
|
|
36
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
37
|
+
var getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
16
38
|
if (!dateTime || !scheduleList || scheduleList.length === 0) {
|
|
17
39
|
return false;
|
|
18
40
|
}
|
|
19
|
-
const targetDate = (0,
|
|
41
|
+
const targetDate = (0, import_dayjs.default)(dateTime);
|
|
20
42
|
if (!targetDate.isValid()) {
|
|
21
43
|
return false;
|
|
22
44
|
}
|
|
23
|
-
|
|
24
|
-
// 遍历所有日程项
|
|
25
45
|
for (const schedule of scheduleList) {
|
|
26
46
|
if (isTimeInScheduleItem(dateTime, schedule)) {
|
|
27
47
|
return true;
|
|
@@ -29,263 +49,175 @@ const getDateIsInSchedule = (dateTime, scheduleList) => {
|
|
|
29
49
|
}
|
|
30
50
|
return false;
|
|
31
51
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const targetDate = (0, _dayjs.default)(dateTime);
|
|
37
|
-
const targetDateString = dateTime.split(' ')[0]; // YYYY-MM-DD
|
|
38
|
-
const targetTimeString = dateTime.split(' ')[1] || '00:00:00'; // HH:mm:ss
|
|
39
|
-
|
|
52
|
+
var isTimeInScheduleItem = (dateTime, schedule) => {
|
|
53
|
+
const targetDate = (0, import_dayjs.default)(dateTime);
|
|
54
|
+
const targetDateString = dateTime.split(" ")[0];
|
|
55
|
+
const targetTimeString = dateTime.split(" ")[1] || "00:00:00";
|
|
40
56
|
switch (schedule.type) {
|
|
41
|
-
case
|
|
57
|
+
case "standard":
|
|
42
58
|
return isInStandardSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
43
|
-
case
|
|
59
|
+
case "time-slots":
|
|
44
60
|
return isInTimeSlotsSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
45
|
-
case
|
|
61
|
+
case "designation":
|
|
46
62
|
return isInDesignationSchedule(targetDate, targetDateString, targetTimeString, schedule);
|
|
47
63
|
default:
|
|
48
64
|
return false;
|
|
49
65
|
}
|
|
50
66
|
};
|
|
51
|
-
|
|
52
|
-
// 处理标准类型日程
|
|
53
|
-
const isInStandardSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
67
|
+
var isInStandardSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
54
68
|
if (!schedule.start_time || !schedule.end_time) {
|
|
55
69
|
return false;
|
|
56
70
|
}
|
|
57
|
-
const startDate = (0,
|
|
58
|
-
const endDate = (0,
|
|
59
|
-
|
|
60
|
-
// 先检查是否在基础时间范围内(不考虑重复),end 为开区间
|
|
71
|
+
const startDate = (0, import_dayjs.default)(schedule.start_time);
|
|
72
|
+
const endDate = (0, import_dayjs.default)(schedule.end_time);
|
|
61
73
|
const isInBasicRange = targetDate.isSameOrAfter(startDate) && targetDate.isBefore(endDate);
|
|
62
|
-
if (schedule.repeat_type ===
|
|
74
|
+
if (schedule.repeat_type === "none") {
|
|
63
75
|
return isInBasicRange;
|
|
64
76
|
}
|
|
65
|
-
|
|
66
|
-
// 处理重复日程
|
|
67
77
|
return isInRepeatingSchedule(targetDate, targetDateString, targetTimeString, schedule, startDate, endDate);
|
|
68
78
|
};
|
|
69
|
-
|
|
70
|
-
// 处理时间段类型日程
|
|
71
|
-
const isInTimeSlotsSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
79
|
+
var isInTimeSlotsSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
72
80
|
if (!schedule.start_time) {
|
|
73
81
|
return false;
|
|
74
82
|
}
|
|
75
|
-
const scheduleStartDate = (0,
|
|
83
|
+
const scheduleStartDate = (0, import_dayjs.default)(schedule.start_time.split(" ")[0]);
|
|
76
84
|
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
77
85
|
return false;
|
|
78
86
|
}
|
|
79
87
|
for (const timeSlot of schedule.time_slot) {
|
|
80
|
-
const slotStart =
|
|
81
|
-
const slotEnd =
|
|
82
|
-
|
|
88
|
+
const slotStart = `${targetDateString} ${timeSlot.start_time}:00`;
|
|
89
|
+
const slotEnd = `${targetDateString} ${timeSlot.end_time}:00`;
|
|
90
|
+
const slotStartDate = (0, import_dayjs.default)(slotStart);
|
|
91
|
+
const slotEndDate = (0, import_dayjs.default)(slotEnd);
|
|
92
|
+
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
83
93
|
return true;
|
|
84
94
|
}
|
|
85
95
|
}
|
|
86
96
|
return false;
|
|
87
97
|
};
|
|
88
|
-
|
|
89
|
-
// 处理指定类型日程
|
|
90
|
-
const isInDesignationSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
98
|
+
var isInDesignationSchedule = (targetDate, targetDateString, targetTimeString, schedule) => {
|
|
91
99
|
if (!schedule.designation) {
|
|
92
100
|
return false;
|
|
93
101
|
}
|
|
94
|
-
|
|
95
|
-
// @ts-ignore
|
|
96
102
|
for (const designation of schedule.designation) {
|
|
97
103
|
const startDateTime = `${designation.start_date} ${designation.start_time}:00`;
|
|
98
104
|
const endDateTime = `${designation.end_date} ${designation.end_time}:00`;
|
|
99
|
-
const startDate = (0,
|
|
100
|
-
const endDate = (0,
|
|
101
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
105
|
+
const startDate = (0, import_dayjs.default)(startDateTime);
|
|
106
|
+
const endDate = (0, import_dayjs.default)(endDateTime);
|
|
107
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
|
|
102
108
|
return true;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
return false;
|
|
106
112
|
};
|
|
107
|
-
|
|
108
|
-
// 处理重复日程逻辑
|
|
109
|
-
const isInRepeatingSchedule = (targetDate, targetDateString, targetTimeString, schedule, startDate, endDate) => {
|
|
113
|
+
var isInRepeatingSchedule = (targetDate, targetDateString, targetTimeString, schedule, startDate, endDate) => {
|
|
110
114
|
if (!schedule.repeat_rule) {
|
|
111
115
|
return false;
|
|
112
116
|
}
|
|
113
|
-
const {
|
|
114
|
-
|
|
115
|
-
repeat_type
|
|
116
|
-
} = schedule;
|
|
117
|
-
const targetDateOnly = (0, _dayjs.default)(targetDateString); // 只取日期部分
|
|
118
|
-
|
|
119
|
-
// 首先检查是否在包含日期中(包含日期是额外增加的有效日期)
|
|
117
|
+
const { repeat_rule, repeat_type } = schedule;
|
|
118
|
+
const targetDateOnly = (0, import_dayjs.default)(targetDateString);
|
|
120
119
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
121
120
|
for (const includedDate of repeat_rule.included_date) {
|
|
122
|
-
const includeStartDate = (0,
|
|
123
|
-
const includeEndDate = (0,
|
|
124
|
-
if (targetDateOnly.isSameOrAfter(includeStartDate,
|
|
125
|
-
// 在包含日期中,直接返回true,无需检查其他条件
|
|
121
|
+
const includeStartDate = (0, import_dayjs.default)(includedDate.start);
|
|
122
|
+
const includeEndDate = (0, import_dayjs.default)(includedDate.end);
|
|
123
|
+
if (targetDateOnly.isSameOrAfter(includeStartDate, "day") && targetDateOnly.isSameOrBefore(includeEndDate, "day")) {
|
|
126
124
|
return true;
|
|
127
125
|
}
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
|
-
|
|
131
|
-
// 检查是否在排除日期中
|
|
132
128
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
133
|
-
const excludeStartDate = (0,
|
|
134
|
-
const excludeEndDate = (0,
|
|
135
|
-
|
|
136
|
-
if (targetDateOnly.isSameOrAfter(excludeStartDate, 'day') && targetDateOnly.isSameOrBefore(excludeEndDate, 'day')) {
|
|
129
|
+
const excludeStartDate = (0, import_dayjs.default)(excludedDate.start);
|
|
130
|
+
const excludeEndDate = (0, import_dayjs.default)(excludedDate.end);
|
|
131
|
+
if (targetDateOnly.isSameOrAfter(excludeStartDate, "day") && targetDateOnly.isSameOrBefore(excludeEndDate, "day")) {
|
|
137
132
|
return false;
|
|
138
133
|
}
|
|
139
134
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (repeat_rule.end.type === 'date' && repeat_rule.end.end_date) {
|
|
143
|
-
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
135
|
+
if (repeat_rule.end.type === "date" && repeat_rule.end.end_date) {
|
|
136
|
+
const ruleEndDate = (0, import_dayjs.default)(repeat_rule.end.end_date);
|
|
144
137
|
if (targetDate.isAfter(ruleEndDate)) {
|
|
145
138
|
return false;
|
|
146
139
|
}
|
|
147
140
|
}
|
|
148
|
-
|
|
149
|
-
// 根据重复类型检查
|
|
150
141
|
switch (repeat_type) {
|
|
151
|
-
case
|
|
142
|
+
case "daily":
|
|
152
143
|
return isInDailyRepeat(targetDate, startDate, endDate, repeat_rule);
|
|
153
|
-
case
|
|
144
|
+
case "weekly":
|
|
154
145
|
return isInWeeklyRepeat(targetDate, startDate, endDate, repeat_rule);
|
|
155
146
|
default:
|
|
156
147
|
return false;
|
|
157
|
-
// 不支持月和年重复
|
|
158
148
|
}
|
|
159
149
|
};
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
163
|
-
const daysDiff = targetDate.diff(startDate, 'day');
|
|
150
|
+
var isInDailyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
151
|
+
const daysDiff = targetDate.diff(startDate, "day");
|
|
164
152
|
if (daysDiff < 0) {
|
|
165
153
|
return false;
|
|
166
154
|
}
|
|
167
|
-
|
|
168
|
-
// 检查频率
|
|
169
155
|
if (daysDiff % repeatRule.frequency !== 0) {
|
|
170
156
|
return false;
|
|
171
157
|
}
|
|
172
|
-
|
|
173
|
-
// 检查时间是否在日程的时间范围内
|
|
174
158
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
175
159
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
176
160
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
177
|
-
|
|
178
|
-
// 每日重复:每天都在相同的时间段内有效 [start, end)
|
|
179
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay < endTimeOfDay;
|
|
161
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
180
162
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
184
|
-
const targetDayOfWeek = targetDate.day(); // 0=周日, 1=周一, ..., 6=周六
|
|
185
|
-
|
|
186
|
-
// 检查是否在指定的星期几内
|
|
163
|
+
var isInWeeklyRepeat = (targetDate, startDate, endDate, repeatRule) => {
|
|
164
|
+
const targetDayOfWeek = targetDate.day();
|
|
187
165
|
if (!repeatRule.frequency_date.includes(targetDayOfWeek)) {
|
|
188
166
|
return false;
|
|
189
167
|
}
|
|
190
|
-
|
|
191
|
-
// 计算周差
|
|
192
|
-
const weeksDiff = targetDate.diff(startDate, 'week');
|
|
168
|
+
const weeksDiff = targetDate.diff(startDate, "week");
|
|
193
169
|
if (weeksDiff < 0) {
|
|
194
170
|
return false;
|
|
195
171
|
}
|
|
196
|
-
|
|
197
|
-
// 检查频率
|
|
198
172
|
if (weeksDiff % repeatRule.frequency !== 0) {
|
|
199
173
|
return false;
|
|
200
174
|
}
|
|
201
|
-
|
|
202
|
-
// 检查时间是否在日程的时间范围内
|
|
203
175
|
const targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
204
176
|
const startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
205
177
|
const endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
206
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
178
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
207
179
|
};
|
|
208
|
-
|
|
209
|
-
// 日程时间段类型
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* 获取当前日期日程时间点
|
|
213
|
-
* @param date 日期 YYYY-MM-DD
|
|
214
|
-
* @param scheduleList 日程列表
|
|
215
|
-
* @returns 当前日期日程时间点 结构,数组 [{
|
|
216
|
-
*
|
|
217
|
-
* // HH:mm
|
|
218
|
-
* end_time: string,
|
|
219
|
-
* // HH:mm
|
|
220
|
-
* start_time: string,
|
|
221
|
-
* // 日期时间
|
|
222
|
-
* // YYYY-MM-DD HH:mm:ss
|
|
223
|
-
* end_at: Dayjs,
|
|
224
|
-
* // YYYY-MM-DD HH:mm:ss
|
|
225
|
-
* start_at: Dayjs,
|
|
226
|
-
*
|
|
227
|
-
* }]
|
|
228
|
-
*/
|
|
229
|
-
const getScheduleStartEndTimePoints = (date, scheduleList) => {
|
|
180
|
+
var getScheduleStartEndTimePoints = (date, scheduleList) => {
|
|
230
181
|
if (!date || !scheduleList || scheduleList.length === 0) {
|
|
231
182
|
return [];
|
|
232
183
|
}
|
|
233
|
-
const targetDate = (0,
|
|
184
|
+
const targetDate = (0, import_dayjs.default)(date);
|
|
234
185
|
if (!targetDate.isValid()) {
|
|
235
186
|
return [];
|
|
236
187
|
}
|
|
237
188
|
const timeSlots = [];
|
|
238
|
-
|
|
239
|
-
// 遍历所有日程
|
|
240
189
|
for (const schedule of scheduleList) {
|
|
241
190
|
const slots = extractTimeSlotsFromSchedule(date, schedule);
|
|
242
191
|
timeSlots.push(...slots);
|
|
243
192
|
}
|
|
244
|
-
|
|
245
|
-
// 去重并排序时间段
|
|
246
193
|
return mergeAndSortTimeSlots(timeSlots);
|
|
247
194
|
};
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* 从单个日程中提取指定日期的时间段
|
|
251
|
-
*/
|
|
252
|
-
exports.getScheduleStartEndTimePoints = getScheduleStartEndTimePoints;
|
|
253
|
-
const extractTimeSlotsFromSchedule = (date, schedule) => {
|
|
195
|
+
var extractTimeSlotsFromSchedule = (date, schedule) => {
|
|
254
196
|
switch (schedule.type) {
|
|
255
|
-
case
|
|
197
|
+
case "standard":
|
|
256
198
|
return extractStandardScheduleTimeSlots(date, schedule);
|
|
257
|
-
case
|
|
199
|
+
case "time-slots":
|
|
258
200
|
return extractTimeSlotsScheduleTimeSlots(date, schedule);
|
|
259
|
-
case
|
|
201
|
+
case "designation":
|
|
260
202
|
return extractDesignationScheduleTimeSlots(date, schedule);
|
|
261
203
|
default:
|
|
262
204
|
return [];
|
|
263
205
|
}
|
|
264
206
|
};
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* 提取标准类型日程的时间段
|
|
268
|
-
*/
|
|
269
|
-
const extractStandardScheduleTimeSlots = (date, schedule) => {
|
|
207
|
+
var extractStandardScheduleTimeSlots = (date, schedule) => {
|
|
270
208
|
if (!schedule.start_time || !schedule.end_time) {
|
|
271
209
|
return [];
|
|
272
210
|
}
|
|
273
|
-
const targetDate = (0,
|
|
274
|
-
const startDate = (0,
|
|
275
|
-
const endDate = (0,
|
|
276
|
-
|
|
277
|
-
// 检查日期是否在日程范围内
|
|
211
|
+
const targetDate = (0, import_dayjs.default)(date);
|
|
212
|
+
const startDate = (0, import_dayjs.default)(schedule.start_time);
|
|
213
|
+
const endDate = (0, import_dayjs.default)(schedule.end_time);
|
|
278
214
|
if (!isDateInStandardSchedule(targetDate, schedule, startDate, endDate)) {
|
|
279
215
|
return [];
|
|
280
216
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
// 构造完整的日期时间
|
|
287
|
-
const startAt = (0, _dayjs.default)(`${date} ${startTime}:00`);
|
|
288
|
-
const endAt = (0, _dayjs.default)(`${date} ${endTime}:00`);
|
|
217
|
+
const startTime = startDate.format("HH:mm");
|
|
218
|
+
const endTime = endDate.format("HH:mm");
|
|
219
|
+
const startAt = (0, import_dayjs.default)(`${date} ${startTime}:00`);
|
|
220
|
+
const endAt = (0, import_dayjs.default)(`${date} ${endTime}:00`);
|
|
289
221
|
return [{
|
|
290
222
|
start_time: startTime,
|
|
291
223
|
end_time: endTime,
|
|
@@ -293,30 +225,22 @@ const extractStandardScheduleTimeSlots = (date, schedule) => {
|
|
|
293
225
|
end_at: endAt
|
|
294
226
|
}];
|
|
295
227
|
};
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* 提取时间段类型日程的时间段
|
|
299
|
-
*/
|
|
300
|
-
const extractTimeSlotsScheduleTimeSlots = (date, schedule) => {
|
|
228
|
+
var extractTimeSlotsScheduleTimeSlots = (date, schedule) => {
|
|
301
229
|
if (!schedule.start_time || !schedule.time_slot || schedule.time_slot.length === 0) {
|
|
302
230
|
return [];
|
|
303
231
|
}
|
|
304
|
-
const targetDate = (0,
|
|
305
|
-
const scheduleStartDate = (0,
|
|
306
|
-
|
|
307
|
-
// 检查日期是否在日程的有效范围内(考虑重复规则)
|
|
232
|
+
const targetDate = (0, import_dayjs.default)(date);
|
|
233
|
+
const scheduleStartDate = (0, import_dayjs.default)(schedule.start_time.split(" ")[0]);
|
|
308
234
|
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
309
235
|
return [];
|
|
310
236
|
}
|
|
311
237
|
const slots = [];
|
|
312
|
-
|
|
313
|
-
// 提取所有时间段
|
|
314
238
|
for (const timeSlot of schedule.time_slot) {
|
|
315
239
|
if (!timeSlot.start_time || !timeSlot.end_time) {
|
|
316
240
|
continue;
|
|
317
241
|
}
|
|
318
|
-
const startAt = (0,
|
|
319
|
-
const endAt = (0,
|
|
242
|
+
const startAt = (0, import_dayjs.default)(`${date} ${timeSlot.start_time}:00`);
|
|
243
|
+
const endAt = (0, import_dayjs.default)(`${date} ${timeSlot.end_time}:00`);
|
|
320
244
|
slots.push({
|
|
321
245
|
start_time: timeSlot.start_time,
|
|
322
246
|
end_time: timeSlot.end_time,
|
|
@@ -326,90 +250,63 @@ const extractTimeSlotsScheduleTimeSlots = (date, schedule) => {
|
|
|
326
250
|
}
|
|
327
251
|
return slots;
|
|
328
252
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
*/
|
|
333
|
-
const isDateInTimeSlotsSchedule = (targetDate, schedule, scheduleStartDate) => {
|
|
334
|
-
// 不重复的日程
|
|
335
|
-
if (schedule.repeat_type === 'none') {
|
|
336
|
-
// 只在 start_time 的日期有效
|
|
337
|
-
return targetDate.isSame(scheduleStartDate, 'day');
|
|
253
|
+
var isDateInTimeSlotsSchedule = (targetDate, schedule, scheduleStartDate) => {
|
|
254
|
+
if (schedule.repeat_type === "none") {
|
|
255
|
+
return targetDate.isSame(scheduleStartDate, "day");
|
|
338
256
|
}
|
|
339
|
-
|
|
340
|
-
// 重复的日程,需要检查重复规则
|
|
341
257
|
if (!schedule.repeat_rule) {
|
|
342
258
|
return false;
|
|
343
259
|
}
|
|
344
|
-
const {
|
|
345
|
-
repeat_rule,
|
|
346
|
-
repeat_type
|
|
347
|
-
} = schedule;
|
|
348
|
-
|
|
349
|
-
// 检查是否在包含日期中(优先级最高)
|
|
260
|
+
const { repeat_rule, repeat_type } = schedule;
|
|
350
261
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
351
262
|
for (const includedDate of repeat_rule.included_date) {
|
|
352
|
-
const includeStartDate = (0,
|
|
353
|
-
const includeEndDate = (0,
|
|
354
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
263
|
+
const includeStartDate = (0, import_dayjs.default)(includedDate.start);
|
|
264
|
+
const includeEndDate = (0, import_dayjs.default)(includedDate.end);
|
|
265
|
+
if (targetDate.isSameOrAfter(includeStartDate, "day") && targetDate.isSameOrBefore(includeEndDate, "day")) {
|
|
355
266
|
return true;
|
|
356
267
|
}
|
|
357
268
|
}
|
|
358
269
|
}
|
|
359
|
-
|
|
360
|
-
// 检查是否在排除日期中
|
|
361
270
|
if (repeat_rule.excluded_date && repeat_rule.excluded_date.length > 0) {
|
|
362
271
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
363
|
-
const excludeStartDate = (0,
|
|
364
|
-
const excludeEndDate = (0,
|
|
365
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
272
|
+
const excludeStartDate = (0, import_dayjs.default)(excludedDate.start);
|
|
273
|
+
const excludeEndDate = (0, import_dayjs.default)(excludedDate.end);
|
|
274
|
+
if (targetDate.isSameOrAfter(excludeStartDate, "day") && targetDate.isSameOrBefore(excludeEndDate, "day")) {
|
|
366
275
|
return false;
|
|
367
276
|
}
|
|
368
277
|
}
|
|
369
278
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
374
|
-
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
279
|
+
if (repeat_rule.end.type === "date" && repeat_rule.end.end_date) {
|
|
280
|
+
const ruleEndDate = (0, import_dayjs.default)(repeat_rule.end.end_date);
|
|
281
|
+
if (targetDate.isAfter(ruleEndDate, "day")) {
|
|
375
282
|
return false;
|
|
376
283
|
}
|
|
377
284
|
}
|
|
378
|
-
|
|
379
|
-
// 检查是否在开始日期之前
|
|
380
|
-
if (targetDate.isBefore(scheduleStartDate, 'day')) {
|
|
285
|
+
if (targetDate.isBefore(scheduleStartDate, "day")) {
|
|
381
286
|
return false;
|
|
382
287
|
}
|
|
383
|
-
|
|
384
|
-
// 根据重复类型检查
|
|
385
288
|
switch (repeat_type) {
|
|
386
|
-
case
|
|
289
|
+
case "daily":
|
|
387
290
|
return isDateInDailyRepeat(targetDate, scheduleStartDate, repeat_rule);
|
|
388
|
-
case
|
|
291
|
+
case "weekly":
|
|
389
292
|
return isDateInWeeklyRepeat(targetDate, scheduleStartDate, repeat_rule);
|
|
390
293
|
default:
|
|
391
294
|
return false;
|
|
392
295
|
}
|
|
393
296
|
};
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* 提取指定日期类型日程的时间段
|
|
397
|
-
*/
|
|
398
|
-
const extractDesignationScheduleTimeSlots = (date, schedule) => {
|
|
297
|
+
var extractDesignationScheduleTimeSlots = (date, schedule) => {
|
|
399
298
|
if (!schedule.designation) {
|
|
400
299
|
return [];
|
|
401
300
|
}
|
|
402
|
-
const targetDate = (0,
|
|
301
|
+
const targetDate = (0, import_dayjs.default)(date);
|
|
403
302
|
const designations = Array.isArray(schedule.designation) ? schedule.designation : [schedule.designation];
|
|
404
303
|
const slots = [];
|
|
405
304
|
for (const designation of designations) {
|
|
406
|
-
const startDate = (0,
|
|
407
|
-
const endDate = (0,
|
|
408
|
-
|
|
409
|
-
// 检查日期是否在指定范围内(考虑重复规则)
|
|
305
|
+
const startDate = (0, import_dayjs.default)(designation.start_date);
|
|
306
|
+
const endDate = (0, import_dayjs.default)(designation.end_date);
|
|
410
307
|
if (isDateInDesignationSchedule(targetDate, schedule, designation, startDate, endDate)) {
|
|
411
|
-
const startAt = (0,
|
|
412
|
-
const endAt = (0,
|
|
308
|
+
const startAt = (0, import_dayjs.default)(`${date} ${designation.start_time}:00`);
|
|
309
|
+
const endAt = (0, import_dayjs.default)(`${date} ${designation.end_time}:00`);
|
|
413
310
|
slots.push({
|
|
414
311
|
start_time: designation.start_time,
|
|
415
312
|
end_time: designation.end_time,
|
|
@@ -420,196 +317,125 @@ const extractDesignationScheduleTimeSlots = (date, schedule) => {
|
|
|
420
317
|
}
|
|
421
318
|
return slots;
|
|
422
319
|
};
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
*/
|
|
427
|
-
const isDateInDesignationSchedule = (targetDate, schedule, designation, startDate, endDate) => {
|
|
428
|
-
// 不重复的日程
|
|
429
|
-
if (schedule.repeat_type === 'none') {
|
|
430
|
-
// 检查日期是否在指定的日期范围内
|
|
431
|
-
return targetDate.isSameOrAfter(startDate, 'day') && targetDate.isSameOrBefore(endDate, 'day');
|
|
320
|
+
var isDateInDesignationSchedule = (targetDate, schedule, designation, startDate, endDate) => {
|
|
321
|
+
if (schedule.repeat_type === "none") {
|
|
322
|
+
return targetDate.isSameOrAfter(startDate, "day") && targetDate.isSameOrBefore(endDate, "day");
|
|
432
323
|
}
|
|
433
|
-
|
|
434
|
-
// 重复的日程,需要检查重复规则
|
|
435
324
|
if (!schedule.repeat_rule) {
|
|
436
325
|
return false;
|
|
437
326
|
}
|
|
438
|
-
const {
|
|
439
|
-
repeat_rule,
|
|
440
|
-
repeat_type
|
|
441
|
-
} = schedule;
|
|
442
|
-
|
|
443
|
-
// 检查是否在包含日期中(优先级最高)
|
|
327
|
+
const { repeat_rule, repeat_type } = schedule;
|
|
444
328
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
445
329
|
for (const includedDate of repeat_rule.included_date) {
|
|
446
|
-
const includeStartDate = (0,
|
|
447
|
-
const includeEndDate = (0,
|
|
448
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
330
|
+
const includeStartDate = (0, import_dayjs.default)(includedDate.start);
|
|
331
|
+
const includeEndDate = (0, import_dayjs.default)(includedDate.end);
|
|
332
|
+
if (targetDate.isSameOrAfter(includeStartDate, "day") && targetDate.isSameOrBefore(includeEndDate, "day")) {
|
|
449
333
|
return true;
|
|
450
334
|
}
|
|
451
335
|
}
|
|
452
336
|
}
|
|
453
|
-
|
|
454
|
-
// 检查是否在排除日期中
|
|
455
337
|
if (repeat_rule.excluded_date && repeat_rule.excluded_date.length > 0) {
|
|
456
338
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
457
|
-
const excludeStartDate = (0,
|
|
458
|
-
const excludeEndDate = (0,
|
|
459
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
339
|
+
const excludeStartDate = (0, import_dayjs.default)(excludedDate.start);
|
|
340
|
+
const excludeEndDate = (0, import_dayjs.default)(excludedDate.end);
|
|
341
|
+
if (targetDate.isSameOrAfter(excludeStartDate, "day") && targetDate.isSameOrBefore(excludeEndDate, "day")) {
|
|
460
342
|
return false;
|
|
461
343
|
}
|
|
462
344
|
}
|
|
463
345
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
468
|
-
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
346
|
+
if (repeat_rule.end.type === "date" && repeat_rule.end.end_date) {
|
|
347
|
+
const ruleEndDate = (0, import_dayjs.default)(repeat_rule.end.end_date);
|
|
348
|
+
if (targetDate.isAfter(ruleEndDate, "day")) {
|
|
469
349
|
return false;
|
|
470
350
|
}
|
|
471
351
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if (!targetDate.isSameOrAfter(startDate, 'day') || !targetDate.isSameOrBefore(endDate, 'day')) {
|
|
475
|
-
// 对于重复日程,如果不在基本范围内,还需要检查是否符合重复规则
|
|
476
|
-
// 只要在 startDate 之后,并且符合重复规则即可
|
|
477
|
-
if (targetDate.isBefore(startDate, 'day')) {
|
|
352
|
+
if (!targetDate.isSameOrAfter(startDate, "day") || !targetDate.isSameOrBefore(endDate, "day")) {
|
|
353
|
+
if (targetDate.isBefore(startDate, "day")) {
|
|
478
354
|
return false;
|
|
479
355
|
}
|
|
480
356
|
}
|
|
481
|
-
|
|
482
|
-
// 根据重复类型检查
|
|
483
357
|
switch (repeat_type) {
|
|
484
|
-
case
|
|
358
|
+
case "daily":
|
|
485
359
|
return isDateInDailyRepeat(targetDate, startDate, repeat_rule);
|
|
486
|
-
case
|
|
360
|
+
case "weekly":
|
|
487
361
|
return isDateInWeeklyRepeat(targetDate, startDate, repeat_rule);
|
|
488
362
|
default:
|
|
489
363
|
return false;
|
|
490
364
|
}
|
|
491
365
|
};
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
// 不重复的日程
|
|
500
|
-
if (schedule.repeat_type === 'none') {
|
|
501
|
-
// 检查日期是否在范围内
|
|
502
|
-
const scheduleStartDate = startDate.format('YYYY-MM-DD');
|
|
503
|
-
const scheduleEndDate = endDate.format('YYYY-MM-DD');
|
|
504
|
-
return targetDate.isSameOrAfter(scheduleStartDate, 'day') && targetDate.isSameOrBefore(scheduleEndDate, 'day');
|
|
366
|
+
var isDateInStandardSchedule = (targetDate, schedule, startDate, endDate) => {
|
|
367
|
+
const targetDateString = targetDate.format("YYYY-MM-DD");
|
|
368
|
+
if (schedule.repeat_type === "none") {
|
|
369
|
+
const scheduleStartDate = startDate.format("YYYY-MM-DD");
|
|
370
|
+
const scheduleEndDate = endDate.format("YYYY-MM-DD");
|
|
371
|
+
return targetDate.isSameOrAfter(scheduleStartDate, "day") && targetDate.isSameOrBefore(scheduleEndDate, "day");
|
|
505
372
|
}
|
|
506
|
-
|
|
507
|
-
// 重复的日程,需要检查重复规则
|
|
508
373
|
if (!schedule.repeat_rule) {
|
|
509
374
|
return false;
|
|
510
375
|
}
|
|
511
|
-
const {
|
|
512
|
-
repeat_rule,
|
|
513
|
-
repeat_type
|
|
514
|
-
} = schedule;
|
|
515
|
-
|
|
516
|
-
// 检查是否在包含日期中
|
|
376
|
+
const { repeat_rule, repeat_type } = schedule;
|
|
517
377
|
if (repeat_rule.included_date && repeat_rule.included_date.length > 0) {
|
|
518
378
|
for (const includedDate of repeat_rule.included_date) {
|
|
519
|
-
const includeStartDate = (0,
|
|
520
|
-
const includeEndDate = (0,
|
|
521
|
-
if (targetDate.isSameOrAfter(includeStartDate,
|
|
379
|
+
const includeStartDate = (0, import_dayjs.default)(includedDate.start);
|
|
380
|
+
const includeEndDate = (0, import_dayjs.default)(includedDate.end);
|
|
381
|
+
if (targetDate.isSameOrAfter(includeStartDate, "day") && targetDate.isSameOrBefore(includeEndDate, "day")) {
|
|
522
382
|
return true;
|
|
523
383
|
}
|
|
524
384
|
}
|
|
525
385
|
}
|
|
526
|
-
|
|
527
|
-
// 检查是否在排除日期中
|
|
528
386
|
for (const excludedDate of repeat_rule.excluded_date) {
|
|
529
|
-
const excludeStartDate = (0,
|
|
530
|
-
const excludeEndDate = (0,
|
|
531
|
-
if (targetDate.isSameOrAfter(excludeStartDate,
|
|
387
|
+
const excludeStartDate = (0, import_dayjs.default)(excludedDate.start);
|
|
388
|
+
const excludeEndDate = (0, import_dayjs.default)(excludedDate.end);
|
|
389
|
+
if (targetDate.isSameOrAfter(excludeStartDate, "day") && targetDate.isSameOrBefore(excludeEndDate, "day")) {
|
|
532
390
|
return false;
|
|
533
391
|
}
|
|
534
392
|
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const ruleEndDate = (0, _dayjs.default)(repeat_rule.end.end_date);
|
|
539
|
-
if (targetDate.isAfter(ruleEndDate, 'day')) {
|
|
393
|
+
if (repeat_rule.end.type === "date" && repeat_rule.end.end_date) {
|
|
394
|
+
const ruleEndDate = (0, import_dayjs.default)(repeat_rule.end.end_date);
|
|
395
|
+
if (targetDate.isAfter(ruleEndDate, "day")) {
|
|
540
396
|
return false;
|
|
541
397
|
}
|
|
542
398
|
}
|
|
543
|
-
|
|
544
|
-
// 检查是否在开始日期之前
|
|
545
|
-
if (targetDate.isBefore(startDate, 'day')) {
|
|
399
|
+
if (targetDate.isBefore(startDate, "day")) {
|
|
546
400
|
return false;
|
|
547
401
|
}
|
|
548
|
-
|
|
549
|
-
// 根据重复类型检查
|
|
550
402
|
switch (repeat_type) {
|
|
551
|
-
case
|
|
403
|
+
case "daily":
|
|
552
404
|
return isDateInDailyRepeat(targetDate, startDate, repeat_rule);
|
|
553
|
-
case
|
|
405
|
+
case "weekly":
|
|
554
406
|
return isDateInWeeklyRepeat(targetDate, startDate, repeat_rule);
|
|
555
407
|
default:
|
|
556
408
|
return false;
|
|
557
409
|
}
|
|
558
410
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
* 检查日期是否符合每日重复规则
|
|
562
|
-
*/
|
|
563
|
-
const isDateInDailyRepeat = (targetDate, startDate, repeatRule) => {
|
|
564
|
-
const daysDiff = targetDate.diff(startDate, 'day');
|
|
411
|
+
var isDateInDailyRepeat = (targetDate, startDate, repeatRule) => {
|
|
412
|
+
const daysDiff = targetDate.diff(startDate, "day");
|
|
565
413
|
if (daysDiff < 0) {
|
|
566
414
|
return false;
|
|
567
415
|
}
|
|
568
|
-
|
|
569
|
-
// 检查频率
|
|
570
416
|
return daysDiff % repeatRule.frequency === 0;
|
|
571
417
|
};
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
* 检查日期是否符合每周重复规则
|
|
575
|
-
*/
|
|
576
|
-
const isDateInWeeklyRepeat = (targetDate, startDate, repeatRule) => {
|
|
577
|
-
const targetDayOfWeek = targetDate.day(); // 0=周日, 1=周一, ..., 6=周六
|
|
578
|
-
|
|
579
|
-
// 检查是否在指定的星期几内
|
|
418
|
+
var isDateInWeeklyRepeat = (targetDate, startDate, repeatRule) => {
|
|
419
|
+
const targetDayOfWeek = targetDate.day();
|
|
580
420
|
if (!repeatRule.frequency_date.includes(targetDayOfWeek)) {
|
|
581
421
|
return false;
|
|
582
422
|
}
|
|
583
|
-
|
|
584
|
-
// 计算周差
|
|
585
|
-
const weeksDiff = targetDate.diff(startDate, 'week');
|
|
423
|
+
const weeksDiff = targetDate.diff(startDate, "week");
|
|
586
424
|
if (weeksDiff < 0) {
|
|
587
425
|
return false;
|
|
588
426
|
}
|
|
589
|
-
|
|
590
|
-
// 检查频率
|
|
591
427
|
return weeksDiff % repeatRule.frequency === 0;
|
|
592
428
|
};
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* 对时间段去重并排序
|
|
596
|
-
* 只移除开始时间和结束时间完全相同的重复时间段
|
|
597
|
-
*/
|
|
598
|
-
const mergeAndSortTimeSlots = slots => {
|
|
429
|
+
var mergeAndSortTimeSlots = (slots) => {
|
|
599
430
|
if (slots.length === 0) {
|
|
600
431
|
return [];
|
|
601
432
|
}
|
|
602
|
-
|
|
603
|
-
// 按开始时间排序
|
|
604
433
|
const sorted = [...slots].sort((a, b) => {
|
|
605
434
|
return a.start_at.valueOf() - b.start_at.valueOf();
|
|
606
435
|
});
|
|
607
|
-
|
|
608
|
-
// 去重:移除开始和结束时间完全相同的时间段
|
|
609
436
|
const unique = [];
|
|
610
|
-
const seenKeys = new Set();
|
|
437
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
611
438
|
for (const slot of sorted) {
|
|
612
|
-
// 使用开始时间和结束时间作为唯一键
|
|
613
439
|
const key = `${slot.start_time}-${slot.end_time}`;
|
|
614
440
|
if (!seenKeys.has(key)) {
|
|
615
441
|
seenKeys.add(key);
|
|
@@ -617,4 +443,9 @@ const mergeAndSortTimeSlots = slots => {
|
|
|
617
443
|
}
|
|
618
444
|
}
|
|
619
445
|
return unique;
|
|
620
|
-
};
|
|
446
|
+
};
|
|
447
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
448
|
+
0 && (module.exports = {
|
|
449
|
+
getDateIsInSchedule,
|
|
450
|
+
getScheduleStartEndTimePoints
|
|
451
|
+
});
|