@pisell/pisellos 2.2.311 → 2.2.312-vm.0
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/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/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/index.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/index.d.ts +25 -3
- package/dist/modules/Order/index.d.ts.map +1 -0
- package/dist/modules/Order/index.js +1647 -1211
- package/dist/modules/Order/payment-utils.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.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/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/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/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/solution/BaseSales/index.d.ts +16 -1
- package/dist/solution/BaseSales/index.d.ts.map +1 -0
- package/dist/solution/BaseSales/index.js +1363 -1176
- 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.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.map +1 -0
- package/dist/solution/BookingTicket/index.js +198 -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/applyGlobalScan.js +94 -58
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts.map +1 -0
- package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +117 -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/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/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/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts.map +1 -0
- package/dist/solution/UnifiedBookingSales/index.js +63 -43
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.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/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/model/strategy/adapter/promotion/index.js +46 -1
- package/lib/modules/Discount/index.js +1 -0
- package/lib/modules/Order/index.d.ts +25 -3
- package/lib/modules/Order/index.js +145 -11
- 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/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 +16 -1
- package/lib/solution/BaseSales/index.js +89 -9
- package/lib/solution/BookingTicket/index.js +36 -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/applyGlobalScan.js +14 -2
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +10 -0
- package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +71 -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 +4 -2
|
@@ -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 _types = require("./types");
|
|
12
13
|
Object.keys(_types).forEach(function (key) {
|
|
@@ -468,6 +469,40 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
468
469
|
order: undefined
|
|
469
470
|
};
|
|
470
471
|
otherParams = {};
|
|
472
|
+
getInventory() {
|
|
473
|
+
return this.otherParams.inventory;
|
|
474
|
+
}
|
|
475
|
+
async prepareCheckout(signal) {
|
|
476
|
+
const inventory = this.getInventory();
|
|
477
|
+
const hooks = this.otherParams.checkoutHooks;
|
|
478
|
+
if (!inventory && !hooks?.beforeCheckout) return undefined;
|
|
479
|
+
if (!this.store.order) throw new Error('Order module is not ready');
|
|
480
|
+
return this.store.order.prepareCheckout(async items => {
|
|
481
|
+
const assertCurrent = () => {
|
|
482
|
+
if (signal?.aborted) throw Object.assign(new Error('Checkout cancelled'), {
|
|
483
|
+
name: 'AbortError'
|
|
484
|
+
});
|
|
485
|
+
if (inventory !== this.getInventory() || hooks !== this.otherParams.checkoutHooks) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
|
|
486
|
+
};
|
|
487
|
+
assertCurrent();
|
|
488
|
+
try {
|
|
489
|
+
await hooks?.beforeCheckout?.({
|
|
490
|
+
items,
|
|
491
|
+
signal
|
|
492
|
+
});
|
|
493
|
+
if (inventory) await inventory.refresh({
|
|
494
|
+
reason: 'checkout',
|
|
495
|
+
force: true,
|
|
496
|
+
signal
|
|
497
|
+
});
|
|
498
|
+
assertCurrent();
|
|
499
|
+
return inventory?.freezeCheckout(items);
|
|
500
|
+
} catch (error) {
|
|
501
|
+
if (error?.name === 'AbortError') throw error;
|
|
502
|
+
throw (0, _inventory.salesGuardError)(error instanceof Error ? error.message : String(error));
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
}
|
|
471
506
|
cacheId;
|
|
472
507
|
/**
|
|
473
508
|
* 由已在初始化阶段解析过设备短号的业务解决方案写入。
|
|
@@ -1235,12 +1270,35 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1235
1270
|
}
|
|
1236
1271
|
return (0, _types2.createModule)(moduleName, this.name);
|
|
1237
1272
|
}
|
|
1273
|
+
inventoryOrderHooks;
|
|
1238
1274
|
getSubModuleHooks(moduleName) {
|
|
1239
1275
|
const optionHooks = this.initializeOptions.hooks || {};
|
|
1240
1276
|
const otherHooks = this.otherParams.hooks || {};
|
|
1241
1277
|
if (moduleName === 'order') {
|
|
1242
1278
|
const directOrderHooks = optionHooks;
|
|
1243
|
-
|
|
1279
|
+
const hooks = optionHooks.order || this.otherParams.order?.hooks || otherHooks.order || (directOrderHooks.onBeforeMergeProductToOrder || directOrderHooks.onBeforeCartCommit ? directOrderHooks : undefined);
|
|
1280
|
+
const inventory = this.getInventory();
|
|
1281
|
+
if (!inventory) {
|
|
1282
|
+
this.inventoryOrderHooks = undefined;
|
|
1283
|
+
return hooks;
|
|
1284
|
+
}
|
|
1285
|
+
if (this.inventoryOrderHooks?.inventory === inventory && this.inventoryOrderHooks.base === hooks) {
|
|
1286
|
+
return this.inventoryOrderHooks.hooks;
|
|
1287
|
+
}
|
|
1288
|
+
const combined = {
|
|
1289
|
+
...hooks,
|
|
1290
|
+
onBeforeCartCommit: async context => {
|
|
1291
|
+
await hooks?.onBeforeCartCommit?.(context);
|
|
1292
|
+
if (inventory !== this.getInventory()) throw (0, _inventory.salesGuardError)('The sales context changed. Please try again.');
|
|
1293
|
+
inventory.validate(context.proposedItems, context.currentItems);
|
|
1294
|
+
}
|
|
1295
|
+
};
|
|
1296
|
+
this.inventoryOrderHooks = {
|
|
1297
|
+
inventory,
|
|
1298
|
+
base: hooks,
|
|
1299
|
+
hooks: combined
|
|
1300
|
+
};
|
|
1301
|
+
return combined;
|
|
1244
1302
|
}
|
|
1245
1303
|
return optionHooks[moduleName] || this.otherParams[moduleName]?.hooks || otherHooks[moduleName];
|
|
1246
1304
|
}
|
|
@@ -1288,7 +1346,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1288
1346
|
const nextSubModuleOtherParams = this.buildSubModuleOtherParams(moduleName);
|
|
1289
1347
|
await targetModule.updateOtherParams(nextSubModuleOtherParams, {
|
|
1290
1348
|
changedParams,
|
|
1291
|
-
cover
|
|
1349
|
+
cover,
|
|
1350
|
+
...(moduleName === 'order' ? {
|
|
1351
|
+
hooks: this.getSubModuleHooks(moduleName)
|
|
1352
|
+
} : {})
|
|
1292
1353
|
});
|
|
1293
1354
|
}));
|
|
1294
1355
|
}
|
|
@@ -1437,7 +1498,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1437
1498
|
}
|
|
1438
1499
|
return isChanged;
|
|
1439
1500
|
}
|
|
1440
|
-
|
|
1501
|
+
initialization;
|
|
1502
|
+
|
|
1503
|
+
/** Hosts can await readiness without changing Core's synchronous registration API. */
|
|
1504
|
+
whenInitialized() {
|
|
1505
|
+
return this.initialization || Promise.reject(new Error('Sales module is not registered'));
|
|
1506
|
+
}
|
|
1507
|
+
initialize(core, options = {}) {
|
|
1508
|
+
this.initialization = this.initializeSalesRuntime(core, options);
|
|
1509
|
+
return this.initialization;
|
|
1510
|
+
}
|
|
1511
|
+
async initializeSalesRuntime(core, options = {}) {
|
|
1441
1512
|
this.core = core;
|
|
1442
1513
|
this.initializeOptions = options || {};
|
|
1443
1514
|
this.paymentNumberDevicePrefix = null;
|
|
@@ -1494,17 +1565,19 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1494
1565
|
this.serverOrderChangeUnsubscribe = null;
|
|
1495
1566
|
this.paymentMethodsChangedUnsubscribe?.();
|
|
1496
1567
|
this.paymentMethodsChangedUnsubscribe = null;
|
|
1497
|
-
Object.keys(this.store)
|
|
1498
|
-
if (this.reusedSharedSubModuleNames.has(key))
|
|
1568
|
+
for (const key of Object.keys(this.store)) {
|
|
1569
|
+
if (this.reusedSharedSubModuleNames.has(key)) continue;
|
|
1499
1570
|
const sub = this.store[key];
|
|
1500
1571
|
if (sub && typeof sub.destroy === 'function') {
|
|
1501
1572
|
try {
|
|
1502
|
-
|
|
1573
|
+
// A host may register a replacement after destroy resolves. Wait for
|
|
1574
|
+
// nested modules so their cleanup cannot unregister the replacement.
|
|
1575
|
+
await sub.destroy();
|
|
1503
1576
|
} catch (error) {
|
|
1504
1577
|
console.warn(`[BaseSales] 子模块 ${key} 销毁失败`, error);
|
|
1505
1578
|
}
|
|
1506
1579
|
}
|
|
1507
|
-
}
|
|
1580
|
+
}
|
|
1508
1581
|
this.currentSalesDetail = null;
|
|
1509
1582
|
this.paymentNumberDevicePrefix = null;
|
|
1510
1583
|
this.queuedServerOrderChanges = [];
|
|
@@ -2218,10 +2291,10 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
2218
2291
|
}
|
|
2219
2292
|
await discountModule.setDiscountList(params.discountList);
|
|
2220
2293
|
}
|
|
2221
|
-
async scanPromotionCode(code, customerId) {
|
|
2294
|
+
async scanPromotionCode(code, customerId, options) {
|
|
2222
2295
|
try {
|
|
2223
2296
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
2224
|
-
const raw = await this.store.order.scanCode(code, customerId);
|
|
2297
|
+
const raw = await this.store.order.scanCode(code, customerId, options);
|
|
2225
2298
|
if (raw.isAvailable) {
|
|
2226
2299
|
await this.store.order.recalculateSummary({
|
|
2227
2300
|
createIfMissing: true
|
|
@@ -3884,6 +3957,13 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
3884
3957
|
});
|
|
3885
3958
|
});
|
|
3886
3959
|
}
|
|
3960
|
+
setProductVoucherGroups(groups) {
|
|
3961
|
+
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
3962
|
+
this.store.order.setProductVoucherGroups(groups);
|
|
3963
|
+
}
|
|
3964
|
+
validateProductVoucherSelection() {
|
|
3965
|
+
this.store.order?.validateProductVoucherSelection();
|
|
3966
|
+
}
|
|
3887
3967
|
async addProductToOrder(product, booking, options) {
|
|
3888
3968
|
try {
|
|
3889
3969
|
if (!this.store.order) throw new Error('order 模块未初始化');
|
|
@@ -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");
|
|
@@ -1672,6 +1673,20 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1672
1673
|
};
|
|
1673
1674
|
}
|
|
1674
1675
|
try {
|
|
1676
|
+
if (bridge?.scanScope === 'product-voucher') {
|
|
1677
|
+
if (!bridge.applyPromotionCode) return {
|
|
1678
|
+
status: 'failed',
|
|
1679
|
+
reason: 'no_bridge'
|
|
1680
|
+
};
|
|
1681
|
+
const promotion = await bridge.applyPromotionCode(trimmed);
|
|
1682
|
+
return promotion.isAccepted ?? promotion.isAvailable ? {
|
|
1683
|
+
status: 'success',
|
|
1684
|
+
kind: 'promotion'
|
|
1685
|
+
} : {
|
|
1686
|
+
status: 'failed',
|
|
1687
|
+
reason: 'not_found'
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1675
1690
|
const localSearch = v => this.store.products.findProductsByCodeOrBarcode(v);
|
|
1676
1691
|
const scanCallback = (0, _handleScan.handleGlobalScan)(this.request, localSearch, this.getSubmitOrderSalesChannel());
|
|
1677
1692
|
const raw = await scanCallback({
|
|
@@ -1686,7 +1701,7 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1686
1701
|
reason: 'not_found'
|
|
1687
1702
|
};
|
|
1688
1703
|
}
|
|
1689
|
-
const
|
|
1704
|
+
const host = {
|
|
1690
1705
|
setOrderCustomer: customer => this.setOrderCustomer(customer),
|
|
1691
1706
|
getOrderCustomerSnapshot: () => this.getOrderCustomerSnapshot(),
|
|
1692
1707
|
resolveCustomerById: customerId => this.resolveCustomerById(customerId),
|
|
@@ -1698,10 +1713,29 @@ class BookingTicketImpl extends _BaseSales.BaseSalesImpl {
|
|
|
1698
1713
|
addProductToOrder: (product, booking) => this.addProductToOrder(product, booking),
|
|
1699
1714
|
refreshWalletAssets: params => this.refreshWalletAssets(params),
|
|
1700
1715
|
scanWalletAsset: scanCode => this.scanWalletAsset(scanCode)
|
|
1701
|
-
}
|
|
1716
|
+
};
|
|
1717
|
+
const result = bridge?.scanScope === 'product-voucher-collection' ? await (0, _applyProductVoucherCollectionScan.applyProductVoucherCollectionScan)({
|
|
1718
|
+
...host,
|
|
1719
|
+
waitForCustomerDiscounts: () => this.orderCustomerDiscountRefreshInFlight || Promise.resolve(),
|
|
1720
|
+
loadCustomerDiscounts: async () => {
|
|
1721
|
+
const customerId = Number(this.getOrderCustomer()?.customer_id || 0);
|
|
1722
|
+
if (customerId <= 1) return [];
|
|
1723
|
+
await this.refreshDiscountConfigAfterOrderCustomerChange(customerId);
|
|
1724
|
+
return this.getDiscountList();
|
|
1725
|
+
}
|
|
1726
|
+
}, formatted, bridge) : await (0, _applyGlobalScan.applyGlobalScan)(host, formatted, bridge);
|
|
1702
1727
|
bridge?.refresh?.();
|
|
1703
1728
|
return result;
|
|
1704
1729
|
} catch (error) {
|
|
1730
|
+
if (bridge?.scanScope === 'product-voucher-collection') {
|
|
1731
|
+
if (bridge.isCurrent?.() === false) return {
|
|
1732
|
+
status: 'cancelled'
|
|
1733
|
+
};
|
|
1734
|
+
return {
|
|
1735
|
+
status: 'failed',
|
|
1736
|
+
reason: 'entry_resolution_failed'
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1705
1739
|
console.error('[BookingTicket] handleGlobalScanCode failed', error);
|
|
1706
1740
|
bridge?.onNotify?.('fail', 'pisell2.text.scan-global-failed');
|
|
1707
1741
|
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 only; product-voucher-collection also resolves wallet customer vouchers. */
|
|
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
|
}
|
|
@@ -283,6 +283,18 @@ async function applyGlobalScan(host, formatted, bridge) {
|
|
|
283
283
|
// batch-search 可能返回来源门店客户;先映射到当前门店,确保 Wallet
|
|
284
284
|
// 支付资产查询使用本店客户上下文。
|
|
285
285
|
const bindResult = await bindWalletPassCustomer();
|
|
286
|
+
// Voucher collection prioritizes goods coupons resolved from the wristband/order.
|
|
287
|
+
// Only this opt-in flow checks them before selecting a payment wallet asset.
|
|
288
|
+
const collectionPromotion = bridge?.scanScope === 'product-voucher-collection' && bridge.applyPromotionCode ? await bridge.applyPromotionCode(scanCode, getRealCustomerId(activeCustomer), {
|
|
289
|
+
suppressFailureNotification: true,
|
|
290
|
+
productVouchersOnly: true
|
|
291
|
+
}) : undefined;
|
|
292
|
+
if (collectionPromotion?.isAccepted ?? collectionPromotion?.isAvailable) {
|
|
293
|
+
return {
|
|
294
|
+
status: 'success',
|
|
295
|
+
kind: 'promotion'
|
|
296
|
+
};
|
|
297
|
+
}
|
|
286
298
|
const walletSelection = await trySelectWalletAsset();
|
|
287
299
|
if (walletSelection) return walletSelection;
|
|
288
300
|
if (!bridge?.applyPromotionCode) {
|
|
@@ -292,9 +304,9 @@ async function applyGlobalScan(host, formatted, bridge) {
|
|
|
292
304
|
};
|
|
293
305
|
}
|
|
294
306
|
const promotionCustomerId = getRealCustomerId(activeCustomer);
|
|
295
|
-
const promotionResult = bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
|
|
307
|
+
const promotionResult = collectionPromotion ?? (bindResult.customerBound ? await bridge.applyPromotionCode(scanCode, promotionCustomerId, {
|
|
296
308
|
suppressFailureNotification: true
|
|
297
|
-
}) : await bridge.applyPromotionCode(scanCode, promotionCustomerId);
|
|
309
|
+
}) : await bridge.applyPromotionCode(scanCode, promotionCustomerId));
|
|
298
310
|
if (promotionResult?.isAccepted ?? promotionResult?.isAvailable) {
|
|
299
311
|
return {
|
|
300
312
|
status: 'success',
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
waitForCustomerDiscounts(): Promise<void>;
|
|
6
|
+
loadCustomerDiscounts(): Promise<Record<string, any>[]>;
|
|
7
|
+
}
|
|
8
|
+
/** Collect voucher candidates after customer binding and coupon loading finish.
|
|
9
|
+
* Never expand a wristband's result to other orders of the same customer. */
|
|
10
|
+
export declare function applyProductVoucherCollectionScan(host: ProductVoucherCollectionScanHost, formatted: GlobalScanFormattedResult, bridge: GlobalScanHostBridge): Promise<GlobalScanHandleResult>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.applyProductVoucherCollectionScan = applyProductVoucherCollectionScan;
|
|
7
|
+
var _applyGlobalScan = require("./applyGlobalScan");
|
|
8
|
+
/** Collect voucher candidates after customer binding and coupon loading finish.
|
|
9
|
+
* Never expand a wristband's result to other orders of the same customer. */
|
|
10
|
+
async function applyProductVoucherCollectionScan(host, formatted, bridge) {
|
|
11
|
+
const assertCurrent = () => {
|
|
12
|
+
if (bridge.isCurrent?.() === false) {
|
|
13
|
+
throw new DOMException('Scan session ended', 'AbortError');
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
let vouchers = [];
|
|
17
|
+
assertCurrent();
|
|
18
|
+
const result = await (0, _applyGlobalScan.applyGlobalScan)({
|
|
19
|
+
...host,
|
|
20
|
+
setOrderCustomer: customer => {
|
|
21
|
+
assertCurrent();
|
|
22
|
+
host.setOrderCustomer(customer);
|
|
23
|
+
},
|
|
24
|
+
addProductToOrder: (product, booking) => {
|
|
25
|
+
assertCurrent();
|
|
26
|
+
return host.addProductToOrder(product, booking);
|
|
27
|
+
}
|
|
28
|
+
}, formatted, {
|
|
29
|
+
...bridge,
|
|
30
|
+
applyPromotionCode: bridge.applyPromotionCode && (async (code, customerId, options) => {
|
|
31
|
+
// Customer binding starts prepare/config in the background. Let it finish
|
|
32
|
+
// before adding scanned coupons so its response cannot overwrite them.
|
|
33
|
+
await host.waitForCustomerDiscounts();
|
|
34
|
+
assertCurrent();
|
|
35
|
+
const promotion = await bridge.applyPromotionCode(code, customerId, {
|
|
36
|
+
...options,
|
|
37
|
+
productVouchersOnly: true,
|
|
38
|
+
suppressFailureNotification: true
|
|
39
|
+
});
|
|
40
|
+
assertCurrent();
|
|
41
|
+
// An empty successful search is different from a swallowed request error.
|
|
42
|
+
if (!Array.isArray(promotion.scannedDiscountList)) {
|
|
43
|
+
throw new Error('Could not resolve scanned vouchers');
|
|
44
|
+
}
|
|
45
|
+
vouchers = promotion.scannedDiscountList;
|
|
46
|
+
return promotion;
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
assertCurrent();
|
|
50
|
+
if (formatted.searchType === 'wallet' && result.status === 'success') {
|
|
51
|
+
vouchers = await host.loadCustomerDiscounts();
|
|
52
|
+
assertCurrent();
|
|
53
|
+
return {
|
|
54
|
+
...result,
|
|
55
|
+
redemption: {
|
|
56
|
+
source: 'wallet',
|
|
57
|
+
vouchers
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (formatted.searchType === 'walletPass') {
|
|
62
|
+
return {
|
|
63
|
+
...result,
|
|
64
|
+
redemption: {
|
|
65
|
+
source: 'scan',
|
|
66
|
+
vouchers
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
@@ -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
|
};
|
|
@@ -127,7 +127,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
127
127
|
*/
|
|
128
128
|
clearSessionStorageOrderSnapshot(): void;
|
|
129
129
|
/**
|
|
130
|
-
* PC/H5
|
|
130
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
131
131
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
132
132
|
*/
|
|
133
133
|
protected shouldUseCheckoutSyncTask(): boolean;
|
|
@@ -1366,11 +1366,16 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1366
1366
|
cover = false
|
|
1367
1367
|
} = {}) {
|
|
1368
1368
|
const previousScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1369
|
+
const previousCatalogScope = this.otherParams?.catalogScopeKey;
|
|
1369
1370
|
const previousItemRuleConfig = this.otherParams?.itemRule;
|
|
1370
1371
|
const explicitlySetsOpenData = Object.prototype.hasOwnProperty.call(params, 'openData');
|
|
1371
1372
|
await super.setOtherParams(params, {
|
|
1372
1373
|
cover
|
|
1373
1374
|
});
|
|
1375
|
+
if (previousCatalogScope !== this.otherParams?.catalogScopeKey && (previousCatalogScope || this.otherParams?.catalogScopeKey)) {
|
|
1376
|
+
this.unifiedProductCatalog = [];
|
|
1377
|
+
await this.core.effects.emit(`${this.name}:onProductsLoaded`, []);
|
|
1378
|
+
}
|
|
1374
1379
|
const nextScope = this.getAvailabilityScopeDescriptor(this.otherParams || {});
|
|
1375
1380
|
if (explicitlySetsOpenData) {
|
|
1376
1381
|
this.openDataTarget = this.otherParams?.openData && nextScope.businessCode && nextScope.channel ? `${nextScope.businessCode}+${nextScope.channel}` : null;
|
|
@@ -1580,14 +1585,14 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1580
1585
|
}
|
|
1581
1586
|
|
|
1582
1587
|
/**
|
|
1583
|
-
* PC/H5
|
|
1588
|
+
* PC/H5 及自助终端结账默认直接等待云端 checkout;POS/WebPOS 仍保持本地待同步。
|
|
1584
1589
|
* 显式传 checkoutSyncTaskEnabled: true 时仍可回退到本地同步模式。
|
|
1585
1590
|
*/
|
|
1586
1591
|
shouldUseCheckoutSyncTask() {
|
|
1587
1592
|
const configured = this.otherParams?.checkoutSyncTaskEnabled;
|
|
1588
1593
|
if (configured === true) return true;
|
|
1589
1594
|
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
1590
|
-
return !(0, _platform.isCustomerUserPlatform)(platform) && platform
|
|
1595
|
+
return !(0, _platform.isCustomerUserPlatform)(platform) && !(0, _platform.isSelfServicePlatform)(platform);
|
|
1591
1596
|
}
|
|
1592
1597
|
|
|
1593
1598
|
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
@@ -1874,7 +1879,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1874
1879
|
throw new Error('[UnifiedBookingSales] getProtocol 需要 policyId');
|
|
1875
1880
|
}
|
|
1876
1881
|
let policyUrl = 'shop-policy';
|
|
1877
|
-
if (this.otherParams.platform
|
|
1882
|
+
if ((0, _platform.isSelfServicePlatform)(this.otherParams.platform) || this.otherParams.platform === 'pos' || this.otherParams.platform === 'shop') {
|
|
1878
1883
|
policyUrl = 'policy';
|
|
1879
1884
|
}
|
|
1880
1885
|
return this.request.get(`/${policyUrl}/${encodeURIComponent(normalizedPolicyId)}`);
|
|
@@ -1886,6 +1891,7 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1886
1891
|
*/
|
|
1887
1892
|
async loadProducts(params = {}, options) {
|
|
1888
1893
|
if (!this.store.products) throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
1894
|
+
const catalogScope = this.otherParams.catalogScopeKey;
|
|
1889
1895
|
const schedule_date = params.schedule_date || (0, _dayjs.default)().format('YYYY-MM-DD');
|
|
1890
1896
|
const schedule_datetime = params.schedule_datetime || `${schedule_date} ${(0, _dayjs.default)().format('HH:mm:ss')}`;
|
|
1891
1897
|
const result = await this.store.products.loadProducts({
|
|
@@ -1896,6 +1902,11 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
1896
1902
|
schedule_datetime,
|
|
1897
1903
|
cacheId: this.cacheId
|
|
1898
1904
|
}, options);
|
|
1905
|
+
if (catalogScope !== this.otherParams.catalogScopeKey) {
|
|
1906
|
+
throw Object.assign(new Error('Product scope changed'), {
|
|
1907
|
+
name: 'AbortError'
|
|
1908
|
+
});
|
|
1909
|
+
}
|
|
1899
1910
|
this.unifiedProductCatalog = Array.isArray(result) ? [...result] : [];
|
|
1900
1911
|
await this.core.effects.emit(`${this.name}:onProductsLoaded`, result);
|
|
1901
1912
|
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;
|
package/lib/utils/platform.js
CHANGED
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isCustomerUserPlatform = isCustomerUserPlatform;
|
|
7
|
+
exports.isSelfServicePlatform = isSelfServicePlatform;
|
|
7
8
|
exports.normalizeRuntimePlatform = normalizeRuntimePlatform;
|
|
8
9
|
const CUSTOMER_USER_PLATFORMS = new Set(['pc', 'h5']);
|
|
10
|
+
const SELF_SERVICE_PLATFORMS = new Set(['kiosk', 'vending']);
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Normalize the runtime platform passed through solution/module otherParams.
|
|
@@ -19,4 +21,9 @@ function normalizeRuntimePlatform(platform) {
|
|
|
19
21
|
*/
|
|
20
22
|
function isCustomerUserPlatform(platform) {
|
|
21
23
|
return CUSTOMER_USER_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Kiosk and vending retain distinct channels but share self-service checkout behavior. */
|
|
27
|
+
function isSelfServicePlatform(platform) {
|
|
28
|
+
return SELF_SERVICE_PLATFORMS.has(normalizeRuntimePlatform(platform));
|
|
22
29
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@pisell/pisellos",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.312-vm.0",
|
|
5
5
|
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
"node": ">=18.0.0"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
|
-
"access": "public"
|
|
71
|
+
"access": "public",
|
|
72
|
+
"registry": "https://registry.npmjs.org/",
|
|
73
|
+
"tag": "vm"
|
|
72
74
|
}
|
|
73
75
|
}
|