@lancom/shared 0.0.422 → 0.0.424

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.
Files changed (40) hide show
  1. package/assets/js/api/admin.js +33 -7
  2. package/assets/js/api/index.js +17 -3
  3. package/assets/js/utils/share-promises/index.js +76 -0
  4. package/components/common/coupon_select/coupon-select.vue +12 -2
  5. package/components/common/phone_input/phone-input.vue +15 -3
  6. package/components/common/postcode_select/postcode-select.vue +3 -1
  7. package/components/customer/customer_navigation_menu/customer-navigation-menu.vue +11 -7
  8. package/components/customer/customer_preferences_form/customer-preferences-form.scss +12 -0
  9. package/components/customer/customer_preferences_form/customer-preferences-form.vue +87 -0
  10. package/components/pages/customer/preferences/preferences.vue +79 -0
  11. package/components/product/product.vue +0 -12
  12. package/components/product/product_colors_selector/product-colors-selector.vue +22 -13
  13. package/components/product/product_reviews/product-reviews.vue +6 -6
  14. package/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell.vue +23 -3
  15. package/components/product/products_multipacks_size_selector_color/product_multipacks_size_selector_color/product-multipacks-size-selector-color.scss +61 -0
  16. package/components/product/products_multipacks_size_selector_color/product_multipacks_size_selector_color/product-multipacks-size-selector-color.vue +102 -0
  17. package/components/product/products_multipacks_size_selector_color/products-multipacks-size-selector-color.scss +15 -0
  18. package/components/product/products_multipacks_size_selector_color/products-multipacks-size-selector-color.vue +95 -0
  19. package/components/product/related_products/related-products.vue +4 -4
  20. package/components/product/wizard-editor/wizard-editor.vue +5 -1
  21. package/components/products/children_categories/children-categories.scss +3 -3
  22. package/components/resource/resource_view/resource-view.mixin.js +74 -0
  23. package/components/resource/resource_view/resource-view.scss +13 -0
  24. package/components/resource/resource_view/resource-view.vue +97 -0
  25. package/components/resource/resource_view/resource_view_prints/resource-view-prints.scss +7 -0
  26. package/components/resource/resource_view/resource_view_prints/resource-view-prints.vue +42 -0
  27. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource-view-print.scss +5 -0
  28. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource-view-print.vue +54 -0
  29. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource-view-print-products.scss +0 -0
  30. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource-view-print-products.vue +45 -0
  31. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource_view_print_product/resource-view-print-product.scss +0 -0
  32. package/components/resource/resource_view/resource_view_prints/resource_view_print/resource_view_print_products/resource_view_print_product/resource-view-print-product.vue +44 -0
  33. package/layouts/products.vue +7 -13
  34. package/package.json +1 -1
  35. package/pages/customer/preferences.vue +33 -0
  36. package/pages/order/_token/resource/_resource.vue +53 -0
  37. package/routes/index.js +10 -0
  38. package/store/auth.js +1 -0
  39. package/store/index.js +12 -3
  40. package/store/product.js +2 -1
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div class="ResourceViewPrintProducts__wrapper">
3
+ <resource-view-print-product
4
+ v-for="(product, index) in products"
5
+ :key="product.guid || index"
6
+ :order="order"
7
+ :resource="resource"
8
+ :print="print"
9
+ :product="product" />
10
+ </div>
11
+ </template>
12
+
13
+ <script>
14
+ import ResourceViewPrintProduct from './resource_view_print_product/resource-view-print-product';
15
+
16
+ export default {
17
+ name: 'LancomResourceViewPrintProducts',
18
+ components: {
19
+ ResourceViewPrintProduct
20
+ },
21
+ props: {
22
+ order: {
23
+ type: Object,
24
+ required: true
25
+ },
26
+ resource: {
27
+ type: Object,
28
+ required: true
29
+ },
30
+ print: {
31
+ type: Object,
32
+ required: true
33
+ }
34
+ },
35
+ computed: {
36
+ products() {
37
+ return this.order.products;
38
+ }
39
+ }
40
+ };
41
+ </script>
42
+
43
+ <style lang="scss" scoped>
44
+ @import 'resource-view-print-products.scss';
45
+ </style>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <div class="ResourceViewPrintProduct__wrapper">
3
+ <div
4
+ v-for="simpleProduct in simpleProducts"
5
+ :key="simpleProduct.guid"
6
+ class="lc_regular14">
7
+ {{ simpleProduct.SKU }} x {{ simpleProduct.amount }}
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ name: 'LancomResourceViewPrintProduct',
15
+ props: {
16
+ order: {
17
+ type: Object,
18
+ required: true
19
+ },
20
+ resource: {
21
+ type: Object,
22
+ required: true
23
+ },
24
+ print: {
25
+ type: Object,
26
+ required: true
27
+ },
28
+ product: {
29
+ type: Object,
30
+ required: true
31
+ }
32
+ },
33
+ computed: {
34
+ simpleProducts() {
35
+ const simpleProducts = this.product.simpleProducts || [];
36
+ return simpleProducts.filter(sp => sp.amount > 0);
37
+ }
38
+ }
39
+ };
40
+ </script>
41
+
42
+ <style lang="scss" scoped>
43
+ @import 'resource-view-print-product.scss';
44
+ </style>
@@ -20,16 +20,12 @@
20
20
  <h1 class="Products__name">
