@lancom/shared 0.0.217 → 0.0.218

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.
@@ -1,6 +1,8 @@
1
1
 
2
2
  import { _get, _post, _put, _delete, _patch } from './helpers';
3
3
  import adminApi from './admin';
4
+ import { unminifySimpleProducts } from './utils/simple-products';
5
+ import { unminifyProduct } from './utils/product';
4
6
 
5
7
  const api = {
6
8
  fetchClientSettings(shop, params) {
@@ -48,8 +50,8 @@ const api = {
48
50
  fetchPricingProducts(shop, params) {
49
51
  return _get(`shop/${shop}/products/pricing-products`, params);
50
52
  },
51
- fetchProduct(shop, alias, params) {
52
- return _get(`shop/${shop}/products/${alias}`, params);
53
+ async fetchProduct(shop, alias, params) {
54
+ return unminifyProduct(await _get(`shop/${shop}/products/${alias}`, params));
53
55
  },
54
56
  fetchCouponByCode(shop, code) {
55
57
  return _get(`shop/${shop}/coupons/${code}`);
@@ -72,8 +74,8 @@ const api = {
72
74
  fetchNewsTag(shop, alias) {
73
75
  return _get(`shop/${shop}/news-tag/${alias}`);
74
76
  },
75
- fetchProductDetails(shop, alias, params) {
76
- return _get(`shop/${shop}/products/${alias}/simple-products`, params);
77
+ async fetchProductDetails(shop, alias, params) {
78
+ return unminifySimpleProducts(await _get(`shop/${shop}/products/${alias}/simple-products`, params));
77
79
  },
78
80
  fetchRelatedProducts(shop, alias, params) {
79
81
  return _get(`shop/${shop}/products/${alias}/related-products`, params);
@@ -0,0 +1,65 @@
1
+ export function unminifyProduct(product) {
2
+ const { mapPrintTypes, mapPrintAreas, mapPrintSizes } = product;
3
+
4
+ product.printTypes = (product.printTypes || []).map(pt => {
5
+ return mapPrintTypes.find(({ _id }) => _id === pt);
6
+ });
7
+ if (product.productType) {
8
+ product.productType.printTypes = (product.productType.printTypes || []).map(pt => {
9
+ return mapPrintTypes.find(({ _id }) => _id === pt);
10
+ });
11
+ }
12
+
13
+
14
+ product.printAreas = (product.printAreas || []).map(pa => {
15
+ return mapPrintAreas.find(({ _id }) => _id === pa || _id === pa?._id);
16
+ });
17
+ if (product.productType) {
18
+ product.productType.printAreas = (product.productType.printAreas || []).map(pa => {
19
+ return mapPrintAreas.find(({ _id }) => _id === pa || _id === pa?._id);
20
+ });
21
+ }
22
+
23
+
24
+ (product.printAreas || []).forEach(pa => {
25
+ if (pa.printSize) {
26
+ pa.printSize = mapPrintSizes.find(({ _id }) => _id === pa.printSize || _id === pa.printSize?._id);
27
+ }
28
+ (pa.sizes || []).forEach(size => {
29
+ if (size.printSize) {
30
+ size.printSize = mapPrintSizes.find(({ _id }) => _id === size.printSize || _id === size.printSize?._id);
31
+ }
32
+ });
33
+ });
34
+ (product.printTypes || []).forEach(pt => {
35
+ (pt.printAreas || []).forEach(pa => {
36
+ pa.printSizes = (pa.printSizes || []).map(size => {
37
+ return mapPrintSizes.find(({ _id }) => _id === size || _id === size?._id);
38
+ });
39
+ });
40
+ });
41
+ if (product.productType) {
42
+ (product.productType.printAreas || []).forEach(pa => {
43
+ if (pa.printSize) {
44
+ pa.printSize = mapPrintSizes.find(({ _id }) => _id === pa.printSize || _id === pa.printSize?._id);
45
+ }
46
+ (pa.sizes || []).forEach(size => {
47
+ if (size.printSize) {
48
+ size.printSize = mapPrintSizes.find(({ _id }) => _id === size.printSize || _id === size.printSize?._id);
49
+ }
50
+ });
51
+ });
52
+ (product.productType.printTypes || []).forEach(pt => {
53
+ (pt.printAreas || []).forEach(pa => {
54
+ pa.printSizes = (pa.printSizes || []).map(size => {
55
+ return mapPrintSizes.find(({ _id }) => _id === size || _id === size?._id);
56
+ });
57
+ });
58
+ });
59
+ }
60
+
61
+
62
+
63
+
64
+ return product;
65
+ }
@@ -0,0 +1,7 @@
1
+ export function unminifySimpleProducts({ simpleProducts, colors, sizes }) {
2
+ simpleProducts.forEach(sp => {
3
+ sp.color = colors.find(c => c._id === sp.color);
4
+ sp.size = sizes.find(s => s._id === sp.size);
5
+ });
6
+ return simpleProducts;
7
+ }
@@ -24,7 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <script>
27
- import { Power3, TimelineLite } from 'gsap';
27
+ // import { Power3, TimelineLite } from 'gsap';
28
28
  import api from '@lancom/shared/assets/js/api';
29
29
  import { staticLink } from '@lancom/shared/assets/js/utils/filters';
30
30
  import FailedConversionModal from '@lancom/shared/components/modals/failed_conversion_modal/failed-conversion-modal';
@@ -48,7 +48,7 @@ export default {
48
48
  rendered: null,
49
49
  error: null,
50
50
  progress: 0,
51
- timelineLite: new TimelineLite()
51
+ // timelineLite: new TimelineLite()
52
52
  };
53
53
  },
54
54
  methods: {
@@ -96,8 +96,8 @@ export default {
96
96
  }
97
97
  },
98
98
  onProgress(progress) {
99
- const duration = progress ? 0.1 : 0;
100
- this.timelineLite.to(this, duration, { progress, ease: Power3.easeIn });
99
+ // const duration = progress ? 0.1 : 0;
100
+ // this.timelineLite.to(this, duration, { progress, ease: Power3.easeIn });
101
101
  },
102
102
  toggle() {
103
103
  this.$refs.fileUploaderField.click();
@@ -3,7 +3,7 @@
3
3
  class="Gallery__wrapper"
4
4
  @click="canLoadImages = true">
5
5
  <div class="Gallery__big">
6
- <vue-slick-carousel
6
+ <!-- <vue-slick-carousel
7
7
  ref="bigCarousel"
8
8
  :key="updateCarouselTime"
9
9
  :arrows="true"
@@ -51,7 +51,7 @@
51
51
  </div>
52
52
  </div>
53
53
  </div>
54
- </vue-slick-carousel>
54
+ </vue-slick-carousel> -->
55
55
  <div
56
56
  v-if="!isTouch"
57
57
  class="Gallery__zoom"
@@ -60,7 +60,7 @@
60
60
  </div>
61
61
  </div>
62
62
  <div class="Gallery__small">
63
- <vue-slick-carousel
63
+ <!-- <vue-slick-carousel
64
64
  ref="smallCarousel"
65
65
  :key="updateCarouselTime"
66
66
  :slides-per-row="slidesPerRow"
@@ -88,7 +88,7 @@
88
88
  {{ image.printType ? 'Printed' : (product.prePrint ? product.prePrintText : image.colorName || 'Blank') }}
89
89
  </div>
90
90
  </div>
91
- </vue-slick-carousel>
91
+ </vue-slick-carousel> -->
92
92
  </div>
93
93
  <div
94
94
  v-if="hasValidFilters"
@@ -112,8 +112,8 @@
112
112
 
113
113
  <script>
114
114
  import { mapGetters, mapActions } from 'vuex';
115
- import VueSlickCarousel from 'vue-slick-carousel';
116
- import 'vue-slick-carousel/dist/vue-slick-carousel.css';
115
+ // import VueSlickCarousel from 'vue-slick-carousel';
116
+ // import 'vue-slick-carousel/dist/vue-slick-carousel.css';
117
117
  import { staticLink } from '@lancom/shared/assets/js/utils/filters';
118
118
  import { isValidImageTypes } from '@lancom/shared/assets/js/utils/colors';
119
119
  import Price from '@lancom/shared/components/common/price';
@@ -121,7 +121,7 @@ import Price from '@lancom/shared/components/common/price';
121
121
  export default {
122
122
  name: 'Gallery',
123
123
  components: {
124
- VueSlickCarousel,
124
+ // VueSlickCarousel,
125
125
  Price
126
126
  },
127
127
  props: {
@@ -6,7 +6,7 @@
6
6
  <div
7
7
  v-if="hasReviews"
8
8
  class="ProductReviews__carousel">
9
- <vue-slick-carousel
9
+ <!-- <vue-slick-carousel
10
10
  :arrows="true"
11
11
  :infinite="false"
12
12
  :speed="800">
@@ -14,7 +14,7 @@
14
14
  v-for="review in reviews"
15
15
  :key="review._id"
16
16
  :review="review" />
17
- </vue-slick-carousel>
17
+ </vue-slick-carousel> -->
18
18
  </div>
19
19
  <div class="ProductReviews__add">
20
20
  <btn
@@ -27,15 +27,15 @@
27
27
  </template>
28
28
 
29
29
  <script>
30
- import VueSlickCarousel from 'vue-slick-carousel';
31
- import 'vue-slick-carousel/dist/vue-slick-carousel.css';
30
+ // import VueSlickCarousel from 'vue-slick-carousel';
31
+ // import 'vue-slick-carousel/dist/vue-slick-carousel.css';
32
32
  import ProductReview from './product_review/product-review';
33
33
  import AddReviewModal from './add_review_modal/add-review-modal';
34
34
 
35
35
  export default {
36
36
  name: 'ProductReviews',
37
37
  components: {
38
- VueSlickCarousel,
38
+ // VueSlickCarousel,
39
39
  ProductReview
40
40
  },
41
41
  mixins: [],
package/mixins/modals.js CHANGED
@@ -1,8 +1,3 @@
1
- import CartModal from '@lancom/shared/components/modals/cart_modal/cart-modal';
2
- import OrderModal from '@lancom/shared/components/modals/order_modal/order-modal';
3
- import PaymentModal from '@lancom/shared/components/modals/payment_modal/payment-modal';
4
- import LayersTemplatesModal from '@lancom/shared/components/modals/editor_layers_templates/editor-layers-templates';
5
-
6
1
  const modals = {
7
2
  data() {
8
3
  return {
@@ -30,7 +25,8 @@ const modals = {
30
25
  this.switchModalTo = null;
31
26
  }
32
27
  },
33
- showCartModal(onclose) {
28
+ async showCartModal(onclose) {
29
+ const CartModal = await import('@lancom/shared/components/modals/cart_modal/cart-modal');
34
30
  this.openedModal = 'cart-modal';
35
31
  this.onclose = onclose;
36
32
  this.$modal.show(
@@ -52,7 +48,9 @@ const modals = {
52
48
  }
53
49
  );
54
50
  },
55
- showOrderModal() {
51
+ async showOrderModal() {
52
+ const OrderModal = await import('@lancom/shared/components/modals/order_modal/order-modal');
53
+
56
54
  this.openedModal = 'order-modal';
57
55
  this.$modal.show(
58
56
  OrderModal,
@@ -73,7 +71,8 @@ const modals = {
73
71
  }
74
72
  );
75
73
  },
76
- showPaymentModal() {
74
+ async showPaymentModal() {
75
+ const PaymentModal = await import('@lancom/shared/components/modals/payment_modal/payment-modal');
77
76
  this.openedModal = 'payment-modal';
78
77
  this.$modal.show(
79
78
  PaymentModal,
@@ -97,7 +96,9 @@ const modals = {
97
96
  }
98
97
  );
99
98
  },
100
- openPrintTemplates() {
99
+ async openPrintTemplates() {
100
+ const LayersTemplatesModal = await import('@lancom/shared/components/modals/editor_layers_templates/editor-layers-templates');
101
+
101
102
  this.$modal.show(
102
103
  LayersTemplatesModal,
103
104
  {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.217",
3
+ "version": "0.0.218",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -1,7 +1,7 @@
1
1
  import Vue from 'vue';
2
- import { VueHammer } from 'vue2-hammer';
2
+ // import { VueHammer } from 'vue2-hammer';
3
3
 
4
- VueHammer.config.pan = {
5
- threshold: 5
6
- };
7
- Vue.use(VueHammer);
4
+ // VueHammer.config.pan = {
5
+ // threshold: 5
6
+ // };
7
+ // Vue.use(VueHammer);