@pisell/pisellos 2.3.184 → 2.3.185
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/apis/picoding.d.ts.map +1 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/inventory/index.d.ts +92 -0
- package/dist/inventory/index.d.ts.map +1 -0
- package/dist/inventory/index.js +509 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts.map +1 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts.map +1 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts.map +1 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts.map +1 -0
- package/dist/model/strategy/adapter/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/itemRule/adapter.d.ts.map +1 -0
- package/dist/model/strategy/adapter/itemRule/evaluator.d.ts.map +1 -0
- package/dist/model/strategy/adapter/itemRule/examples.d.ts.map +1 -0
- package/dist/model/strategy/adapter/itemRule/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/itemRule/type.d.ts.map +1 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts.map +1 -0
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts.map +1 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts.map +1 -0
- package/dist/model/strategy/adapter/promotion/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts.map +1 -0
- package/dist/model/strategy/adapter/type.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/evaluator.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/example.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts.map +1 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts.map +1 -0
- package/dist/model/strategy/engine.d.ts.map +1 -0
- package/dist/model/strategy/index.d.ts.map +1 -0
- package/dist/model/strategy/strategy-example.d.ts.map +1 -0
- package/dist/model/strategy/type.d.ts.map +1 -0
- package/dist/modules/Account/index.d.ts.map +1 -0
- package/dist/modules/Account/types.d.ts.map +1 -0
- package/dist/modules/AccountList/index.d.ts.map +1 -0
- package/dist/modules/AccountList/types.d.ts.map +1 -0
- package/dist/modules/AccountList/utils.d.ts.map +1 -0
- package/dist/modules/BaseModule.d.ts.map +1 -0
- package/dist/modules/BookingContext/index.d.ts.map +1 -0
- package/dist/modules/BookingContext/types.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/index.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/productExtend.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/resources.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts.map +1 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts.map +1 -0
- package/dist/modules/BusinessAvailability/index.d.ts.map +1 -0
- package/dist/modules/Cart/index.d.ts.map +1 -0
- package/dist/modules/Cart/types.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartAccount.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartDate.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartDiscount.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartNote.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartProduct.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartRelationForms.d.ts.map +1 -0
- package/dist/modules/Cart/utils/cartResource.d.ts.map +1 -0
- package/dist/modules/Cart/utils/changePrice.d.ts.map +1 -0
- package/dist/modules/Cart/utils/index.d.ts.map +1 -0
- package/dist/modules/Customer/constants.d.ts.map +1 -0
- package/dist/modules/Customer/index.d.ts.map +1 -0
- package/dist/modules/Customer/types.d.ts.map +1 -0
- package/dist/modules/Date/index.d.ts.map +1 -0
- package/dist/modules/Date/types.d.ts.map +1 -0
- package/dist/modules/Date/utils.d.ts.map +1 -0
- package/dist/modules/Discount/availability.d.ts.map +1 -0
- package/dist/modules/Discount/entitlementPass.d.ts.map +1 -0
- package/dist/modules/Discount/index.d.ts.map +1 -0
- package/dist/modules/Discount/index.js +1 -0
- package/dist/modules/Discount/types.d.ts.map +1 -0
- package/dist/modules/FulfillmentTiming/index.d.ts.map +1 -0
- package/dist/modules/FulfillmentTiming/types.d.ts.map +1 -0
- package/dist/modules/Guests/index.d.ts.map +1 -0
- package/dist/modules/Guests/types.d.ts.map +1 -0
- package/dist/modules/Holder/index.d.ts.map +1 -0
- package/dist/modules/Holder/types.d.ts.map +1 -0
- package/dist/modules/Holder/utils.d.ts.map +1 -0
- package/dist/modules/OpenData/contactInfo.d.ts.map +1 -0
- package/dist/modules/OpenData/index.d.ts.map +1 -0
- package/dist/modules/OpenData/salesSettings.d.ts.map +1 -0
- package/dist/modules/OpenData/types.d.ts.map +1 -0
- package/dist/modules/OpenData/utils.d.ts.map +1 -0
- package/dist/modules/Order/holderRelations.d.ts.map +1 -0
- package/dist/modules/Order/index.d.ts +25 -3
- package/dist/modules/Order/index.d.ts.map +1 -0
- package/dist/modules/Order/index.js +1770 -1311
- package/dist/modules/Order/localEftposState.d.ts.map +1 -0
- package/dist/modules/Order/payment-utils.d.ts.map +1 -0
- package/dist/modules/Order/pickupTiming.d.ts.map +1 -0
- package/dist/modules/Order/salesNotes.d.ts.map +1 -0
- package/dist/modules/Order/types.d.ts +7 -0
- package/dist/modules/Order/types.d.ts.map +1 -0
- package/dist/modules/Order/utils/bundleDiscountHydration.d.ts.map +1 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.d.ts.map +1 -0
- package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
- package/dist/modules/Order/utils/manualProductDiscount.d.ts.map +1 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts.map +1 -0
- package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/dist/modules/Order/utils/productVoucherGroups.d.ts.map +1 -0
- package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
- package/dist/modules/Order/utils/virtualSettlement.d.ts.map +1 -0
- package/dist/modules/Order/utils/weighedProduct.d.ts.map +1 -0
- package/dist/modules/Order/utils.d.ts.map +1 -0
- package/dist/modules/Payment/cash.d.ts.map +1 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts.map +1 -0
- package/dist/modules/Payment/eftpos.d.ts.map +1 -0
- package/dist/modules/Payment/index.d.ts.map +1 -0
- package/dist/modules/Payment/mx51.d.ts.map +1 -0
- package/dist/modules/Payment/types.d.ts.map +1 -0
- package/dist/modules/Payment/utils.d.ts.map +1 -0
- package/dist/modules/Payment/walletpass.d.ts.map +1 -0
- package/dist/modules/Product/index.d.ts +1 -1
- package/dist/modules/Product/index.d.ts.map +1 -0
- package/dist/modules/Product/types.d.ts.map +1 -0
- package/dist/modules/Product/utils.d.ts.map +1 -0
- package/dist/modules/ProductList/clientDataVariants.d.ts.map +1 -0
- package/dist/modules/ProductList/index.d.ts.map +1 -0
- package/dist/modules/ProductList/index.js +33 -12
- package/dist/modules/ProductList/types.d.ts.map +1 -0
- package/dist/modules/Quotation/index.d.ts.map +1 -0
- package/dist/modules/Quotation/types.d.ts.map +1 -0
- package/dist/modules/Resource/index.d.ts.map +1 -0
- package/dist/modules/Resource/types.d.ts.map +1 -0
- package/dist/modules/Resource/utils.d.ts.map +1 -0
- package/dist/modules/ResourcePlanner/index.d.ts.map +1 -0
- package/dist/modules/ResourcePlanner/localClock.d.ts.map +1 -0
- package/dist/modules/ResourcePlanner/planner.d.ts.map +1 -0
- package/dist/modules/ResourcePlanner/types.d.ts.map +1 -0
- package/dist/modules/Rules/index.d.ts +2 -0
- package/dist/modules/Rules/index.d.ts.map +1 -0
- package/dist/modules/Rules/index.js +29 -21
- package/dist/modules/Rules/promotionSelection.d.ts.map +1 -0
- package/dist/modules/Rules/types.d.ts.map +1 -0
- package/dist/modules/SalesSummary/index.d.ts.map +1 -0
- package/dist/modules/SalesSummary/types.d.ts.map +1 -0
- package/dist/modules/SalesSummary/utils.d.ts.map +1 -0
- package/dist/modules/ScanOrderLogger/index.d.ts.map +1 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts.map +1 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts.map +1 -0
- package/dist/modules/ScanOrderLogger/types.d.ts.map +1 -0
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts.map +1 -0
- package/dist/modules/Schedule/index.d.ts.map +1 -0
- package/dist/modules/Schedule/type.d.ts.map +1 -0
- package/dist/modules/Schedule/types.d.ts.map +1 -0
- package/dist/modules/Schedule/utils.d.ts.map +1 -0
- package/dist/modules/Step/index.d.ts.map +1 -0
- package/dist/modules/Step/tyeps.d.ts.map +1 -0
- package/dist/modules/Summary/index.d.ts.map +1 -0
- package/dist/modules/Summary/types.d.ts.map +1 -0
- package/dist/modules/Summary/utils.d.ts.map +1 -0
- package/dist/modules/SurchargeList/index.d.ts.map +1 -0
- package/dist/modules/SurchargeList/types.d.ts.map +1 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/plugins/app.d.ts.map +1 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/request.d.ts.map +1 -0
- package/dist/plugins/shopStore.d.ts.map +1 -0
- package/dist/plugins/user.d.ts.map +1 -0
- package/dist/plugins/window.d.ts.map +1 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/modules/floor-plan/index.d.ts.map +1 -0
- package/dist/server/modules/floor-plan/types.d.ts.map +1 -0
- package/dist/server/modules/form/index.d.ts.map +1 -0
- package/dist/server/modules/form/types.d.ts.map +1 -0
- package/dist/server/modules/index.d.ts.map +1 -0
- package/dist/server/modules/menu/index.d.ts.map +1 -0
- package/dist/server/modules/menu/types.d.ts.map +1 -0
- package/dist/server/modules/order/index.d.ts.map +1 -0
- package/dist/server/modules/order/types.d.ts.map +1 -0
- package/dist/server/modules/order/utils/filterBookings.d.ts.map +1 -0
- package/dist/server/modules/order/utils/filterOrders.d.ts.map +1 -0
- package/dist/server/modules/payment/index.d.ts.map +1 -0
- package/dist/server/modules/payment/types.d.ts.map +1 -0
- package/dist/server/modules/products/index.d.ts.map +1 -0
- package/dist/server/modules/products/replication.d.ts.map +1 -0
- package/dist/server/modules/products/types.d.ts.map +1 -0
- package/dist/server/modules/quotation/index.d.ts.map +1 -0
- package/dist/server/modules/quotation/types.d.ts.map +1 -0
- package/dist/server/modules/resource/index.d.ts.map +1 -0
- package/dist/server/modules/resource/types.d.ts.map +1 -0
- package/dist/server/modules/schedule/index.d.ts.map +1 -0
- package/dist/server/modules/schedule/types.d.ts.map +1 -0
- package/dist/server/modules/schedule/utils.d.ts.map +1 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils/index.d.ts.map +1 -0
- package/dist/server/utils/product.d.ts.map +1 -0
- package/dist/server/utils/schedule.d.ts.map +1 -0
- package/dist/server/utils/small-ticket.d.ts.map +1 -0
- package/dist/server/utils/time.d.ts.map +1 -0
- package/dist/shared/payment/loadPaymentMethods.d.ts.map +1 -0
- package/dist/shared/receipt/customerInvoiceLanguages.d.ts.map +1 -0
- package/dist/shared/receipt/loadCustomerInvoiceLayout.d.ts.map +1 -0
- package/dist/shared/receipt/small-ticket.d.ts.map +1 -0
- package/dist/shared/receipt/templateVisibility.d.ts.map +1 -0
- package/dist/shared/sales/loadSalesOrderSnapshot.d.ts.map +1 -0
- package/dist/solution/BaseSales/fulfillmentItemRules.d.ts.map +1 -0
- package/dist/solution/BaseSales/index.d.ts +17 -1
- package/dist/solution/BaseSales/index.d.ts.map +1 -0
- package/dist/solution/BaseSales/index.js +1611 -1372
- package/dist/solution/BaseSales/pickupTiming.d.ts.map +1 -0
- package/dist/solution/BaseSales/types.d.ts.map +1 -0
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts.map +1 -0
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts.map +1 -0
- package/dist/solution/BaseSales/utils/quotationPrice.d.ts.map +1 -0
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts.map +1 -0
- package/dist/solution/BaseSales/utils.d.ts.map +1 -0
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingByStep/index.d.ts.map +1 -0
- package/dist/solution/BookingByStep/types.d.ts.map +1 -0
- package/dist/solution/BookingByStep/utils/capacity.d.ts.map +1 -0
- package/dist/solution/BookingByStep/utils/products.d.ts.map +1 -0
- package/dist/solution/BookingByStep/utils/resources.d.ts.map +1 -0
- package/dist/solution/BookingByStep/utils/stock.d.ts.map +1 -0
- package/dist/solution/BookingByStep/utils/timeslots.d.ts.map +1 -0
- package/dist/solution/BookingTicket/index.d.ts +13 -1
- package/dist/solution/BookingTicket/index.d.ts.map +1 -0
- package/dist/solution/BookingTicket/index.js +197 -108
- package/dist/solution/BookingTicket/types.d.ts +14 -2
- package/dist/solution/BookingTicket/types.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/dist/solution/BookingTicket/utils/addProductDecision.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/dist/solution/BookingTicket/utils/addTimeAvailability.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/cartView.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/orderCustomer.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/dist/solution/BookingTicket/utils/scan/index.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/sessionCatalogStale.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts.map +1 -0
- package/dist/solution/BuyTickets/index.d.ts.map +1 -0
- package/dist/solution/BuyTickets/types.d.ts.map +1 -0
- package/dist/solution/Checkout/index.d.ts.map +1 -0
- package/dist/solution/Checkout/types.d.ts.map +1 -0
- package/dist/solution/Checkout/utils/index.d.ts.map +1 -0
- package/dist/solution/OrderInvoicePreview/index.d.ts.map +1 -0
- package/dist/solution/PlaceOrder/index.d.ts.map +1 -0
- package/dist/solution/RegisterAndLogin/config.d.ts.map +1 -0
- package/dist/solution/RegisterAndLogin/index.d.ts.map +1 -0
- package/dist/solution/RegisterAndLogin/types.d.ts.map +1 -0
- package/dist/solution/RegisterAndLogin/utils.d.ts.map +1 -0
- package/dist/solution/Sales/index.d.ts.map +1 -0
- package/dist/solution/Sales/types.d.ts.map +1 -0
- package/dist/solution/ScanOrder/index.d.ts.map +1 -0
- package/dist/solution/ScanOrder/menuAvailability.d.ts.map +1 -0
- package/dist/solution/ScanOrder/types.d.ts.map +1 -0
- package/dist/solution/ScanOrder/utils.d.ts.map +1 -0
- package/dist/solution/ShopDiscount/index.d.ts.map +1 -0
- package/dist/solution/ShopDiscount/types.d.ts.map +1 -0
- package/dist/solution/ShopDiscount/utils.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/businessAvailability.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/index.js +79 -59
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/salesSettings.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts.map +1 -0
- package/dist/solution/VenueBooking/index.d.ts.map +1 -0
- package/dist/solution/VenueBooking/types.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils/dateSummary.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils/resource.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils/smartPricing.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils/timeSlot.d.ts.map +1 -0
- package/dist/solution/VenueBooking/utils.d.ts.map +1 -0
- package/dist/solution/index.d.ts.map +1 -0
- package/dist/store/createStore.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/os-private-payload.d.ts.map +1 -0
- package/dist/utils/payment-number.d.ts.map +1 -0
- package/dist/utils/platform.d.ts +2 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +6 -0
- package/dist/utils/task.d.ts.map +1 -0
- package/dist/utils/watch.d.ts.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/inventory/index.d.ts +92 -0
- package/lib/inventory/index.js +287 -0
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Order/index.d.ts +25 -3
- package/lib/modules/Order/index.js +192 -38
- package/lib/modules/Order/types.d.ts +7 -0
- package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
- package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
- package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
- package/lib/modules/Product/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +15 -0
- package/lib/modules/Rules/index.d.ts +2 -0
- package/lib/modules/Rules/index.js +6 -0
- package/lib/solution/BaseSales/index.d.ts +17 -1
- package/lib/solution/BaseSales/index.js +119 -14
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +13 -1
- package/lib/solution/BookingTicket/index.js +37 -2
- package/lib/solution/BookingTicket/types.d.ts +14 -2
- package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +1 -1
- package/lib/solution/BookingTicket/utils/addProductDecision.js +4 -3
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.js +14 -3
- package/lib/utils/platform.d.ts +2 -0
- package/lib/utils/platform.js +7 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InventoryController, type CheckoutRuntimeSnapshot } from '../../inventory';
|
|
1
2
|
import { Module, ModuleOptions, PisellCore } from '../../types';
|
|
2
3
|
import { BaseModule } from '../../modules/BaseModule';
|
|
3
4
|
import { type LocalEftposFinalization } from '../../modules/Order/localEftposState';
|
|
@@ -52,6 +53,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
52
53
|
protected appPlugin: AppPlugin;
|
|
53
54
|
protected store: BaseSalesState;
|
|
54
55
|
protected otherParams: Record<string, any>;
|
|
56
|
+
getInventory(): InventoryController | undefined;
|
|
57
|
+
prepareCheckout(signal?: AbortSignal): Promise<CheckoutRuntimeSnapshot | undefined>;
|
|
55
58
|
protected cacheId: string | undefined;
|
|
56
59
|
/**
|
|
57
60
|
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
@@ -66,6 +69,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
66
69
|
request: RequestPlugin;
|
|
67
70
|
protected currentSalesDetail: ISalesDetail | null;
|
|
68
71
|
protected discountConfigCacheKey: string | null;
|
|
72
|
+
private discountConfigPrepareInFlight;
|
|
69
73
|
protected hasManualDiscountSelection: boolean;
|
|
70
74
|
private readonly reusedSharedSubModuleNames;
|
|
71
75
|
private paymentMethodsCache;
|
|
@@ -194,6 +198,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
194
198
|
* 可覆盖此方法并把未识别的 name 委托给 `super.createSubModule(name)`。
|
|
195
199
|
*/
|
|
196
200
|
protected createSubModule(moduleName: string): Module | null;
|
|
201
|
+
private inventoryOrderHooks?;
|
|
197
202
|
protected getSubModuleHooks(moduleName: string): any;
|
|
198
203
|
/**
|
|
199
204
|
* 构造传给 BaseSales 子模块的完整运行态参数,保证初始化和后续同步语义一致。
|
|
@@ -231,7 +236,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
231
236
|
private isActiveVirtualSettlementOrder;
|
|
232
237
|
private isHistoricalVirtualSettlementOrder;
|
|
233
238
|
private syncAppDataToTempOrder;
|
|
239
|
+
private initialization?;
|
|
240
|
+
/** Hosts can await readiness without changing Core's synchronous registration API. */
|
|
241
|
+
whenInitialized(): Promise<void>;
|
|
234
242
|
initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
|
|
243
|
+
private initializeSalesRuntime;
|
|
235
244
|
destroy(): Promise<void>;
|
|
236
245
|
/**
|
|
237
246
|
* 加载销售订单到统一 tempOrder 工作区。
|
|
@@ -340,7 +349,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
340
349
|
discountList: Discount[];
|
|
341
350
|
originalDiscountList?: Discount[];
|
|
342
351
|
}): Promise<void>;
|
|
343
|
-
scanPromotionCode(code: string, customerId?: number
|
|
352
|
+
scanPromotionCode(code: string, customerId?: number, options?: {
|
|
353
|
+
productVouchersOnly?: boolean;
|
|
354
|
+
}): Promise<BaseSalesScanCodeResult>;
|
|
344
355
|
setDiscountSelected(params: {
|
|
345
356
|
discountId: number;
|
|
346
357
|
isSelected: boolean;
|
|
@@ -525,6 +536,11 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
525
536
|
private hasSmartPricingStrategies;
|
|
526
537
|
shouldRecalculateProductBookingPricesForContextChange(params: BaseSalesPriceRecalculationContextChange): boolean;
|
|
527
538
|
calculateProductBookingPrices(paramsList: BaseSalesCalculateProductBookingPriceParams[]): Promise<BaseSalesProductBookingPriceResult[]>;
|
|
539
|
+
setProductVoucherGroups(groups: Array<{
|
|
540
|
+
key: string;
|
|
541
|
+
discountIds: Array<number | string>;
|
|
542
|
+
}>): void;
|
|
543
|
+
validateProductVoucherSelection(): void;
|
|
528
544
|
addProductToOrder(product: Partial<BaseSalesOrderProduct> & BaseSalesOrderProductIdentity, booking?: AddProductBookingInput, options?: AddProductToOrderOptions): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
529
545
|
updateOrderProduct(params: UpdateOrderProductParams): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
530
546
|
updateOrderProducts(paramsList: UpdateOrderProductParams[]): Promise<import("../../modules/Order/types").OrderProduct[]>;
|
|
@@ -7,6 +7,7 @@ var _exportNames = {
|
|
|
7
7
|
BaseSalesImpl: true
|
|
8
8
|
};
|
|
9
9
|
exports.BaseSalesImpl = void 0;
|
|
10
|
+
var _inventory = require("../../inventory");
|
|
10
11
|
var _BaseModule = require("../../modules/BaseModule");
|
|
11
12
|
var _localEftposState = require("../../modules/Order/localEftposState");
|
|
12
13
|
var _types = require("./types");
|
|
@@ -511,6 +512,40 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
511
512
|
order: undefined
|
|
512
513
|
};
|
|
513
514
|
otherParams = {};
|
|
515
|
+
getInventory() {
|
|
516
|
+
return this.otherParams.inventory;
|
|
517
|
+
}
|
|
518
|
+
async prepareCheckout(signal) {
|
|
519
|
+
const inventory = this.getInventory();
|
|
520
|
+
const hooks = this.otherParams.checkoutHooks;
|
|
521
|
+
if (!inventory && !hooks?.beforeCheckout) return undefined;
|
|
522
|
+
if (!this.store.order) throw new Error('Order module is not ready');
|
|
523
|
+
return this.store.order.prepareCheckout(async items => {
|
|
524
|
+
const assertCurrent = () => {
|
|
525
|
+
if (signal?.aborted) throw Object.assign(new Error('Checkout cancelled'), {
|
|
526
|
+
name: 'AbortError'
|
|
527
|
+
});
|
|
528
|
+
if (inventory !== this.getInventory() || hooks !== this.otherParams.checkoutHooks) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
|
|
529
|
+
};
|
|
530
|
+
assertCurrent();
|
|
531
|
+
try {
|
|
532
|
+
await hooks?.beforeCheckout?.({
|
|
533
|
+
items,
|
|
534
|
+
signal
|
|
535
|
+
});
|
|
536
|
+
if (inventory) await inventory.refresh({
|
|
537
|
+
reason: 'checkout',
|
|
538
|
+
force: true,
|
|
539
|
+
signal
|
|
540
|
+
});
|
|
541
|
+
assertCurrent();
|
|
542
|
+
return inventory?.freezeCheckout(items);
|
|
543
|
+
} catch (error) {
|
|
544
|
+
if (error?.name === 'AbortError') throw error;
|
|
545
|
+
throw (0, _inventory.salesGuardError)(error instanceof Error ? error.message : String(error));
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
514
549
|
cacheId;
|
|
515
550
|
/**
|
|
516
551
|
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
@@ -527,6 +562,7 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
527
562
|
// 当前缓存中已加载的最新 SalesDetail;只读 getter 走它对外暴露详情数据。
|
|
528
563
|
currentSalesDetail = null;
|
|
529
564
|
discountConfigCacheKey = null;
|
|
565
|
+
discountConfigPrepareInFlight = null;
|
|
530
566
|
hasManualDiscountSelection = false;
|
|
531
567
|
reusedSharedSubModuleNames = new Set();
|
|
532
568
|
paymentMethodsCache = [];
|
|
@@ -1401,12 +1437,35 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1401
1437
|
}
|
|
1402
1438
|
return (0, _types2.createModule)(moduleName, this.name);
|
|
1403
1439
|
}
|
|
1440
|
+
inventoryOrderHooks;
|
|
1404
1441
|
getSubModuleHooks(moduleName) {
|
|
1405
1442
|
const optionHooks = this.initializeOptions.hooks || {};
|
|
1406
1443
|
const otherHooks = this.otherParams.hooks || {};
|
|
1407
1444
|
if (moduleName === 'order') {
|
|
1408
1445
|
const directOrderHooks = optionHooks;
|
|
1409
|
-
|
|
1446
|
+
const hooks = optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder || directOrderHooks.onBeforeCartCommit ? directOrderHooks : undefined);
|
|
1447
|
+
const inventory = this.getInventory();
|
|
1448
|
+
if (!inventory) {
|
|
1449
|
+
this.inventoryOrderHooks = undefined;
|
|
1450
|
+
return hooks;
|
|
1451
|
+
}
|
|
1452
|
+
if (this.inventoryOrderHooks?.inventory === inventory && this.inventoryOrderHooks.base === hooks) {
|
|
1453
|
+
return this.inventoryOrderHooks.hooks;
|
|
1454
|
+
}
|
|
1455
|
+
const combined = {
|
|
1456
|
+
...hooks,
|
|
1457
|
+
onBeforeCartCommit: async context => {
|
|
1458
|
+
await hooks?.onBeforeCartCommit?.(context);
|
|
1459
|
+
if (inventory !== this.getInventory()) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
|
|
1460
|
+
inventory.validate(context.proposedItems, context.currentItems);
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
this.inventoryOrderHooks = {
|
|
1464
|
+
inventory,
|
|
1465
|
+
base: hooks,
|
|
1466
|
+
hooks: combined
|
|
1467
|
+
};
|
|
1468
|
+
return combined;
|
|
1410
1469
|
}
|
|
1411
1470
|
return optionHooks[moduleName] || this.otherParams[moduleName]?.hooks || otherHooks[moduleName];
|
|
1412
1471
|
}
|
|
@@ -1454,7 +1513,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1454
1513
|
const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
|
|
1455
1514
|
await targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1456
1515
|
changedParams,
|
|
1457
|
-
cover
|
|
1516
|
+
cover,
|
|
1517
|
+
...(moduleName === 'order' ? {
|
|
1518
|
+
hooks: this.getSubModuleHooks(moduleName)
|
|
1519
|
+
} : {})
|
|
1458
1520
|
});
|
|
1459
1521
|
}));
|
|
1460
1522
|
}
|
|
@@ -1603,7 +1665,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1603
1665
|
}
|
|
1604
1666
|
return isChanged;
|
|
1605
1667
|
}
|
|
1606
|
-
|
|
1668
|
+
initialization;
|
|
1669
|
+
|
|
1670
|
+
/** Hosts can await readiness without changing Core's synchronous registration API. */
|
|
1671
|
+
whenInitialized() {
|
|
1672
|
+
return this.initialization || Promise.reject(new Error('Sales module is not registered'));
|
|
1673
|
+
}
|
|
1674
|
+
initialize(core, options = {}) {
|
|
1675
|
+
this.initialization = this.initializeSalesRuntime(core, options);
|
|
1676
|
+
return this.initialization;
|
|
1677
|
+
}
|
|
1678
|
+
async initializeSalesRuntime(core, options = {}) {
|
|
1607
1679
|
this.resetPickupTimingCache();
|
|
1608
1680
|
this.core = core;
|
|
1609
1681
|
this.initializeOptions = options || {};
|
|
@@ -1663,17 +1735,19 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1663
1735
|
this.serverOrderChangeUnsubscribe = null;
|
|
1664
1736
|
this.paymentMethodsChangedUnsubscribe?.();
|
|
1665
1737
|
this.paymentMethodsChangedUnsubscribe = null;
|
|
1666
|
-
Object.keys(this.store)
|
|
1667
|
-
if (this.reusedSharedSubModuleNames.has(key))
|
|
1738
|
+
for (const key of Object.keys(this.store)) {
|
|
1739
|
+
if (this.reusedSharedSubModuleNames.has(key)) continue;
|
|
1668
1740
|
const sub = this.store[key];
|
|
1669
1741
|
if (sub && typeof sub.destroy === 'function') {
|
|
1670
1742
|
try {
|
|
1671
|
-
|
|
1743
|
+
// A host may register a replacement after destroy resolves. Wait for
|
|
1744
|
+
// nested modules so their cleanup cannot unregister the replacement.
|
|
1745
|
+
await sub.destroy();
|
|
1672
1746
|
} catch (error) {
|
|
1673
1747
|
console.warn(`[BaseSales] 子模块 ${key} 销毁失败`, error);
|
|
1674
1748
|
}
|
|
1675
1749
|
}
|
|
1676
|
-
}
|
|
1750
|
+
}
|
|
1677
1751
|
this.currentSalesDetail = null;
|
|
1678
1752
|
this.paymentNumberDevicePrefix = null;
|
|
1679
1753
|
this.queuedServerOrderChanges = [];
|
|
@@ -2210,9 +2284,16 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2210
2284
|
const searchedDiscountIds = new Set(searchedDiscountList.map(discount => String(discount.id)));
|
|
2211
2285
|
let preparedDiscountList = [...searchedDiscountList, ...originalDiscountList.filter(discount => !searchedDiscountIds.has(String(discount.id)))];
|
|
2212
2286
|
if (customerId && customerId !== 1) {
|
|
2213
|
-
|
|
2287
|
+
const inFlight = this.discountConfigPrepareInFlight;
|
|
2288
|
+
// 客户刷新和商品查询共享配置准备;force 仅绕过已完成的缓存。
|
|
2289
|
+
if (inFlight?.key === discountConfigCacheKey && inFlight.epoch === requestEpoch) {
|
|
2290
|
+
preparedDiscountList = await inFlight.promise;
|
|
2291
|
+
if (!isCurrentRequest()) return getCurrentResult();
|
|
2292
|
+
} else if (!params?.force && this.discountConfigCacheKey === discountConfigCacheKey) {
|
|
2214
2293
|
preparedDiscountList = originalDiscountList;
|
|
2215
2294
|
} else {
|
|
2295
|
+
// 强制刷新失败后,下次普通加载也应重试,不能命中刷新前的缓存。
|
|
2296
|
+
this.discountConfigCacheKey = null;
|
|
2216
2297
|
const prepareConfigPromise = this.store.order.loadDiscountConfig({
|
|
2217
2298
|
customerId,
|
|
2218
2299
|
action: discountAction,
|
|
@@ -2221,11 +2302,28 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2221
2302
|
});
|
|
2222
2303
|
// OrderModule increments this epoch synchronously before its first await.
|
|
2223
2304
|
requestEpoch = this.store.order.getCustomerWalletPrepareConfigEpoch?.();
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2305
|
+
const prepareTask = {
|
|
2306
|
+
key: discountConfigCacheKey,
|
|
2307
|
+
epoch: requestEpoch,
|
|
2308
|
+
promise: prepareConfigPromise.then(async discountList => {
|
|
2309
|
+
if (!isCurrentRequest()) return discountList;
|
|
2310
|
+
await discountModule?.setOriginalDiscountList?.(discountList);
|
|
2311
|
+
if (isCurrentRequest()) {
|
|
2312
|
+
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
2313
|
+
}
|
|
2314
|
+
return discountList;
|
|
2315
|
+
})
|
|
2316
|
+
};
|
|
2317
|
+
this.discountConfigPrepareInFlight = prepareTask;
|
|
2318
|
+
try {
|
|
2319
|
+
preparedDiscountList = await prepareTask.promise;
|
|
2320
|
+
} finally {
|
|
2321
|
+
// 旧请求结束时不能清掉客户/订单切换后创建的新任务。
|
|
2322
|
+
if (this.discountConfigPrepareInFlight === prepareTask) {
|
|
2323
|
+
this.discountConfigPrepareInFlight = null;
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2227
2326
|
if (!isCurrentRequest()) return getCurrentResult();
|
|
2228
|
-
this.discountConfigCacheKey = discountConfigCacheKey;
|
|
2229
2327
|
}
|
|
2230
2328
|
}
|
|
2231
2329
|
if (this.isActiveVirtualSettlementOrder(tempOrder)) {
|
|
@@ -2441,10 +2539,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2441
2539
|
}
|
|
2442
2540
|
await discountModule.setDiscountList(params.discountList);
|
|
2443
2541
|
}
|
|
2444
|
-
async scanPromotionCode(code, customerId) {
|
|
2542
|
+
async scanPromotionCode(code, customerId, options) {
|
|
2445
2543
|
try {
|
|
2446
2544
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2447
|
-
const raw = await this.store.order.scanCode(code, customerId);
|
|
2545
|
+
const raw = await this.store.order.scanCode(code, customerId, options);
|
|
2448
2546
|
if (raw.isAvailable) {
|
|
2449
2547
|
await this.store.order.recalculateSummary({
|
|
2450
2548
|
createIfMissing: true
|
|
@@ -4264,6 +4362,13 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
4264
4362
|
});
|
|
4265
4363
|
});
|
|
4266
4364
|
}
|
|
4365
|
+
setProductVoucherGroups(groups) {
|
|
4366
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
4367
|
+
this.store.order.setProductVoucherGroups(groups);
|
|
4368
|
+
}
|
|
4369
|
+
validateProductVoucherSelection() {
|
|
4370
|
+
this.store.order?.validateProductVoucherSelection();
|
|
4371
|
+
}
|
|
4267
4372
|
async addProductToOrder(product, booking, options) {
|
|
4268
4373
|
try {
|
|
4269
4374
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -375,7 +375,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
375
375
|
};
|
|
376
376
|
setOtherData(key: string, value: any): void;
|
|
377
377
|
getOtherData(key: string): any;
|
|
378
|
-
getProductTypeById(id: number): Promise<"duration" | "
|
|
378
|
+
getProductTypeById(id: number): Promise<"duration" | "normal" | "session">;
|
|
379
379
|
/**
|
|
380
380
|
* 提供给 UI 的方法,减轻 UI 层的计算压力,UI 层只需要传递 cartItemId 和 resourceCode 即返回对应的 renderList
|
|
381
381
|
*
|
|
@@ -485,7 +485,19 @@ export declare class BookingTicketImpl extends BaseSalesImpl implements Module {
|
|
|
485
485
|
* 加车两阶段主决策(规格弹窗 / 资源编辑 / 直接加车)。
|
|
486
486
|
* 与 ticketBooking `handleSelectProduct` + `handleBooking4Service` 等价。
|
|
487
487
|
*/
|
|
488
|
-
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>):
|
|
488
|
+
decideAddProduct(item: any, options?: Partial<AddProductDecideContext>): {
|
|
489
|
+
action: "reloadCatalog";
|
|
490
|
+
} | {
|
|
491
|
+
action: "add";
|
|
492
|
+
cacheItem: any;
|
|
493
|
+
} | {
|
|
494
|
+
action: "requiresDetail";
|
|
495
|
+
payload: AddProductRequiresDetailPayload;
|
|
496
|
+
} | {
|
|
497
|
+
action: "requiresBookingEdit";
|
|
498
|
+
cacheItem: any;
|
|
499
|
+
payload: import("./utils/addProductDecision").AddProductRequiresBookingEditPayload;
|
|
500
|
+
};
|
|
489
501
|
/** 规格弹窗 callback 后的第二段决策。 */
|
|
490
502
|
decideAfterDetail(cacheItem: any, options?: Partial<AddProductDecideContext>): import("./utils/addProductDecision").AddProductDecision;
|
|
491
503
|
/**
|
|
@@ -30,6 +30,7 @@ var _handleScan = require("./utils/scan/handleScan");
|
|
|
30
30
|
var _scanCache = _interopRequireDefault(require("./utils/scan/scanCache"));
|
|
31
31
|
var _formatGlobalScan = require("./utils/scan/formatGlobalScan");
|
|
32
32
|
var _applyGlobalScan = require("./utils/scan/applyGlobalScan");
|
|
33
|
+
var _applyProductVoucherCollectionScan = require("./utils/scan/applyProductVoucherCollectionScan");
|
|
33
34
|
var _cartView = require("./utils/cartView");
|
|
34
35
|
var _addProductDecision = require("./utils/addProductDecision");
|
|
35
36
|
var _buildCacheItemFromOrderLine = require("../../modules/BookingContext/utils/buildCacheItemFromOrderLine");
|
|
@@ -1845,6 +1846,20 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1845
1846
|
return bridge.openBookingEdit(payload);
|
|
1846
1847
|
} : undefined
|
|
1847
1848
|
} : undefined;
|
|
1849
|
+
if (guardedBridge?.scanScope === 'product-voucher') {
|
|
1850
|
+
if (!guardedBridge.applyPromotionCode) return {
|
|
1851
|
+
status: 'failed',
|
|
1852
|
+
reason: 'no_bridge'
|
|
1853
|
+
};
|
|
1854
|
+
const promotion = await guardedBridge.applyPromotionCode(trimmed);
|
|
1855
|
+
return promotion.isAccepted ?? promotion.isAvailable ? {
|
|
1856
|
+
status: 'success',
|
|
1857
|
+
kind: 'promotion'
|
|
1858
|
+
} : {
|
|
1859
|
+
status: 'failed',
|
|
1860
|
+
reason: 'not_found'
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1848
1863
|
const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
|
|
1849
1864
|
const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
1850
1865
|
const raw = await scanCallback({
|
|
@@ -1859,7 +1874,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1859
1874
|
reason: 'not_found'
|
|
1860
1875
|
};
|
|
1861
1876
|
}
|
|
1862
|
-
const
|
|
1877
|
+
const host = {
|
|
1863
1878
|
setOrderCustomer: customer => {
|
|
1864
1879
|
beforeScanCommit();
|
|
1865
1880
|
this.setOrderCustomer(customer);
|
|
@@ -1880,10 +1895,30 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1880
1895
|
beforeScanCommit();
|
|
1881
1896
|
return this.scanWalletAsset(scanCode);
|
|
1882
1897
|
}
|
|
1883
|
-
}
|
|
1898
|
+
};
|
|
1899
|
+
const result = guardedBridge?.scanScope === 'product-voucher-collection' ? await (0, _applyProductVoucherCollectionScan.applyProductVoucherCollectionScan)({
|
|
1900
|
+
...host,
|
|
1901
|
+
loadCustomerDiscounts: async () => {
|
|
1902
|
+
beforeScanCommit();
|
|
1903
|
+
const customerId = Number(this.getOrderCustomer()?.customer_id || 0);
|
|
1904
|
+
if (customerId <= 1) return [];
|
|
1905
|
+
await this.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
1906
|
+
beforeScanCommit();
|
|
1907
|
+
return this.getDiscountList();
|
|
1908
|
+
}
|
|
1909
|
+
}, formatted, guardedBridge) : await (0, _applyGlobalScan.applyGlobalScan)(host, formatted, guardedBridge);
|
|
1884
1910
|
bridge?.refresh?.();
|
|
1885
1911
|
return result;
|
|
1886
1912
|
} catch (error) {
|
|
1913
|
+
if (bridge?.scanScope === 'product-voucher-collection') {
|
|
1914
|
+
if (bridge.isCurrent?.() === false) return {
|
|
1915
|
+
status: 'cancelled'
|
|
1916
|
+
};
|
|
1917
|
+
return {
|
|
1918
|
+
status: 'failed',
|
|
1919
|
+
reason: 'entry_resolution_failed'
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1887
1922
|
console.error('[BookingTicket] handleGlobalScanCode failed', error);
|
|
1888
1923
|
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
1889
1924
|
return {
|
|
@@ -208,6 +208,10 @@ export interface AddAddTimeProductsToBookingInput {
|
|
|
208
208
|
}
|
|
209
209
|
/** 扫码宿主桥接:SalesSdk 在 pubsub 订阅回调里注入,OS 需要 UI 时直接调用 */
|
|
210
210
|
export interface GlobalScanHostBridge {
|
|
211
|
+
/** product-voucher handles voucher codes; product-voucher-collection loads all vouchers for the scanned customer. */
|
|
212
|
+
scanScope?: 'all' | 'product-voucher' | 'product-voucher-collection';
|
|
213
|
+
/** A one-shot entry may outlive its page while requests are in flight. */
|
|
214
|
+
isCurrent?: () => boolean;
|
|
211
215
|
openProductDetail?: (payload: Record<string, any>) => Promise<any | null>;
|
|
212
216
|
openBookingEdit?: (payload: Record<string, any>) => Promise<any | null>;
|
|
213
217
|
confirmDetail?: (input: {
|
|
@@ -232,11 +236,13 @@ export interface GlobalScanHostBridge {
|
|
|
232
236
|
*/
|
|
233
237
|
applyPromotionCode?: (code: string, customerId?: number, options?: {
|
|
234
238
|
suppressFailureNotification?: boolean;
|
|
239
|
+
productVouchersOnly?: boolean;
|
|
235
240
|
}) => Promise<{
|
|
236
241
|
isAvailable?: boolean;
|
|
237
242
|
isAccepted?: boolean;
|
|
238
243
|
type?: string;
|
|
239
244
|
unavailableReason?: string;
|
|
245
|
+
scannedDiscountList?: Record<string, any>[];
|
|
240
246
|
}>;
|
|
241
247
|
/** 当前订单已有其他客户时,由宿主复用客户组件完成确认及切换。 */
|
|
242
248
|
requestCustomerSwitch?: (customer: ICustomer) => Promise<boolean | null>;
|
|
@@ -244,7 +250,7 @@ export interface GlobalScanHostBridge {
|
|
|
244
250
|
refresh?: () => void;
|
|
245
251
|
}
|
|
246
252
|
/** handleGlobalScanCode 结构化返回 */
|
|
247
|
-
export type GlobalScanHandleResult = {
|
|
253
|
+
export type GlobalScanHandleResult = ({
|
|
248
254
|
status: 'success';
|
|
249
255
|
kind: 'customer' | 'products' | 'promotion';
|
|
250
256
|
meta?: {
|
|
@@ -257,5 +263,11 @@ export type GlobalScanHandleResult = {
|
|
|
257
263
|
status: 'cancelled';
|
|
258
264
|
} | {
|
|
259
265
|
status: 'failed';
|
|
260
|
-
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge';
|
|
266
|
+
reason: 'empty_code' | 'not_found' | 'invalid_data' | 'no_bridge' | 'entry_resolution_failed';
|
|
267
|
+
}) & {
|
|
268
|
+
/** product-voucher-collection returns voucher candidates; the caller decides how to use them. */
|
|
269
|
+
redemption?: {
|
|
270
|
+
source: 'wallet' | 'scan';
|
|
271
|
+
vouchers: Record<string, any>[];
|
|
272
|
+
};
|
|
261
273
|
};
|
|
@@ -5,7 +5,7 @@ import type { OrderProduct, OrderProductIdentity, AddProductBookingInput } from
|
|
|
5
5
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
6
6
|
*
|
|
7
7
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
8
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
8
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
9
9
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
10
10
|
*/
|
|
11
11
|
export type AddProductDecision = {
|
|
@@ -17,12 +17,13 @@ var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
|
17
17
|
var _BookingContext = require("../../../modules/BookingContext");
|
|
18
18
|
var _transformBaseProductToOrderProduct = require("../../BaseSales/utils/transformBaseProductToOrderProduct");
|
|
19
19
|
var _weighingProductSku = require("./weighingProductSku");
|
|
20
|
+
var _platform = require("../../../utils/platform");
|
|
20
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
22
|
/**
|
|
22
23
|
* cart.addProduct 两阶段决策(与 ticketBooking `handleSelectProduct` 对齐):
|
|
23
24
|
*
|
|
24
25
|
* 1. `requiresDetail`:规格 / SKU / 套餐 / Session / 称重弹窗(门禁:`isOpenDetailModal` / `cartDetailValue` / `open_sold_weight`)
|
|
25
|
-
* 2. `requiresBookingEdit`:资源 /
|
|
26
|
+
* 2. `requiresBookingEdit`:资源 / 时间编辑抽屉(自助终端强制进入;其他渠道由 `getIsAutoClose` 决定)
|
|
26
27
|
* 3. `add`:两关均通过,直接 transform + 加车
|
|
27
28
|
*/
|
|
28
29
|
|
|
@@ -39,11 +40,11 @@ function needsSpecDetailModal(item) {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
|
-
* 第二段:预约商品是否仍需打开资源 /
|
|
43
|
+
* 第二段:预约商品是否仍需打开资源 / 时间编辑(自助终端强制打开,其他渠道与 info2 `cacheItem.autoClose` 等价)。
|
|
43
44
|
*/
|
|
44
45
|
function needsBookingEdit(cacheItem, ctx) {
|
|
45
46
|
if (isNormalBookingProduct(cacheItem)) return false;
|
|
46
|
-
if (ctx?.channel
|
|
47
|
+
if ((0, _platform.isSelfServicePlatform)(ctx?.channel)) return true;
|
|
47
48
|
const isAutoAllocationOn = ctx?.isAutoAllocationOn || (() => true);
|
|
48
49
|
return !(0, _BookingContext.getIsAutoClose)(cacheItem, isAutoAllocationOn);
|
|
49
50
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GlobalScanHandleResult, GlobalScanHostBridge } from '../../types';
|
|
2
|
+
import { type GlobalScanApplyHost } from './applyGlobalScan';
|
|
3
|
+
import type { GlobalScanFormattedResult } from './formatGlobalScan';
|
|
4
|
+
export interface ProductVoucherCollectionScanHost extends GlobalScanApplyHost {
|
|
5
|
+
loadCustomerDiscounts(): Promise<Record<string, any>[]>;
|
|
6
|
+
}
|
|
7
|
+
/** Resolve the scanned account, then collect all of that customer's vouchers. */
|
|
8
|
+
export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyProductVoucherCollectionScan = applyProductVoucherCollectionScan;
|
|
7
|
+
var _applyGlobalScan = require("./applyGlobalScan");
|
|
8
|
+
/** Resolve the scanned account, then collect all of that customer's vouchers. */
|
|
9
|
+
async function applyProductVoucherCollectionScan(host, formatted, bridge) {
|
|
10
|
+
const assertCurrent = () => {
|
|
11
|
+
if (bridge.isCurrent?.() === false) {
|
|
12
|
+
throw new DOMException('Scan session ended', 'AbortError');
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const isPass = formatted.searchType === 'walletPass';
|
|
16
|
+
// Order numbers and wristbands resolve through batch-search. Their returned
|
|
17
|
+
// passes identify the customer; they are not the collection's voucher list.
|
|
18
|
+
// Resolve source-shop IDs before reusing the wallet customer-binding flow.
|
|
19
|
+
const customerScan = isPass ? {
|
|
20
|
+
...formatted,
|
|
21
|
+
searchType: 'wallet',
|
|
22
|
+
customerId: formatted.customerId ?? formatted.data?.id ?? formatted.data?.customer_id,
|
|
23
|
+
isCrossShopWallet: true
|
|
24
|
+
} : formatted;
|
|
25
|
+
assertCurrent();
|
|
26
|
+
const result = await (0, _applyGlobalScan.applyGlobalScan)({
|
|
27
|
+
...host,
|
|
28
|
+
setOrderCustomer: customer => {
|
|
29
|
+
assertCurrent();
|
|
30
|
+
host.setOrderCustomer(customer);
|
|
31
|
+
},
|
|
32
|
+
addProductToOrder: (product, booking) => {
|
|
33
|
+
assertCurrent();
|
|
34
|
+
return host.addProductToOrder(product, booking);
|
|
35
|
+
}
|
|
36
|
+
}, customerScan, {
|
|
37
|
+
...bridge,
|
|
38
|
+
// Without a switch bridge, do not return the previous customer's vouchers.
|
|
39
|
+
requestCustomerSwitch: bridge.requestCustomerSwitch ?? (async () => false)
|
|
40
|
+
});
|
|
41
|
+
assertCurrent();
|
|
42
|
+
if (customerScan.searchType === 'wallet' && result.status === 'success') {
|
|
43
|
+
const vouchers = await host.loadCustomerDiscounts();
|
|
44
|
+
assertCurrent();
|
|
45
|
+
return {
|
|
46
|
+
...result,
|
|
47
|
+
redemption: {
|
|
48
|
+
source: isPass ? 'scan' : 'wallet',
|
|
49
|
+
vouchers
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
@@ -10,6 +10,7 @@ exports.searchWalletPass = exports.searchWallet = exports.searchProduct = export
|
|
|
10
10
|
const searchWalletPass = async (request, code) => {
|
|
11
11
|
const params = {
|
|
12
12
|
code,
|
|
13
|
+
resolve_ticket_order: 1,
|
|
13
14
|
translate_flag: 1,
|
|
14
15
|
// 翻译识别码名称 0:不翻译 1:翻译
|
|
15
16
|
relation_product: 1,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.handleUniversalScan = exports.handleGlobalScan = exports.handleCustomerScan = void 0;
|
|
7
7
|
var _cloudSearch = require("./cloudSearch");
|
|
8
8
|
var _scanCache = _interopRequireDefault(require("./scanCache"));
|
|
9
|
+
var _platform = require("../../../../utils/platform");
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
11
|
/**
|
|
11
12
|
* Promise.any 的替代实现
|
|
@@ -107,7 +108,7 @@ const handleGlobalScan = (request, localSearch, channel) => {
|
|
|
107
108
|
if (value.startsWith('WL')) {
|
|
108
109
|
requestList = [(0, _cloudSearch.searchWallet)(request, value)];
|
|
109
110
|
} else {
|
|
110
|
-
requestList = [...(channel
|
|
111
|
+
requestList = [...((0, _platform.isSelfServicePlatform)(channel) ? [] : [(0, _cloudSearch.searchOrder)(request, value)]), (0, _cloudSearch.searchWalletPass)(request, value), (0, _cloudSearch.searchWallet)(request, value), (0, _cloudSearch.searchProduct)(request, value)];
|
|
111
112
|
}
|
|
112
113
|
return requestList;
|
|
113
114
|
};
|
|
@@ -160,7 +160,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
160
160
|
/** 在 Kiosk 拉起支付设备前补齐订单号,同一订单重试复用已分配的号码。 */
|
|
161
161
|
ensureLocalOrderNumbersForCheckout(): Promise<void>;
|
|
162
162
|
/**
|
|
163
|
-
* PC/H5
|
|
163
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
164
164
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
165
165
|
*/
|
|
166
166
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
@@ -1558,6 +1558,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1558
1558
|
cover = false
|
|
1559
1559
|
} = {}) {
|
|
1560
1560
|
const previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1561
|
+
const previousCatalogScope = this.otherParams?.catalogScopeKey;
|
|
1561
1562
|
const previousItemRuleConfig = this.otherParams?.itemRule;
|
|
1562
1563
|
const explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1563
1564
|
const nextParams = cover ? params : {
|
|
@@ -1570,6 +1571,10 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1570
1571
|
await super.setOtherParams(params, {
|
|
1571
1572
|
cover
|
|
1572
1573
|
});
|
|
1574
|
+
if (previousCatalogScope !== this.otherParams?.catalogScopeKey && (previousCatalogScope || this.otherParams?.catalogScopeKey)) {
|
|
1575
|
+
this.unifiedProductCatalog = [];
|
|
1576
|
+
await this.core.effects.emit(`${this.name}:onProductsLoaded`, []);
|
|
1577
|
+
}
|
|
1573
1578
|
const nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1574
1579
|
if (explicitlySetsOpenData) {
|
|
1575
1580
|
this.openDataTarget = this.otherParams?.openData && nextScope.businessCode && nextScope.channel ? `${nextScope.businessCode}+${nextScope.channel}` : null;
|
|
@@ -1824,14 +1829,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1824
1829
|
}
|
|
1825
1830
|
|
|
1826
1831
|
/**
|
|
1827
|
-
* PC/H5
|
|
1832
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1828
1833
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1829
1834
|
*/
|
|
1830
1835
|
shouldUseCheckoutSyncTask() {
|
|
1831
1836
|
const configured = this.otherParams?.checkoutSyncTaskEnabled;
|
|
1832
1837
|
if (configured === true) return true;
|
|
1833
1838
|
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
1834
|
-
return !(0, _platform.isCustomerUserPlatform)(platform) && platform
|
|
1839
|
+
return !(0, _platform.isCustomerUserPlatform)(platform) && !(0, _platform.isSelfServicePlatform)(platform);
|
|
1835
1840
|
}
|
|
1836
1841
|
|
|
1837
1842
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -2379,7 +2384,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2379
2384
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
2380
2385
|
}
|
|
2381
2386
|
let policyUrl = 'shop-policy';
|
|
2382
|
-
if (this.otherParams.platform
|
|
2387
|
+
if ((0, _platform.isSelfServicePlatform)(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
2383
2388
|
policyUrl = 'policy';
|
|
2384
2389
|
}
|
|
2385
2390
|
return this.request.get(`/${policyUrl}/${encodeURIComponent(normalizedPolicyId)}`);
|
|
@@ -2391,6 +2396,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2391
2396
|
*/
|
|
2392
2397
|
async loadProducts(params = {}, options) {
|
|
2393
2398
|
if (!this.store.products) throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
2399
|
+
const catalogScope = this.otherParams.catalogScopeKey;
|
|
2394
2400
|
const schedule_date = params.schedule_date || (0, _dayjs.default)().format('YYYY-MM-DD');
|
|
2395
2401
|
const schedule_datetime = params.schedule_datetime || `${schedule_date} ${(0, _dayjs.default)().format('HH:mm:ss')}`;
|
|
2396
2402
|
const result = await this.store.products.loadProducts({
|
|
@@ -2401,6 +2407,11 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2401
2407
|
schedule_datetime,
|
|
2402
2408
|
cacheId: this.cacheId
|
|
2403
2409
|
}, options);
|
|
2410
|
+
if (catalogScope !== this.otherParams.catalogScopeKey) {
|
|
2411
|
+
throw Object.assign(new Error('Product scope changed'), {
|
|
2412
|
+
name: 'AbortError'
|
|
2413
|
+
});
|
|
2414
|
+
}
|
|
2404
2415
|
this.unifiedProductCatalog = Array.isArray(result) ? [...result] : [];
|
|
2405
2416
|
await this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
2406
2417
|
return result;
|
package/lib/utils/platform.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export declare function normalizeRuntimePlatform(platform: unknown): string;
|
|
|
6
6
|
* PC and H5 are authenticated-customer clients rather than staff terminals.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isCustomerUserPlatform(platform: unknown): boolean;
|
|
9
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
10
|
+
export declare function isSelfServicePlatform(platform: unknown): boolean;
|