21
21
  {{ routeName }}
22
22
  </h1>
23
- <div
24
- v-if="!visiblChildrenCategories"
25
- class="Products__filters">
23
+ <div class="Products__filters">
26
24
  <products-filters @open="openAside" />
27
25
  </div>
28
26
  </div>
29
27
  <div class="Products__content">
30
- <div
31
- v-if="!visiblChildrenCategories"
32
- class="Products__aside">
28
+ <div class="Products__aside">
33
29
  <breakpoint
34
30
  name="md"
35
31
  mode="up">
@@ -37,10 +33,8 @@
37
33
  </breakpoint>
38
34
  </div>
39
35
  <div class="Products__list">
40
- <children-categories v-if="visiblChildrenCategories" />
41
- <products-catalog
42
- v-else
43
- class="Products__catalog" />
36
+ <children-categories v-if="hasChildrenCategories" />
37
+ <products-catalog class="Products__catalog" />
44
38
  </div>
45
39
  </div>
46
40
  <div
@@ -103,7 +97,7 @@
103
97
  async fetch() {
104
98
  await this.loadProducts();
105
99
 
106
- if (this.page === 1 && this.products.length === 0) {
100
+ if (this.page === 1) {
107
101
  await this.fetchChildrenCategories(this.currentCategory);
108
102
  }
109
103
 
@@ -115,8 +109,8 @@
115
109
  ...mapGetters('page', ['routeInfo']),
116
110
  ...mapGetters(['notificationBar', 'shop', 'country', 'currency']),
117
111
  ...mapGetters('products', ['category', 'childrenCategories', 'categories', 'brands', 'types', 'tags', 'loadError', 'count', 'products', 'minPrice', 'maxPrice', 'page']),
118
- visiblChildrenCategories() {
119
- return false; // this.page === 1 && this.products.length === 0 && this.childrenCategories.length > 0;
112
+ hasChildrenCategories() {
113
+ return this.childrenCategories.length > 0;
120
114
  },
121
115
  pageItemCanonical() {
122
116
  const page = +this.$route.query.page;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.422",
3
+ "version": "0.0.424",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div
3
+ :data-aos="aosFadeLeft"
4
+ class="CustomerPreferencesPage__wrapper">
5
+ <customer-preferences />
6
+ </div>
7
+ </template>
8
+
9
+ <script>
10
+ import metaInfo from '@lancom/shared/mixins/meta-info';
11
+
12
+ export default {
13
+ name: 'CustomerPreferencesPage',
14
+ components: {
15
+ CustomerPreferences: () => import('@lancom/shared/components/pages/customer/preferences/preferences')
16
+ },
17
+ mixins: [metaInfo]
18
+ };
19
+ </script>
20
+
21
+ <style lang="scss" scoped>
22
+ @import "@/assets/scss/variables";
23
+
24
+ .CustomerPreferencesPage {
25
+ &__wrapper {
26
+ margin: 100px auto;
27
+ width: 500px;
28
+ @media (max-width: $bp-extra-small-max) {
29
+ width: auto;
30
+ }
31
+ }
32
+ }
33
+ </style>
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="ResourceViewPage__wrapper">
3
+ <div :class="isFullScreen ? '' : 'content-inner'">
4
+ <resource-view
5
+ :order="order"
6
+ :resource="resource"
7
+ :responsive="!isFullScreen" />
8
+ </div>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import metaInfo from '@lancom/shared/mixins/meta-info';
14
+ import api from '@lancom/shared/assets/js/api';
15
+
16
+ export default {
17
+ name: 'OrderResourceViewPage',
18
+ components: {
19
+ ResourceView: () => import('@lancom/shared/components/resource/resource_view/resource-view')
20
+ },
21
+ mixins: [metaInfo],
22
+ async asyncData({ params, error }) {
23
+ try {
24
+ const order = await api.fetchOrderByToken(params.token, { invoiceProducts: true });
25
+ const resource = order.resources.find(i => [i._id, i.guid].includes(params.resource));
26
+ if (!resource) {
27
+ return error({
28
+ statusCode: 404,
29
+ error: 'Resource not found'
30
+ });
31
+ }
32
+ return { order, resource };
33
+ } catch (e) {
34
+ const { status, data } = e?.response || {};
35
+ const statusCode = status || 500;
36
+ error({
37
+ statusCode,
38
+ error: data?.error || 'Resource not found'
39
+ });
40
+ }
41
+ },
42
+ data() {
43
+ return {
44
+ order: null,
45
+ invoice: null,
46
+ isFullScreen: this.$route.query.print
47
+ };
48
+ }
49
+ };
50
+ </script>
51
+
52
+ <style lang="scss">
53
+ </style>
package/routes/index.js CHANGED
@@ -87,6 +87,11 @@ module.exports = function(routes, resolve, config) {
87
87
  path: '/order/:token/payment',
88
88
  component: resolve('@lancom/shared/pages/order/_token/payment/index.vue'),
89
89
  chunkName: 'pages/order/payment'
90
+ }, {
91
+ name: 'order-resource',
92
+ path: '/order/:token/resource/:resource',
93
+ component: resolve('@lancom/shared/pages/order/_token/resource/_resource.vue'),
94
+ chunkName: 'pages/order/resource'
90
95
  }, {
91
96
  name: 'order-payment-invoice',
92
97
  path: '/order/:token/payment/invoice/:invoice',
@@ -142,6 +147,11 @@ module.exports = function(routes, resolve, config) {
142
147
  path: '/customer/password/:token',
143
148
  component: resolve('@lancom/shared/pages/customer/password/_token.vue'),
144
149
  chunkName: 'pages/customer/password/reset'
150
+ }, {
151
+ name: 'customer-preferences',
152
+ path: '/customer/preferences',
153
+ component: resolve('@lancom/shared/pages/customer/preferences.vue'),
154
+ chunkName: 'pages/customer/preferences'
145
155
  }, {
146
156
  name: 'checkout-cart',
147
157
  path: '/checkout/cart',
package/store/auth.js CHANGED
@@ -18,6 +18,7 @@ export const getters = {
18
18
  isGuestUser: state => !state.token,
19
19
  isAdmin: state => checkRoles(state.user, ['admin']),
20
20
  isContentEditor: state => checkRoles(state.user, ['admin', 'content-editor']),
21
+ isDesigner: state => checkRoles(state.user, ['admin', 'designer']),
21
22
  isWarehouse: state => checkRoles(state.user, ['admin', 'warehouse']),
22
23
  user: state => state.user,
23
24
  userWarehouse: state => state.user?.warehouse,
package/store/index.js CHANGED
@@ -4,9 +4,13 @@ import { getAuthToken } from '@lancom/shared/assets/js/utils/auth';
4
4
  import { getShopCountrySettings } from '@lancom/shared/assets/js/utils/shop';
5
5
  import { MESSAGES, COUNTRIES_MESSAGES } from '@/messages';
6
6
  import { SETTINGS, COUNTRIES_SETTINGS } from '@/settings';
7
+ import { getSharePromise, clearAllSharePromises } from '@lancom/shared/assets/js/utils/share-promises';
8
+
7
9
  const cookieparser = process.server ? require('cookieparser') : undefined;
8
10
  const CLOSED_NOTIFICATION = 'lancom-closed-notification-1.0';
9
11
 
12
+ const shareShopInfo = getSharePromise(60 * 1000);
13
+
10
14
  export const state = () => ({
11
15
  googleClickId: null,
12
16
  stockCountry: null,
@@ -69,9 +73,14 @@ export const actions = {
69
73
  await commit('setShop', shop);
70
74
  }
71
75
  },
72
- async nuxtServerInit({ commit }, { req }) {
73
- const shop = await api.fetchShopByUrl(process.env.HOST_NAME);
74
- const menus = await api.fetchMenus(shop._id);
76
+ async nuxtServerInit({ commit }, { req, query }) {
77
+ if (query?.cache === 'false') {
78
+ clearAllSharePromises();
79
+ await api.clearAllSharePromises();
80
+ }
81
+
82
+ const shop = await shareShopInfo.share(process.env.HOST_NAME, () => api.fetchShopByUrl(process.env.HOST_NAME));
83
+ const menus = await shareShopInfo.share(`menus_${shop._id}`, () => api.fetchMenus(shop._id));
75
84
  commit('setMenus', menus);
76
85
  commit('setShop', shop);
77
86
  // if (req.headers.cookie) {
package/store/product.js CHANGED
@@ -56,6 +56,7 @@ export const getters = {
56
56
  productDetailsKey: ({ productDetailsKey }) => productDetailsKey,
57
57
  loadingProductDetails: ({ loadingProductDetails }) => loadingProductDetails,
58
58
  multipack: ({ multipack }) => multipack,
59
+ commonProductsMultipacks: ({ product }) => product?.multipacks?.filter(p => !p.SKU) || [],
59
60
  calculatingPrice: ({ calculatingPrice }) => calculatingPrice,
60
61
  product: ({ product }) => product,
61
62
  preSetPrints: ({ preSetPrints }) => preSetPrints,
@@ -76,7 +77,7 @@ export const getters = {
76
77
  usedBigSizeSimpleProductsQuantity: (state, { usedSimpleProducts }) => filterBigSize(usedSimpleProducts).reduce((sum, { amount }) => sum + amount, 0),
77
78
  defaultSimpleProduct: ({ productDetails, editableColor }) => {
78
79
  return editableColor && (
79
- productDetails.simpleProducts.find(({ color, size }) => color._id === editableColor._id && size.alias === 'small')
80
+ productDetails.simpleProducts.find(({ color, size }) => color._id === editableColor._id && size?.alias === 'small')
80
81
  || productDetails.simpleProducts.find(({ color }) => color._id === editableColor._id)
81
82
  );
82
83
  },