@lancom/shared 0.0.388 → 0.0.389

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
+ }
@@ -107,6 +107,7 @@ export default {
107
107
  };
108
108
  await this.addToCart(data);
109
109
  this.$toastr.s('Products Kit successfully added to cart');
110
+ this.kitQty = 1;
110
111
  this.clearOptions();
111
112
  this.clearProductsKitPricing();
112
113
  } 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: {
@@ -17,4 +17,22 @@
17
17
  &__select {
18
18
  padding: 0 20px 10px 20px;
19
19
  }
20
+ &__config {
21
+ position: relative;
22
+ }
23
+ &__no-stock {
24
+ position: absolute;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ top: 0;
29
+ right: 0;
30
+ bottom: 0;
31
+ left: 0;
32
+ background-color: white;
33
+ opacity: 0.5;
34
+ font-size: 17px;
35
+ font-weight: bold;
36
+ z-index: 2;
37
+ }
20
38
  }
@@ -19,7 +19,7 @@
19
19
  btn-label="SELECT" />
20
20
  <div
21
21
  v-if="isSelectedProduct"
22
- class="mt-5">
22
+ class="ProductsKitOptionProduct__config mt-5">
23
23
  <products-kit-option-color
24
24
  :products-kit="productsKit"
25
25
  :option="option"
@@ -33,6 +33,11 @@
33
33
  class="mt-5 lc_subtitle3">
34
34
  Stock: {{ currentQuantityStockLabel }}
35
35
  </div>
36
+ <div
37
+ v-if="dontHaveAvailableStock"
38
+ class="ProductsKitOptionProduct__no-stock">
39
+ out of stock
40
+ </div>
36
41
  </div>
37
42
  </div>
38
43
  </div>
@@ -43,6 +48,7 @@ import { mapGetters, mapActions } from 'vuex';
43
48
  import ProductPreviewMain from '@/components/product/product_preview_main/product-preview-main';
44
49
  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
50
  import ProductsKitOptionSize from '@lancom/shared/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size';
51
+ import { getSimpleProductsSizes, getSimpleProductsColors } from '@lancom/shared/assets/js/utils/simple-products';
46
52
 
47
53
  export default {
48
54
  name: 'ProductsKitOptionProduct',
@@ -95,7 +101,13 @@ export default {
95
101
  },
96
102
  currentQuantityStockLabel() {
97
103
  return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
98
- }
104
+ },
105
+ dontHaveAvailableStock() {
106
+ const simpleProducts = this.selectedOptionsSimpleProducts[this.option._id] || [];
107
+ const colors = getSimpleProductsColors(simpleProducts);
108
+ const sizes = getSimpleProductsSizes(simpleProducts, this.selectedColor);
109
+ return this.isSelectedProduct && (!colors.length || (this.selectedColor && !sizes.length));
110
+ },
99
111
  },
100
112
  watch: {
101
113
  selectedColor() {
@@ -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
  ];
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.389",
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
  }