@lancom/shared 0.0.89 → 0.0.93
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/api/helpers.js +2 -1
- package/assets/js/utils/filters.js +9 -5
- package/assets/js/utils/product.js +3 -3
- package/components/checkout/cart/cart.mixin.js +3 -4
- package/components/checkout/cart/cart_entity/cart-entity.vue +8 -0
- package/components/checkout/cart/cart_price_info/cart-price-info.scss +10 -0
- package/components/checkout/cart/cart_price_info/cart-price-info.vue +9 -3
- package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.scss +44 -0
- package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.vue +107 -0
- package/components/checkout/order/address-form/address-form.vue +1 -1
- package/components/checkout/order/order-billing-information/order-billing-information.vue +0 -8
- package/components/checkout/order/order-shipping-method/order-shipping-method.vue +1 -1
- package/components/common/progress_steps/progress-steps.scss +1 -1
- package/components/editor/editor.vue +0 -8
- package/components/editor/editor_layers/editor_layer_forms/editor_layer_common_fields/editor-layer-common-fields.vue +0 -49
- package/components/editor/editor_layers/editor_layer_forms/editor_layer_form_art/editor-layer-form-art.vue +0 -6
- package/components/editor/editor_layers/editor_layers_toolbar/editor-layers-toolbar.vue +4 -0
- package/components/editor/editor_pricing/editor-pricing.vue +2 -4
- package/components/editor/editor_workspace/editor_workspace_side/editor-workspace-side.vue +0 -3
- package/components/modals/order_modal/order-modal.vue +1 -1
- package/components/order/order_payment/order-payment.vue +0 -4
- package/components/order/order_status/order-status.vue +0 -18
- package/components/product/layouts/product_model_measurements/product-model-measurements.vue +0 -5
- package/components/product/product.vue +0 -7
- package/components/products/product_list/product-list.vue +23 -2
- package/components/products/product_list_product_placeholder/product-list-product-placeholder.scss +52 -0
- package/components/products/product_list_product_placeholder/product-list-product-placeholder.vue +26 -0
- package/components/products/products_aside/products-aside.scss +32 -0
- package/components/products/products_aside/products-aside.vue +27 -27
- package/components/products/products_attributes/products-attributes.vue +0 -3
- package/components/products/products_brands/products-brands.vue +2 -2
- package/components/products/products_catalog/products-catalog.vue +8 -3
- package/components/products/products_colors/products-colors.scss +2 -1
- package/components/products/products_colors/products-colors.vue +11 -0
- package/components/products/products_filters/products-filters.vue +0 -17
- package/components/quotes/quote_request/quote-request.vue +3 -7
- package/mixins/payment.js +0 -1
- package/mixins/product-preview.js +28 -4
- package/nuxt.config.js +8 -5
- package/package.json +1 -1
- package/plugins/global-components.js +0 -4
- package/plugins/vue-recaptcha.js +12 -7
- package/store/cart.js +84 -32
- package/store/order.js +1 -0
- package/store/product.js +0 -2
- package/store/products.js +7 -2
package/store/cart.js
CHANGED
|
@@ -6,7 +6,8 @@ export const state = () => ({
|
|
|
6
6
|
id: null,
|
|
7
7
|
entities: [],
|
|
8
8
|
suburb: null,
|
|
9
|
-
cartPricing: null
|
|
9
|
+
cartPricing: null,
|
|
10
|
+
cartPricingError: null
|
|
10
11
|
});
|
|
11
12
|
|
|
12
13
|
const getSimpleProductsQuantity = simpleProducts => {
|
|
@@ -56,6 +57,7 @@ export const getters = {
|
|
|
56
57
|
notValidPrintsQuantities(state, { quantities }) {
|
|
57
58
|
return (quantities?.prints || []).filter(({ minQuantity, quantity }) => quantity < minQuantity);
|
|
58
59
|
},
|
|
60
|
+
cartPricingError: ({ cartPricingError }) => cartPricingError
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
export const actions = {
|
|
@@ -96,37 +98,24 @@ export const actions = {
|
|
|
96
98
|
await api.saveCart(payload, shop._id);
|
|
97
99
|
commit('setEntities', entities);
|
|
98
100
|
},
|
|
99
|
-
async
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
printCost,
|
|
118
|
-
freeSetupOver,
|
|
119
|
-
printType: getSimpleObj(print.printType),
|
|
120
|
-
printArea: getSimpleObj(print.printArea),
|
|
121
|
-
printSize: getSimpleObj(print.printSize)
|
|
122
|
-
};
|
|
123
|
-
}),
|
|
124
|
-
printSurcharge: product.printSurcharge || 0
|
|
125
|
-
})),
|
|
126
|
-
postcode: suburb && suburb.postcode
|
|
127
|
-
};
|
|
128
|
-
const response = await api.calculateProductPrice(payload, shop._id);
|
|
129
|
-
commit('setCartPricing', response);
|
|
101
|
+
async removeSupplier({ commit, state }, { supplier, shop }) {
|
|
102
|
+
const brands = supplier.brands.map(({ _id }) => _id);
|
|
103
|
+
const entities = state.entities.filter(entity => !brands.includes(entity.product.brand._id));
|
|
104
|
+
const payload = { _id: state.id, entities };
|
|
105
|
+
await api.saveCart(payload, shop._id);
|
|
106
|
+
commit('setEntities', entities);
|
|
107
|
+
},
|
|
108
|
+
async calculateCartPrice({ state: { suburb, entities }, commit }, { shop }) {
|
|
109
|
+
const payload = generateCalculatePriceData(entities, suburb);
|
|
110
|
+
try {
|
|
111
|
+
const response = await api.calculateProductPrice(payload, shop._id);
|
|
112
|
+
commit('setCartPricing', response);
|
|
113
|
+
commit('setCartPricingError', null);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
const { error = 'Error calculate pricing' } = e.response?.data || {};
|
|
116
|
+
commit('setCartPricingError', error);
|
|
117
|
+
commit('setCartPricing', null);
|
|
118
|
+
}
|
|
130
119
|
},
|
|
131
120
|
async setSimpleProductAmount({ state, commit }, { guid, amount, shop }) {
|
|
132
121
|
const entities = (state.entities || []).map(product => ({
|
|
@@ -142,6 +131,28 @@ export const actions = {
|
|
|
142
131
|
},
|
|
143
132
|
clearCart({ commit }) {
|
|
144
133
|
commit('clearCart');
|
|
134
|
+
},
|
|
135
|
+
async selectRate({ state: { cartPricing, entities, suburb }, commit }, { supplier, rate, shop }) {
|
|
136
|
+
const suppliersWithRates = cartPricing.shipping.suppliersWithRates
|
|
137
|
+
.map(supplierWithRates => ({
|
|
138
|
+
...(
|
|
139
|
+
supplierWithRates === supplier
|
|
140
|
+
? ({
|
|
141
|
+
...supplierWithRates,
|
|
142
|
+
rates: supplierWithRates.rates.map(r => ({ ...r, selected: rate === r }))
|
|
143
|
+
})
|
|
144
|
+
: supplierWithRates)
|
|
145
|
+
}));
|
|
146
|
+
const payload = generateCalculatePriceData(entities, suburb, suppliersWithRates);
|
|
147
|
+
try {
|
|
148
|
+
const response = await api.calculateProductPrice(payload, shop._id);
|
|
149
|
+
commit('setCartPricing', response);
|
|
150
|
+
commit('setCartPricingError', null);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
const { error = 'Error calculate pricing' } = e.response?.data || {};
|
|
153
|
+
commit('setCartPricingError', error);
|
|
154
|
+
commit('setCartPricing', null);
|
|
155
|
+
}
|
|
145
156
|
}
|
|
146
157
|
};
|
|
147
158
|
|
|
@@ -162,10 +173,51 @@ export const mutations = {
|
|
|
162
173
|
setCartPricing(state, price) {
|
|
163
174
|
state.cartPricing = price;
|
|
164
175
|
},
|
|
176
|
+
setCartPricingError(state, error) {
|
|
177
|
+
state.cartPricingError = error;
|
|
178
|
+
},
|
|
179
|
+
setSelectedRates(state, selectedRates) {
|
|
180
|
+
state.selectedRates = selectedRates;
|
|
181
|
+
},
|
|
165
182
|
clearCart(state) {
|
|
166
183
|
state.id = null;
|
|
167
184
|
state.entities = [];
|
|
168
185
|
state.cartPricing = null;
|
|
169
186
|
state.suburb = null;
|
|
187
|
+
state.cartPricingError = null;
|
|
170
188
|
}
|
|
171
189
|
};
|
|
190
|
+
|
|
191
|
+
function generateCalculatePriceData(entities, suburb, suppliersWithRates) {
|
|
192
|
+
const getSimpleObj = i => i && ({ _id: i._id, name: i.name });
|
|
193
|
+
return {
|
|
194
|
+
entities: entities.map(({ _id, guid, prints, simpleProducts, product }) => ({
|
|
195
|
+
_id,
|
|
196
|
+
guid,
|
|
197
|
+
brand: getSimpleObj(product.brand),
|
|
198
|
+
simpleProducts: simpleProducts.map(({ _id, guid, amount, pricing, unprintedPricing, weight = 0 }) => ({
|
|
199
|
+
amount,
|
|
200
|
+
pricing: (prints || []).length > 0 ? pricing : unprintedPricing,
|
|
201
|
+
weight: product.weight,
|
|
202
|
+
volume: product.volume,
|
|
203
|
+
guid,
|
|
204
|
+
_id
|
|
205
|
+
})).filter(({ amount }) => +amount > 0),
|
|
206
|
+
prints: (prints || []).map(print => {
|
|
207
|
+
const { setupCost, freeSetupOver, printCost } = getPrintTypeSizePricing(print.printType, print.printSize?._id) || {};
|
|
208
|
+
return {
|
|
209
|
+
costType: print.printType.costType,
|
|
210
|
+
setupCost,
|
|
211
|
+
printCost,
|
|
212
|
+
freeSetupOver,
|
|
213
|
+
printType: getSimpleObj(print.printType),
|
|
214
|
+
printArea: getSimpleObj(print.printArea),
|
|
215
|
+
printSize: getSimpleObj(print.printSize)
|
|
216
|
+
};
|
|
217
|
+
}),
|
|
218
|
+
printSurcharge: product.printSurcharge || 0
|
|
219
|
+
})),
|
|
220
|
+
postcode: suburb && suburb.postcode,
|
|
221
|
+
suppliersWithRates
|
|
222
|
+
};
|
|
223
|
+
}
|
package/store/order.js
CHANGED
|
@@ -22,6 +22,7 @@ export const actions = {
|
|
|
22
22
|
order.productsTotal = pricing.products?.products?.totalPriceWithoutTax || 0;
|
|
23
23
|
order.printsTotal = pricing.products?.prints?.totalPriceWithoutTax || 0;
|
|
24
24
|
order.shippingTotal = pricing.shipping?.totalPriceWithoutTax || 0;
|
|
25
|
+
order.suppliersWithRates = pricing.shipping?.suppliersWithRates || [];
|
|
25
26
|
}
|
|
26
27
|
const response = await api.createOrder(order, shop);
|
|
27
28
|
commit('setOrderData', response);
|
package/store/product.js
CHANGED
|
@@ -133,7 +133,6 @@ export const actions = {
|
|
|
133
133
|
commit('setProduct', response);
|
|
134
134
|
commit('setPreSetPrint', (response.prints || []).find(({ _id }) => _id === print));
|
|
135
135
|
} catch (e) {
|
|
136
|
-
console.log(e);
|
|
137
136
|
const { status, data } = e?.response || {};
|
|
138
137
|
const statusCode = status || 500;
|
|
139
138
|
commit('setLoadError', {
|
|
@@ -305,7 +304,6 @@ export const mutations = {
|
|
|
305
304
|
...(state.template.layers || []).filter(l => l.guid !== layer.guid),
|
|
306
305
|
layer
|
|
307
306
|
];
|
|
308
|
-
console.log('addTemplateLayer: ', layer);
|
|
309
307
|
Vue.set(state.template, 'layers', layers);
|
|
310
308
|
},
|
|
311
309
|
removeTemplateLayer(state, layer) {
|
package/store/products.js
CHANGED
|
@@ -10,7 +10,8 @@ export const state = () => ({
|
|
|
10
10
|
brands: [],
|
|
11
11
|
tags: [],
|
|
12
12
|
attributes: [],
|
|
13
|
-
loadError: null
|
|
13
|
+
loadError: null,
|
|
14
|
+
placeholder: false
|
|
14
15
|
});
|
|
15
16
|
|
|
16
17
|
export const getters = {
|
|
@@ -23,7 +24,8 @@ export const getters = {
|
|
|
23
24
|
page: ({ page }) => page,
|
|
24
25
|
count: ({ count }) => count,
|
|
25
26
|
perPage: ({ perPage }) => perPage,
|
|
26
|
-
loadError: ({ loadError }) => loadError
|
|
27
|
+
loadError: ({ loadError }) => loadError,
|
|
28
|
+
placeholder: ({ placeholder }) => placeholder
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export const actions = {
|
|
@@ -55,6 +57,9 @@ export const actions = {
|
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
export const mutations = {
|
|
60
|
+
setPlaceholder(state, placeholder) {
|
|
61
|
+
state.placeholder = placeholder;
|
|
62
|
+
},
|
|
58
63
|
setProducts(state, products) {
|
|
59
64
|
state.products = products;
|
|
60
65
|
},
|