@viur/shop-components 0.14.8 → 0.15.0

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.14.8",
3
+ "version": "0.15.0",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,6 +9,7 @@
9
9
  item?.shop_image
10
10
  ? item.shop_image
11
11
  : undefined,
12
+ shopStore.state.serving_url_params.CartItem,
12
13
  )
13
14
  "
14
15
  />
@@ -9,6 +9,7 @@
9
9
  item?.shop_image
10
10
  ? item.shop_image
11
11
  : undefined,
12
+ shopStore.state.serving_url_params.CartItemSmall,
12
13
  )
13
14
  "
14
15
  />
@@ -69,14 +69,14 @@ function removeDiscountAction(key){
69
69
  removeDiscount(key)
70
70
  .then(async (resp) => {
71
71
  state.loading=false
72
- state.alert.msg = $t('viur.shop.discount_removed');
72
+ state.alert.msg = i18n.t('viur.shop.discount_removed');
73
73
  state.alert.show = true;
74
74
  state.alert.variant = "success";
75
75
  })
76
76
  .catch((error) => {
77
77
  state.loading=false
78
78
  console.log("error bei rabatt", error);
79
- state.alert.msg = $t('viur.shop.discount_not_found');
79
+ state.alert.msg = i18n.t('viur.shop.discount_not_found');
80
80
  state.alert.show = true;
81
81
  state.alert.variant = "danger";
82
82
  });
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/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
- if (image !== undefined) return Request.downloadUrlFor(image);
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
+ }