@pisell/pisellos 0.0.159 → 0.0.161
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/modules/Cart/utils/changePrice.js +4 -0
- package/dist/modules/Schedule/index.js +1 -1
- package/dist/solution/ShopDiscount/index.js +6 -6
- package/lib/modules/Cart/utils/changePrice.js +14 -0
- package/lib/modules/Schedule/index.js +1 -1
- package/lib/solution/ShopDiscount/index.js +6 -6
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
12
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
13
|
+
import Decimal from "decimal.js";
|
|
13
14
|
export function updateAllCartItemPrice(_x, _x2, _x3, _x4) {
|
|
14
15
|
return _updateAllCartItemPrice.apply(this, arguments);
|
|
15
16
|
}
|
|
@@ -49,6 +50,9 @@ function _updateAllCartItemPrice() {
|
|
|
49
50
|
var targetBundleItem = targetBundle.bundle_item.find(function (m) {
|
|
50
51
|
return m.id === n.id;
|
|
51
52
|
});
|
|
53
|
+
if (targetBundleItem.price_type === 'markdown') {
|
|
54
|
+
targetBundleItem.price = new Decimal(targetBundleItem.price || 0).mul(-1).toNumber();
|
|
55
|
+
}
|
|
52
56
|
if (targetBundleItem) {
|
|
53
57
|
return _objectSpread(_objectSpread({}, n), {}, {
|
|
54
58
|
price: targetBundleItem.price,
|
|
@@ -232,7 +232,7 @@ export var ScheduleModule = /*#__PURE__*/function (_BaseModule) {
|
|
|
232
232
|
cacheId: this.cacheId,
|
|
233
233
|
fatherModule: this.fatherModule,
|
|
234
234
|
store: store,
|
|
235
|
-
cacheKey: ['scheduleList', 'availabilityDateList']
|
|
235
|
+
cacheKey: ['scheduleList', 'availabilityDateList', 'otherProductsIds']
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -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;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
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
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// src/modules/Cart/utils/changePrice.ts
|
|
@@ -22,6 +32,7 @@ __export(changePrice_exports, {
|
|
|
22
32
|
updateAllCartItemPrice: () => updateAllCartItemPrice
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(changePrice_exports);
|
|
35
|
+
var import_decimal = __toESM(require("decimal.js"));
|
|
25
36
|
async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCart) {
|
|
26
37
|
for (const item of cartItems) {
|
|
27
38
|
const targetProduct = priceData.find((n) => n.id === item.id);
|
|
@@ -41,6 +52,9 @@ async function updateAllCartItemPrice(cartItems, priceData, getProduct, updateCa
|
|
|
41
52
|
const targetBundleItem = targetBundle.bundle_item.find(
|
|
42
53
|
(m) => m.id === n.id
|
|
43
54
|
);
|
|
55
|
+
if (targetBundleItem.price_type === "markdown") {
|
|
56
|
+
targetBundleItem.price = new import_decimal.default(targetBundleItem.price || 0).mul(-1).toNumber();
|
|
57
|
+
}
|
|
44
58
|
if (targetBundleItem) {
|
|
45
59
|
return {
|
|
46
60
|
...n,
|
|
@@ -154,7 +154,7 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
|
|
|
154
154
|
cacheId: this.cacheId,
|
|
155
155
|
fatherModule: this.fatherModule,
|
|
156
156
|
store,
|
|
157
|
-
cacheKey: ["scheduleList", "availabilityDateList"]
|
|
157
|
+
cacheKey: ["scheduleList", "availabilityDateList", "otherProductsIds"]
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -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;
|