@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.
- package/assets/js/utils/prints.js +5 -0
- package/components/faq/faq.vue +1 -0
- package/components/products/products_colors/products-colors.scss +7 -0
- package/components/products/products_colors/products-colors.vue +19 -2
- package/components/subscribe/subscribe.vue +1 -1
- package/nuxt.config.js +1 -0
- package/package.json +1 -1
- package/plugins/vee-validate.js +20 -1
- package/store/cart.js +5 -2
|
@@ -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
|
}
|
package/components/faq/faq.vue
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</div>
|
|
22
22
|
<div class="ProductsColors__items">
|
|
23
23
|
<products-link
|
|
24
|
-
v-for="color in
|
|
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
|
};
|
package/nuxt.config.js
CHANGED
package/package.json
CHANGED
package/plugins/vee-validate.js
CHANGED
|
@@ -12,7 +12,26 @@ extend('required', {
|
|
|
12
12
|
return `${name} attribute is mandatory`;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
|
|
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
|
|
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 =
|
|
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);
|