@open-tender/utils 0.5.71 → 0.5.72
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.
|
@@ -17,7 +17,12 @@ const useCartPoints = (cart, check, form, updatePoints) => {
|
|
|
17
17
|
}, {})
|
|
18
18
|
: null;
|
|
19
19
|
const hasPoints = points && itemsPoints;
|
|
20
|
-
const cartWithPoints = (cart === null || cart === void 0 ? void 0 : cart.map((i, index) =>
|
|
20
|
+
const cartWithPoints = (cart === null || cart === void 0 ? void 0 : cart.map((i, index) => {
|
|
21
|
+
const validatedItem = items[index];
|
|
22
|
+
return Object.assign(Object.assign({}, i), { index, totalPrice: validatedItem
|
|
23
|
+
? parseFloat(validatedItem.price_total)
|
|
24
|
+
: i.totalPrice, points: hasPoints ? itemsPoints[index.toString()] : null });
|
|
25
|
+
})) || [];
|
|
21
26
|
const pointsApplied = (0, react_1.useMemo)(() => (form.points ? form.points.reduce((t, i) => (t += i.points), 0) : 0), [form.points]);
|
|
22
27
|
const cartDiff = ((_a = cart === null || cart === void 0 ? void 0 : cart.length) !== null && _a !== void 0 ? _a : 0) - (cartLength !== null && cartLength !== void 0 ? cartLength : 0);
|
|
23
28
|
const pointsName = points ? points.name.toLowerCase() : null;
|
|
@@ -14,7 +14,12 @@ export const useCartPoints = (cart, check, form, updatePoints) => {
|
|
|
14
14
|
}, {})
|
|
15
15
|
: null;
|
|
16
16
|
const hasPoints = points && itemsPoints;
|
|
17
|
-
const cartWithPoints = (cart === null || cart === void 0 ? void 0 : cart.map((i, index) =>
|
|
17
|
+
const cartWithPoints = (cart === null || cart === void 0 ? void 0 : cart.map((i, index) => {
|
|
18
|
+
const validatedItem = items[index];
|
|
19
|
+
return Object.assign(Object.assign({}, i), { index, totalPrice: validatedItem
|
|
20
|
+
? parseFloat(validatedItem.price_total)
|
|
21
|
+
: i.totalPrice, points: hasPoints ? itemsPoints[index.toString()] : null });
|
|
22
|
+
})) || [];
|
|
18
23
|
const pointsApplied = useMemo(() => (form.points ? form.points.reduce((t, i) => (t += i.points), 0) : 0), [form.points]);
|
|
19
24
|
const cartDiff = ((_a = cart === null || cart === void 0 ? void 0 : cart.length) !== null && _a !== void 0 ? _a : 0) - (cartLength !== null && cartLength !== void 0 ? cartLength : 0);
|
|
20
25
|
const pointsName = points ? points.name.toLowerCase() : null;
|
package/package.json
CHANGED