@lancom/shared 0.0.246 → 0.0.247

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.
@@ -191,6 +191,9 @@ export default {
191
191
  this.onOrderSucces();
192
192
  this.$emit('next');
193
193
  }
194
+ } catch (e) {
195
+ const { message } = (e.response && e.response.data) || e;
196
+ this.handleErrors({ messages: [{ message }] });
194
197
  } finally {
195
198
  this.creating = false;
196
199
  }
@@ -1,3 +1,19 @@
1
+ async function googleLocalShoppingFeed(axios, config, availableStores) {
2
+ const result = await googleShoppingFeed(axios, config, availableStores);
3
+
4
+ const fields = [
5
+ 'g:availability',
6
+ 'g:id',
7
+ 'g:pickup_method',
8
+ 'g:pickup_sla',
9
+ 'g:price',
10
+ 'g:quantity',
11
+ 'g:store_code'
12
+ ];
13
+ result.rss.channel.item = result.rss.channel.item
14
+ .map(i => fields.reduce((item, field) => ({ ...item, [field]: i[field] }), {}));
15
+ return result;
16
+ }
1
17
  async function googleShoppingFeed(axios, config, availableStores) {
2
18
  const { data } = await axios.get(`${config.LOCAL_API_URL}/feed/products?host=${config.HOST_NAME}`);
3
19
  const spliceFirstImage = images => (images || []).splice(0, 1)[0];
@@ -72,6 +88,7 @@ async function googleShoppingFeed(axios, config, availableStores) {
72
88
  }
73
89
  } else {
74
90
  info['g:pickup_method'] = { _text: 'not_supported' };
91
+ info['g:excluded_destination'] = { _text: 'Local_inventory_ads' };
75
92
  }
76
93
  if (product.volume) {
77
94
  if (product.volume.length) {
@@ -104,5 +121,6 @@ async function googleShoppingFeed(axios, config, availableStores) {
104
121
  }
105
122
 
106
123
  module.exports = {
107
- googleShoppingFeed
124
+ googleShoppingFeed,
125
+ googleLocalShoppingFeed
108
126
  };
package/feeds/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const { reviewsFeed } = require('./reviews');
2
- const { googleShoppingFeed } = require('./google-shopping');
2
+ const { googleShoppingFeed, googleLocalShoppingFeed } = require('./google-shopping');
3
3
 
4
4
  module.exports = {
5
5
  reviewsFeed,
6
- googleShoppingFeed
6
+ googleShoppingFeed,
7
+ googleLocalShoppingFeed
7
8
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.246",
3
+ "version": "0.0.247",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {