@pisell/pisellos 2.1.131 → 2.1.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/modules/ProductList/index.js +2 -2
- package/dist/modules/SalesSummary/utils.js +6 -4
- package/dist/solution/VenueBooking/index.js +83 -27
- package/lib/model/strategy/adapter/promotion/index.js +0 -49
- package/lib/modules/ProductList/index.js +3 -2
- package/lib/modules/SalesSummary/utils.js +3 -1
- package/lib/solution/VenueBooking/index.js +31 -0
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY } from "./examples";
|
|
@@ -85,7 +85,6 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
85
85
|
key: "loadProducts",
|
|
86
86
|
value: function () {
|
|
87
87
|
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref) {
|
|
88
|
-
var _this$otherParams, _this$otherParams2;
|
|
89
88
|
var _ref$category_ids, category_ids, _ref$product_ids, product_ids, _ref$collection, collection, _ref$menu_list_ids, menu_list_ids, paramsCustomerId, _ref$with_count, with_count, schedule_datetime, schedule_date, cacheId, with_schedule, userPlugin, customer_id, _userPlugin$get, productsData, sortedList;
|
|
90
89
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
91
90
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -129,7 +128,8 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
|
|
|
129
128
|
with_count: with_count,
|
|
130
129
|
// client_schedule_ids: schedule_ids,
|
|
131
130
|
schedule_date: schedule_date,
|
|
132
|
-
application_code:
|
|
131
|
+
// application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
|
|
132
|
+
application_code: 'online-store',
|
|
133
133
|
with_schedule: with_schedule,
|
|
134
134
|
schedule_datetime: schedule_datetime,
|
|
135
135
|
is_eject: 1
|
|
@@ -236,8 +236,10 @@ function getMainProductPaymentTotal(product) {
|
|
|
236
236
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
237
237
|
var bundleItem = _step5.value;
|
|
238
238
|
if (isBundleMarkupOrDiscount(bundleItem)) {
|
|
239
|
-
var _ref3, _bundleItem$bundle_se;
|
|
240
|
-
|
|
239
|
+
var _ref3, _bundleItem$bundle_se, _bundleItem$num;
|
|
240
|
+
var unit = toDecimal((_ref3 = (_bundleItem$bundle_se = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se !== void 0 ? _bundleItem$bundle_se : bundleItem.price) !== null && _ref3 !== void 0 ? _ref3 : 0);
|
|
241
|
+
var qty = getSafeNum((_bundleItem$num = bundleItem.num) !== null && _bundleItem$num !== void 0 ? _bundleItem$num : bundleItem.quantity);
|
|
242
|
+
total = total.plus(unit.times(qty));
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
} catch (err) {
|
|
@@ -305,10 +307,10 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
|
|
|
305
307
|
_step7;
|
|
306
308
|
try {
|
|
307
309
|
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
308
|
-
var _bundleItem$
|
|
310
|
+
var _bundleItem$num2, _ref4, _bundleItem$bundle_se2, _ref5, _ref6, _bundleItem$original_, _ref7, _bundleItem$is_charge, _ref8, _bundleItem$is_charge2;
|
|
309
311
|
var bundleItem = _step7.value;
|
|
310
312
|
if (!isBundleOriginalPrice(bundleItem)) continue;
|
|
311
|
-
var bundleQuantity = new Decimal(getSafeNum((_bundleItem$
|
|
313
|
+
var bundleQuantity = new Decimal(getSafeNum((_bundleItem$num2 = bundleItem.num) !== null && _bundleItem$num2 !== void 0 ? _bundleItem$num2 : bundleItem.quantity));
|
|
312
314
|
var bundlePrice = toDecimal((_ref4 = (_bundleItem$bundle_se2 = bundleItem.bundle_selling_price) !== null && _bundleItem$bundle_se2 !== void 0 ? _bundleItem$bundle_se2 : bundleItem.price) !== null && _ref4 !== void 0 ? _ref4 : 0);
|
|
313
315
|
var bundleOriginalPrice = toDecimal((_ref5 = (_ref6 = (_bundleItem$original_ = bundleItem.original_price) !== null && _bundleItem$original_ !== void 0 ? _bundleItem$original_ : bundleItem.product_price) !== null && _ref6 !== void 0 ? _ref6 : bundleItem.price) !== null && _ref5 !== void 0 ? _ref5 : 0);
|
|
314
316
|
var bundleTaxPrecise = calculateSingleItemTax({
|
|
@@ -2455,7 +2455,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2455
2455
|
key: "removeProductFromOrder",
|
|
2456
2456
|
value: function () {
|
|
2457
2457
|
var _removeProductFromOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(identity) {
|
|
2458
|
-
var products;
|
|
2458
|
+
var _this$store$order$get3, _this$store$order6, _this$store$order$ens, _this$store$order7, _tempOrder$bookings, tempOrder, products, _tempOrder$bookings2, _tempOrder$bookings3, venueProductUids, venueBookingUids, _iterator15, _step15, _product$metadata6, _product$metadata7, product, beforeBookingCount, _this$store$order$per, _this$store$order8;
|
|
2459
2459
|
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
2460
2460
|
while (1) switch (_context27.prev = _context27.next) {
|
|
2461
2461
|
case 0:
|
|
@@ -2470,30 +2470,86 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
throw new Error('order 模块未初始化');
|
|
2472
2472
|
case 4:
|
|
2473
|
-
|
|
2473
|
+
tempOrder = ((_this$store$order$get3 = (_this$store$order6 = this.store.order).getTempOrder) === null || _this$store$order$get3 === void 0 ? void 0 : _this$store$order$get3.call(_this$store$order6)) || ((_this$store$order$ens = (_this$store$order7 = this.store.order).ensureTempOrder) === null || _this$store$order$ens === void 0 ? void 0 : _this$store$order$ens.call(_this$store$order7));
|
|
2474
|
+
_context27.next = 7;
|
|
2474
2475
|
return this.store.order.removeProductFromOrder(identity);
|
|
2475
|
-
case
|
|
2476
|
+
case 7:
|
|
2476
2477
|
products = _context27.sent;
|
|
2477
|
-
|
|
2478
|
+
if (!(tempOrder !== null && tempOrder !== void 0 && (_tempOrder$bookings = tempOrder.bookings) !== null && _tempOrder$bookings !== void 0 && _tempOrder$bookings.length)) {
|
|
2479
|
+
_context27.next = 33;
|
|
2480
|
+
break;
|
|
2481
|
+
}
|
|
2482
|
+
venueProductUids = new Set();
|
|
2483
|
+
venueBookingUids = new Set();
|
|
2484
|
+
_iterator15 = _createForOfIteratorHelper(tempOrder.products || []);
|
|
2485
|
+
_context27.prev = 12;
|
|
2486
|
+
_iterator15.s();
|
|
2487
|
+
case 14:
|
|
2488
|
+
if ((_step15 = _iterator15.n()).done) {
|
|
2489
|
+
_context27.next = 22;
|
|
2490
|
+
break;
|
|
2491
|
+
}
|
|
2492
|
+
product = _step15.value;
|
|
2493
|
+
if (product !== null && product !== void 0 && (_product$metadata6 = product.metadata) !== null && _product$metadata6 !== void 0 && _product$metadata6.venue_booking) {
|
|
2494
|
+
_context27.next = 18;
|
|
2495
|
+
break;
|
|
2496
|
+
}
|
|
2497
|
+
return _context27.abrupt("continue", 20);
|
|
2498
|
+
case 18:
|
|
2499
|
+
if (product.identity_key) venueProductUids.add(String(product.identity_key));
|
|
2500
|
+
if ((_product$metadata7 = product.metadata) !== null && _product$metadata7 !== void 0 && _product$metadata7.booking_uid) {
|
|
2501
|
+
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
2502
|
+
}
|
|
2503
|
+
case 20:
|
|
2504
|
+
_context27.next = 14;
|
|
2505
|
+
break;
|
|
2506
|
+
case 22:
|
|
2507
|
+
_context27.next = 27;
|
|
2508
|
+
break;
|
|
2509
|
+
case 24:
|
|
2510
|
+
_context27.prev = 24;
|
|
2511
|
+
_context27.t0 = _context27["catch"](12);
|
|
2512
|
+
_iterator15.e(_context27.t0);
|
|
2513
|
+
case 27:
|
|
2514
|
+
_context27.prev = 27;
|
|
2515
|
+
_iterator15.f();
|
|
2516
|
+
return _context27.finish(27);
|
|
2517
|
+
case 30:
|
|
2518
|
+
beforeBookingCount = ((_tempOrder$bookings2 = tempOrder.bookings) === null || _tempOrder$bookings2 === void 0 ? void 0 : _tempOrder$bookings2.length) || 0;
|
|
2519
|
+
tempOrder.bookings = (tempOrder.bookings || []).filter(function (booking) {
|
|
2520
|
+
var _booking$metadata, _booking$metadata2;
|
|
2521
|
+
if (!(booking !== null && booking !== void 0 && (_booking$metadata = booking.metadata) !== null && _booking$metadata !== void 0 && _booking$metadata.venue_booking)) return true;
|
|
2522
|
+
if (booking.product_uid) {
|
|
2523
|
+
return venueProductUids.has(String(booking.product_uid));
|
|
2524
|
+
}
|
|
2525
|
+
var bookingUid = (_booking$metadata2 = booking.metadata) === null || _booking$metadata2 === void 0 ? void 0 : _booking$metadata2.unique_identification_number;
|
|
2526
|
+
if (bookingUid) return venueBookingUids.has(String(bookingUid));
|
|
2527
|
+
return true;
|
|
2528
|
+
});
|
|
2529
|
+
if ((((_tempOrder$bookings3 = tempOrder.bookings) === null || _tempOrder$bookings3 === void 0 ? void 0 : _tempOrder$bookings3.length) || 0) !== beforeBookingCount) {
|
|
2530
|
+
(_this$store$order$per = (_this$store$order8 = this.store.order).persistTempOrder) === null || _this$store$order$per === void 0 || _this$store$order$per.call(_this$store$order8);
|
|
2531
|
+
}
|
|
2532
|
+
case 33:
|
|
2533
|
+
_context27.next = 35;
|
|
2478
2534
|
return this.refreshItemRuleQuantityLimits();
|
|
2479
|
-
case
|
|
2480
|
-
_context27.next =
|
|
2535
|
+
case 35:
|
|
2536
|
+
_context27.next = 37;
|
|
2481
2537
|
return this.refreshCartValidationPassed();
|
|
2482
|
-
case
|
|
2538
|
+
case 37:
|
|
2483
2539
|
this.logMethodSuccess('removeProductFromOrder', {
|
|
2484
2540
|
productCount: products.length
|
|
2485
2541
|
});
|
|
2486
2542
|
return _context27.abrupt("return", products);
|
|
2487
|
-
case
|
|
2488
|
-
_context27.prev =
|
|
2489
|
-
_context27.
|
|
2490
|
-
this.logMethodError('removeProductFromOrder', _context27.
|
|
2491
|
-
throw _context27.
|
|
2492
|
-
case
|
|
2543
|
+
case 41:
|
|
2544
|
+
_context27.prev = 41;
|
|
2545
|
+
_context27.t1 = _context27["catch"](1);
|
|
2546
|
+
this.logMethodError('removeProductFromOrder', _context27.t1);
|
|
2547
|
+
throw _context27.t1;
|
|
2548
|
+
case 45:
|
|
2493
2549
|
case "end":
|
|
2494
2550
|
return _context27.stop();
|
|
2495
2551
|
}
|
|
2496
|
-
}, _callee27, this, [[1,
|
|
2552
|
+
}, _callee27, this, [[1, 41], [12, 24, 27, 30]]);
|
|
2497
2553
|
}));
|
|
2498
2554
|
function removeProductFromOrder(_x18) {
|
|
2499
2555
|
return _removeProductFromOrder.apply(this, arguments);
|
|
@@ -2697,17 +2753,17 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2697
2753
|
if (visited.has(value)) return;
|
|
2698
2754
|
visited.add(value);
|
|
2699
2755
|
if (Array.isArray(value)) {
|
|
2700
|
-
var
|
|
2701
|
-
|
|
2756
|
+
var _iterator16 = _createForOfIteratorHelper(value),
|
|
2757
|
+
_step16;
|
|
2702
2758
|
try {
|
|
2703
|
-
for (
|
|
2704
|
-
var item =
|
|
2759
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
2760
|
+
var item = _step16.value;
|
|
2705
2761
|
collectFromValue(item);
|
|
2706
2762
|
}
|
|
2707
2763
|
} catch (err) {
|
|
2708
|
-
|
|
2764
|
+
_iterator16.e(err);
|
|
2709
2765
|
} finally {
|
|
2710
|
-
|
|
2766
|
+
_iterator16.f();
|
|
2711
2767
|
}
|
|
2712
2768
|
return;
|
|
2713
2769
|
}
|
|
@@ -2862,7 +2918,7 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2862
2918
|
key: "applyPrefillByItemRule",
|
|
2863
2919
|
value: function () {
|
|
2864
2920
|
var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
2865
|
-
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges,
|
|
2921
|
+
var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator17, _step17, _prefillItem$product_, _targetProduct$_origi, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct;
|
|
2866
2922
|
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
2867
2923
|
while (1) switch (_context36.prev = _context36.next) {
|
|
2868
2924
|
case 0:
|
|
@@ -2907,15 +2963,15 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2907
2963
|
productSourceMap = _context36.sent;
|
|
2908
2964
|
tempOrder = this.ensureTempOrder();
|
|
2909
2965
|
hasChanges = false;
|
|
2910
|
-
|
|
2966
|
+
_iterator17 = _createForOfIteratorHelper(prefillItems);
|
|
2911
2967
|
_context36.prev = 20;
|
|
2912
|
-
|
|
2968
|
+
_iterator17.s();
|
|
2913
2969
|
case 22:
|
|
2914
|
-
if ((
|
|
2970
|
+
if ((_step17 = _iterator17.n()).done) {
|
|
2915
2971
|
_context36.next = 45;
|
|
2916
2972
|
break;
|
|
2917
2973
|
}
|
|
2918
|
-
prefillItem =
|
|
2974
|
+
prefillItem = _step17.value;
|
|
2919
2975
|
productId = Number(prefillItem.product_id);
|
|
2920
2976
|
productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
|
|
2921
2977
|
targetQuantity = toNonNegativeInt(prefillItem.quantity);
|
|
@@ -2984,10 +3040,10 @@ export var VenueBookingImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
2984
3040
|
case 47:
|
|
2985
3041
|
_context36.prev = 47;
|
|
2986
3042
|
_context36.t0 = _context36["catch"](20);
|
|
2987
|
-
|
|
3043
|
+
_iterator17.e(_context36.t0);
|
|
2988
3044
|
case 50:
|
|
2989
3045
|
_context36.prev = 50;
|
|
2990
|
-
|
|
3046
|
+
_iterator17.f();
|
|
2991
3047
|
return _context36.finish(50);
|
|
2992
3048
|
case 53:
|
|
2993
3049
|
if (!hasChanges) {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/model/strategy/adapter/promotion/index.ts
|
|
30
|
-
var promotion_exports = {};
|
|
31
|
-
__export(promotion_exports, {
|
|
32
|
-
BUY_X_GET_Y_FREE_STRATEGY: () => import_examples.BUY_X_GET_Y_FREE_STRATEGY,
|
|
33
|
-
PromotionAdapter: () => import_adapter.PromotionAdapter,
|
|
34
|
-
PromotionEvaluator: () => import_evaluator.PromotionEvaluator,
|
|
35
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY: () => import_examples.X_ITEMS_FOR_Y_PRICE_STRATEGY,
|
|
36
|
-
default: () => import_adapter2.default
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(promotion_exports);
|
|
39
|
-
var import_evaluator = require("./evaluator");
|
|
40
|
-
var import_adapter = require("./adapter");
|
|
41
|
-
var import_adapter2 = __toESM(require("./adapter"));
|
|
42
|
-
var import_examples = require("./examples");
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
BUY_X_GET_Y_FREE_STRATEGY,
|
|
46
|
-
PromotionAdapter,
|
|
47
|
-
PromotionEvaluator,
|
|
48
|
-
X_ITEMS_FOR_Y_PRICE_STRATEGY
|
|
49
|
-
});
|
|
@@ -61,7 +61,7 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
61
61
|
cacheId,
|
|
62
62
|
with_schedule
|
|
63
63
|
}) {
|
|
64
|
-
var _a
|
|
64
|
+
var _a;
|
|
65
65
|
let userPlugin = this.core.getPlugin("user");
|
|
66
66
|
let customer_id = void 0;
|
|
67
67
|
try {
|
|
@@ -95,7 +95,8 @@ var ProductList = class extends import_BaseModule.BaseModule {
|
|
|
95
95
|
with_count,
|
|
96
96
|
// client_schedule_ids: schedule_ids,
|
|
97
97
|
schedule_date,
|
|
98
|
-
application_code:
|
|
98
|
+
// application_code: this.otherParams?.channel === 'online_store' ? 'online-store' : this.otherParams?.channel,
|
|
99
|
+
application_code: "online-store",
|
|
99
100
|
with_schedule,
|
|
100
101
|
schedule_datetime,
|
|
101
102
|
is_eject: 1
|
|
@@ -210,7 +210,9 @@ function getMainProductPaymentTotal(product) {
|
|
|
210
210
|
const bundleItems = product.product_bundle || [];
|
|
211
211
|
for (const bundleItem of bundleItems) {
|
|
212
212
|
if (isBundleMarkupOrDiscount(bundleItem)) {
|
|
213
|
-
|
|
213
|
+
const unit = toDecimal(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
|
|
214
|
+
const qty = getSafeNum(bundleItem.num ?? bundleItem.quantity);
|
|
215
|
+
total = total.plus(unit.times(qty));
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
return import_decimal.default.max(total, 0);
|
|
@@ -1455,6 +1455,7 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
1457
|
async removeProductFromOrder(identity) {
|
|
1458
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1458
1459
|
this.logMethodStart("removeProductFromOrder", {
|
|
1459
1460
|
product_id: identity.product_id,
|
|
1460
1461
|
product_variant_id: identity.product_variant_id
|
|
@@ -1462,7 +1463,37 @@ var _VenueBookingImpl = class extends import_BaseModule.BaseModule {
|
|
|
1462
1463
|
try {
|
|
1463
1464
|
if (!this.store.order)
|
|
1464
1465
|
throw new Error("order 模块未初始化");
|
|
1466
|
+
const tempOrder = ((_b = (_a = this.store.order).getTempOrder) == null ? void 0 : _b.call(_a)) || ((_d = (_c = this.store.order).ensureTempOrder) == null ? void 0 : _d.call(_c));
|
|
1465
1467
|
const products = await this.store.order.removeProductFromOrder(identity);
|
|
1468
|
+
if ((_e = tempOrder == null ? void 0 : tempOrder.bookings) == null ? void 0 : _e.length) {
|
|
1469
|
+
const venueProductUids = /* @__PURE__ */ new Set();
|
|
1470
|
+
const venueBookingUids = /* @__PURE__ */ new Set();
|
|
1471
|
+
for (const product of tempOrder.products || []) {
|
|
1472
|
+
if (!((_f = product == null ? void 0 : product.metadata) == null ? void 0 : _f.venue_booking))
|
|
1473
|
+
continue;
|
|
1474
|
+
if (product.identity_key)
|
|
1475
|
+
venueProductUids.add(String(product.identity_key));
|
|
1476
|
+
if ((_g = product.metadata) == null ? void 0 : _g.booking_uid) {
|
|
1477
|
+
venueBookingUids.add(String(product.metadata.booking_uid));
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
const beforeBookingCount = ((_h = tempOrder.bookings) == null ? void 0 : _h.length) || 0;
|
|
1481
|
+
tempOrder.bookings = (tempOrder.bookings || []).filter((booking) => {
|
|
1482
|
+
var _a2, _b2;
|
|
1483
|
+
if (!((_a2 = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a2.venue_booking))
|
|
1484
|
+
return true;
|
|
1485
|
+
if (booking.product_uid) {
|
|
1486
|
+
return venueProductUids.has(String(booking.product_uid));
|
|
1487
|
+
}
|
|
1488
|
+
const bookingUid = (_b2 = booking.metadata) == null ? void 0 : _b2.unique_identification_number;
|
|
1489
|
+
if (bookingUid)
|
|
1490
|
+
return venueBookingUids.has(String(bookingUid));
|
|
1491
|
+
return true;
|
|
1492
|
+
});
|
|
1493
|
+
if ((((_i = tempOrder.bookings) == null ? void 0 : _i.length) || 0) !== beforeBookingCount) {
|
|
1494
|
+
(_k = (_j = this.store.order).persistTempOrder) == null ? void 0 : _k.call(_j);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1466
1497
|
await this.refreshItemRuleQuantityLimits();
|
|
1467
1498
|
await this.refreshCartValidationPassed();
|
|
1468
1499
|
this.logMethodSuccess("removeProductFromOrder", {
|