@pisell/pisellos 0.0.158 → 0.0.160
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.
|
@@ -458,7 +458,7 @@ export var RulesModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
458
458
|
options: product.options
|
|
459
459
|
}),
|
|
460
460
|
variant: variant,
|
|
461
|
-
original_price: new Decimal(
|
|
461
|
+
original_price: new Decimal(product.price).toNumber(),
|
|
462
462
|
total: getProductTotalPrice({
|
|
463
463
|
product: {
|
|
464
464
|
price: targetProductPrice
|
|
@@ -497,19 +497,19 @@ export var ShopDiscountImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
497
497
|
}) : [];
|
|
498
498
|
}).flat();
|
|
499
499
|
newDiscountList.forEach(function (item) {
|
|
500
|
-
var _item$applicableProdu
|
|
501
|
-
var
|
|
502
|
-
return allUsedProductIds === null || allUsedProductIds === void 0 ? void 0 : allUsedProductIds.includes(id);
|
|
503
|
-
});
|
|
504
|
-
var isAllProductFree = (_item$applicableProdu2 = item.applicableProductIds) === null || _item$applicableProdu2 === void 0 ? void 0 : _item$applicableProdu2.every(function (id) {
|
|
500
|
+
var _item$applicableProdu;
|
|
501
|
+
var isProductFree = function isProductFree(id) {
|
|
505
502
|
var _this3$hooks2;
|
|
506
503
|
var targetProduct = productList.find(function (n) {
|
|
507
504
|
return n.id === id;
|
|
508
505
|
});
|
|
509
506
|
var product = (_this3$hooks2 = _this3.hooks) === null || _this3$hooks2 === void 0 ? void 0 : _this3$hooks2.getProduct(targetProduct);
|
|
510
507
|
return Number(product === null || product === void 0 ? void 0 : product.price) === 0;
|
|
508
|
+
};
|
|
509
|
+
var isAllProductUsedOrFree = (_item$applicableProdu = item.applicableProductIds) === null || _item$applicableProdu === void 0 ? void 0 : _item$applicableProdu.every(function (id) {
|
|
510
|
+
return (allUsedProductIds === null || allUsedProductIds === void 0 ? void 0 : allUsedProductIds.includes(id)) || isProductFree(id);
|
|
511
511
|
});
|
|
512
|
-
if (!item.isSelected &&
|
|
512
|
+
if (!item.isSelected && isAllProductUsedOrFree) {
|
|
513
513
|
item.isDisabledForProductUsed = true;
|
|
514
514
|
} else {
|
|
515
515
|
item.isDisabledForProductUsed = false;
|
|
@@ -329,7 +329,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
|
|
|
329
329
|
options: product.options
|
|
330
330
|
}),
|
|
331
331
|
variant,
|
|
332
|
-
original_price: new import_decimal.default(
|
|
332
|
+
original_price: new import_decimal.default(product.price).toNumber(),
|
|
333
333
|
total: (0, import_utils2.getProductTotalPrice)({
|
|
334
334
|
product: {
|
|
335
335
|
price: targetProductPrice
|
|
@@ -341,17 +341,17 @@ var ShopDiscountImpl = class extends import_BaseModule.BaseModule {
|
|
|
341
341
|
}) : [];
|
|
342
342
|
}).flat();
|
|
343
343
|
newDiscountList.forEach((item) => {
|
|
344
|
-
var _a2
|
|
345
|
-
const
|
|
346
|
-
return allUsedProductIds == null ? void 0 : allUsedProductIds.includes(id);
|
|
347
|
-
});
|
|
348
|
-
const isAllProductFree = (_b = item.applicableProductIds) == null ? void 0 : _b.every((id) => {
|
|
344
|
+
var _a2;
|
|
345
|
+
const isProductFree = (id) => {
|
|
349
346
|
var _a3;
|
|
350
347
|
const targetProduct = productList.find((n) => n.id === id);
|
|
351
348
|
const product = (_a3 = this.hooks) == null ? void 0 : _a3.getProduct(targetProduct);
|
|
352
349
|
return Number(product == null ? void 0 : product.price) === 0;
|
|
350
|
+
};
|
|
351
|
+
const isAllProductUsedOrFree = (_a2 = item.applicableProductIds) == null ? void 0 : _a2.every((id) => {
|
|
352
|
+
return (allUsedProductIds == null ? void 0 : allUsedProductIds.includes(id)) || isProductFree(id);
|
|
353
353
|
});
|
|
354
|
-
if (!item.isSelected &&
|
|
354
|
+
if (!item.isSelected && isAllProductUsedOrFree) {
|
|
355
355
|
item.isDisabledForProductUsed = true;
|
|
356
356
|
} else {
|
|
357
357
|
item.isDisabledForProductUsed = false;
|