@lancom/shared 0.0.332 → 0.0.333

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.
@@ -108,5 +108,5 @@ export const getLayerModel = async ({ type, colorId, top, left, isEditMode, url,
108
108
  };
109
109
 
110
110
  export const cloneLayerModel = layer => {
111
- return { ...layer, createdAt: Date.now() };
111
+ return { ...layer, createdAt: Date.now(), guid: generateGUID() };
112
112
  };
@@ -8,7 +8,7 @@
8
8
  <span v-if="country">
9
9
  <img
10
10
  v-if="checkedCountry"
11
- :src="checkedCountry.icon" />
11
+ :src="checkedCountry.icon | staticLink" />
12
12
  <i
13
13
  v-else
14
14
  class="icon-globe"></i>
@@ -75,12 +75,16 @@
75
75
 
76
76
  <script>
77
77
  import { mapGetters } from 'vuex';
78
+ import { staticLink } from '@lancom/shared/assets/js/utils/filters';
78
79
  import CheckedIcon from '@lancom/shared/components/common/checked-icon';
79
80
 
80
81
  const Cookie = process.client ? require('js-cookie') : undefined;
81
82
 
82
83
  export default {
83
84
  name: 'ClientSettings',
85
+ filters: {
86
+ staticLink
87
+ },
84
88
  components: {
85
89
  CheckedIcon
86
90
  },
@@ -11,7 +11,7 @@
11
11
  }
12
12
  &__item-wrapper {
13
13
  width: 270px;
14
- height: 450px;
14
+ height: 490px;
15
15
  margin: 0 0 15px 15px;
16
16
  position: relative;
17
17
  z-index: 1;
@@ -73,7 +73,7 @@
73
73
  transition: opacity 0.35s ease-in-out;
74
74
  opacity: 1;
75
75
  position: absolute;
76
- top: 30px;
76
+ // top: 30px;
77
77
  max-width: 250px;
78
78
  }
79
79
  &__cover-hover {
@@ -81,14 +81,14 @@
81
81
  z-index: 2;
82
82
  opacity: 0;
83
83
  position: absolute;
84
- top: 30px;
84
+ // top: 30px;
85
85
  max-width: 250px;
86
86
  }
87
87
  &__link {
88
88
  position: relative;
89
89
  transition: background-color 0.5s ease;
90
90
  background-color: white;
91
- height: 300px;
91
+ height: 340px;
92
92
  width: 270px;
93
93
  display: flex;
94
94
  align-items: center;
@@ -42,7 +42,8 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
42
42
  const backImages = filterImagesByType('back');
43
43
  const additionalImages = filterImagesByType('additional_image_link');
44
44
  const catalogFrontImages = (product.images || []).filter(i => (i.types || []).includes('catalog_front')).map(i => i.image);
45
- const image = spliceFirstImage(feedImages) || spliceFirstImage(frontImages) || spliceFirstImage(catalogFrontImages) || spliceFirstImage(backImages) || null;
45
+ const feedImage = spliceFirstImage(feedImages);
46
+ const image = feedImage || spliceFirstImage(frontImages) || spliceFirstImage(catalogFrontImages) || spliceFirstImage(backImages) || null;
46
47
  const images = [
47
48
  ...additionalImages,
48
49
  ...((!backImages?.includes(image) && getImages(backImages)) || (!frontImages?.includes(image) && getImages(frontImages)) || [])
@@ -78,8 +79,8 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
78
79
  'g:condition': { _text: 'new' },
79
80
  'g:mpn': { _text: sp.SKU },
80
81
  'g:color': { _text: sp.color.name },
81
- 'g:image_link': { _text: sp.image || image },
82
- 'g:additional_image_link': (sp.image ? [image, ...images] : images).map(i => ({ _text: i })),
82
+ 'g:image_link': { _text: staticLink(feedImage || sp.image || image, config) },
83
+ 'g:additional_image_link': ((sp.image || feedImage) ? [image, ...images] : images).map(i => ({ _text: staticLink(i, config) })),
83
84
  'g:price': { _text: `${(sp.price || 0)} ${sp.currencyCode || 'AUD'}` },
84
85
  'g:availability': { _text: sp.quantityStock > 0 ? 'in_stock' : 'out_of_stock' },
85
86
  'g:google_product_category': { _text: product.feedGoogleProductCategory || 2047 },
@@ -159,7 +160,7 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
159
160
  }
160
161
 
161
162
  if (product.feedLifestyleImage) {
162
- info['g:lifestyle_image_link'] = { _text: product.feedLifestyleImage };
163
+ info['g:lifestyle_image_link'] = { _text: staticLink(product.feedLifestyleImage, config) };
163
164
  }
164
165
 
165
166
  return info;
@@ -208,8 +209,24 @@ function generateProductLink(product, color, toEditor) {
208
209
  return `${link}${color ? `?color=${color.alias || color}` : ''}`;
209
210
  }
210
211
 
212
+ export const staticLink = (link, config) => {
213
+ const { PROD_S3_BUCKET, DEV_S3_BUCKET, PROD_CDN_URL, DEV_CDN_URL, STATIC_URL } = config || {};
214
+ if ((link || '').startsWith('http')) {
215
+ if (PROD_S3_BUCKET && PROD_CDN_URL) {
216
+ link = link.replace(new RegExp(`https://${PROD_S3_BUCKET}[a-z\-\.0-9]+.amazonaws.com`), PROD_CDN_URL);
217
+ }
218
+ if (DEV_S3_BUCKET && PROD_CDN_URL) {
219
+ link = link.replace(new RegExp(`https://${DEV_S3_BUCKET}[a-z\-\.0-9]+.amazonaws.com`), DEV_CDN_URL);
220
+ }
221
+ return link;
222
+ } else {
223
+ return `${STATIC_URL || ''}${link}`;
224
+ };
225
+ }
226
+
211
227
 
212
228
  module.exports = {
213
229
  googleShoppingFeed,
214
- googleLocalShoppingFeed
230
+ googleLocalShoppingFeed,
231
+ generateProductLink
215
232
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.332",
3
+ "version": "0.0.333",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {