@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
|
@@ -81,17 +81,23 @@ var isInTimeSlotsSchedule = function isInTimeSlotsSchedule(targetDate, targetDat
|
|
|
81
81
|
return false;
|
|
82
82
|
}
|
|
83
83
|
var scheduleStartDate = dayjs(schedule.start_time.split(' ')[0]);
|
|
84
|
+
|
|
85
|
+
// 检查日期是否在日程的有效范围内(包含 daily / weekly 重复规则)
|
|
84
86
|
if (!isDateInTimeSlotsSchedule(targetDate, schedule, scheduleStartDate)) {
|
|
85
87
|
return false;
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
// 检查是否在任一时间段内
|
|
87
91
|
var _iterator2 = _createForOfIteratorHelper(schedule.time_slot),
|
|
88
92
|
_step2;
|
|
89
93
|
try {
|
|
90
94
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
91
95
|
var timeSlot = _step2.value;
|
|
92
|
-
var slotStart =
|
|
93
|
-
var slotEnd =
|
|
94
|
-
|
|
96
|
+
var slotStart = "".concat(targetDateString, " ").concat(timeSlot.start_time, ":00");
|
|
97
|
+
var slotEnd = "".concat(targetDateString, " ").concat(timeSlot.end_time, ":00");
|
|
98
|
+
var slotStartDate = dayjs(slotStart);
|
|
99
|
+
var slotEndDate = dayjs(slotEnd);
|
|
100
|
+
if (targetDate.isSameOrAfter(slotStartDate) && targetDate.isSameOrBefore(slotEndDate)) {
|
|
95
101
|
return true;
|
|
96
102
|
}
|
|
97
103
|
}
|
|
@@ -119,7 +125,7 @@ var isInDesignationSchedule = function isInDesignationSchedule(targetDate, targe
|
|
|
119
125
|
var endDateTime = "".concat(designation.end_date, " ").concat(designation.end_time, ":00");
|
|
120
126
|
var startDate = dayjs(startDateTime);
|
|
121
127
|
var endDate = dayjs(endDateTime);
|
|
122
|
-
if (targetDate.isSameOrAfter(startDate) && targetDate.
|
|
128
|
+
if (targetDate.isSameOrAfter(startDate) && targetDate.isSameOrBefore(endDate)) {
|
|
123
129
|
return true;
|
|
124
130
|
}
|
|
125
131
|
}
|
|
@@ -217,8 +223,9 @@ var isInDailyRepeat = function isInDailyRepeat(targetDate, startDate, endDate, r
|
|
|
217
223
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
218
224
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
219
225
|
|
|
220
|
-
// 每日重复:每天都在相同的时间段内有效
|
|
221
|
-
|
|
226
|
+
// 每日重复:每天都在相同的时间段内有效
|
|
227
|
+
// 例如:01:00:00 - 16:00:00,每天都是这个时间段
|
|
228
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
222
229
|
};
|
|
223
230
|
|
|
224
231
|
// 每周重复逻辑
|
|
@@ -245,7 +252,7 @@ var isInWeeklyRepeat = function isInWeeklyRepeat(targetDate, startDate, endDate,
|
|
|
245
252
|
var targetTimeOfDay = targetDate.hour() * 3600 + targetDate.minute() * 60 + targetDate.second();
|
|
246
253
|
var startTimeOfDay = startDate.hour() * 3600 + startDate.minute() * 60 + startDate.second();
|
|
247
254
|
var endTimeOfDay = endDate.hour() * 3600 + endDate.minute() * 60 + endDate.second();
|
|
248
|
-
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay
|
|
255
|
+
return targetTimeOfDay >= startTimeOfDay && targetTimeOfDay <= endTimeOfDay;
|
|
249
256
|
};
|
|
250
257
|
|
|
251
258
|
// 日程时间段类型
|
|
@@ -9,15 +9,28 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
9
9
|
private cacheId;
|
|
10
10
|
private openCache;
|
|
11
11
|
private fatherModule;
|
|
12
|
+
private hasLoadedScheduleList;
|
|
12
13
|
constructor(name?: string, version?: string);
|
|
13
14
|
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* 更新父级解决方案透传的运行态参数,并刷新 schedule 缓存写入配置。
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
|
|
20
|
+
*/
|
|
21
|
+
updateOtherParams(params: Record<string, any>): void;
|
|
14
22
|
/**
|
|
15
23
|
* 加载当前店铺下所有 schedule
|
|
16
24
|
*
|
|
17
25
|
* @memberof ScheduleModule
|
|
18
26
|
*/
|
|
19
|
-
loadAllSchedule(
|
|
27
|
+
loadAllSchedule(options?: {
|
|
28
|
+
useCache?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
20
30
|
setScheduleList(list: ScheduleItem[]): void;
|
|
31
|
+
private syncScheduleMap;
|
|
32
|
+
getScheduleList(): ScheduleItem[];
|
|
33
|
+
isScheduleListLoaded(): boolean;
|
|
21
34
|
loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<import("../Date/types").ITime[]>;
|
|
22
35
|
getScheduleListByIds(ids: number[]): ScheduleItem[];
|
|
23
36
|
setAvailabilityScheduleDateList(list: ScheduleAvailabilityDateItem[]): void;
|
|
@@ -35,10 +48,10 @@ export declare class ScheduleModule extends BaseModule implements Module, Schedu
|
|
|
35
48
|
schedule: any;
|
|
36
49
|
}): boolean;
|
|
37
50
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
52
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
42
55
|
static isInScheduleByDate({ date, schedule, }: {
|
|
43
56
|
date: string;
|
|
44
57
|
schedule: any;
|
|
@@ -44,6 +44,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
44
44
|
_defineProperty(_assertThisInitialized(_this), "cacheId", void 0);
|
|
45
45
|
_defineProperty(_assertThisInitialized(_this), "openCache", false);
|
|
46
46
|
_defineProperty(_assertThisInitialized(_this), "fatherModule", void 0);
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "hasLoadedScheduleList", false);
|
|
47
48
|
return _this;
|
|
48
49
|
}
|
|
49
50
|
_createClass(ScheduleModule, [{
|
|
@@ -70,10 +71,14 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
70
71
|
this.store = options === null || options === void 0 ? void 0 : options.store;
|
|
71
72
|
if (options.initialState) {
|
|
72
73
|
this.store.scheduleList = options.initialState.scheduleList;
|
|
74
|
+
this.syncScheduleMap();
|
|
73
75
|
this.store.availabilityDateList = options.initialState.availabilityDateList;
|
|
76
|
+
this.hasLoadedScheduleList = Array.isArray(options.initialState.scheduleList);
|
|
74
77
|
} else {
|
|
75
78
|
this.store.scheduleList = [];
|
|
79
|
+
this.store.map = new Map();
|
|
76
80
|
this.store.availabilityDateList = [];
|
|
81
|
+
this.hasLoadedScheduleList = false;
|
|
77
82
|
}
|
|
78
83
|
if ((_options$otherParams = options.otherParams) !== null && _options$otherParams !== void 0 && _options$otherParams.cacheId) {
|
|
79
84
|
this.openCache = options.otherParams.openCache;
|
|
@@ -93,6 +98,22 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
93
98
|
}
|
|
94
99
|
return initialize;
|
|
95
100
|
}()
|
|
101
|
+
/**
|
|
102
|
+
* 更新父级解决方案透传的运行态参数,并刷新 schedule 缓存写入配置。
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* scheduleModule.updateOtherParams({ openCache: true, cacheId: 'cache-2' });
|
|
106
|
+
*/
|
|
107
|
+
}, {
|
|
108
|
+
key: "updateOtherParams",
|
|
109
|
+
value: function updateOtherParams(params) {
|
|
110
|
+
var _otherParams$openCach;
|
|
111
|
+
var otherParams = params || {};
|
|
112
|
+
this.openCache = (_otherParams$openCach = otherParams.openCache) !== null && _otherParams$openCach !== void 0 ? _otherParams$openCach : false;
|
|
113
|
+
this.cacheId = otherParams.cacheId;
|
|
114
|
+
this.fatherModule = otherParams.fatherModule;
|
|
115
|
+
}
|
|
116
|
+
|
|
96
117
|
/**
|
|
97
118
|
* 加载当前店铺下所有 schedule
|
|
98
119
|
*
|
|
@@ -102,21 +123,24 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
102
123
|
key: "loadAllSchedule",
|
|
103
124
|
value: (function () {
|
|
104
125
|
var _loadAllSchedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
105
|
-
var _scheduleList$data;
|
|
106
|
-
var
|
|
126
|
+
var _options$useCache, _scheduleList$data;
|
|
127
|
+
var options,
|
|
128
|
+
scheduleList,
|
|
129
|
+
_args2 = arguments;
|
|
107
130
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
108
131
|
while (1) switch (_context2.prev = _context2.next) {
|
|
109
132
|
case 0:
|
|
110
|
-
|
|
133
|
+
options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
|
|
134
|
+
_context2.next = 3;
|
|
111
135
|
return this.request.get("/schedule", {
|
|
112
136
|
num: 999
|
|
113
137
|
}, {
|
|
114
|
-
useCache: true
|
|
138
|
+
useCache: (_options$useCache = options.useCache) !== null && _options$useCache !== void 0 ? _options$useCache : true
|
|
115
139
|
});
|
|
116
|
-
case
|
|
140
|
+
case 3:
|
|
117
141
|
scheduleList = _context2.sent;
|
|
118
142
|
this.setScheduleList(((_scheduleList$data = scheduleList.data) === null || _scheduleList$data === void 0 ? void 0 : _scheduleList$data.list) || []);
|
|
119
|
-
case
|
|
143
|
+
case 5:
|
|
120
144
|
case "end":
|
|
121
145
|
return _context2.stop();
|
|
122
146
|
}
|
|
@@ -131,13 +155,31 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
131
155
|
key: "setScheduleList",
|
|
132
156
|
value: function setScheduleList(list) {
|
|
133
157
|
this.store.scheduleList = list;
|
|
158
|
+
this.syncScheduleMap();
|
|
159
|
+
this.hasLoadedScheduleList = true;
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: "syncScheduleMap",
|
|
163
|
+
value: function syncScheduleMap() {
|
|
164
|
+
this.store.map = new Map((this.store.scheduleList || []).map(function (schedule) {
|
|
165
|
+
return [Number(schedule.id), schedule];
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
key: "getScheduleList",
|
|
170
|
+
value: function getScheduleList() {
|
|
171
|
+
return this.store.scheduleList || [];
|
|
172
|
+
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "isScheduleListLoaded",
|
|
175
|
+
value: function isScheduleListLoaded() {
|
|
176
|
+
return this.hasLoadedScheduleList;
|
|
134
177
|
}
|
|
135
178
|
}, {
|
|
136
179
|
key: "loadScheduleAvailableDate",
|
|
137
180
|
value: function () {
|
|
138
181
|
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
139
|
-
var
|
|
140
|
-
var startDate, endDate, custom_page_id, channel, dates, res;
|
|
182
|
+
var startDate, endDate, custom_page_id, channel, dates, res, responseData, dateList, otherProductIds;
|
|
141
183
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
142
184
|
while (1) switch (_context3.prev = _context3.next) {
|
|
143
185
|
case 0:
|
|
@@ -165,22 +207,25 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
165
207
|
});
|
|
166
208
|
case 8:
|
|
167
209
|
res = _context3.sent;
|
|
168
|
-
|
|
169
|
-
|
|
210
|
+
responseData = res.data || {};
|
|
211
|
+
dateList = Array.isArray(responseData.date_list) ? responseData.date_list : [];
|
|
212
|
+
otherProductIds = Array.isArray(responseData.other_product_ids) ? responseData.other_product_ids : [];
|
|
213
|
+
this.setAvailabilityScheduleDateList(dateList);
|
|
214
|
+
this.setOtherProductsIds(otherProductIds);
|
|
170
215
|
// 如果没有schedule或者结束日期在今天之前,则所有日期均不可用
|
|
171
|
-
if (!(!
|
|
172
|
-
_context3.next =
|
|
216
|
+
if (!(!dateList.length && !otherProductIds.length || dayjs(endDate).isBefore(dayjs(), 'day'))) {
|
|
217
|
+
_context3.next = 16;
|
|
173
218
|
break;
|
|
174
219
|
}
|
|
175
220
|
return _context3.abrupt("return", dates);
|
|
176
|
-
case
|
|
177
|
-
if (
|
|
221
|
+
case 16:
|
|
222
|
+
if (otherProductIds.length) {
|
|
178
223
|
// 如果后端有返回 other_product_ids ,意味着有 duration 商品,则今天以及今天以后的日期均可用
|
|
179
224
|
dates.forEach(function (n) {
|
|
180
225
|
n.status = 'available';
|
|
181
226
|
});
|
|
182
227
|
} else {
|
|
183
|
-
|
|
228
|
+
dateList.forEach(function (n) {
|
|
184
229
|
var index = dates.findIndex(function (m) {
|
|
185
230
|
return m.date === n.date;
|
|
186
231
|
});
|
|
@@ -191,7 +236,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
191
236
|
}
|
|
192
237
|
dates = disableDatesBeforeOneDay(dates);
|
|
193
238
|
return _context3.abrupt("return", dates);
|
|
194
|
-
case
|
|
239
|
+
case 19:
|
|
195
240
|
case "end":
|
|
196
241
|
return _context3.stop();
|
|
197
242
|
}
|
|
@@ -205,9 +250,20 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
205
250
|
}, {
|
|
206
251
|
key: "getScheduleListByIds",
|
|
207
252
|
value: function getScheduleListByIds(ids) {
|
|
208
|
-
|
|
209
|
-
|
|
253
|
+
var _this2 = this,
|
|
254
|
+
_this$store$scheduleL;
|
|
255
|
+
var idSet = new Set(ids.map(function (id) {
|
|
256
|
+
return String(id);
|
|
257
|
+
}));
|
|
258
|
+
if (this.store.map instanceof Map && this.store.map.size > 0) {
|
|
259
|
+
return ids.map(function (id) {
|
|
260
|
+
return _this2.store.map.get(Number(id));
|
|
261
|
+
}).filter(Boolean);
|
|
262
|
+
}
|
|
263
|
+
var list = (_this$store$scheduleL = this.store.scheduleList) === null || _this$store$scheduleL === void 0 ? void 0 : _this$store$scheduleL.filter(function (n) {
|
|
264
|
+
return idSet.has(String(n.id));
|
|
210
265
|
});
|
|
266
|
+
return list;
|
|
211
267
|
}
|
|
212
268
|
}, {
|
|
213
269
|
key: "setAvailabilityScheduleDateList",
|
|
@@ -243,7 +299,6 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
243
299
|
});
|
|
244
300
|
}
|
|
245
301
|
}
|
|
246
|
-
|
|
247
302
|
/**
|
|
248
303
|
* 传入一个时间, 判断改时间是否在schedule 内
|
|
249
304
|
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
@@ -256,12 +311,11 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
256
311
|
schedule = _ref2.schedule;
|
|
257
312
|
return getDateIsInSchedule(date, [schedule]);
|
|
258
313
|
}
|
|
259
|
-
|
|
260
314
|
/**
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
315
|
+
* 传入一个时间, 判断改时间是否在schedule 内
|
|
316
|
+
* @param param0 { date: string, schedule: any } date: 日期, schedule: schedule
|
|
317
|
+
* @returns
|
|
318
|
+
*/
|
|
265
319
|
}], [{
|
|
266
320
|
key: "isInScheduleByDate",
|
|
267
321
|
value: function isInScheduleByDate(_ref3) {
|
|
@@ -113,14 +113,14 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
113
113
|
key: "getSummary",
|
|
114
114
|
value: function () {
|
|
115
115
|
var _getSummary = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(cartItems) {
|
|
116
|
-
var _this$shopStore$get;
|
|
116
|
+
var _this$shopStore$get, _this$store$surcharge;
|
|
117
117
|
var shopInfo, scheduleModule, needScheduleIds, scheduleList, scheduleById, _iterator, _step, item, summary;
|
|
118
118
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
119
119
|
while (1) switch (_context3.prev = _context3.next) {
|
|
120
120
|
case 0:
|
|
121
121
|
shopInfo = ((_this$shopStore$get = this.shopStore.get('core')) === null || _this$shopStore$get === void 0 || (_this$shopStore$get = _this$shopStore$get.core) === null || _this$shopStore$get === void 0 ? void 0 : _this$shopStore$get.shop) || {};
|
|
122
122
|
scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
123
|
-
needScheduleIds = (this.store.surchargeList ||
|
|
123
|
+
needScheduleIds = (_this$store$surcharge = this.store.surchargeList) === null || _this$store$surcharge === void 0 ? void 0 : _this$store$surcharge.map(function (item) {
|
|
124
124
|
return item.available_schedule_ids;
|
|
125
125
|
}).flat();
|
|
126
126
|
scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
|
@@ -208,9 +208,10 @@ export var SummaryModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
208
208
|
}, {
|
|
209
209
|
key: "getSurchargeforUtils",
|
|
210
210
|
value: function getSurchargeforUtils(items) {
|
|
211
|
+
var _this$store$surcharge2;
|
|
211
212
|
// const surchargeList = this.store.surchargeList;
|
|
212
213
|
var scheduleModule = this.core.getModule('appointmentBooking_schedule');
|
|
213
|
-
var needScheduleIds = (this.store.surchargeList ||
|
|
214
|
+
var needScheduleIds = (_this$store$surcharge2 = this.store.surchargeList) === null || _this$store$surcharge2 === void 0 ? void 0 : _this$store$surcharge2.map(function (item) {
|
|
214
215
|
return item.available_schedule_ids;
|
|
215
216
|
}).flat();
|
|
216
217
|
var scheduleList = scheduleModule === null || scheduleModule === void 0 ? void 0 : scheduleModule.getScheduleListByIds(needScheduleIds);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
|
+
import { BaseModule } from '../BaseModule';
|
|
3
|
+
import { SurchargeListItem, SurchargeListModuleAPI, SurchargeListQuery } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare class SurchargeListModule extends BaseModule implements Module, SurchargeListModuleAPI {
|
|
6
|
+
protected defaultName: string;
|
|
7
|
+
protected defaultVersion: string;
|
|
8
|
+
private request;
|
|
9
|
+
private store;
|
|
10
|
+
private loadingPromises;
|
|
11
|
+
private requestVersion;
|
|
12
|
+
constructor(name?: string, version?: string);
|
|
13
|
+
initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
|
|
14
|
+
private resolveChannel;
|
|
15
|
+
getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
16
|
+
refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
17
|
+
private loadSurchargeList;
|
|
18
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
12
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
13
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
import { BaseModule } from "../BaseModule";
|
|
19
|
+
export * from "./types";
|
|
20
|
+
var DEFAULT_SURCHARGE_CHANNEL = 'online-store';
|
|
21
|
+
export var SurchargeListModule = /*#__PURE__*/function (_BaseModule) {
|
|
22
|
+
_inherits(SurchargeListModule, _BaseModule);
|
|
23
|
+
var _super = _createSuper(SurchargeListModule);
|
|
24
|
+
function SurchargeListModule(name, version) {
|
|
25
|
+
var _this;
|
|
26
|
+
_classCallCheck(this, SurchargeListModule);
|
|
27
|
+
_this = _super.call(this, name, version);
|
|
28
|
+
_defineProperty(_assertThisInitialized(_this), "defaultName", 'surchargeList');
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
30
|
+
_defineProperty(_assertThisInitialized(_this), "request", void 0);
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "loadingPromises", new Map());
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "requestVersion", 0);
|
|
34
|
+
return _this;
|
|
35
|
+
}
|
|
36
|
+
_createClass(SurchargeListModule, [{
|
|
37
|
+
key: "initialize",
|
|
38
|
+
value: function () {
|
|
39
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
40
|
+
var _options$initialState, _options$initialState2, _options$initialState3, _options$otherParams, _options$initialState4;
|
|
41
|
+
var hasInitialSurchargeList;
|
|
42
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
43
|
+
while (1) switch (_context.prev = _context.next) {
|
|
44
|
+
case 0:
|
|
45
|
+
this.core = core;
|
|
46
|
+
this.store = options.store;
|
|
47
|
+
this.request = this.core.getPlugin('request');
|
|
48
|
+
hasInitialSurchargeList = Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.surchargeList);
|
|
49
|
+
this.store.surchargeList = hasInitialSurchargeList ? (_options$initialState2 = options.initialState) === null || _options$initialState2 === void 0 ? void 0 : _options$initialState2.surchargeList : [];
|
|
50
|
+
this.store.channel = ((_options$initialState3 = options.initialState) === null || _options$initialState3 === void 0 ? void 0 : _options$initialState3.channel) || ((_options$otherParams = options.otherParams) === null || _options$otherParams === void 0 ? void 0 : _options$otherParams.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
51
|
+
this.store.isLoaded = Boolean((_options$initialState4 = options.initialState) === null || _options$initialState4 === void 0 ? void 0 : _options$initialState4.isLoaded) || hasInitialSurchargeList;
|
|
52
|
+
if (this.request) {
|
|
53
|
+
_context.next = 9;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
throw new Error('SurchargeListModule 需要 request 插件支持');
|
|
57
|
+
case 9:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee, this);
|
|
62
|
+
}));
|
|
63
|
+
function initialize(_x, _x2) {
|
|
64
|
+
return _initialize.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
return initialize;
|
|
67
|
+
}()
|
|
68
|
+
}, {
|
|
69
|
+
key: "resolveChannel",
|
|
70
|
+
value: function resolveChannel(query) {
|
|
71
|
+
return (query === null || query === void 0 ? void 0 : query.channel) || DEFAULT_SURCHARGE_CHANNEL;
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "getSurchargeList",
|
|
75
|
+
value: function () {
|
|
76
|
+
var _getSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(query) {
|
|
77
|
+
var channel, loadingPromise, nextPromise;
|
|
78
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
79
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
channel = this.resolveChannel(query);
|
|
82
|
+
if (!(this.store.isLoaded && this.store.channel === channel)) {
|
|
83
|
+
_context2.next = 3;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
return _context2.abrupt("return", this.store.surchargeList);
|
|
87
|
+
case 3:
|
|
88
|
+
loadingPromise = this.loadingPromises.get(channel);
|
|
89
|
+
if (!loadingPromise) {
|
|
90
|
+
_context2.next = 6;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
return _context2.abrupt("return", loadingPromise);
|
|
94
|
+
case 6:
|
|
95
|
+
nextPromise = this.loadSurchargeList(channel);
|
|
96
|
+
this.loadingPromises.set(channel, nextPromise);
|
|
97
|
+
return _context2.abrupt("return", nextPromise);
|
|
98
|
+
case 9:
|
|
99
|
+
case "end":
|
|
100
|
+
return _context2.stop();
|
|
101
|
+
}
|
|
102
|
+
}, _callee2, this);
|
|
103
|
+
}));
|
|
104
|
+
function getSurchargeList(_x3) {
|
|
105
|
+
return _getSurchargeList.apply(this, arguments);
|
|
106
|
+
}
|
|
107
|
+
return getSurchargeList;
|
|
108
|
+
}()
|
|
109
|
+
}, {
|
|
110
|
+
key: "refreshSurchargeList",
|
|
111
|
+
value: function () {
|
|
112
|
+
var _refreshSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(query) {
|
|
113
|
+
var channel, nextPromise;
|
|
114
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
115
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
channel = this.resolveChannel(query);
|
|
118
|
+
nextPromise = this.loadSurchargeList(channel);
|
|
119
|
+
this.loadingPromises.set(channel, nextPromise);
|
|
120
|
+
return _context3.abrupt("return", nextPromise);
|
|
121
|
+
case 4:
|
|
122
|
+
case "end":
|
|
123
|
+
return _context3.stop();
|
|
124
|
+
}
|
|
125
|
+
}, _callee3, this);
|
|
126
|
+
}));
|
|
127
|
+
function refreshSurchargeList(_x4) {
|
|
128
|
+
return _refreshSurchargeList.apply(this, arguments);
|
|
129
|
+
}
|
|
130
|
+
return refreshSurchargeList;
|
|
131
|
+
}()
|
|
132
|
+
}, {
|
|
133
|
+
key: "loadSurchargeList",
|
|
134
|
+
value: function () {
|
|
135
|
+
var _loadSurchargeList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(channel) {
|
|
136
|
+
var currentRequestVersion, surchargeList, nextSurchargeList;
|
|
137
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
138
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
currentRequestVersion = ++this.requestVersion;
|
|
141
|
+
_context4.prev = 1;
|
|
142
|
+
_context4.next = 4;
|
|
143
|
+
return this.request.get('/order/custom-surcharge/available/v2', {
|
|
144
|
+
channel: channel,
|
|
145
|
+
is_assemble_product_data: 1,
|
|
146
|
+
is_assemble_schedule_data: 1,
|
|
147
|
+
with: ['relationSchedule']
|
|
148
|
+
});
|
|
149
|
+
case 4:
|
|
150
|
+
surchargeList = _context4.sent;
|
|
151
|
+
nextSurchargeList = (surchargeList === null || surchargeList === void 0 ? void 0 : surchargeList.data) || [];
|
|
152
|
+
if (currentRequestVersion === this.requestVersion) {
|
|
153
|
+
this.store.surchargeList = nextSurchargeList;
|
|
154
|
+
this.store.channel = channel;
|
|
155
|
+
this.store.isLoaded = true;
|
|
156
|
+
}
|
|
157
|
+
return _context4.abrupt("return", nextSurchargeList);
|
|
158
|
+
case 10:
|
|
159
|
+
_context4.prev = 10;
|
|
160
|
+
_context4.t0 = _context4["catch"](1);
|
|
161
|
+
console.warn('[SurchargeListModule] 加载附加费配置失败', _context4.t0);
|
|
162
|
+
if (currentRequestVersion === this.requestVersion) {
|
|
163
|
+
this.store.surchargeList = [];
|
|
164
|
+
this.store.channel = channel;
|
|
165
|
+
this.store.isLoaded = true;
|
|
166
|
+
}
|
|
167
|
+
return _context4.abrupt("return", []);
|
|
168
|
+
case 15:
|
|
169
|
+
_context4.prev = 15;
|
|
170
|
+
this.loadingPromises.delete(channel);
|
|
171
|
+
return _context4.finish(15);
|
|
172
|
+
case 18:
|
|
173
|
+
case "end":
|
|
174
|
+
return _context4.stop();
|
|
175
|
+
}
|
|
176
|
+
}, _callee4, this, [[1, 10, 15, 18]]);
|
|
177
|
+
}));
|
|
178
|
+
function loadSurchargeList(_x5) {
|
|
179
|
+
return _loadSurchargeList.apply(this, arguments);
|
|
180
|
+
}
|
|
181
|
+
return loadSurchargeList;
|
|
182
|
+
}()
|
|
183
|
+
}]);
|
|
184
|
+
return SurchargeListModule;
|
|
185
|
+
}(BaseModule);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface SurchargeListItem {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export interface SurchargeListState {
|
|
5
|
+
surchargeList: SurchargeListItem[];
|
|
6
|
+
isLoaded: boolean;
|
|
7
|
+
channel?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SurchargeListQuery {
|
|
10
|
+
channel?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SurchargeListModuleAPI {
|
|
13
|
+
getSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
14
|
+
refreshSurchargeList(query?: SurchargeListQuery): Promise<SurchargeListItem[]>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/modules/index.d.ts
CHANGED
|
@@ -12,8 +12,11 @@ export * from './Resource';
|
|
|
12
12
|
export * from './Step';
|
|
13
13
|
export * from './Summary';
|
|
14
14
|
export * from './SalesSummary';
|
|
15
|
+
export * from './SurchargeList';
|
|
15
16
|
export * from './Schedule';
|
|
16
17
|
export * from './Quotation';
|
|
17
18
|
export * from './ScanOrderLogger';
|
|
18
19
|
export * from './OpenData';
|
|
20
|
+
export * from './BookingContext';
|
|
19
21
|
export * from './Holder';
|
|
22
|
+
export * from './ResourcePlanner';
|
package/dist/modules/index.js
CHANGED
|
@@ -12,8 +12,11 @@ export * from "./Resource";
|
|
|
12
12
|
export * from "./Step";
|
|
13
13
|
export * from "./Summary";
|
|
14
14
|
export * from "./SalesSummary";
|
|
15
|
+
export * from "./SurchargeList";
|
|
15
16
|
export * from "./Schedule";
|
|
16
17
|
export * from "./Quotation";
|
|
17
18
|
export * from "./ScanOrderLogger";
|
|
18
19
|
export * from "./OpenData";
|
|
19
|
-
export * from "./
|
|
20
|
+
export * from "./BookingContext";
|
|
21
|
+
export * from "./Holder";
|
|
22
|
+
export * from "./ResourcePlanner";
|
package/dist/plugins/app.d.ts
CHANGED