@lancom/shared 0.0.379 → 0.0.381

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.
@@ -117,6 +117,9 @@ export default {
117
117
  type: Boolean,
118
118
  default: false
119
119
  },
120
+ postcodesRange: {
121
+ type: String
122
+ },
120
123
  disabled: {
121
124
  type: Boolean,
122
125
  default: false
@@ -168,12 +171,13 @@ export default {
168
171
  }
169
172
  },
170
173
  methods: {
171
- async handleSearch(query) {
174
+ async handleSearch(query = '') {
172
175
  if (query.trim().length > 1) {
173
176
  this.isLoading = true;
174
177
  const country = this.codeCountry || this.country;
175
178
  const countryName = country ? (['GB','UK'].includes(country.isoCode) ? 'UK' : (country.name || country)) : 'Australia';
176
179
  const params = {
180
+ postcode: this.postcodesRange,
177
181
  query: query.trim(),
178
182
  country: countryName
179
183
  };
@@ -105,6 +105,16 @@
105
105
  const page = +this.$route.query.page;
106
106
  return `${this.breadcrumbs[this.breadcrumbs.length - 1]?.to}${page > 1 ? `?page=${page}` : ''}`;
107
107
  },
108
+ pageItemType() {
109
+ return 'product';
110
+ },
111
+ pageItemImage() {
112
+ const images = this.products.reduce((images, product) => {
113
+ const image = getProductLargeCover(product, 'front') || getProductMediumCover(product, 'front');
114
+ return image ? [...images, image] : images;
115
+ }, []);
116
+ return images.slice(0, 1);
117
+ },
108
118
  currentBrand() {
109
119
  return this.findByRouteParam(this.brands, 'brand');
110
120
  },
@@ -51,6 +51,10 @@ const metaInfo = {
51
51
  hid: 'og:title',
52
52
  property: 'og:title',
53
53
  content: pageTitle
54
+ }, {
55
+ hid: 'og:type',
56
+ property: 'og:type',
57
+ content: this.pageItemType || 'website'
54
58
  }];
55
59
 
56
60
  const canonical = this.getCanonical();
@@ -91,23 +95,26 @@ const metaInfo = {
91
95
  });
92
96
  }
93
97
 
94
- const pageImage = this.pageItemImage || this.pageItem?.image || (this.pageItem?.images && this.pageItem?.images[0]) || image;
98
+ const pageImage = this.pageItemImage || this.pageItem?.image || (this.pageItem?.images?.length > 0 && this.pageItem?.images) || image;
95
99
  if (pageImage) {
96
- const pageImageUrl = staticLink(typeof pageImage === 'string' ? pageImage : (pageImage.medium || pageImage.large));
97
- metaTags.push({
98
- hid: 'og:image',
99
- property: 'og:image',
100
- content: pageImageUrl
101
- });
102
-
103
- link.push({
104
- hid: 'preloadImage',
105
- rel: 'preload',
106
- fetchpriority: 'high',
107
- as: 'image',
108
- type: 'image/webp',
109
- href: pageImageUrl
110
- });
100
+ const pageImages = Array.isArray(pageImage) ? pageImage : [pageImage];
101
+ for (const image of pageImages) {
102
+ const pageImageUrl = staticLink(typeof image === 'string' ? image : (image.medium || image.large));
103
+ metaTags.push({
104
+ hid: 'og:image',
105
+ property: 'og:image',
106
+ content: pageImageUrl
107
+ });
108
+
109
+ link.push({
110
+ hid: 'preloadImage',
111
+ rel: 'preload',
112
+ fetchpriority: 'high',
113
+ as: 'image',
114
+ type: 'image/webp',
115
+ href: pageImageUrl
116
+ });
117
+ }
111
118
  }
112
119
 
113
120
  const pageTags = pageItemMeta?.tags?.length > 0 ? pageItemMeta.tags : meta.tags;
