@lancom/shared 0.0.169 → 0.0.171
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/gtm.js
CHANGED
|
@@ -11,6 +11,17 @@
|
|
|
11
11
|
padding: 15px;
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
&__same-day-dispatch {
|
|
15
|
+
width: 30px;
|
|
16
|
+
height: 30px;
|
|
17
|
+
background-image: url('/icons/same-day-dispatch.svg');
|
|
18
|
+
background-position: center center;
|
|
19
|
+
background-repeat: no-repeat;
|
|
20
|
+
background-size: contain;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
position: relative;
|
|
23
|
+
top: 7px;
|
|
24
|
+
}
|
|
14
25
|
&__info {
|
|
15
26
|
flex-grow: 1;
|
|
16
27
|
}
|
|
@@ -173,11 +173,11 @@ export default {
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
mounted() {
|
|
176
|
-
const index = this.filteredImages.findIndex(i => i.color === this.editableColor?._id);
|
|
177
|
-
if (index > -1) {
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
console.log('filteredImages: ', this.filteredImages);
|
|
176
|
+
// const index = this.filteredImages.findIndex(i => i.color === this.editableColor?._id);
|
|
177
|
+
// if (index > -1) {
|
|
178
|
+
// this.goToSlide(index, true);
|
|
179
|
+
// }
|
|
180
|
+
// console.log('filteredImages: ', this.filteredImages);
|
|
181
181
|
},
|
|
182
182
|
methods: {
|
|
183
183
|
...mapActions('product', ['selectColor']),
|
package/package.json
CHANGED
package/store/product.js
CHANGED
|
@@ -10,6 +10,8 @@ import { filterBigSize } from '@lancom/shared/assets/js/utils/product';
|
|
|
10
10
|
import { sortByName } from '../assets/js/utils/filters';
|
|
11
11
|
|
|
12
12
|
export const state = () => ({
|
|
13
|
+
calculatingPrice: false,
|
|
14
|
+
images: [],
|
|
13
15
|
priceIncludeGST: false,
|
|
14
16
|
product: null,
|
|
15
17
|
preSetPrint: null,
|
|
@@ -43,6 +45,7 @@ export const state = () => ({
|
|
|
43
45
|
});
|
|
44
46
|
|
|
45
47
|
export const getters = {
|
|
48
|
+
calculatingPrice: ({ calculatingPrice }) => calculatingPrice,
|
|
46
49
|
product: ({ product }) => product,
|
|
47
50
|
preSetPrint: ({ preSetPrint }) => preSetPrint,
|
|
48
51
|
preSetPrintPriceRange: ({ preSetPrint, product }) => {
|
|
@@ -117,15 +120,7 @@ export const getters = {
|
|
|
117
120
|
...printTypesMinQuantity
|
|
118
121
|
);
|
|
119
122
|
},
|
|
120
|
-
images: ({
|
|
121
|
-
const imagesGroups = new Map();
|
|
122
|
-
(product.images || [])
|
|
123
|
-
.filter(i => isValidImageTypes(i, ['front', 'back', 'model']))
|
|
124
|
-
.forEach(i => {
|
|
125
|
-
imagesGroups.set(i.color, [...(imagesGroups.get(i.color) || []), i]);
|
|
126
|
-
});
|
|
127
|
-
return [...imagesGroups.values()].reduce((images, group) => [...images, ...group], []);
|
|
128
|
-
},
|
|
123
|
+
images: ({ images }) => images,
|
|
129
124
|
editableSide: ({ editableSide }) => editableSide,
|
|
130
125
|
priceIncludeGST: ({ priceIncludeGST }) => priceIncludeGST,
|
|
131
126
|
hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice
|
|
@@ -162,15 +157,30 @@ export const actions = {
|
|
|
162
157
|
state.availableColors.find(c => c._id === catalogFrontColorId) ||
|
|
163
158
|
state.availableColors[0];
|
|
164
159
|
commit('setEditableColor', editableColor);
|
|
160
|
+
|
|
161
|
+
let images = editableColor ? [
|
|
162
|
+
...(state.product.images || []).filter(image => image.color === editableColor._id),
|
|
163
|
+
...(state.product.images || []).filter(image => image.color !== editableColor._id)
|
|
164
|
+
] : state.product.images;
|
|
165
|
+
const imagesGroups = new Map();
|
|
166
|
+
images
|
|
167
|
+
.filter(i => isValidImageTypes(i, ['front', 'back', 'model']))
|
|
168
|
+
.forEach(i => {
|
|
169
|
+
imagesGroups.set(i.color, [...(imagesGroups.get(i.color) || []), i]);
|
|
170
|
+
});
|
|
171
|
+
images = [...imagesGroups.values()].reduce((images, group) => [...images, ...group], []);
|
|
172
|
+
commit('setImages', images);
|
|
165
173
|
},
|
|
166
174
|
async fetchPrintTypes({ commit }, { shop }) {
|
|
167
175
|
const response = await api.fetchPrintTypes(shop);
|
|
168
176
|
commit('setPrintTypes', response);
|
|
169
177
|
},
|
|
170
178
|
async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, shop) {
|
|
179
|
+
commit('setCalculatingPrice', true);
|
|
171
180
|
const entities = getProductsForCalculatePricing(product, getters.usedSimpleProducts, template.layers, isPrintPricing, true);
|
|
172
181
|
const response = await api.calculateProductPrice({ entities }, shop._id);
|
|
173
182
|
commit('setProductPricing', response);
|
|
183
|
+
commit('setCalculatingPrice', false);
|
|
174
184
|
},
|
|
175
185
|
async createLayer(
|
|
176
186
|
{
|
|
@@ -220,7 +230,7 @@ export const actions = {
|
|
|
220
230
|
commit('addTemplateColor', color);
|
|
221
231
|
}
|
|
222
232
|
const lastSelectedColorId = colorSelected ? color : getters.templateColors[0];
|
|
223
|
-
if (lastSelectedColorId) {
|
|
233
|
+
if (lastSelectedColorId && getters.editableColor?._id !== lastSelectedColorId) {
|
|
224
234
|
commit('setEditableColor', getters.availableColors.find(({ _id }) => lastSelectedColorId === _id));
|
|
225
235
|
}
|
|
226
236
|
}
|
|
@@ -238,12 +248,8 @@ export const mutations = {
|
|
|
238
248
|
},
|
|
239
249
|
setProductDetails(state, simpleProducts) {
|
|
240
250
|
const { preSetPrint } = state;
|
|
241
|
-
console.log('');
|
|
242
|
-
console.log('setProductDetails: ');
|
|
243
|
-
console.log('simpleProducts1: ', simpleProducts);
|
|
244
251
|
simpleProducts = simpleProducts.filter(sp => !preSetPrint || (preSetPrint.colors || []).includes(sp.color._id) )
|
|
245
252
|
state.productDetails = { simpleProducts };
|
|
246
|
-
console.log('simpleProducts2: ', simpleProducts);
|
|
247
253
|
const availableSizes = [];
|
|
248
254
|
const sizesPerColor = simpleProducts.reduce((map, { color, size }) => {
|
|
249
255
|
if (!map[color.alias]) {
|
|
@@ -405,6 +411,12 @@ export const mutations = {
|
|
|
405
411
|
},
|
|
406
412
|
setEditableSide(state, side) {
|
|
407
413
|
state.editableSide = side;
|
|
414
|
+
},
|
|
415
|
+
setImages(state, images) {
|
|
416
|
+
state.images = images;
|
|
417
|
+
},
|
|
418
|
+
setCalculatingPrice(state, calculatingPrice) {
|
|
419
|
+
state.calculatingPrice = calculatingPrice;
|
|
408
420
|
}
|
|
409
421
|
};
|
|
410
422
|
|