@viur/shop-components 0.14.9 → 0.15.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 +1 -1
- package/src/ShopSummary.vue +3 -3
- package/src/components/AddressForm.vue +19 -2
- package/src/components/CartItem.vue +1 -0
- package/src/components/CartItemSmall.vue +1 -0
- package/src/shop.js +6 -2
- package/src/translations/de.js +1 -0
- package/src/translations/en.js +1 -0
- package/src/translations/fr.js +1 -0
- package/src/utils.js +14 -3
package/package.json
CHANGED
package/src/ShopSummary.vue
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
</sl-format-number>
|
|
29
29
|
</div>
|
|
30
30
|
<div class="viur-shop-cart-sidebar-info" v-if="shopStore.state.cartRoot.discount">
|
|
31
|
-
<span
|
|
31
|
+
<span>{{ shopStore.state.cartRoot.discount.dest.name }}</span>
|
|
32
32
|
<sl-format-number lang="de" type="currency" currency="EUR" :value="state.discount">
|
|
33
33
|
</sl-format-number>
|
|
34
34
|
</div>
|
|
@@ -76,7 +76,7 @@ import LoadingHandler from "./components/LoadingHandler.vue"
|
|
|
76
76
|
import DiscountInput from './components/DiscountInput.vue';
|
|
77
77
|
|
|
78
78
|
const shopStore = useViurShopStore();
|
|
79
|
-
const { fetchCart, addItem, state: cartState } = useCart();
|
|
79
|
+
const { fetchCart, fetchCartRoot, addItem, state: cartState } = useCart();
|
|
80
80
|
|
|
81
81
|
const props = defineProps({
|
|
82
82
|
showFeatures: {type: Boolean, default: true},
|
|
@@ -138,7 +138,7 @@ onBeforeMount(() => {
|
|
|
138
138
|
if (!shopStore.state.cartList.length) {
|
|
139
139
|
fetchCart().then(()=>state.loading=false).catch(()=>state.loading=false)
|
|
140
140
|
}else{
|
|
141
|
-
state.loading=false
|
|
141
|
+
fetchCartRoot().then(()=>state.loading=false).catch(()=>state.loading=false)
|
|
142
142
|
}
|
|
143
143
|
})
|
|
144
144
|
|
|
@@ -13,11 +13,22 @@
|
|
|
13
13
|
error-style="decent"
|
|
14
14
|
>
|
|
15
15
|
</ViForm>
|
|
16
|
+
<ShopAlert
|
|
17
|
+
v-if="state.showCountryChangeHint"
|
|
18
|
+
class="country-change-hint"
|
|
19
|
+
variant="warning"
|
|
20
|
+
icon-name="exclamation-triangle"
|
|
21
|
+
:closeable="true"
|
|
22
|
+
duration="Infinity"
|
|
23
|
+
:msg="$t('viur.shop.country_change_vat_hint')"
|
|
24
|
+
@on-hide="state.showCountryChangeHint = false"
|
|
25
|
+
/>
|
|
16
26
|
</template>
|
|
17
27
|
|
|
18
28
|
<script setup>
|
|
19
29
|
import {computed, onMounted, reactive, watch} from 'vue'
|
|
20
30
|
import LoadingHandler from './LoadingHandler.vue';
|
|
31
|
+
import ShopAlert from './ShopAlert.vue';
|
|
21
32
|
import ViForm from "@viur/vue-utils/forms/ViForm.vue";
|
|
22
33
|
import {useViurShopStore} from "../shop";
|
|
23
34
|
import {useAddress} from "../composables/address";
|
|
@@ -68,11 +79,14 @@ const state = reactive({
|
|
|
68
79
|
}
|
|
69
80
|
return [state.formtype]
|
|
70
81
|
}),
|
|
71
|
-
language: "de"
|
|
82
|
+
language: "de",
|
|
83
|
+
initialCountry: null,
|
|
84
|
+
showCountryChangeHint: false
|
|
72
85
|
})
|
|
73
86
|
|
|
74
87
|
function formChange(data){
|
|
75
88
|
if (data.name === "country"){
|
|
89
|
+
state.showCountryChangeHint = data.value !== state.initialCountry
|
|
76
90
|
state.language = data.value
|
|
77
91
|
if (state.formtype === 'billing'){
|
|
78
92
|
fetchPaymentData()
|
|
@@ -87,6 +101,7 @@ onMounted(()=>{
|
|
|
87
101
|
}else{
|
|
88
102
|
state.language = shopStore.state.language
|
|
89
103
|
}
|
|
104
|
+
state.initialCountry = state.language
|
|
90
105
|
})
|
|
91
106
|
|
|
92
107
|
|
|
@@ -104,5 +119,7 @@ watch(()=>addressState.billingIsShipping, (newVal,oldVal)=>{
|
|
|
104
119
|
</script>
|
|
105
120
|
|
|
106
121
|
<style scoped>
|
|
107
|
-
|
|
122
|
+
.country-change-hint {
|
|
123
|
+
margin: 1em 0;
|
|
124
|
+
}
|
|
108
125
|
</style>
|
package/src/shop.js
CHANGED
|
@@ -131,8 +131,13 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
|
|
|
131
131
|
//stepper rules:
|
|
132
132
|
stepperVisible: computed(()=>{
|
|
133
133
|
return state.currentTab!=='complete'
|
|
134
|
-
})
|
|
134
|
+
}),
|
|
135
135
|
|
|
136
|
+
// serving_url_params for utils.getImage
|
|
137
|
+
serving_url_params: {
|
|
138
|
+
CartItem: '=s600-rw',
|
|
139
|
+
CartItemSmall: '=s200-rw',
|
|
140
|
+
},
|
|
136
141
|
})
|
|
137
142
|
|
|
138
143
|
function addTab({name, component, displayname, iconname, iconlibrary,active})
|
|
@@ -301,7 +306,6 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
|
|
|
301
306
|
})
|
|
302
307
|
}
|
|
303
308
|
|
|
304
|
-
|
|
305
309
|
return {
|
|
306
310
|
state,
|
|
307
311
|
navigateToTab,
|
package/src/translations/de.js
CHANGED
|
@@ -61,6 +61,7 @@ export default {
|
|
|
61
61
|
'payment_link': 'Ihr Browser öffnet kein Popup? Dann klicken Sie bitte <a href="{url}" target="_blank">hier</a>.',
|
|
62
62
|
'birthdate': 'Geburtsdatum',
|
|
63
63
|
'missing_birthdate': 'Bei der ausgewählten Bezahlmethode benötigen wir zur Rechnungsadresse noch das Geburtsdatum von <i>{firstname} {lastname}</i>.',
|
|
64
|
+
'country_change_vat_hint': 'Bitte beachten Sie, dass bei Lieferung in ein anderes Land die Mehrwertsteuer abweichen kann.',
|
|
64
65
|
},
|
|
65
66
|
},
|
|
66
67
|
messages: {
|
package/src/translations/en.js
CHANGED
|
@@ -60,6 +60,7 @@ export default {
|
|
|
60
60
|
'payment_link': 'Your browser does not open a popup? Then please click <a href="{url}" target="_blank">here</a>.',
|
|
61
61
|
'birthdate': 'date of birth',
|
|
62
62
|
'missing_birthdate': 'For the selected payment method, we require the date of birth of <i>{firstname} {lastname}</i> in addition to the billing address.',
|
|
63
|
+
'country_change_vat_hint': 'Please note that VAT may differ when shipping to a different country.',
|
|
63
64
|
},
|
|
64
65
|
},
|
|
65
66
|
messages: {
|
package/src/translations/fr.js
CHANGED
|
@@ -61,6 +61,7 @@ export default {
|
|
|
61
61
|
'payment_link': 'Votre navigateur n\'ouvre pas de popup ? Alors cliquez <a href="{url}" target="_blank">ici</a>.',
|
|
62
62
|
'birthdate': 'date de naissance',
|
|
63
63
|
'missing_birthdate': 'Pour le mode de paiement sélectionné, nous avons besoin, en plus de l\'adresse de facturation, de la date de naissance de <i>{firstname} {lastname}</i>.',
|
|
64
|
+
'country_change_vat_hint': 'Veuillez noter que la TVA peut varier en cas de livraison dans un autre pays.',
|
|
64
65
|
},
|
|
65
66
|
},
|
|
66
67
|
messages: {
|
package/src/utils.js
CHANGED
|
@@ -46,9 +46,20 @@ export function getTranslations(languages="de", pattern=null){
|
|
|
46
46
|
return fetchTranslations(languages,pattern)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export function getImage(image) {
|
|
50
|
-
|
|
49
|
+
export function getImage(image, serving_url_params = '=rw') {
|
|
50
|
+
let dest = image;
|
|
51
|
+
if (image && 'dest' in image) {
|
|
52
|
+
dest = image['dest'];
|
|
53
|
+
}
|
|
54
|
+
if (dest && dest?.['serving_url']) {
|
|
55
|
+
return `${dest['serving_url']}${serving_url_params}`;
|
|
56
|
+
}
|
|
51
57
|
|
|
58
|
+
if (image !== undefined) {
|
|
59
|
+
return Request.downloadUrlFor(image);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// FIXME: this is stupid: return null or raise an exception, but do not return a non-empty string!
|
|
52
63
|
return 'PLACEHOLDER';
|
|
53
64
|
}
|
|
54
65
|
|
|
@@ -57,4 +68,4 @@ export function removeUndefinedValues(obj) {
|
|
|
57
68
|
Object.entries(obj)
|
|
58
69
|
.filter(([key, value]) => value !== undefined && value !== null),
|
|
59
70
|
);
|
|
60
|
-
}
|
|
71
|
+
}
|