@moonbase.sh/vue 0.1.36 → 0.1.38

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 CHANGED
@@ -258,6 +258,10 @@ function useCart() {
258
258
  }
259
259
  const _ = storefront.pushOrderContent();
260
260
  },
261
+ setQuantity: (cartItem, quantity) => {
262
+ cartItem.quantity = quantity;
263
+ const _ = storefront.pushOrderContent();
264
+ },
261
265
  removeFromCart: (cartItem) => {
262
266
  const index = storefront.currentOrder.value.items.findIndex((i) => i.type === "Bundle" && cartItem.type === "Bundle" && i.bundleId === cartItem.bundleId || i.type === "Product" && cartItem.type === "Product" && i.productId === cartItem.productId);
263
267
  storefront.currentOrder.value.items.splice(index, 1);
@@ -269,7 +273,7 @@ function useCart() {
269
273
  returnUrl: absoluteReturnUrl
270
274
  });
271
275
  storefront.currentOrder.value = updatedOrder;
272
- if (updatedOrder.checkoutUrl)
276
+ if (updatedOrder.checkoutUrl && (window == null ? void 0 : window.location))
273
277
  window.location.href = updatedOrder.checkoutUrl;
274
278
  else
275
279
  throw new Error("No checkout URL found");
package/dist/index.d.cts CHANGED
@@ -38,6 +38,7 @@ declare function useCart(): {
38
38
  currency: string;
39
39
  }>;
40
40
  addToCart: (item: StorefrontProduct | StorefrontBundle, variation?: PricingVariation) => void;
41
+ setQuantity: (cartItem: CartItem, quantity: number) => void;
41
42
  removeFromCart: (cartItem: CartItem) => void;
42
43
  checkout: (returnUrl: string) => Promise<void>;
43
44
  };
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ declare function useCart(): {
38
38
  currency: string;
39
39
  }>;
40
40
  addToCart: (item: StorefrontProduct | StorefrontBundle, variation?: PricingVariation) => void;
41
+ setQuantity: (cartItem: CartItem, quantity: number) => void;
41
42
  removeFromCart: (cartItem: CartItem) => void;
42
43
  checkout: (returnUrl: string) => Promise<void>;
43
44
  };
package/dist/index.js CHANGED
@@ -226,6 +226,10 @@ function useCart() {
226
226
  }
227
227
  const _ = storefront.pushOrderContent();
228
228
  },
229
+ setQuantity: (cartItem, quantity) => {
230
+ cartItem.quantity = quantity;
231
+ const _ = storefront.pushOrderContent();
232
+ },
229
233
  removeFromCart: (cartItem) => {
230
234
  const index = storefront.currentOrder.value.items.findIndex((i) => i.type === "Bundle" && cartItem.type === "Bundle" && i.bundleId === cartItem.bundleId || i.type === "Product" && cartItem.type === "Product" && i.productId === cartItem.productId);
231
235
  storefront.currentOrder.value.items.splice(index, 1);
@@ -237,7 +241,7 @@ function useCart() {
237
241
  returnUrl: absoluteReturnUrl
238
242
  });
239
243
  storefront.currentOrder.value = updatedOrder;
240
- if (updatedOrder.checkoutUrl)
244
+ if (updatedOrder.checkoutUrl && (window == null ? void 0 : window.location))
241
245
  window.location.href = updatedOrder.checkoutUrl;
242
246
  else
243
247
  throw new Error("No checkout URL found");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.1.36",
4
+ "version": "0.1.38",
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",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "@vue/devtools-api": "^6.5.0",
17
17
  "uuid": "^9.0.0",
18
- "@moonbase.sh/api-client": "0.1.36"
18
+ "@moonbase.sh/api-client": "0.1.38"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "vue": "^3.2.0"