@viur/shop-components 0.3.0 → 0.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@viur/ignite": "^5.1.2",
27
27
  "@viur/shoelace": "^1.0.10-v2.20.0",
28
- "@viur/vue-utils": "^2.2.6",
28
+ "@viur/vue-utils": "^3.1.3",
29
29
  "@vueuse/core": "^13.1.0",
30
30
  "pinia": "^2.3.1",
31
31
  "vue": "^3.5.13",
@@ -74,7 +74,16 @@ async function nextStep(){
74
74
  return await fetchOrder(shopStore.state.orderKey)
75
75
  }
76
76
 
77
- onBeforeMount(()=>{
77
+ onBeforeMount(() => {
78
+ // console.debug(shopStore.state.cartRoot?.['shipping_status']);
79
+ // By default a cart has always the cheapest shipping set, therefore we can skip this step.
80
+ // But with the link on verify the user is still able to choose a different shipping.
81
+ if (shopStore.state.cartRoot?.['shipping_status'] === 'cheapest') {
82
+ console.debug(`Skip cheapest shipping @ %o`, shopStore.state.cartRoot);
83
+ nextStep().then(() => shopStore.navigateToNext());
84
+ return;
85
+ }
86
+
78
87
  fetchShippingData()
79
88
  state.selectedShippingMethod = shopStore.state.cartRoot?.['shipping']
80
89
  })
@@ -94,12 +94,12 @@ export function useCart() {
94
94
  name:name?name:shopStore.state.cartRoot['name'],
95
95
  customer_comment:customer_comment?customer_comment:shopStore.state.cartRoot['customer_comment'],
96
96
  shipping_address_key:shipping_address_key?shipping_address_key:shippingAddressKey.value,
97
- shipping_key:shipping_key?shipping_key:shopStore.state.cartRoot?.['shipping']?.['dest']?.['key'],
97
+ shipping_key: shipping_key, // only after explicit user selection
98
98
  discount_key:discount_key?discount_key:shopStore.state.cartRoot?.['discount']?.['dest']?.['key'],
99
99
  cart_key:cart_key ? cart_key : shopStore.state.cartRoot['key'],
100
100
  }
101
101
 
102
- if (commission) {
102
+ if (commission) { // TODO: that's not standard, must be more generic!
103
103
  data.commission = commission
104
104
  }
105
105