@lancom/shared 0.0.151 → 0.0.152

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.
@@ -1,3 +1,5 @@
1
+ import { generateGUID } from '@lancom/shared/assets/js/utils/guid';
2
+
1
3
  export function getPrintAreasSizes(printAreas, side) {
2
4
  return printAreas
3
5
  .filter(printArea => !side || printArea.side === side)
@@ -38,6 +40,7 @@ export function getPrintsFromLayers(layers, product) {
38
40
  const { setupCost, printCost, freeSetupOver } = getPrintTypeSizePricing(layerPrintType, printSize) || {};
39
41
  const getSimpleObj = i => i && ({ _id: i._id, name: i.name });
40
42
  const data = {
43
+ guid: layer.printGuid || generateGUID(),
41
44
  printArea: getSimpleObj(layerPrintArea),
42
45
  printType: getSimpleObj(layerPrintType),
43
46
  printSize: getSimpleObj(layerPrintSize),
@@ -48,8 +51,10 @@ export function getPrintsFromLayers(layers, product) {
48
51
  layers: [generatePrintLayer(layer)]
49
52
  };
50
53
  prints.set(printArea, data);
54
+ layer.printGuid = data.guid;
51
55
  } else {
52
56
  const print = prints.get(printArea);
57
+ layer.printGuid = print.guid;
53
58
  print.layers.push(generatePrintLayer(layer));
54
59
  prints.set(printArea, print);
55
60
  }
@@ -223,6 +223,7 @@ $types: delivery, general, other, printing, garments;
223
223
  line-height: 25px;
224
224
  letter-spacing: 0.02em;
225
225
  color: $dark_blue;
226
+ padding-right: 40px;
226
227
  }
227
228
  &-body {
228
229
  padding: 6px 30px 24px 30px;
@@ -57,4 +57,11 @@
57
57
  margin: 1px 4px;
58
58
  }
59
59
  }
60
+ &__toggle-list {
61
+ margin-top: 5px;
62
+ margin-right: 10px;
63
+ font-size: 11px;
64
+ cursor: pointer;
65
+ text-align: right;
66
+ }
60
67
  }
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
  <div class="ProductsColors__items">
23
23
  <products-link
24
- v-for="color in colors"
24
+ v-for="color in visibleColors"
25
25
  :key="color._id"
26
26
  v-tooltip="color.name"
27
27
  :color="color.alias">
@@ -37,6 +37,12 @@
37
37
  </div>
38
38
  </products-link>
39
39
  </div>
40
+ <div
41
+ v-if="shortListColorsLimit < colorsCount"
42
+ @click="toggleDisplayAllColors()"
43
+ class="ProductsColors__toggle-list">
44
+ {{ displayAllColors ? 'Hide all colours' : 'Show all colours' }}
45
+ </div>
40
46
  </toggle-content>
41
47
  </div>
42
48
  </template>
@@ -56,14 +62,22 @@ export default {
56
62
  },
57
63
  data() {
58
64
  return {
59
- canLoadImages: false
65
+ canLoadImages: false,
66
+ displayAllColors: false,
67
+ shortListColorsLimit: 15
60
68
  };
61
69
  },
62
70
  computed: {
63
71
  ...mapGetters('products', ['colors']),
72
+ colorsCount() {
73
+ return this.colors.length;
74
+ },
64
75
  selectedColors() {
65
76
  const colors = (this.$route.query.colors || '').split(',');
66
77
  return this.colors.filter(color => colors.includes(color.alias));
78
+ },
79
+ visibleColors() {
80
+ return this.displayAllColors ? this.colors : this.colors.slice(0, this.shortListColorsLimit);
67
81
  }
68
82
  },
69
83
  mounted() {
@@ -74,6 +88,9 @@ export default {
74
88
  methods: {
75
89
  isSelectedColor(color) {
76
90
  return this.selectedColors.some(c => c._id === color._id);
91
+ },
92
+ toggleDisplayAllColors() {
93
+ this.displayAllColors = !this.displayAllColors;
77
94
  }
78
95
  }
79
96
  };
@@ -29,7 +29,7 @@
29
29
  v-slot="{ errors }"
30
30
  tag="div"
31
31
  name="Email"
32
- rules="required"
32
+ rules="required|email"
33
33
  class="form-row">
34
34
  <input
35
35
  :id="'email' + uniqueKey"
package/nuxt.config.js CHANGED
@@ -56,6 +56,7 @@ module.exports = (config, axios, { raygunClient } = {}) => ({
56
56
  // { src: '@/node_modules/@lancom/shared/plugins/vue-tables-2', ssr: false }
57
57
  ],
58
58
  modules: [
59
+ 'nuxt-helmet',
59
60
  '@nuxtjs/axios',
60
61
  '@nuxtjs/dotenv',
61
62
  '@nuxtjs/sitemap',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.151",
3
+ "version": "0.0.152",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -12,7 +12,26 @@ extend('required', {
12
12
  return `${name} attribute is mandatory`;
13
13
  }
14
14
  });
15
- extend('email', email);
15
+ console.log('ValidationObserver:email', email);
16
+ extend('email', {
17
+ ...email,
18
+ validate(value) {
19
+ if (email.validate(value)) {
20
+ const auDomain = value.match(/\.co[a-z]+\.au$/i);
21
+ const comDomain = value.match(/\.co[a-z]+$/i);
22
+ if (auDomain && auDomain[0]) {
23
+ return auDomain[0] === '.com.au';
24
+ } else if (comDomain && comDomain[0]) {
25
+ return comDomain[0] === '.com';
26
+ }
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ // message(name) {
32
+ // return `${name} attribute is mandatory`;
33
+ // }
34
+ });
16
35
  extend('max', max);
17
36
  extend('float', float);
18
37
  extend('min_value', minValue);
package/store/cart.js CHANGED
@@ -66,9 +66,12 @@ export const getters = {
66
66
  export const actions = {
67
67
  async addToCart({ state, commit }, { entities, shop, pricing }) {
68
68
  const addingEntities = [...entities];
69
- const withoutPrints = e => (e.prints || []).length === 0;
69
+ const isSamePrints = (e, e2) => {
70
+ const samePrints = (e.prints || []).filter(p => (e2.prints || []).some(p2 => p2.guid === p.guid));
71
+ return (e.prints || []).length === samePrints.length;
72
+ };
70
73
  entities = entities.map(e => {
71
- const entitiy = withoutPrints(e) && state.entities.find(e2 => withoutPrints(e2) && e2?.product?._id === e?.product?._id);
74
+ const entitiy = state.entities.find(e2 => isSamePrints(e, e2) && e2?.product?._id === e?.product?._id);
72
75
  if (entitiy) {
73
76
  e.simpleProducts.forEach(sp => {
74
77
  const simpleProduct = entitiy.simpleProducts.find(sp2 => sp2.SKU === sp.SKU);