@@ -62,7 +62,10 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
62
62
  const pageItem = store.getters['product/product'];
63
63
  const loadError = store.getters['product/loadError'];
64
64
 
65
- if (loadError) {
65
+ // console.log('loadError: ', loadError);
66
+ if (loadError?.redirectLink) {
67
+ return redirect(301, loadError?.redirectLink);
68
+ } else if (loadError) {
66
69
  error(loadError);
67
70
  }
68
71
 
@@ -91,6 +94,9 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
91
94
  stockCountryId() {
92
95
  return this.stockCountry?._id || null;
93
96
  },
97
+ pageItemType() {
98
+ return 'product';
99
+ },
94
100
  pageItemImage() {
95
101
  return this.mainProductImageSrc;
96
102
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.379",
3
+ "version": "0.0.381",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -39,6 +39,11 @@ export default {
39
39
  openedGroup: this.$route.params.group,
40
40
  openedEntity: this.$route.query.id
41
41
  };
42
+ },
43
+ computed: {
44
+ pageItemType() {
45
+ return 'article';
46
+ }
42
47
  }
43
48
  };
44
49
  </script>
@@ -30,6 +30,11 @@ export default {
30
30
  openedGroup: this.$route.query.group,
31
31
  openedEntity: this.$route.query.id
32
32
  };
33
+ },
34
+ computed: {
35
+ pageItemType() {
36
+ return 'article';
37
+ }
33
38
  }
34
39
  };
35
40
  </script>
@@ -59,6 +59,9 @@ export default {
59
59
  to: '/news',
60
60
  text: 'Blog'
61
61
  }, item].filter(i => !!i);
62
+ },
63
+ pageItemType() {
64
+ return 'article';
62
65
  }
63
66
  },
64
67
  getRoute() {
@@ -41,6 +41,11 @@ export default {
41
41
  text: 'Blog'
42
42
  }]
43
43
  };
44
+ },
45
+ computed: {
46
+ pageItemType() {
47
+ return 'article';
48
+ }
44
49
  }
45
50
  };
46
51
  </script>
@@ -49,6 +49,9 @@ export default {
49
49
  }, {
50
50
  text: this.pageItem.title
51
51
  }];
52
+ },
53
+ pageItemType() {
54
+ return 'article';
52
55
  }
53
56
  }
54
57
  };
package/store/product.js CHANGED
@@ -172,12 +172,14 @@ export const actions = {
172
172
  commit('setIsPrintPricing', true);
173
173
  }
174
174
  } catch (e) {
175
- console.log(e);
175
+ // console.log(e);
176
176
  const { status, data } = e?.response || {};
177
+ // console.log('data: ', data);
177
178
  const statusCode = status || 500;
178
179
  commit('setLoadError', {
179
180
  statusCode,
180
- message: data?.error || 'Product not found'
181
+ message: data?.error || 'Product not found',
182
+ redirectLink: data?.redirectLink || null
181
183
  });
182
184
  }
183
185
  },
@@ -265,7 +267,7 @@ export const actions = {
265
267
  printType: selectedPrintType?._id
266
268
  }
267
269
  });
268
- console.log('layer: ', layer);
270
+ // console.log('layer: ', layer);
269
271
  if (preselect) {
270
272
  commit('setSelectedLayer', layer);
271
273
  }
package/store/products.js CHANGED
@@ -69,11 +69,13 @@ export const actions = {
69
69
  return { products };
70
70
  } catch (e) {
71
71
  const { status, data } = e?.response || {};
72
+ // console.log(e.response.data)
72
73
  const statusCode = status || 500;
73
74
  // console.log('statusCode: ', statusCode, data?.error || 'Post not found');
74
75
  commit('setLoadError', {
75
76
  statusCode,
76
- error: data?.error || 'Post not found'
77
+ error: data?.error || 'Post not found',
78
+ redirectLink: data?.redirectLink || null
77
79
  });
78
80
  throw e;
79
81
  }