@moonbase.sh/vue 0.1.79 → 0.1.81
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 +13 -9
- package/dist/index.js +13 -9
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -283,18 +283,18 @@ function useCart() {
|
|
|
283
283
|
total: (0, import_vue8.computed)(() => {
|
|
284
284
|
const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
|
|
285
285
|
const total = storefront.currentOrder.value.items.reduce((agg, item) => {
|
|
286
|
-
var _a, _b, _c, _d, _e, _f
|
|
286
|
+
var _a, _b, _c, _d, _e, _f;
|
|
287
287
|
let price;
|
|
288
288
|
if (item.type === "Product") {
|
|
289
|
-
const product =
|
|
290
|
-
const variations = (
|
|
289
|
+
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
290
|
+
const variations = (product == null ? void 0 : product.variations) || [];
|
|
291
291
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
292
|
-
price = (
|
|
292
|
+
price = (_c = (_b = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _b : (_a = product == null ? void 0 : product.defaultVariation) == null ? void 0 : _a.price[currency]) != null ? _c : 0;
|
|
293
293
|
} else {
|
|
294
|
-
const bundle =
|
|
295
|
-
const variations = (
|
|
294
|
+
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
295
|
+
const variations = (bundle == null ? void 0 : bundle.variations) || [];
|
|
296
296
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
297
|
-
price = (
|
|
297
|
+
price = (_f = (_e = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _e : (_d = bundle == null ? void 0 : bundle.defaultVariation) == null ? void 0 : _d.price[currency]) != null ? _f : 0;
|
|
298
298
|
}
|
|
299
299
|
return agg + price * item.quantity;
|
|
300
300
|
}, 0);
|
|
@@ -315,7 +315,9 @@ function useCart() {
|
|
|
315
315
|
bundleId: item.id,
|
|
316
316
|
bundle: item,
|
|
317
317
|
quantity: 1,
|
|
318
|
-
|
|
318
|
+
variation,
|
|
319
|
+
variationId: variation.id,
|
|
320
|
+
price: variation.price
|
|
319
321
|
};
|
|
320
322
|
storefront.currentOrder.value.items.push(lineItem);
|
|
321
323
|
} else if (item.type === "product") {
|
|
@@ -325,7 +327,9 @@ function useCart() {
|
|
|
325
327
|
productId: item.id,
|
|
326
328
|
product: item,
|
|
327
329
|
quantity: 1,
|
|
328
|
-
|
|
330
|
+
variation,
|
|
331
|
+
variationId: variation.id,
|
|
332
|
+
price: variation.price
|
|
329
333
|
};
|
|
330
334
|
storefront.currentOrder.value.items.push(lineItem);
|
|
331
335
|
}
|
package/dist/index.js
CHANGED
|
@@ -249,18 +249,18 @@ function useCart() {
|
|
|
249
249
|
total: computed5(() => {
|
|
250
250
|
const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
|
|
251
251
|
const total = storefront.currentOrder.value.items.reduce((agg, item) => {
|
|
252
|
-
var _a, _b, _c, _d, _e, _f
|
|
252
|
+
var _a, _b, _c, _d, _e, _f;
|
|
253
253
|
let price;
|
|
254
254
|
if (item.type === "Product") {
|
|
255
|
-
const product =
|
|
256
|
-
const variations = (
|
|
255
|
+
const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
|
|
256
|
+
const variations = (product == null ? void 0 : product.variations) || [];
|
|
257
257
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
258
|
-
price = (
|
|
258
|
+
price = (_c = (_b = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _b : (_a = product == null ? void 0 : product.defaultVariation) == null ? void 0 : _a.price[currency]) != null ? _c : 0;
|
|
259
259
|
} else {
|
|
260
|
-
const bundle =
|
|
261
|
-
const variations = (
|
|
260
|
+
const bundle = storefront.storefront.value.bundles.find((b) => b.id === item.bundleId);
|
|
261
|
+
const variations = (bundle == null ? void 0 : bundle.variations) || [];
|
|
262
262
|
const pickedVariation = variations.find((v) => v.id === item.variationId);
|
|
263
|
-
price = (
|
|
263
|
+
price = (_f = (_e = pickedVariation == null ? void 0 : pickedVariation.price[currency]) != null ? _e : (_d = bundle == null ? void 0 : bundle.defaultVariation) == null ? void 0 : _d.price[currency]) != null ? _f : 0;
|
|
264
264
|
}
|
|
265
265
|
return agg + price * item.quantity;
|
|
266
266
|
}, 0);
|
|
@@ -281,7 +281,9 @@ function useCart() {
|
|
|
281
281
|
bundleId: item.id,
|
|
282
282
|
bundle: item,
|
|
283
283
|
quantity: 1,
|
|
284
|
-
|
|
284
|
+
variation,
|
|
285
|
+
variationId: variation.id,
|
|
286
|
+
price: variation.price
|
|
285
287
|
};
|
|
286
288
|
storefront.currentOrder.value.items.push(lineItem);
|
|
287
289
|
} else if (item.type === "product") {
|
|
@@ -291,7 +293,9 @@ function useCart() {
|
|
|
291
293
|
productId: item.id,
|
|
292
294
|
product: item,
|
|
293
295
|
quantity: 1,
|
|
294
|
-
|
|
296
|
+
variation,
|
|
297
|
+
variationId: variation.id,
|
|
298
|
+
price: variation.price
|
|
295
299
|
};
|
|
296
300
|
storefront.currentOrder.value.items.push(lineItem);
|
|
297
301
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.81",
|
|
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",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@vue/devtools-api": "^6.5.1",
|
|
20
20
|
"uuid": "^9.0.1",
|
|
21
|
-
"@moonbase.sh/storefront-api": "0.1.
|
|
21
|
+
"@moonbase.sh/storefront-api": "0.1.81"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/uuid": "^9.0.7",
|