@lancom/shared 0.0.365 → 0.0.367

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.
@@ -296,10 +296,11 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
296
296
  value: this.product.sameDayDispatch ? 1 : 0
297
297
  };
298
298
  // if (sp.quantityStock > 0) {
299
- offer.shippingDetails = { "@id": "#shipping_policy" };
300
- offer.hasMerchantReturnPolicy = { "@id": "#return_policy" };
301
299
  // }
302
300
  }
301
+
302
+ offer.shippingDetails = { "@id": "#shipping_policy" };
303
+ offer.hasMerchantReturnPolicy = { "@id": "#return_policy" };
303
304
 
304
305
  const galleryImages = this.product.images?.filter(i => !(i.types || []).includes('designer') && i.color === sp.color?._id) || [];
305
306
  const image = getProductLargeCover(this.product, 'front', sp.color);
package/nuxt.config.js CHANGED
@@ -67,7 +67,8 @@ module.exports = (config, axios, { raygunClient, publicPath, productUrlToEditor
67
67
  // { src: '@/node_modules/@lancom/shared/plugins/vue-tables-2', ssr: false }
68
68
  ],
69
69
  serverMiddleware: [
70
- '@/node_modules/@lancom/shared/plugins/headers'
70
+ '@/node_modules/@lancom/shared/plugins/headers',
71
+ '@/node_modules/@lancom/shared/server-middleware/robots'
71
72
  ],
72
73
  modules: [
73
74
  'nuxt-helmet',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.365",
3
+ "version": "0.0.367",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,21 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const filePath = path.resolve(process.cwd(), 'robots.txt');
5
+ const robots = fs.readFileSync(filePath);
6
+
7
+ module.exports = function (req, res, next) {
8
+ if (req.url === '/robots.txt') {
9
+ if (req.headers.host?.includes('www1') && !req.headers['X-PULL']) {
10
+ res.setHeader('Content-Type', 'text/plain');
11
+ res.end('User-agent: *\nDisallow: /');
12
+ return;
13
+ }
14
+
15
+ res.setHeader('Content-Type', 'text/plain');
16
+ res.end(robots);
17
+ return;
18
+ }
19
+
20
+ next();
21
+ }