@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.
@@ -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 class="ProductsKitCart__price">
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
- const uniqueColorsMap = new Map();
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 class="ProductsKitOptionProduct__preview">
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
- const uniqueSizesMap = new Map();
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: {
@@ -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
  ];
@@ -25,6 +25,10 @@ const productPreview = {
25
25
  lazy: {
26
26
  type: Boolean,
27
27
  default: true
28
+ },
29
+ visiblePrices: {
30
+ type: Boolean,
31
+ default: true
28
32
  }
29
33
  },
30
34
  data() {
package/nuxt.config.js CHANGED
@@ -32,6 +32,7 @@ module.exports = (config, axios, { raygunClient, publicPath, productUrlToEditor
32
32
  exclude: [
33
33
  // '/',
34
34
  '/faq',
35
+ '/quotes/request',
35
36
  '/products/',
36
37
  '/preview/**',
37
38
  '/checkout/**',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.388",
3
+ "version": "0.0.390",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -22,7 +22,7 @@ extend('email', {
22
22
  if (auDomain && auDomain[0]) {
23
23
  return auDomain[0] === '.com.au';
24
24
  } else if (comDomain && comDomain[0]) {
25
- return comDomain[0] === '.com';
25
+ return ['.com', '.college'].includes(comDomain[0]);
26
26
  }
27
27
  return true;
28
28
  }