@pisell/pisellos 0.0.568 → 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/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/dist/model/strategy/adapter/walletPass/utils.js +7 -4
- package/dist/modules/BaseModule.d.ts +2 -2
- package/dist/modules/BaseModule.js +4 -4
- package/dist/modules/BookingContext/index.d.ts +48 -0
- package/dist/modules/BookingContext/index.js +566 -0
- package/dist/modules/BookingContext/types.d.ts +102 -0
- package/dist/modules/BookingContext/types.js +51 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +302 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +149 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +249 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/flexible.js +56 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
- package/dist/modules/BookingContext/utils/index.d.ts +11 -0
- package/dist/modules/BookingContext/utils/index.js +11 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/noResource.js +77 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.js +36 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/dist/modules/BookingContext/utils/productExtend.js +339 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
- package/dist/modules/BookingContext/utils/resources.js +486 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
- package/dist/modules/Cart/utils/cartProduct.js +26 -5
- package/dist/modules/Cart/utils/changePrice.js +27 -20
- package/dist/modules/Customer/index.d.ts +20 -0
- package/dist/modules/Customer/index.js +172 -83
- package/dist/modules/Customer/types.d.ts +2 -0
- package/dist/modules/Discount/index.d.ts +2 -1
- package/dist/modules/Discount/index.js +37 -9
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/OpenData/index.d.ts +8 -0
- package/dist/modules/OpenData/index.js +36 -16
- package/dist/modules/Order/index.d.ts +448 -23
- package/dist/modules/Order/index.js +5417 -561
- package/dist/modules/Order/types.d.ts +693 -88
- package/dist/modules/Order/types.js +68 -1
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.js +144 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +405 -0
- package/dist/modules/Order/utils.d.ts +167 -18
- package/dist/modules/Order/utils.js +960 -165
- package/dist/modules/Payment/index.d.ts +10 -9
- package/dist/modules/Payment/index.js +465 -703
- package/dist/modules/Payment/types.d.ts +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 +44 -29
- 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 +221 -109
- 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/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/server/index.d.ts +462 -8
- package/dist/server/index.js +6112 -656
- package/dist/server/modules/floor-plan/index.d.ts +39 -0
- package/dist/server/modules/floor-plan/index.js +595 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/floor-plan/types.js +13 -0
- package/dist/server/modules/index.d.ts +7 -2
- package/dist/server/modules/index.js +6 -0
- package/dist/server/modules/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 +1393 -516
- 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 +278 -66
- package/dist/server/modules/resource/index.d.ts +2 -3
- package/dist/server/modules/resource/index.js +108 -86
- package/dist/server/modules/schedule/index.d.ts +6 -4
- package/dist/server/modules/schedule/index.js +116 -85
- package/dist/server/test.json +713 -0
- package/dist/server/types.d.ts +2 -0
- package/dist/server/utils/product.js +2 -2
- package/dist/server/utils/small-ticket.d.ts +71 -0
- package/dist/server/utils/small-ticket.js +963 -0
- package/dist/solution/BaseSales/index.d.ts +378 -0
- package/dist/solution/BaseSales/index.js +4006 -0
- package/dist/solution/BaseSales/types.d.ts +394 -0
- package/dist/solution/BaseSales/types.js +40 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/dist/solution/BaseSales/utils/cartPromotion.js +1450 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +157 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/dist/solution/BaseSales/utils/quotationPrice.js +250 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +218 -0
- package/dist/solution/BaseSales/utils.d.ts +40 -0
- package/dist/solution/BaseSales/utils.js +263 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +394 -25
- package/dist/solution/BookingTicket/index.js +2506 -443
- package/dist/solution/BookingTicket/types.d.ts +191 -6
- package/dist/solution/BookingTicket/types.js +83 -10
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/dist/solution/BookingTicket/utils/addTimeAvailability.js +95 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/dist/solution/BookingTicket/utils/cartView.js +209 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/exampleData.js +183 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.js +31 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.js +438 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +400 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +41 -1
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.js +56 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +11 -3
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +20 -8
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.js +150 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.js +78 -0
- package/dist/solution/Checkout/index.d.ts +1 -0
- package/dist/solution/Checkout/index.js +25 -34
- package/dist/solution/Checkout/utils/index.js +4 -4
- package/dist/solution/RegisterAndLogin/config.js +2 -10
- package/dist/solution/Sales/index.d.ts +50 -5
- package/dist/solution/Sales/index.js +484 -92
- package/dist/solution/Sales/types.d.ts +26 -2
- package/dist/solution/ScanOrder/index.d.ts +27 -21
- package/dist/solution/ScanOrder/index.js +499 -434
- 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 +4 -4
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +29 -20
- package/dist/solution/VenueBooking/index.js +301 -213
- package/dist/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/dist/solution/VenueBooking/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/lib/model/strategy/adapter/promotion/evaluator.js +3 -2
- package/lib/model/strategy/adapter/walletPass/utils.js +6 -4
- package/lib/modules/BaseModule.d.ts +2 -2
- package/lib/modules/BaseModule.js +4 -4
- package/lib/modules/BookingContext/index.d.ts +48 -0
- package/lib/modules/BookingContext/index.js +390 -0
- package/lib/modules/BookingContext/types.d.ts +102 -0
- package/lib/modules/BookingContext/types.js +48 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +286 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +148 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +242 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/flexible.js +63 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/formatResourceList.js +35 -0
- package/lib/modules/BookingContext/utils/index.d.ts +11 -0
- package/lib/modules/BookingContext/utils/index.js +126 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/noResource.js +78 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.js +29 -0
- package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
- package/lib/modules/BookingContext/utils/productExtend.js +330 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/resourceSelection.js +24 -0
- package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
- package/lib/modules/BookingContext/utils/resources.js +419 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/serviceTimes.js +161 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/BookingContext/utils/timeSlices.js +114 -0
- package/lib/modules/Cart/utils/cartProduct.js +27 -5
- package/lib/modules/Cart/utils/changePrice.js +20 -14
- package/lib/modules/Customer/index.d.ts +20 -0
- package/lib/modules/Customer/index.js +63 -10
- package/lib/modules/Customer/types.d.ts +2 -0
- package/lib/modules/Discount/index.d.ts +2 -1
- package/lib/modules/Discount/index.js +18 -2
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/OpenData/index.d.ts +8 -0
- package/lib/modules/OpenData/index.js +21 -3
- package/lib/modules/Order/index.d.ts +448 -23
- package/lib/modules/Order/index.js +3641 -308
- package/lib/modules/Order/types.d.ts +693 -88
- package/lib/modules/Order/types.js +55 -1
- package/lib/modules/Order/utils/bundleDiscountHydration.d.ts +5 -0
- package/lib/modules/Order/utils/bundleDiscountHydration.js +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/manualProductDiscount.js +207 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +353 -0
- package/lib/modules/Order/utils.d.ts +167 -18
- package/lib/modules/Order/utils.js +974 -138
- package/lib/modules/Payment/index.d.ts +10 -9
- package/lib/modules/Payment/index.js +30 -124
- package/lib/modules/Payment/types.d.ts +40 -16
- package/lib/modules/Payment/utils.d.ts +1 -1
- package/lib/modules/Payment/utils.js +4 -3
- package/lib/modules/Payment/walletpass.js +16 -6
- package/lib/modules/Product/types.d.ts +29 -7
- package/lib/modules/ProductList/index.d.ts +17 -13
- package/lib/modules/ProductList/index.js +92 -51
- package/lib/modules/ProductList/types.d.ts +17 -0
- package/lib/modules/Quotation/index.d.ts +22 -2
- package/lib/modules/Quotation/index.js +76 -20
- package/lib/modules/Quotation/types.d.ts +19 -0
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +147 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +895 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +5 -0
- package/lib/modules/Rules/index.d.ts +8 -10
- package/lib/modules/Rules/index.js +152 -60
- package/lib/modules/Rules/types.d.ts +14 -3
- package/lib/modules/SalesSummary/index.d.ts +23 -26
- package/lib/modules/SalesSummary/index.js +84 -16
- package/lib/modules/SalesSummary/types.d.ts +9 -1
- package/lib/modules/SalesSummary/utils.d.ts +3 -22
- package/lib/modules/SalesSummary/utils.js +616 -111
- package/lib/modules/Schedule/getDateIsInSchedule.js +14 -7
- package/lib/modules/Schedule/index.d.ts +18 -5
- package/lib/modules/Schedule/index.js +49 -14
- package/lib/modules/Schedule/types.d.ts +2 -0
- package/lib/modules/Summary/index.js +2 -2
- package/lib/modules/SurchargeList/index.d.ts +18 -0
- package/lib/modules/SurchargeList/index.js +95 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/modules/SurchargeList/types.js +5 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +33 -0
- package/lib/plugins/app.d.ts +2 -0
- package/lib/plugins/request.d.ts +1 -0
- package/lib/server/index.d.ts +462 -8
- package/lib/server/index.js +3901 -205
- package/lib/server/modules/floor-plan/index.d.ts +39 -0
- package/lib/server/modules/floor-plan/index.js +306 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/floor-plan/types.js +19 -0
- package/lib/server/modules/index.d.ts +7 -2
- package/lib/server/modules/index.js +21 -0
- package/lib/server/modules/order/index.d.ts +207 -14
- package/lib/server/modules/order/index.js +1324 -141
- package/lib/server/modules/order/types.d.ts +76 -5
- package/lib/server/modules/order/types.js +11 -1
- package/lib/server/modules/order/utils/filterBookings.d.ts +7 -1
- package/lib/server/modules/order/utils/filterBookings.js +119 -11
- package/lib/server/modules/order/utils/filterOrders.js +238 -13
- package/lib/server/modules/payment/index.d.ts +28 -0
- package/lib/server/modules/payment/index.js +168 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/payment/types.js +5 -0
- package/lib/server/modules/products/index.d.ts +105 -14
- package/lib/server/modules/products/index.js +588 -97
- package/lib/server/modules/products/types.d.ts +34 -1
- package/lib/server/modules/products/types.js +3 -0
- package/lib/server/modules/quotation/index.d.ts +39 -0
- package/lib/server/modules/quotation/index.js +145 -1
- package/lib/server/modules/resource/index.d.ts +2 -3
- package/lib/server/modules/resource/index.js +71 -45
- package/lib/server/modules/schedule/index.d.ts +6 -4
- package/lib/server/modules/schedule/index.js +55 -44
- package/lib/server/test.json +713 -0
- package/lib/server/types.d.ts +2 -0
- package/lib/server/utils/product.js +2 -2
- package/lib/server/utils/small-ticket.d.ts +71 -0
- package/lib/server/utils/small-ticket.js +926 -0
- package/lib/solution/BaseSales/index.d.ts +378 -0
- package/lib/solution/BaseSales/index.js +2367 -0
- package/lib/solution/BaseSales/types.d.ts +394 -0
- package/lib/solution/BaseSales/types.js +47 -0
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +287 -0
- package/lib/solution/BaseSales/utils/cartPromotion.js +1155 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +144 -0
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +140 -0
- package/lib/solution/BaseSales/utils/quotationPrice.d.ts +18 -0
- package/lib/solution/BaseSales/utils/quotationPrice.js +231 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +63 -0
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +215 -0
- package/lib/solution/BaseSales/utils.d.ts +40 -0
- package/lib/solution/BaseSales/utils.js +259 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +394 -25
- package/lib/solution/BookingTicket/index.js +1350 -76
- package/lib/solution/BookingTicket/types.d.ts +191 -6
- package/lib/solution/BookingTicket/types.js +71 -10
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +117 -0
- package/lib/solution/BookingTicket/utils/addProductDecision.js +353 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.d.ts +35 -0
- package/lib/solution/BookingTicket/utils/addTimeAvailability.js +94 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.js +136 -0
- package/lib/solution/BookingTicket/utils/cartView.d.ts +29 -0
- package/lib/solution/BookingTicket/utils/cartView.js +200 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/exampleData.js +185 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/orderCustomer.js +35 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.js +387 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +36 -0
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +220 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +4 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +24 -3
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +32 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.js +64 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +4 -2
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +5 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.js +115 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.d.ts +23 -0
- package/lib/solution/BookingTicket/utils/sessionCatalogStale.js +83 -0
- package/lib/solution/Checkout/index.d.ts +1 -0
- package/lib/solution/Checkout/index.js +18 -19
- package/lib/solution/Checkout/utils/index.js +4 -4
- package/lib/solution/RegisterAndLogin/config.js +2 -10
- package/lib/solution/Sales/index.d.ts +50 -5
- package/lib/solution/Sales/index.js +296 -39
- package/lib/solution/Sales/types.d.ts +26 -2
- package/lib/solution/ScanOrder/index.d.ts +27 -21
- package/lib/solution/ScanOrder/index.js +144 -103
- package/lib/solution/ScanOrder/types.d.ts +33 -11
- package/lib/solution/ScanOrder/types.js +4 -5
- package/lib/solution/ScanOrder/utils.d.ts +4 -1
- package/lib/solution/ScanOrder/utils.js +98 -26
- package/lib/solution/ShopDiscount/index.js +3 -3
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1050 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +14 -0
- package/lib/solution/VenueBooking/index.d.ts +29 -20
- package/lib/solution/VenueBooking/index.js +169 -94
- package/lib/solution/VenueBooking/sales-section-4-annotated.json +0 -2
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +6 -0
- package/lib/solution/VenueBooking/utils/slotMerge.js +9 -3
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +22 -0
- package/lib/types/index.d.ts +11 -1
- package/package.json +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +0 -1
- package/lib/solution/Checkout/appointmentDemo.json +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyGlobalScan = applyGlobalScan;
|
|
7
|
+
var _addProductDecision = require("../addProductDecision");
|
|
8
|
+
var _cartView = require("../cartView");
|
|
9
|
+
var _scanProductValues = require("./scanProductValues");
|
|
10
|
+
/** applyGlobalScan 所需的 BookingTicket 运行时能力 */
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 处理单条扫码商品的加车决策(含弹窗链)。
|
|
14
|
+
*/
|
|
15
|
+
async function processScannedProductItem(host, item, code, bridge) {
|
|
16
|
+
const ctx = host.buildAddProductCtx();
|
|
17
|
+
if ((0, _scanProductValues.isScanProductBundle)(item) || (0, _scanProductValues.isScanProductOption)(item)) {
|
|
18
|
+
return runRequiresDetailFlow(host, item, ctx, bridge);
|
|
19
|
+
}
|
|
20
|
+
if ((0, _scanProductValues.countScanVariantMatches)(item, code) >= 2) {
|
|
21
|
+
return runRequiresDetailFlow(host, item, ctx, bridge);
|
|
22
|
+
}
|
|
23
|
+
const values = (0, _scanProductValues.genScanProductValues)(item, code);
|
|
24
|
+
const itemWithSelection = {
|
|
25
|
+
...item,
|
|
26
|
+
cartDetailValue: values
|
|
27
|
+
};
|
|
28
|
+
const decision = host.decideAddProduct(itemWithSelection, ctx);
|
|
29
|
+
return runAddProductDecision(host, item, decision, ctx, bridge);
|
|
30
|
+
}
|
|
31
|
+
async function runRequiresDetailFlow(host, item, ctx, bridge) {
|
|
32
|
+
if (!bridge?.openProductDetail) {
|
|
33
|
+
return 'pending';
|
|
34
|
+
}
|
|
35
|
+
const payload = (0, _addProductDecision.buildRequiresDetailPayload)(item, ctx);
|
|
36
|
+
const detailResult = await bridge.openProductDetail(payload);
|
|
37
|
+
if (!detailResult) {
|
|
38
|
+
return 'cancelled';
|
|
39
|
+
}
|
|
40
|
+
if (!bridge.confirmDetail) {
|
|
41
|
+
return 'pending';
|
|
42
|
+
}
|
|
43
|
+
await bridge.confirmDetail({
|
|
44
|
+
item: payload.productData ?? payload.item ?? item,
|
|
45
|
+
detailResult
|
|
46
|
+
});
|
|
47
|
+
return 'added';
|
|
48
|
+
}
|
|
49
|
+
async function runAddProductDecision(host, catalogItem, decision, ctx, bridge) {
|
|
50
|
+
if (decision.action === 'reloadCatalog') {
|
|
51
|
+
return 'cancelled';
|
|
52
|
+
}
|
|
53
|
+
if (decision.action === 'add') {
|
|
54
|
+
const transformed = host.transformDetailToProductAndBooking({
|
|
55
|
+
item: catalogItem,
|
|
56
|
+
cacheItem: decision.cacheItem,
|
|
57
|
+
options: ctx
|
|
58
|
+
});
|
|
59
|
+
await host.addProductToOrder(transformed.product, transformed.booking);
|
|
60
|
+
return 'added';
|
|
61
|
+
}
|
|
62
|
+
if (decision.action === 'requiresDetail') {
|
|
63
|
+
return runRequiresDetailFlow(host, catalogItem, ctx, bridge);
|
|
64
|
+
}
|
|
65
|
+
if (decision.action === 'requiresBookingEdit') {
|
|
66
|
+
if (!bridge?.openBookingEdit) {
|
|
67
|
+
return 'pending';
|
|
68
|
+
}
|
|
69
|
+
const edited = await bridge.openBookingEdit(decision.payload);
|
|
70
|
+
if (!edited) {
|
|
71
|
+
return 'cancelled';
|
|
72
|
+
}
|
|
73
|
+
if (!bridge.confirmBookingEdit) {
|
|
74
|
+
return 'pending';
|
|
75
|
+
}
|
|
76
|
+
await bridge.confirmBookingEdit({
|
|
77
|
+
cacheItem: edited
|
|
78
|
+
});
|
|
79
|
+
return 'added';
|
|
80
|
+
}
|
|
81
|
+
return 'pending';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 应用全局扫码格式化结果:设客户 / 加车 / 开单 / 弹窗链。
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const result = await applyGlobalScan(bookingTicket, formatted, bridge);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
async function applyGlobalScan(host, formatted, bridge) {
|
|
93
|
+
const {
|
|
94
|
+
searchType,
|
|
95
|
+
data,
|
|
96
|
+
scanCode
|
|
97
|
+
} = formatted;
|
|
98
|
+
if (searchType === 'wallet') {
|
|
99
|
+
if (!data) {
|
|
100
|
+
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
101
|
+
return {
|
|
102
|
+
status: 'failed',
|
|
103
|
+
reason: 'invalid_data'
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
host.setOrderCustomer(data);
|
|
107
|
+
bridge?.onNotify?.('success', 'pisell2.text.add-client-success');
|
|
108
|
+
return {
|
|
109
|
+
status: 'success',
|
|
110
|
+
kind: 'customer'
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (searchType === 'walletPass') {
|
|
114
|
+
if (!data) {
|
|
115
|
+
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
116
|
+
return {
|
|
117
|
+
status: 'failed',
|
|
118
|
+
reason: 'invalid_data'
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const snapshot = host.getOrderCustomerSnapshot();
|
|
122
|
+
const scannedCustomerIsWalkIn = (0, _cartView.isWalkInCustomer)(data);
|
|
123
|
+
if ((0, _cartView.isWalkInCustomer)(snapshot) || scannedCustomerIsWalkIn) {
|
|
124
|
+
// 当前购物车或 walletPass 绑定客户为 walk-in 时不绑客户,避免覆盖已有下单客户。
|
|
125
|
+
if (!bridge?.applyPromotionCode) {
|
|
126
|
+
return {
|
|
127
|
+
status: 'failed',
|
|
128
|
+
reason: 'no_bridge'
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const result = await bridge.applyPromotionCode(scanCode);
|
|
132
|
+
if (result?.isAvailable) {
|
|
133
|
+
return {
|
|
134
|
+
status: 'success',
|
|
135
|
+
kind: 'promotion'
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
status: 'failed',
|
|
140
|
+
reason: 'invalid_data'
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
host.setOrderCustomer(data);
|
|
144
|
+
bridge?.onNotify?.('success', 'pisell2.text.add-client-success');
|
|
145
|
+
return {
|
|
146
|
+
status: 'success',
|
|
147
|
+
kind: 'customer'
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (searchType === 'product' || searchType === 'local_product') {
|
|
151
|
+
const list = data?.list;
|
|
152
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
153
|
+
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
154
|
+
return {
|
|
155
|
+
status: 'failed',
|
|
156
|
+
reason: 'invalid_data'
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
let addedCount = 0;
|
|
160
|
+
for (const item of list) {
|
|
161
|
+
const outcome = await processScannedProductItem(host, item, scanCode, bridge);
|
|
162
|
+
if (outcome === 'added') {
|
|
163
|
+
addedCount += 1;
|
|
164
|
+
}
|
|
165
|
+
if (outcome === 'cancelled') {
|
|
166
|
+
return {
|
|
167
|
+
status: 'cancelled'
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
if (outcome === 'pending') {
|
|
171
|
+
return {
|
|
172
|
+
status: 'pending',
|
|
173
|
+
kind: 'requiresDetail'
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (addedCount > 0) {
|
|
178
|
+
bridge?.onNotify?.('success');
|
|
179
|
+
return {
|
|
180
|
+
status: 'success',
|
|
181
|
+
kind: 'products',
|
|
182
|
+
meta: {
|
|
183
|
+
count: addedCount
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
188
|
+
status: 'failed',
|
|
189
|
+
reason: 'no_bridge'
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (searchType === 'order') {
|
|
193
|
+
const orderId = data?.order_id ?? data?.id;
|
|
194
|
+
if (!orderId) {
|
|
195
|
+
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
196
|
+
return {
|
|
197
|
+
status: 'failed',
|
|
198
|
+
reason: 'invalid_data'
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (!bridge?.openOrder) {
|
|
202
|
+
return {
|
|
203
|
+
status: 'pending',
|
|
204
|
+
kind: 'openOrder'
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
bridge.openOrder({
|
|
208
|
+
order_id: Number(orderId),
|
|
209
|
+
business_code: data?.business_code ?? host.getBusinessCode()
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
status: 'pending',
|
|
213
|
+
kind: 'openOrder'
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
status: 'failed',
|
|
218
|
+
reason: 'invalid_data'
|
|
219
|
+
};
|
|
220
|
+
}
|
|
@@ -20,3 +20,7 @@ export declare const searchProduct: (request: RequestPlugin, code: string) => Pr
|
|
|
20
20
|
searchType: string;
|
|
21
21
|
response: any;
|
|
22
22
|
}>;
|
|
23
|
+
export declare const searchOrder: (request: RequestPlugin, code: string) => Promise<{
|
|
24
|
+
searchType: string;
|
|
25
|
+
response: any;
|
|
26
|
+
}>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.searchWalletPass = exports.searchWallet = exports.searchProduct = void 0;
|
|
6
|
+
exports.searchWalletPass = exports.searchWallet = exports.searchProduct = exports.searchOrder = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* 搜索通用识别码
|
|
9
9
|
*/
|
|
@@ -81,7 +81,7 @@ const searchProduct = async (request, code) => {
|
|
|
81
81
|
skip: 1,
|
|
82
82
|
num: 20,
|
|
83
83
|
status: 'published',
|
|
84
|
-
with: ['variantGroup'],
|
|
84
|
+
with: ['variantGroup.variantItem', 'optionGroup.optionItem'],
|
|
85
85
|
with_count: ['bundleGroup', 'optionGroup'],
|
|
86
86
|
exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item']
|
|
87
87
|
};
|
|
@@ -98,4 +98,25 @@ const searchProduct = async (request, code) => {
|
|
|
98
98
|
throw error;
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
exports.searchProduct = searchProduct;
|
|
101
|
+
exports.searchProduct = searchProduct;
|
|
102
|
+
const searchOrder = async (request, code) => {
|
|
103
|
+
try {
|
|
104
|
+
// 注意 下面这段由于 pisellos: server/index 的特性,可能转发到本地去数据库查询
|
|
105
|
+
const res = await request?.get(`/order/sales/${code}`, {
|
|
106
|
+
lookup_mode: 'multi'
|
|
107
|
+
}, {
|
|
108
|
+
customToast: () => {},
|
|
109
|
+
osServer: true
|
|
110
|
+
});
|
|
111
|
+
if (res?.code == 200 && !!res?.data) {
|
|
112
|
+
return {
|
|
113
|
+
searchType: 'order',
|
|
114
|
+
response: res
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
throw new Error('没有找到对应的识别码');
|
|
118
|
+
} catch (error) {
|
|
119
|
+
throw error;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
exports.searchOrder = searchOrder;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
|
|
3
|
+
*/
|
|
4
|
+
export type GlobalScanSearchType = 'customer' | 'wallet' | 'walletPass' | 'product' | 'local_product' | 'order';
|
|
5
|
+
export interface GlobalScanFormattedResult {
|
|
6
|
+
searchType: GlobalScanSearchType;
|
|
7
|
+
data: any;
|
|
8
|
+
scanCode: string;
|
|
9
|
+
}
|
|
10
|
+
interface RawScanSearchResult {
|
|
11
|
+
searchType?: GlobalScanSearchType;
|
|
12
|
+
response?: {
|
|
13
|
+
status?: boolean;
|
|
14
|
+
code?: number;
|
|
15
|
+
message?: string;
|
|
16
|
+
data?: any;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const formatted = formatGlobalScanResult(
|
|
25
|
+
* { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
|
|
26
|
+
* 'WL123',
|
|
27
|
+
* );
|
|
28
|
+
* // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatGlobalScanResult(raw: RawScanSearchResult | null | undefined, scanCode: string): GlobalScanFormattedResult | null;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatGlobalScanResult = formatGlobalScanResult;
|
|
7
|
+
/**
|
|
8
|
+
* 全局扫码搜索结果格式化(对齐 ticketBooking `formatScanGlobal`)。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 将 handleGlobalScan 返回的原始结构格式化为 UI/OS 统一结构。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const formatted = formatGlobalScanResult(
|
|
17
|
+
* { searchType: 'wallet', response: { code: 200, data: { customer: {...} } } },
|
|
18
|
+
* 'WL123',
|
|
19
|
+
* );
|
|
20
|
+
* // => { searchType: 'wallet', data: customerObj, scanCode: 'WL123' }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
function formatGlobalScanResult(raw, scanCode) {
|
|
24
|
+
if (!raw?.searchType) return null;
|
|
25
|
+
const {
|
|
26
|
+
searchType
|
|
27
|
+
} = raw;
|
|
28
|
+
const {
|
|
29
|
+
data: resultData,
|
|
30
|
+
code
|
|
31
|
+
} = raw.response || {};
|
|
32
|
+
if (code !== 200 && searchType !== 'local_product') {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (searchType === 'wallet') {
|
|
36
|
+
return {
|
|
37
|
+
searchType,
|
|
38
|
+
data: resultData?.customer,
|
|
39
|
+
scanCode
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (searchType === 'walletPass') {
|
|
43
|
+
return {
|
|
44
|
+
searchType,
|
|
45
|
+
data: resultData?.[0]?.customer,
|
|
46
|
+
scanCode
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (searchType === 'product' || searchType === 'local_product') {
|
|
50
|
+
return {
|
|
51
|
+
searchType,
|
|
52
|
+
data: resultData,
|
|
53
|
+
scanCode
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (searchType === 'order') {
|
|
57
|
+
return {
|
|
58
|
+
searchType,
|
|
59
|
+
data: resultData,
|
|
60
|
+
scanCode
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
@@ -2,9 +2,11 @@ import { RequestPlugin } from '../../../../plugins';
|
|
|
2
2
|
/**
|
|
3
3
|
* 处理全局扫码
|
|
4
4
|
* @param request 请求插件
|
|
5
|
+
* @param localSearch 本地商品搜索
|
|
6
|
+
* @param channel 当前销售渠道
|
|
5
7
|
* @returns 处理结果
|
|
6
8
|
*/
|
|
7
|
-
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[]) => (scanResult: {
|
|
9
|
+
export declare const handleGlobalScan: (request: RequestPlugin, localSearch: (v: string) => any[], channel?: string) => (scanResult: {
|
|
8
10
|
type: string;
|
|
9
11
|
value: string;
|
|
10
12
|
}) => Promise<any>;
|
|
@@ -96,16 +96,18 @@ const handleScanFn = (getRequestList, localSearch) => {
|
|
|
96
96
|
/**
|
|
97
97
|
* 处理全局扫码
|
|
98
98
|
* @param request 请求插件
|
|
99
|
+
* @param localSearch 本地商品搜索
|
|
100
|
+
* @param channel 当前销售渠道
|
|
99
101
|
* @returns 处理结果
|
|
100
102
|
*/
|
|
101
|
-
const handleGlobalScan = (request, localSearch) => {
|
|
103
|
+
const handleGlobalScan = (request, localSearch, channel) => {
|
|
102
104
|
const getRequestList = value => {
|
|
103
105
|
let requestList = [];
|
|
104
106
|
// 如果value是已WL开头的,则认为是钱包识别码
|
|
105
107
|
if (value.startsWith('WL')) {
|
|
106
108
|
requestList = [(0, _cloudSearch.searchWallet)(request, value)];
|
|
107
109
|
} else {
|
|
108
|
-
requestList = [(0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
|
|
110
|
+
requestList = [...(channel === 'kiosk' ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
|
|
109
111
|
}
|
|
110
112
|
return requestList;
|
|
111
113
|
};
|
|
@@ -14,12 +14,17 @@ declare enum ScanResultType {
|
|
|
14
14
|
NativeScanner = "nativeScanner"
|
|
15
15
|
}
|
|
16
16
|
export default class Scan {
|
|
17
|
+
private static scanInstances;
|
|
18
|
+
private static peripheralsListenerMounted;
|
|
17
19
|
private solution;
|
|
18
20
|
private watchKey;
|
|
19
21
|
private listenerConfig;
|
|
20
22
|
constructor(solution: BookingTicketImpl, watchKey: string);
|
|
21
23
|
/**
|
|
22
24
|
* 初始化外设扫码结果监听
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* scan.initPeripheralsListener();
|
|
23
28
|
*/
|
|
24
29
|
initPeripheralsListener(): void;
|
|
25
30
|
/**
|
|
@@ -14,12 +14,15 @@ var ScanResultType = /*#__PURE__*/function (ScanResultType) {
|
|
|
14
14
|
return ScanResultType;
|
|
15
15
|
}(ScanResultType || {});
|
|
16
16
|
class Scan {
|
|
17
|
+
static scanInstances = new Set();
|
|
18
|
+
static peripheralsListenerMounted = false;
|
|
17
19
|
solution;
|
|
18
20
|
watchKey;
|
|
19
21
|
listenerConfig = new Map();
|
|
20
22
|
constructor(solution, watchKey) {
|
|
21
23
|
this.solution = solution;
|
|
22
24
|
this.watchKey = watchKey;
|
|
25
|
+
Scan.scanInstances.add(this);
|
|
23
26
|
|
|
24
27
|
// 初始化扫码监听
|
|
25
28
|
// this.initPeripheralsListener();
|
|
@@ -27,12 +30,19 @@ class Scan {
|
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* 初始化外设扫码结果监听
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* scan.initPeripheralsListener();
|
|
30
36
|
*/
|
|
31
37
|
initPeripheralsListener() {
|
|
38
|
+
if (Scan.peripheralsListenerMounted) return;
|
|
39
|
+
Scan.peripheralsListenerMounted = true;
|
|
32
40
|
this.solution?.window?.interaction?.utils?.mountFunction?.('global', 'peripheralsResult', strVal => {
|
|
33
41
|
try {
|
|
34
42
|
const result = JSON.parse(strVal);
|
|
35
|
-
|
|
43
|
+
Scan.scanInstances.forEach(instance => {
|
|
44
|
+
instance.handleScan(result);
|
|
45
|
+
});
|
|
36
46
|
} catch (err) {
|
|
37
47
|
console.error(err);
|
|
38
48
|
}
|
|
@@ -49,8 +59,9 @@ class Scan {
|
|
|
49
59
|
if (lastEnableEventKey) {
|
|
50
60
|
const listenerConfig = this.listenerConfig.get(lastEnableEventKey);
|
|
51
61
|
if (listenerConfig) {
|
|
62
|
+
const taskUuid = this.generateUuid();
|
|
52
63
|
listenerConfig.task.addTask({
|
|
53
|
-
uuid:
|
|
64
|
+
uuid: taskUuid,
|
|
54
65
|
type: lastEnableEventKey,
|
|
55
66
|
actionParams: {
|
|
56
67
|
scanResult: result
|
|
@@ -108,6 +119,7 @@ class Scan {
|
|
|
108
119
|
* 移除所有监听
|
|
109
120
|
*/
|
|
110
121
|
removeAllListeners() {
|
|
122
|
+
Scan.scanInstances.delete(this);
|
|
111
123
|
_watch.default.clearEvent(this.watchKey);
|
|
112
124
|
this.listenerConfig?.forEach?.(item => {
|
|
113
125
|
item?.task?.clear();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 扫码商品条码预选规格纯函数(对齐 ticketBooking addServiceVariant/utils)。
|
|
3
|
+
*/
|
|
4
|
+
/** 套餐商品 */
|
|
5
|
+
export declare function isScanProductBundle(item: any): boolean;
|
|
6
|
+
/** 单规格 / 选项组商品 */
|
|
7
|
+
export declare function isScanProductOption(item: any): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 根据条码匹配 variant,生成 cartDetailValue(对齐 ticketBooking `genValues`)。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const values = genScanProductValues(catalogItem, '6901234567890');
|
|
14
|
+
* const itemWithSelection = { ...catalogItem, cartDetailValue: values };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function genScanProductValues(item: any, code: string): Record<string, any>;
|
|
18
|
+
/**
|
|
19
|
+
* 统计条码命中的 variant 数量(多命中时需弹窗选择)。
|
|
20
|
+
*/
|
|
21
|
+
export declare function countScanVariantMatches(item: any, code: string): number;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.countScanVariantMatches = countScanVariantMatches;
|
|
7
|
+
exports.genScanProductValues = genScanProductValues;
|
|
8
|
+
exports.isScanProductBundle = isScanProductBundle;
|
|
9
|
+
exports.isScanProductOption = isScanProductOption;
|
|
10
|
+
/**
|
|
11
|
+
* 扫码商品条码预选规格纯函数(对齐 ticketBooking addServiceVariant/utils)。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** 套餐商品 */
|
|
15
|
+
function isScanProductBundle(item) {
|
|
16
|
+
return (item?.bundle_group_count || 0) > 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** 单规格 / 选项组商品 */
|
|
20
|
+
function isScanProductOption(item) {
|
|
21
|
+
return (item?.option_group_count || 0) > 0 || (item?.option_group?.length || 0) > 0;
|
|
22
|
+
}
|
|
23
|
+
function formatVariantGroupTitle(title, variantGroup = []) {
|
|
24
|
+
try {
|
|
25
|
+
return variantGroup.map(group => {
|
|
26
|
+
const value = title?.[group?.position_id];
|
|
27
|
+
return value ? `${group?.name || '-'}: ${value}` : '';
|
|
28
|
+
}).filter(Boolean).join(', ');
|
|
29
|
+
} catch {
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function formatDataKey(data) {
|
|
34
|
+
const next = {
|
|
35
|
+
...data
|
|
36
|
+
};
|
|
37
|
+
let key = `${next.product_id}`;
|
|
38
|
+
let rowKey = key;
|
|
39
|
+
if (next.product_variant_id) {
|
|
40
|
+
const str = `_${next.product_variant_id}`;
|
|
41
|
+
key += str;
|
|
42
|
+
rowKey += str;
|
|
43
|
+
}
|
|
44
|
+
if (next?.option?.length) {
|
|
45
|
+
for (const item of next.option) {
|
|
46
|
+
const str = `_${item.option_group_id}_${item.product_option_item_id}`;
|
|
47
|
+
key += str;
|
|
48
|
+
rowKey += `${str}_${item.quantity || item.num}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (next?.bundle?.length) {
|
|
52
|
+
for (const item of next.bundle) {
|
|
53
|
+
let str = `_${item.group_id}_${item.bundle_product_id}`;
|
|
54
|
+
key += str;
|
|
55
|
+
rowKey += `${str}_${item.quantity || item.num}`;
|
|
56
|
+
if (item?.option) {
|
|
57
|
+
for (const opt of item.option) {
|
|
58
|
+
const optStr = `_${opt.option_group_id}_${opt.product_option_item_id}`;
|
|
59
|
+
key += optStr;
|
|
60
|
+
rowKey += `${optStr}_${opt.quantity || opt.num}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (next?.session) {
|
|
66
|
+
const str = `_${next.session?.key}`;
|
|
67
|
+
key += str;
|
|
68
|
+
rowKey += str;
|
|
69
|
+
}
|
|
70
|
+
if (next?.schedule) {
|
|
71
|
+
const str = `_${next.schedule?.key}`;
|
|
72
|
+
key += str;
|
|
73
|
+
rowKey += str;
|
|
74
|
+
}
|
|
75
|
+
next.key = key;
|
|
76
|
+
next.rowKey = rowKey;
|
|
77
|
+
return next;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 根据条码匹配 variant,生成 cartDetailValue(对齐 ticketBooking `genValues`)。
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const values = genScanProductValues(catalogItem, '6901234567890');
|
|
86
|
+
* const itemWithSelection = { ...catalogItem, cartDetailValue: values };
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
function genScanProductValues(item, code) {
|
|
90
|
+
const params = {
|
|
91
|
+
bundle: [],
|
|
92
|
+
option: [],
|
|
93
|
+
product_id: item.id,
|
|
94
|
+
product_variant_id: 0,
|
|
95
|
+
quantity: 1,
|
|
96
|
+
rowKey: '',
|
|
97
|
+
session: null
|
|
98
|
+
};
|
|
99
|
+
if (item?.variant_group?.length || item?.option_group?.length) {
|
|
100
|
+
const variantItem = (item.variant || []).find(v => v?.code === code || v?.barcode === code);
|
|
101
|
+
if (variantItem) {
|
|
102
|
+
params.price = Number(variantItem?.price || 0);
|
|
103
|
+
params.product_variant_id = variantItem.id;
|
|
104
|
+
params.product_option_string = formatVariantGroupTitle(variantItem?.title, item?.variant_group || []);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return formatDataKey(params);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 统计条码命中的 variant 数量(多命中时需弹窗选择)。
|
|
112
|
+
*/
|
|
113
|
+
function countScanVariantMatches(item, code) {
|
|
114
|
+
return (item?.variant || []).filter(v => v?.code === code || v?.barcode === code).length;
|
|
115
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ProductData } from '../../../modules/Product/types';
|
|
2
|
+
export interface SessionCatalogStaleInfo {
|
|
3
|
+
productId: number | string | null;
|
|
4
|
+
productTitle: string | null;
|
|
5
|
+
sessionDay: string | null;
|
|
6
|
+
timeBarDay: string | null;
|
|
7
|
+
bookingDate: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 判断 session 商品 catalog 中的 session 日历日是否与当前 TimeBar / bookingDate 不一致。
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* isSessionCatalogDateStale(product, '2026-06-05 19:01:18');
|
|
14
|
+
* // session 为 2026-06-04 → true;一致或无 session 快照 → false
|
|
15
|
+
*/
|
|
16
|
+
export declare function isSessionCatalogDateStale(product: ProductData & Record<string, any>, bookingDate: unknown): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 组装 session catalog 日期不一致时的日志 metadata。
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* buildSessionCatalogStaleInfo(product, '2026-06-05 19:01:18');
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildSessionCatalogStaleInfo(product: ProductData & Record<string, any>, bookingDate: unknown): SessionCatalogStaleInfo;
|