@pisell/pisellos 0.0.152 → 0.0.154
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.
|
@@ -497,11 +497,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
497
497
|
}) : [];
|
|
498
498
|
}).flat();
|
|
499
499
|
newDiscountList.forEach(function (item) {
|
|
500
|
-
var _item$applicableProdu;
|
|
500
|
+
var _item$applicableProdu, _item$applicableProdu2;
|
|
501
501
|
var isAllProductUsed = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
|
|
502
502
|
return allUsedProductIds === null || allUsedProductIds === void 0 ? void 0 : allUsedProductIds.includes(id);
|
|
503
503
|
});
|
|
504
|
-
|
|
504
|
+
var isAllProductFree = (_item$applicableProdu2 = item.applicableProductIds) === null || _item$applicableProdu2 === void 0 ? void 0 : _item$applicableProdu2.every(function (n) {
|
|
505
|
+
var _this3$hooks2;
|
|
506
|
+
var targetProduct = productList.find(function (n) {
|
|
507
|
+
return n.id === n;
|
|
508
|
+
});
|
|
509
|
+
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
510
|
+
return Number(product === null || product === void 0 ? void 0 : product.price) === 0;
|
|
511
|
+
});
|
|
512
|
+
if (!item.isSelected && (isAllProductUsed || isAllProductFree)) {
|
|
505
513
|
item.isDisabledForProductUsed = true;
|
|
506
514
|
} else {
|
|
507
515
|
item.isDisabledForProductUsed = false;
|
|
@@ -341,11 +341,17 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
341
341
|
}) : [];
|
|
342
342
|
}).flat();
|
|
343
343
|
newDiscountList.forEach((item) => {
|
|
344
|
-
var _a2;
|
|
344
|
+
var _a2, _b;
|
|
345
345
|
const isAllProductUsed = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
|
|
346
346
|
return allUsedProductIds == null ? void 0 : allUsedProductIds.includes(id);
|
|
347
347
|
});
|
|
348
|
-
|
|
348
|
+
const isAllProductFree = (_b = item.applicableProductIds) == null ? void 0 : _b.every((n) => {
|
|
349
|
+
var _a3;
|
|
350
|
+
const targetProduct = productList.find((n2) => n2.id === n2);
|
|
351
|
+
const product = (_a3 = this.hooks) == null ? void 0 : _a3.getProduct(targetProduct);
|
|
352
|
+
return Number(product == null ? void 0 : product.price) === 0;
|
|
353
|
+
});
|
|
354
|
+
if (!item.isSelected && (isAllProductUsed || isAllProductFree)) {
|
|
349
355
|
item.isDisabledForProductUsed = true;
|
|
350
356
|
} else {
|
|
351
357
|
item.isDisabledForProductUsed = false;
|