@lancom/shared 0.0.160 → 0.0.162

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.
@@ -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',
package/mixins/payment.js CHANGED
@@ -63,7 +63,7 @@ export default {
63
63
  }
64
64
  },
65
65
  sendConversionData() {
66
- gtm.push({
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
@@ -77,6 +77,7 @@ module.exports = (config, axios, { raygunClient } = {}) => ({
77
77
  },
78
78
  build: {
79
79
  publicPath: '/client/',
80
+ postcss: null,
80
81
  transpile: [
81
82
  'vee-validate/dist/rules',
82
83
  'vue-json-editor',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.160",
3
+ "version": "0.0.162",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
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
  },