@lancom/shared 0.0.331 → 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.
- package/assets/js/models/product-layers.js +1 -1
- package/components/common/client_settings/client-settings.vue +5 -1
- package/components/editor/editor_print_area_options/editor-print-area-options.vue +6 -1
- package/components/editor/editor_print_area_options/editor_print_area_option/editor-print-area-option.scss +1 -1
- package/components/editor/editor_print_area_options/editor_print_area_option/editor-print-area-option.vue +5 -3
- package/components/products/product_list/product-list.scss +1 -1
- package/components/products/product_list_product/product-list-product.scss +3 -3
- package/feeds/google-shopping.js +53 -7
- package/mixins/product-view.js +2 -1
- package/package.json +1 -1
|
@@ -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
|
},
|
|
@@ -55,7 +55,12 @@ export default {
|
|
|
55
55
|
},
|
|
56
56
|
computed: {
|
|
57
57
|
options() {
|
|
58
|
-
const groupItemToOption = printArea => ({
|
|
58
|
+
const groupItemToOption = printArea => ({
|
|
59
|
+
printArea,
|
|
60
|
+
label: printArea.name,
|
|
61
|
+
size: printArea.printSize.alias,
|
|
62
|
+
sizeLabel: printArea.printSize.name
|
|
63
|
+
});
|
|
59
64
|
const productsOptions = (this.product.printAreas || [])
|
|
60
65
|
.map(printArea => {
|
|
61
66
|
const mainOption = { ...groupItemToOption(printArea), sides: [printArea.side] };
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
</div>
|
|
18
18
|
<div class="EditorPrintAreaOption__info">
|
|
19
19
|
<div class="lc_caption">
|
|
20
|
-
{{ option.label }}
|
|
20
|
+
{{ option.label }}. {{ option.sizeLabel }}
|
|
21
21
|
</div>
|
|
22
22
|
<div class="lc_regular10">
|
|
23
23
|
<price
|
|
@@ -46,8 +46,10 @@
|
|
|
46
46
|
[productType]: true
|
|
47
47
|
}">
|
|
48
48
|
</div>
|
|
49
|
-
<div
|
|
50
|
-
|
|
49
|
+
<div>
|
|
50
|
+
<div class="lc_caption">
|
|
51
|
+
{{ suboption.label }}. {{ suboption.sizeLabel }}
|
|
52
|
+
</div>
|
|
51
53
|
</div>
|
|
52
54
|
</div>
|
|
53
55
|
</div>
|
|
@@ -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:
|
|
91
|
+
height: 340px;
|
|
92
92
|
width: 270px;
|
|
93
93
|
display: flex;
|
|
94
94
|
align-items: center;
|
package/feeds/google-shopping.js
CHANGED
|
@@ -19,7 +19,7 @@ const COUNTRIES_SIZE_SYSTEMS = {
|
|
|
19
19
|
GB: 'UK'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
async function googleShoppingFeed(axios, config, availableStores, country,
|
|
22
|
+
async function googleShoppingFeed(axios, config, availableStores, country, isEditor) {
|
|
23
23
|
const { data } = await axios.get(`${config.LOCAL_API_URL}/feed/products?host=${config.HOST_NAME}&country=${country || ''}`);
|
|
24
24
|
const spliceFirstImage = images => (images || []).splice(0, 1)[0];
|
|
25
25
|
const getImages = images => (images || []).length > 0 ? images : null;
|
|
@@ -42,7 +42,8 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
|
|
|
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
|
|
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)) || [])
|
|
@@ -56,7 +57,8 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
|
|
|
56
57
|
const description = `${product.description || product.fabricInfoShort || product.name || ''}`
|
|
57
58
|
.replace(/ /g, ' ')
|
|
58
59
|
.replace(/·/, '·');
|
|
59
|
-
|
|
60
|
+
|
|
61
|
+
let link = `https://${config.HOST_NAME}${generateProductLink(product, sp.color, isEditor)}`;
|
|
60
62
|
if (sp.multipackQty) {
|
|
61
63
|
link = `${link}&multipack=${sp.SKU}`
|
|
62
64
|
}
|
|
@@ -77,8 +79,8 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
|
|
|
77
79
|
'g:condition': { _text: 'new' },
|
|
78
80
|
'g:mpn': { _text: sp.SKU },
|
|
79
81
|
'g:color': { _text: sp.color.name },
|
|
80
|
-
'g:image_link': { _text: sp.image || image },
|
|
81
|
-
'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) })),
|
|
82
84
|
'g:price': { _text: `${(sp.price || 0)} ${sp.currencyCode || 'AUD'}` },
|
|
83
85
|
'g:availability': { _text: sp.quantityStock > 0 ? 'in_stock' : 'out_of_stock' },
|
|
84
86
|
'g:google_product_category': { _text: product.feedGoogleProductCategory || 2047 },
|
|
@@ -158,7 +160,7 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
if (product.feedLifestyleImage) {
|
|
161
|
-
info['g:lifestyle_image_link'] = { _text: product.feedLifestyleImage };
|
|
163
|
+
info['g:lifestyle_image_link'] = { _text: staticLink(product.feedLifestyleImage, config) };
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
return info;
|
|
@@ -180,7 +182,51 @@ async function googleShoppingFeed(axios, config, availableStores, country, endSl
|
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
|
|
185
|
+
function generateCategoryPath(cat) {
|
|
186
|
+
let category = cat;
|
|
187
|
+
const categories = [];
|
|
188
|
+
while (category) {
|
|
189
|
+
categories.unshift(category.alias);
|
|
190
|
+
category = category.parent;
|
|
191
|
+
}
|
|
192
|
+
let baseLink = '';
|
|
193
|
+
if (categories.length) {
|
|
194
|
+
baseLink = `${categories.join('/')}`;
|
|
195
|
+
}
|
|
196
|
+
return baseLink;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function generateProductLink(product, color, toEditor) {
|
|
200
|
+
const baseLink = `/${product.brand?.alias}/${product.productType?.alias}/${product.alias}`;
|
|
201
|
+
let link = toEditor ? `${baseLink}/editor` : baseLink;
|
|
202
|
+
if (product.useTaxonomyUrl) {
|
|
203
|
+
const categoryPath = generateCategoryPath(product.category);
|
|
204
|
+
if (categoryPath) {
|
|
205
|
+
const categoryBaseLink = `/c/${categoryPath}/${product.alias}/${product.SKU.toLowerCase()}`;
|
|
206
|
+
link = toEditor ? `${categoryBaseLink}.html` : `${categoryBaseLink}/info.html`;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return `${link}${color ? `?color=${color.alias || color}` : ''}`;
|
|
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
|
+
|
|
227
|
+
|
|
183
228
|
module.exports = {
|
|
184
229
|
googleShoppingFeed,
|
|
185
|
-
googleLocalShoppingFeed
|
|
230
|
+
googleLocalShoppingFeed,
|
|
231
|
+
generateProductLink
|
|
186
232
|
};
|
package/mixins/product-view.js
CHANGED
|
@@ -63,6 +63,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return {
|
|
66
|
+
isEditor,
|
|
66
67
|
pageItem,
|
|
67
68
|
breadcrumbs: []
|
|
68
69
|
};
|
|
@@ -80,7 +81,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
80
81
|
return this.mainProductImageSrc;
|
|
81
82
|
},
|
|
82
83
|
pageItemCanonical() {
|
|
83
|
-
return generateProductLink(this.product);
|
|
84
|
+
return generateProductLink(this.product, null, this.isEditor);
|
|
84
85
|
},
|
|
85
86
|
hasImages() {
|
|
86
87
|
return this.images.length > 0;
|