@moonbase.sh/vue 0.4.57 → 0.4.58
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/index.cjs +12 -6
- package/dist/index.js +12 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1088,16 +1088,22 @@ function useEligibleOffers(context) {
|
|
|
1088
1088
|
throw new Error("No storefront configured");
|
|
1089
1089
|
return (0, import_vue10.computed)(() => {
|
|
1090
1090
|
var _a;
|
|
1091
|
-
return ((_a = storefront.storefront.value.offers) != null ? _a : []).filter((o) => import_storefront_api6.OfferUtils.eligible(o, storefront.currentOrder.value) && !offerTargetIsInCart(o, storefront.currentOrder.value));
|
|
1091
|
+
return ((_a = storefront.storefront.value.offers) != null ? _a : []).filter((o) => import_storefront_api6.OfferUtils.eligible(o, storefront.currentOrder.value) && !offerIsInCart(o, storefront.currentOrder.value) && !offerTargetIsInCart(o, storefront.currentOrder.value));
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
|
+
function offerIsInCart(offer, order) {
|
|
1095
|
+
return order.items.some(
|
|
1096
|
+
(i) => i.offerId === offer.id
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1094
1099
|
function offerTargetIsInCart(offer, order) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
return true;
|
|
1100
|
+
const target = offer.target;
|
|
1101
|
+
if (Array.isArray(target)) {
|
|
1102
|
+
return target.every((target2) => order.items.some((i) => i.type === "Product" && target2.type === "Product" && i.productId === target2.id || i.type === "Bundle" && target2.type === "Bundle" && i.bundleId === target2.id));
|
|
1099
1103
|
}
|
|
1100
|
-
return
|
|
1104
|
+
return order.items.some(
|
|
1105
|
+
(i) => i.type === "Product" && target.type === "Product" && i.productId === target.id || i.type === "Bundle" && target.type === "Bundle" && i.bundleId === target.id
|
|
1106
|
+
);
|
|
1101
1107
|
}
|
|
1102
1108
|
|
|
1103
1109
|
// src/composables/useProduct.ts
|
package/dist/index.js
CHANGED
|
@@ -1056,16 +1056,22 @@ function useEligibleOffers(context) {
|
|
|
1056
1056
|
throw new Error("No storefront configured");
|
|
1057
1057
|
return computed6(() => {
|
|
1058
1058
|
var _a;
|
|
1059
|
-
return ((_a = storefront.storefront.value.offers) != null ? _a : []).filter((o) => OfferUtils3.eligible(o, storefront.currentOrder.value) && !offerTargetIsInCart(o, storefront.currentOrder.value));
|
|
1059
|
+
return ((_a = storefront.storefront.value.offers) != null ? _a : []).filter((o) => OfferUtils3.eligible(o, storefront.currentOrder.value) && !offerIsInCart(o, storefront.currentOrder.value) && !offerTargetIsInCart(o, storefront.currentOrder.value));
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
|
+
function offerIsInCart(offer, order) {
|
|
1063
|
+
return order.items.some(
|
|
1064
|
+
(i) => i.offerId === offer.id
|
|
1065
|
+
);
|
|
1066
|
+
}
|
|
1062
1067
|
function offerTargetIsInCart(offer, order) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
return true;
|
|
1068
|
+
const target = offer.target;
|
|
1069
|
+
if (Array.isArray(target)) {
|
|
1070
|
+
return target.every((target2) => order.items.some((i) => i.type === "Product" && target2.type === "Product" && i.productId === target2.id || i.type === "Bundle" && target2.type === "Bundle" && i.bundleId === target2.id));
|
|
1067
1071
|
}
|
|
1068
|
-
return
|
|
1072
|
+
return order.items.some(
|
|
1073
|
+
(i) => i.type === "Product" && target.type === "Product" && i.productId === target.id || i.type === "Bundle" && target.type === "Bundle" && i.bundleId === target.id
|
|
1074
|
+
);
|
|
1069
1075
|
}
|
|
1070
1076
|
|
|
1071
1077
|
// src/composables/useProduct.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.58",
|
|
5
5
|
"description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@vue/devtools-api": "^6.6.3",
|
|
20
20
|
"uuid": "^9.0.1",
|
|
21
21
|
"zod": "^3.23.8",
|
|
22
|
-
"@moonbase.sh/storefront-api": "0.4.
|
|
22
|
+
"@moonbase.sh/storefront-api": "0.4.58"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.8",
|