@lancom/shared 0.0.161 → 0.0.163
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/admin.js +3 -0
- package/assets/js/utils/product.js +4 -0
- package/components/checkout/cart/cart.mixin.js +6 -1
- package/components/checkout/cart/cart_quantity_errors/cart-quantity-errors.vue +5 -0
- package/components/quotes/quote_view/quote-view.mixin.js +3 -1
- package/mixins/payment.js +3 -2
- package/nuxt.config.js +1 -0
- package/package.json +1 -1
- package/store/cart.js +2 -0
- package/store/product.js +2 -0
- package/store/quote.js +3 -0
package/assets/js/api/admin.js
CHANGED
|
@@ -106,6 +106,9 @@ export default {
|
|
|
106
106
|
markSubOrderAsDispatched(order, subOrder) {
|
|
107
107
|
return _post(`admin/shop/${order.shop}/order/${order._id}/sub-order/${subOrder._id}/dispatched`, subOrder);
|
|
108
108
|
},
|
|
109
|
+
sendShipmentTracking(order, shipment, tracking) {
|
|
110
|
+
return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/tracking/${tracking._id}/send`, tracking);
|
|
111
|
+
},
|
|
109
112
|
removeShipmentFromStarshipit(order, shipment) {
|
|
110
113
|
return _delete(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}`);
|
|
111
114
|
},
|
|
@@ -67,6 +67,10 @@ export function getProductSides({ layers = [] }) {
|
|
|
67
67
|
return [...sidesSet];
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
export function filterBigSize(simpleProducts) {
|
|
71
|
+
return (simpleProducts || []).filter(sp => ['5XL', '6XL', '7XL'].includes(sp.size?.shortName));
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
// function getPrintZoneLayer(layer, { width: editorWidth, height: editorHeight }, product) {
|
|
71
75
|
// const printAreaRect = getPrintAreaByName({ printArea: layer.printArea, editorWidth, editorHeight }, product);
|
|
72
76
|
// return {
|
|
@@ -17,6 +17,8 @@ export default {
|
|
|
17
17
|
...mapGetters('cart', [
|
|
18
18
|
'entities',
|
|
19
19
|
'simpleProducts',
|
|
20
|
+
'simpleProductsQuantity',
|
|
21
|
+
'bigSizeSimpleProductsQuantity',
|
|
20
22
|
'coupon',
|
|
21
23
|
'suburb',
|
|
22
24
|
'quantities',
|
|
@@ -24,13 +26,16 @@ export default {
|
|
|
24
26
|
'notValidPrintsQuantities'
|
|
25
27
|
]),
|
|
26
28
|
isNotValidQuantity() {
|
|
27
|
-
return this.isNotValidProductsQuantity || this.isNotValidPrintsQuantity;
|
|
29
|
+
return this.isNotValidProductsQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
|
|
28
30
|
},
|
|
29
31
|
isNotValidProductsQuantity() {
|
|
30
32
|
return this.notValidProductsQuantities.length > 0;
|
|
31
33
|
},
|
|
32
34
|
isNotValidPrintsQuantity() {
|
|
33
35
|
return this.notValidPrintsQuantities.length > 0;
|
|
36
|
+
},
|
|
37
|
+
isNotValidPrintsBigSizeQuantity() {
|
|
38
|
+
return this.simpleProductsQuantity ? ((this.bigSizeSimpleProductsQuantity / this.simpleProductsQuantity * 100) > 50) : false;
|
|
34
39
|
}
|
|
35
40
|
},
|
|
36
41
|
watch: {
|
|
@@ -10,14 +10,19 @@
|
|
|
10
10
|
:key="print._id">
|
|
11
11
|
Minimum products quantity with <b>{{ print.name }}</b> print type: {{ print.minQuantity }}
|
|
12
12
|
</li>
|
|
13
|
+
<li v-if="isNotValidPrintsBigSizeQuantity">
|
|
14
|
+
Minimum order of 5XL-7XL should be 50%
|
|
15
|
+
</li>
|
|
13
16
|
</ul>
|
|
14
17
|
</template>
|
|
15
18
|
|
|
16
19
|
<script>
|
|
17
20
|
import { mapGetters } from 'vuex';
|
|
21
|
+
import CartMixin from '@lancom/shared/components/checkout/cart/cart.mixin';
|
|
18
22
|
|
|
19
23
|
export default {
|
|
20
24
|
name: 'CartQuantityErrors',
|
|
25
|
+
mixins: [CartMixin],
|
|
21
26
|
computed: {
|
|
22
27
|
...mapGetters('cart', [
|
|
23
28
|
'notValidProductsQuantities',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapGetters, mapActions } from 'vuex';
|
|
1
|
+
import { mapGetters, mapActions, mapMutations } from 'vuex';
|
|
2
2
|
import api from '@lancom/shared/assets/js/api';
|
|
3
3
|
import { price, shortDate, tax } from '@lancom/shared/assets/js/utils/filters';
|
|
4
4
|
import { convertQuoteToOrder } from '@lancom/shared/assets/js/utils/quote';
|
|
@@ -26,6 +26,7 @@ export default {
|
|
|
26
26
|
},
|
|
27
27
|
methods: {
|
|
28
28
|
...mapActions('quote', ['selectOption', 'clear']),
|
|
29
|
+
...mapMutations('quote', ['setOrder']),
|
|
29
30
|
optionGst(option) {
|
|
30
31
|
return tax(option.total, this.gstTax) - option.total;
|
|
31
32
|
},
|
|
@@ -33,6 +34,7 @@ export default {
|
|
|
33
34
|
try {
|
|
34
35
|
this.processing = true;
|
|
35
36
|
this.order = await this.createOrder(option);
|
|
37
|
+
this.setOrder(this.order);
|
|
36
38
|
this.clear();
|
|
37
39
|
} catch (e) {
|
|
38
40
|
const { message } = (e.response && e.response.data) || e;
|
package/mixins/payment.js
CHANGED
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
sendConversionData() {
|
|
66
|
-
|
|
66
|
+
const event = {
|
|
67
67
|
event: 'purchase',
|
|
68
68
|
transaction_id: this.orderData.code,
|
|
69
69
|
value: this.orderData.total,
|
|
@@ -86,7 +86,8 @@ export default {
|
|
|
86
86
|
}))
|
|
87
87
|
];
|
|
88
88
|
}, [])
|
|
89
|
-
}
|
|
89
|
+
};
|
|
90
|
+
gtm.push(event);
|
|
90
91
|
},
|
|
91
92
|
clearFailedCharge() {
|
|
92
93
|
this.errorMessage = null;
|
package/nuxt.config.js
CHANGED
package/package.json
CHANGED
package/store/cart.js
CHANGED
|
@@ -2,6 +2,7 @@ import groupBy from 'lodash/groupBy';
|
|
|
2
2
|
import api from '@lancom/shared/assets/js/api';
|
|
3
3
|
import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
4
4
|
import { getPrintTypeSizePricing } from '@lancom/shared/assets/js/utils/prints';
|
|
5
|
+
import { filterBigSize } from '@lancom/shared/assets/js/utils/product';
|
|
5
6
|
|
|
6
7
|
export const state = () => ({
|
|
7
8
|
id: null,
|
|
@@ -46,6 +47,7 @@ export const getters = {
|
|
|
46
47
|
simpleProducts: ({ entities }) => entities.reduce((simpleProducts, entity) => [...simpleProducts, ...(entity.simpleProducts || [])], []),
|
|
47
48
|
notEmptySimpleProducts: (state, { simpleProducts }) => simpleProducts.filter(e => e.amount > 0),
|
|
48
49
|
simpleProductsQuantity: (state, { notEmptySimpleProducts }) => notEmptySimpleProducts.reduce((quantity, sp) => quantity + sp.amount, 0),
|
|
50
|
+
bigSizeSimpleProductsQuantity: (state, { notEmptySimpleProducts }) => filterBigSize(notEmptySimpleProducts).reduce((quantity, sp) => quantity + sp.amount, 0),
|
|
49
51
|
suburb: ({ suburb }) => suburb,
|
|
50
52
|
cartPricing: ({ cartPricing }) => cartPricing,
|
|
51
53
|
cartProductsPricing: ({ cartPricing }) => (cartPricing && cartPricing.products) || {},
|
package/store/product.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getPrintAreaByName, getProductPrintsAreasPrices } from '@lancom/shared/
|
|
|
6
6
|
import { sortSizes } from '@lancom/shared/assets/js/utils/sizes';
|
|
7
7
|
import { isValidImageTypes, getColorOfDefaultCatalogFrontImage } from '@lancom/shared/assets/js/utils/colors';
|
|
8
8
|
import { getProductsForCalculatePricing } from '@lancom/shared/assets/js/utils/product';
|
|
9
|
+
import { filterBigSize } from '@lancom/shared/assets/js/utils/product';
|
|
9
10
|
import { sortByName } from '../assets/js/utils/filters';
|
|
10
11
|
|
|
11
12
|
export const state = () => ({
|
|
@@ -65,6 +66,7 @@ export const getters = {
|
|
|
65
66
|
simpleProducts: ({ template }) => template.simpleProducts || [],
|
|
66
67
|
usedSimpleProducts: ({ template }) => (template.simpleProducts || []).filter(p => p.amount > 0),
|
|
67
68
|
usedSimpleProductsQuantity: ({ template }) => (template.simpleProducts || []).filter(p => p.amount > 0).reduce((sum, { amount }) => sum + amount, 0),
|
|
69
|
+
usedBigSizeSimpleProductsQuantity: (state, { usedSimpleProducts }) => filterBigSize(usedSimpleProducts).reduce((sum, { amount }) => sum + amount, 0),
|
|
68
70
|
defaultSimpleProduct: ({ productDetails, editableColor }) => {
|
|
69
71
|
return editableColor && productDetails.simpleProducts.find(({ color, size }) => color._id === editableColor._id && size.alias === 'small');
|
|
70
72
|
},
|