@lancom/shared 0.0.337 → 0.0.338
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/utils/colors.js +10 -8
- package/assets/js/utils/fabric/selection-style.js +1 -2
- package/components/checkout/cart/cart_pricing/cart-pricing.vue +4 -1
- package/components/editor/editor.vue +17 -2
- package/components/editor/editor_product_details/editor-product-details.vue +2 -1
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.scss +26 -15
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +29 -14
- package/components/products/products_catalog/products-catalog.vue +1 -2
- package/feeds/google-shopping.js +3 -2
- package/package.json +1 -1
|
@@ -6,9 +6,11 @@ export const isValidImageType = (i, type) => i.type === type || (i.types || []).
|
|
|
6
6
|
|
|
7
7
|
export const isValidImageTypes = (i, types) => types.some(type => isValidImageType(i, type));
|
|
8
8
|
|
|
9
|
-
export const getColorImage = (product = {}, size = 'small', type, color, allowAnyColor = false) => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
9
|
+
export const getColorImage = (product = {}, size = 'small', type, color, allowAnyColor = false, excludeType = []) => {
|
|
10
|
+
const excludeTypes = (excludeType && Array.isArray(excludeType) ? excludeType : [excludeType]) || [];
|
|
11
|
+
const validImages = (product.images || []).filter(i => !excludeTypes.some(type => isValidImageType(i, type)));
|
|
12
|
+
const colorImage = color && validImages.find(i => isValidImageType(i, type || COLORS_IMAGES_TYPES.FRONT) && (color?._id === i.color || color?._id === i.color?._id));
|
|
13
|
+
const image = colorImage || validImages.find(i => isValidImageType(i, type || COLORS_IMAGES_TYPES.FRONT) && (allowAnyColor || !i.color));
|
|
12
14
|
return image && staticLink(image[size]);
|
|
13
15
|
};
|
|
14
16
|
|
|
@@ -35,11 +37,11 @@ export const getProductCover = (product = {}, size = 'small', type = COLORS_IMAG
|
|
|
35
37
|
getFunc(product, type, null, true);
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
export const getFillColorImage = (product, type, color, allowAnyColor) => getColorImage(product, 'color', type, color, allowAnyColor);
|
|
39
|
-
export const getSmallColorImage = (product, type, color, allowAnyColor) => getColorImage(product, 'small', type, color, allowAnyColor);
|
|
40
|
-
export const getMediumColorImage = (product, type, color, allowAnyColor) => getColorImage(product, 'medium', type, color, allowAnyColor);
|
|
41
|
-
export const getLargeColorImage = (product, type, color, allowAnyColor) => getColorImage(product, 'large', type, color, allowAnyColor);
|
|
42
|
-
export const getOriginColorImage = (product, type, color, allowAnyColor) => getColorImage(product, 'origin', type, color, allowAnyColor);
|
|
40
|
+
export const getFillColorImage = (product, type, color, allowAnyColor, excludeType) => getColorImage(product, 'color', type, color, allowAnyColor, excludeType);
|
|
41
|
+
export const getSmallColorImage = (product, type, color, allowAnyColor, excludeType) => getColorImage(product, 'small', type, color, allowAnyColor, excludeType);
|
|
42
|
+
export const getMediumColorImage = (product, type, color, allowAnyColor, excludeType) => getColorImage(product, 'medium', type, color, allowAnyColor, excludeType);
|
|
43
|
+
export const getLargeColorImage = (product, type, color, allowAnyColor, excludeType) => getColorImage(product, 'large', type, color, allowAnyColor, excludeType);
|
|
44
|
+
export const getOriginColorImage = (product, type, color, allowAnyColor, excludeType) => getColorImage(product, 'origin', type, color, allowAnyColor, excludeType);
|
|
43
45
|
|
|
44
46
|
export const getProductFillCover = (product, type, color) => getProductCover(product, 'color', type, color);
|
|
45
47
|
export const getProductSmallCover = (product, type, color) => getProductCover(product, 'small', type, color);
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { fabric } from 'fabric';
|
|
2
|
-
import { staticLink } from '@lancom/shared/assets/js/utils/filters';
|
|
3
2
|
|
|
4
3
|
let rotate;
|
|
5
4
|
|
|
6
5
|
export function loadRotateImage(cb = Function.prototype) {
|
|
7
6
|
const image = new Image();
|
|
8
|
-
image.src =
|
|
7
|
+
image.src = '/icons/rotate.png';
|
|
9
8
|
image.onload = () => {
|
|
10
9
|
rotate = image;
|
|
11
10
|
cb();
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
COUPON, {{ pricing.coupon.code }}:
|
|
59
59
|
</div>
|
|
60
60
|
<div class="lc_body-large lc_gray-main">
|
|
61
|
-
{{
|
|
61
|
+
{{ couponTotal | price(currency) }}
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
<div class="CartPricing__info CartPricing__info--gray">
|
|
@@ -97,6 +97,9 @@ export default {
|
|
|
97
97
|
},
|
|
98
98
|
computed: {
|
|
99
99
|
...mapGetters(['currency', 'taxName']),
|
|
100
|
+
couponTotal() {
|
|
101
|
+
return -this.pricing.totalsWithoutCoupon.totalPrice + this.pricing.totalPrice;
|
|
102
|
+
},
|
|
100
103
|
hasSuppliersWithRates() {
|
|
101
104
|
return this.suppliersWithRates.length > 0;
|
|
102
105
|
},
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<template v-slot:default="{ currentTab }">
|
|
15
15
|
<component
|
|
16
16
|
:is="editorCurrentTabComponent(currentTab)"
|
|
17
|
-
@choose-products="
|
|
17
|
+
@choose-products="chooseProducts()"
|
|
18
18
|
v-if="currentTab">
|
|
19
19
|
</component>
|
|
20
20
|
</template>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
v-if="isValidPrintOnly && needToAddProducts"
|
|
31
31
|
btn-label="Enter products"
|
|
32
32
|
btn-class="green"
|
|
33
|
-
@onclick="
|
|
33
|
+
@onclick="chooseProducts()" />
|
|
34
34
|
<v-popover
|
|
35
35
|
v-else
|
|
36
36
|
ref="popover"
|
|
@@ -217,6 +217,21 @@ export default {
|
|
|
217
217
|
if (this.$refs.popover) {
|
|
218
218
|
this.$refs.popover.hide();
|
|
219
219
|
}
|
|
220
|
+
},
|
|
221
|
+
chooseProducts() {
|
|
222
|
+
this.selectTab('product');
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
const element = document.getElementById('EditorProductDetails');
|
|
225
|
+
if (element) {
|
|
226
|
+
const offset = 100;
|
|
227
|
+
const elementPosition = element.getBoundingClientRect().top;
|
|
228
|
+
const offsetPosition = elementPosition + window.pageYOffset - offset;
|
|
229
|
+
window.scrollTo({
|
|
230
|
+
top: offsetPosition,
|
|
231
|
+
behavior: 'smooth'
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}, 250);
|
|
220
235
|
}
|
|
221
236
|
}
|
|
222
237
|
};
|
|
@@ -60,37 +60,34 @@
|
|
|
60
60
|
position: absolute;
|
|
61
61
|
z-index: 999;
|
|
62
62
|
text-align: center;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
flex-direction: column;
|
|
66
67
|
|
|
67
68
|
@media (max-width: $bp-extra-small-max) {
|
|
68
|
-
--placeholder-width: 70px;
|
|
69
|
-
--placeholder-height: 50px;
|
|
70
69
|
font-size: 10px;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
&.tighten {
|
|
74
|
-
--placeholder-width: 70px;
|
|
75
|
-
--placeholder-height: 50px;
|
|
76
73
|
font-size: 10px;
|
|
77
|
-
|
|
78
74
|
@media (max-width: $bp-extra-small-max) {
|
|
79
|
-
--placeholder-width: 35px;
|
|
80
|
-
--placeholder-height: 25px;
|
|
81
75
|
font-size: 8px;
|
|
82
76
|
}
|
|
83
77
|
}
|
|
84
|
-
|
|
85
|
-
width: var(--placeholder-width);
|
|
86
|
-
height: var(--placeholder-height);
|
|
87
|
-
margin-left: calc(var(--placeholder-width) / 2 * (-1));
|
|
88
|
-
margin-top: calc(var(--placeholder-height) / 2 * (-1));
|
|
89
78
|
letter-spacing: -0.5px;
|
|
90
79
|
&-option {
|
|
91
80
|
cursor: pointer;
|
|
92
81
|
margin: 5px 0;
|
|
93
82
|
text-transform: uppercase;
|
|
83
|
+
span {
|
|
84
|
+
&:last-child {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
&:first-child {
|
|
88
|
+
display: inline;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
94
91
|
}
|
|
95
92
|
&-divider {
|
|
96
93
|
color: $grey_1;
|
|
@@ -112,6 +109,20 @@
|
|
|
112
109
|
background-color: $green;
|
|
113
110
|
}
|
|
114
111
|
}
|
|
112
|
+
&.side {
|
|
113
|
+
width: 20px;
|
|
114
|
+
.EditorWorkspaceSide__placeholder-option span {
|
|
115
|
+
&:last-child {
|
|
116
|
+
display: inline;
|
|
117
|
+
}
|
|
118
|
+
&:first-child {
|
|
119
|
+
display: none;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
.EditorWorkspaceSide__placeholder-divider {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
&__alert {
|
|
117
128
|
&-container {
|
|
@@ -33,15 +33,19 @@
|
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
35
35
|
<div
|
|
36
|
-
v-if="
|
|
36
|
+
v-if="fabricHelper"
|
|
37
37
|
class="EditorWorkspaceSide__placeholder"
|
|
38
|
-
:class="{
|
|
38
|
+
:class="{
|
|
39
|
+
tighten: printAreaIsSmall,
|
|
40
|
+
side: printAreaLayers.length
|
|
41
|
+
}"
|
|
39
42
|
ignore-document-click
|
|
40
43
|
:style="positionPlaceholder">
|
|
41
44
|
<div
|
|
42
45
|
@click="createTextLayer"
|
|
43
46
|
class="EditorWorkspaceSide__placeholder-option">
|
|
44
|
-
Type here
|
|
47
|
+
<span>Type here</span>
|
|
48
|
+
<span>T</span>
|
|
45
49
|
</div>
|
|
46
50
|
<div class="EditorWorkspaceSide__placeholder-divider">
|
|
47
51
|
or
|
|
@@ -53,7 +57,12 @@
|
|
|
53
57
|
@onuploaded="handleUploaded">
|
|
54
58
|
<template #toggle>
|
|
55
59
|
<div class="EditorWorkspaceSide__placeholder-option">
|
|
56
|
-
<
|
|
60
|
+
<span>
|
|
61
|
+
<i class="icon-picture"></i> Add art
|
|
62
|
+
</span>
|
|
63
|
+
<span>
|
|
64
|
+
<i class="icon-picture"></i>
|
|
65
|
+
</span>
|
|
57
66
|
</div>
|
|
58
67
|
</template>
|
|
59
68
|
<template v-slot:progress="{ progress }">
|
|
@@ -173,7 +182,7 @@ export default {
|
|
|
173
182
|
return !!this.wireframeImage;
|
|
174
183
|
},
|
|
175
184
|
wireframeImage() {
|
|
176
|
-
return this.images.find(i => i.types?.includes('
|
|
185
|
+
return this.images.find(i => i.types?.includes('wireframe') && i.types?.includes(this.side));
|
|
177
186
|
},
|
|
178
187
|
sideEditableLayers() {
|
|
179
188
|
return this.editableLayers.filter(l => l.sideId === this.side);
|
|
@@ -190,26 +199,32 @@ export default {
|
|
|
190
199
|
} : null;
|
|
191
200
|
},
|
|
192
201
|
positionPlaceholder() {
|
|
193
|
-
const { center } = this.fabricHelper.printAreaRect;
|
|
202
|
+
const { center, left, top, width, height } = this.fabricHelper.printAreaRect;
|
|
203
|
+
// console.log('this.fabricHelper.printAreaRect: ', this.fabricHelper.printAreaRect);
|
|
194
204
|
const ratio = this.calcWorkspaceSize() / this.editorSize.width;
|
|
195
|
-
return {
|
|
196
|
-
top: `${
|
|
197
|
-
left: `${
|
|
205
|
+
return this.printAreaLayers.length > 0 ? {
|
|
206
|
+
top: `${top * ratio}px`,
|
|
207
|
+
left: `${(left + width) * ratio + 4}px`
|
|
208
|
+
} : {
|
|
209
|
+
top: `${top * ratio}px`,
|
|
210
|
+
left: `${left * ratio}px`,
|
|
211
|
+
width: `${Math.max(60, width * ratio)}px`,
|
|
212
|
+
height: `${height * ratio}px`,
|
|
198
213
|
};
|
|
199
214
|
},
|
|
200
215
|
showRecommendationToUseLargerImage() {
|
|
201
216
|
return (
|
|
202
217
|
this.selectedLayer &&
|
|
203
218
|
this.selectedLayer.type === 'art' &&
|
|
204
|
-
this.selectedLayer.dpi >=
|
|
205
|
-
this.selectedLayer.dpi <=
|
|
219
|
+
this.selectedLayer.dpi >= 75 &&
|
|
220
|
+
this.selectedLayer.dpi <= 100
|
|
206
221
|
);
|
|
207
222
|
},
|
|
208
223
|
showErrorAboutSmallImage() {
|
|
209
224
|
return (
|
|
210
225
|
this.selectedLayer &&
|
|
211
226
|
this.selectedLayer.type === 'art' &&
|
|
212
|
-
this.selectedLayer.dpi <
|
|
227
|
+
this.selectedLayer.dpi < 75
|
|
213
228
|
);
|
|
214
229
|
},
|
|
215
230
|
printAreaIsSmall() {
|
|
@@ -374,7 +389,7 @@ export default {
|
|
|
374
389
|
updateBackgroundImage() {
|
|
375
390
|
const type = this.side === 'front' ? COLORS_IMAGES_TYPES.FRONT : COLORS_IMAGES_TYPES.BACK;
|
|
376
391
|
const wireframeImageUrl = this.visibleWireframe && this.wireframeImage?.large;
|
|
377
|
-
const imageUrl = wireframeImageUrl || getLargeColorImage(this.product, type, this.editableColor);
|
|
392
|
+
const imageUrl = wireframeImageUrl || getLargeColorImage(this.product, type, this.editableColor, false, ['wireframe']);
|
|
378
393
|
if (this.backgroundImage && this.backgroundImageUrl === imageUrl) {
|
|
379
394
|
return this.fabricHelper.setBackgroundImage(this.backgroundImage);
|
|
380
395
|
}
|
|
@@ -416,7 +431,7 @@ export default {
|
|
|
416
431
|
this.deleteButtonPos = pos;
|
|
417
432
|
},
|
|
418
433
|
setOffsetWarningVisibility(visible) {
|
|
419
|
-
|
|
434
|
+
this.offsetWarningVisible = visible;
|
|
420
435
|
},
|
|
421
436
|
toogleBoundBox(state, option) {
|
|
422
437
|
if (!this.fabricHelper || this.breakpoints.is === 'xs') {
|
package/feeds/google-shopping.js
CHANGED
|
@@ -209,7 +209,7 @@ function generateProductLink(product, color, toEditor) {
|
|
|
209
209
|
return `${link}${color ? `?color=${color.alias || color}` : ''}`;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
const staticLink = (link, config) => {
|
|
213
213
|
const { PROD_S3_BUCKET, DEV_S3_BUCKET, PROD_CDN_URL, DEV_CDN_URL, STATIC_URL } = config || {};
|
|
214
214
|
if ((link || '').startsWith('http')) {
|
|
215
215
|
if (PROD_S3_BUCKET && PROD_CDN_URL) {
|
|
@@ -228,5 +228,6 @@ export const staticLink = (link, config) => {
|
|
|
228
228
|
module.exports = {
|
|
229
229
|
googleShoppingFeed,
|
|
230
230
|
googleLocalShoppingFeed,
|
|
231
|
-
generateProductLink
|
|
231
|
+
generateProductLink,
|
|
232
|
+
staticLink
|
|
232
233
|
};
|