@lancom/shared 0.0.388 → 0.0.390
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/simple-products.js +24 -0
- package/components/products_kit/products_kit/products_kit_cart/products-kit-cart.vue +4 -1
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color.vue +2 -9
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products_kit_option_product/products-kit-option-product.scss +21 -0
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_products/products_kit_option_product/products-kit-option-product.vue +27 -3
- package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size.vue +2 -10
- package/feeds/google-shopping.js +5 -1
- package/mixins/product-preview.js +4 -0
- package/nuxt.config.js +1 -0
- package/package.json +1 -1
- package/plugins/vee-validate.js +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function getSimpleProductsColors(simpleProducts, onlyWithStock = true) {
|
|
2
|
+
const uniqueColorsMap = new Map();
|
|
3
|
+
(simpleProducts || [])
|
|
4
|
+
.filter(sp => !onlyWithStock || sp.quantityStock > 0)
|
|
5
|
+
.forEach(sp => {
|
|
6
|
+
if (sp.color && !uniqueColorsMap.has(sp.color._id)) {
|
|
7
|
+
uniqueColorsMap.set(sp.color._id, sp.color);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
return Array.from(uniqueColorsMap.values());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getSimpleProductsSizes(simpleProducts, sizesColor, onlyWithStock = true) {
|
|
14
|
+
const uniqueSizesMap = new Map();
|
|
15
|
+
(simpleProducts || [])
|
|
16
|
+
.filter(sp => !onlyWithStock || sp.quantityStock > 0)
|
|
17
|
+
.forEach(({ size, color }) => {
|
|
18
|
+
const isSameColor = !sizesColor || color?._id === sizesColor._id;
|
|
19
|
+
if (size && isSameColor && !uniqueSizesMap.has(size._id)) {
|
|
20
|
+
uniqueSizesMap.set(size._id, size);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return Array.from(uniqueSizesMap.values());
|
|
24
|
+
}
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
<div class="ProductsKitCart__info">
|
|
12
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
v-if="isAllOptionsSelected"
|
|
14
|
+
class="ProductsKitCart__price">
|
|
13
15
|
{{ totalPrice | price }}
|
|
14
16
|
</div>
|
|
15
17
|
<div>
|
|
@@ -107,6 +109,7 @@ export default {
|
|
|
107
109
|
};
|
|
108
110
|
await this.addToCart(data);
|
|
109
111
|
this.$toastr.s('Products Kit successfully added to cart');
|
|
112
|
+
this.kitQty = 1;
|
|
110
113
|
this.clearOptions();
|
|
111
114
|
this.clearProductsKitPricing();
|
|
112
115
|
} catch (e) {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
import { mapGetters, mapActions } from 'vuex';
|
|
35
35
|
import Multiselect from 'vue-multiselect';
|
|
36
36
|
import ProductColorImage from '@lancom/shared/components/product/product_color_image/product-color-image';
|
|
37
|
+
import { getSimpleProductsColors } from '@lancom/shared/assets/js/utils/simple-products';
|
|
37
38
|
|
|
38
39
|
export default {
|
|
39
40
|
name: 'ProductsKitOptionColor',
|
|
@@ -66,15 +67,7 @@ export default {
|
|
|
66
67
|
},
|
|
67
68
|
availableColors() {
|
|
68
69
|
const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
|
|
69
|
-
|
|
70
|
-
simpleProducts
|
|
71
|
-
.filter(sp => sp.quantityStock > 0)
|
|
72
|
-
.forEach(sp => {
|
|
73
|
-
if (sp.color && !uniqueColorsMap.has(sp.color._id)) {
|
|
74
|
-
uniqueColorsMap.set(sp.color._id, sp.color);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return Array.from(uniqueColorsMap.values());
|
|
70
|
+
return getSimpleProductsColors(simpleProducts);
|
|
78
71
|
}
|
|
79
72
|
},
|
|
80
73
|
methods: {
|
|
@@ -13,8 +13,29 @@
|
|
|
13
13
|
margin: 0 0 15px 15px;
|
|
14
14
|
position: relative;
|
|
15
15
|
z-index: 1;
|
|
16
|
+
&--without-price {
|
|
17
|
+
height: 440px;
|
|
18
|
+
}
|
|
16
19
|
}
|
|
17
20
|
&__select {
|
|
18
21
|
padding: 0 20px 10px 20px;
|
|
19
22
|
}
|
|
23
|
+
&__config {
|
|
24
|
+
position: relative;
|
|
25
|
+
}
|
|
26
|
+
&__no-stock {
|
|
27
|
+
position: absolute;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
top: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
background-color: white;
|
|
36
|
+
opacity: 0.5;
|
|
37
|
+
font-size: 17px;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
z-index: 2;
|
|
40
|
+
}
|
|
20
41
|
}
|
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
:class="{
|
|
5
5
|
'ProductsKitOptionProduct__wrapper--active': isSelectedProduct
|
|
6
6
|
}">
|
|
7
|
-
<div
|
|
7
|
+
<div
|
|
8
|
+
class="ProductsKitOptionProduct__preview"
|
|
9
|
+
:class="{
|
|
10
|
+
'ProductsKitOptionProduct__preview--without-price': option.required
|
|
11
|
+
}">
|
|
8
12
|
<product-preview-main
|
|
9
13
|
ref="preview"
|
|
10
14
|
:product="product"
|
|
11
15
|
:to-editor="false"
|
|
16
|
+
:visible-prices="!option.required"
|
|
17
|
+
@preview="onPreviewProduct($event)"
|
|
12
18
|
@color="onProductSelectColor($event)" />
|
|
13
19
|
</div>
|
|
14
20
|
<div class="ProductsKitOptionProduct__select">
|
|
@@ -19,7 +25,7 @@
|
|
|
19
25
|
btn-label="SELECT" />
|
|
20
26
|
<div
|
|
21
27
|
v-if="isSelectedProduct"
|
|
22
|
-
class="mt-5">
|
|
28
|
+
class="ProductsKitOptionProduct__config mt-5">
|
|
23
29
|
<products-kit-option-color
|
|
24
30
|
:products-kit="productsKit"
|
|
25
31
|
:option="option"
|
|
@@ -33,6 +39,11 @@
|
|
|
33
39
|
class="mt-5 lc_subtitle3">
|
|
34
40
|
Stock: {{ currentQuantityStockLabel }}
|
|
35
41
|
</div>
|
|
42
|
+
<div
|
|
43
|
+
v-if="dontHaveAvailableStock"
|
|
44
|
+
class="ProductsKitOptionProduct__no-stock">
|
|
45
|
+
out of stock
|
|
46
|
+
</div>
|
|
36
47
|
</div>
|
|
37
48
|
</div>
|
|
38
49
|
</div>
|
|
@@ -43,6 +54,7 @@ import { mapGetters, mapActions } from 'vuex';
|
|
|
43
54
|
import ProductPreviewMain from '@/components/product/product_preview_main/product-preview-main';
|
|
44
55
|
import ProductsKitOptionColor from '@lancom/shared/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color';
|
|
45
56
|
import ProductsKitOptionSize from '@lancom/shared/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size';
|
|
57
|
+
import { getSimpleProductsSizes, getSimpleProductsColors } from '@lancom/shared/assets/js/utils/simple-products';
|
|
46
58
|
|
|
47
59
|
export default {
|
|
48
60
|
name: 'ProductsKitOptionProduct',
|
|
@@ -95,7 +107,13 @@ export default {
|
|
|
95
107
|
},
|
|
96
108
|
currentQuantityStockLabel() {
|
|
97
109
|
return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
|
|
98
|
-
}
|
|
110
|
+
},
|
|
111
|
+
dontHaveAvailableStock() {
|
|
112
|
+
const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
|
|
113
|
+
const colors = getSimpleProductsColors(simpleProducts);
|
|
114
|
+
const sizes = getSimpleProductsSizes(simpleProducts, this.selectedColor);
|
|
115
|
+
return this.isSelectedProduct && (!colors.length || (this.selectedColor && !sizes.length));
|
|
116
|
+
},
|
|
99
117
|
},
|
|
100
118
|
watch: {
|
|
101
119
|
selectedColor() {
|
|
@@ -117,6 +135,12 @@ export default {
|
|
|
117
135
|
},
|
|
118
136
|
onProductSelectColor(color) {
|
|
119
137
|
this.selectOptionColor({ option: this.option, color });
|
|
138
|
+
},
|
|
139
|
+
onPreviewProduct(e) {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
e.stopPropagation();
|
|
142
|
+
|
|
143
|
+
this.selectProduct();
|
|
120
144
|
}
|
|
121
145
|
}
|
|
122
146
|
};
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
<script>
|
|
30
30
|
import { mapGetters, mapActions } from 'vuex';
|
|
31
31
|
import Multiselect from 'vue-multiselect';
|
|
32
|
+
import { getSimpleProductsSizes } from '@lancom/shared/assets/js/utils/simple-products';
|
|
32
33
|
|
|
33
34
|
export default {
|
|
34
35
|
name: 'ProductsKitOptionSize',
|
|
@@ -64,16 +65,7 @@ export default {
|
|
|
64
65
|
},
|
|
65
66
|
availableSizes() {
|
|
66
67
|
const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
|
|
67
|
-
|
|
68
|
-
simpleProducts
|
|
69
|
-
.filter(sp => sp.quantityStock > 0)
|
|
70
|
-
.forEach(({ size, color }) => {
|
|
71
|
-
const isSameColor = color?._id === this.selectedColor?._id;
|
|
72
|
-
if (size && isSameColor && !uniqueSizesMap.has(size._id)) {
|
|
73
|
-
uniqueSizesMap.set(size._id, size);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return Array.from(uniqueSizesMap.values());
|
|
68
|
+
return getSimpleProductsSizes(simpleProducts, this.selectedColor);
|
|
77
69
|
}
|
|
78
70
|
},
|
|
79
71
|
watch: {
|
package/feeds/google-shopping.js
CHANGED
|
@@ -79,7 +79,7 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
|
|
|
79
79
|
'g:size_system': COUNTRIES_SIZE_SYSTEMS[country] || country || 'AU',
|
|
80
80
|
'g:ships_from_country': country || 'AU',
|
|
81
81
|
'g:size_type': 'regular',
|
|
82
|
-
'g:gender': { _text: product.gender },
|
|
82
|
+
'g:gender': { _text: product.feedGender || product.gender },
|
|
83
83
|
'g:material': { _text: product.fabricInfoShort },
|
|
84
84
|
'g:brand': { _text: product.brand.name },
|
|
85
85
|
'g:condition': { _text: 'new' },
|
|
@@ -177,6 +177,10 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
|
|
|
177
177
|
info['g:lifestyle_image_link'] = { _text: staticLink(product.feedLifestyleImage, config) };
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
if (product.feedAgeGroup) {
|
|
181
|
+
info['g:age_group'] = { _text: product.feedAgeGroup };
|
|
182
|
+
}
|
|
183
|
+
|
|
180
184
|
return info;
|
|
181
185
|
})
|
|
182
186
|
];
|
package/nuxt.config.js
CHANGED
package/package.json
CHANGED
package/plugins/vee-validate.js
CHANGED