@lancom/shared 0.0.292 → 0.0.294

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.
@@ -127,7 +127,7 @@ export function generateProductsLink($route, data) {
127
127
  }
128
128
 
129
129
  export function generateProductLink(product, color, toEditor = false) {
130
- const baseLink = `/${product.brand.alias}/${product.productType.alias}/${product.alias}`;
130
+ const baseLink = `/${product.brand?.alias}/${product.productType?.alias}/${product.alias}`;
131
131
  return `${toEditor ? `${baseLink}/editor` : baseLink}${color ? `?color=${color.alias}` : ''}`;
132
132
  }
133
133
 
@@ -98,7 +98,7 @@ export default {
98
98
  return !!this.SETTINGS.CART_ONLY_POSTCODE;
99
99
  },
100
100
  postcodeLabel() {
101
- return this.MESSAGES.CART_POSTCODE || 'Postcode';
101
+ return this.onlyPostcode ? 'Postcode' : (this.MESSAGES.CART_POSTCODE || 'Postcode');
102
102
  },
103
103
  postcodeInfoLabel() {
104
104
  return this.MESSAGES.CART_POSTCODE_INFO || 'Enter postcode to calculate shipping';
@@ -0,0 +1,23 @@
1
+ export default {
2
+ jsonld() {
3
+ const mainEntity = this.groups.reduce((items, group) => {
4
+ return [
5
+ ...items,
6
+ ...group.entities.map(item => ({
7
+ '@type': 'Question',
8
+ name: item.question,
9
+ acceptedAnswer: {
10
+ '@type': 'Answer',
11
+ text: item.answer
12
+ }
13
+ }))
14
+ ];
15
+ }, []);
16
+
17
+ return {
18
+ '@context': 'https://schema.org',
19
+ '@type': 'FAQPage',
20
+ mainEntity
21
+ };
22
+ }
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.292",
3
+ "version": "0.0.294",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <div class="FAQ__wrapper view-transition">
3
+ <faq
4
+ :groups="groups"
5
+ :togable="false"
6
+ :preopened-group="openedGroup"
7
+ :preopened-entity="openedEntity">
8
+ </faq>
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
+ import Faq from '@lancom/shared/components/faq/faq';
16
+ import faqMixin from '@lancom/shared/mixins/faq.mixin';
17
+
18
+ export default {
19
+ name: 'FAQPage',
20
+ mixins: [metaInfo, faqMixin],
21
+ components: {
22
+ Faq
23
+ },
24
+ async asyncData({ store, params, error }) {
25
+ const { _id } = store.getters.shop;
26
+ const groups = await api.fetchFAQ(_id);
27
+ const group = groups.find(g => g.type === params.group);
28
+ if (!group) {
29
+ return error({
30
+ statusCode: 404,
31
+ error: 'Faq not found'
32
+ });
33
+ }
34
+ return { groups: [group] };
35
+ },
36
+ data() {
37
+ return {
38
+ groups: [],
39
+ openedGroup: this.$route.params.group,
40
+ openedEntity: this.$route.query.id
41
+ };
42
+ }
43
+ };
44
+ </script>
45
+
46
+ <style lang="scss">
47
+ .FAQ {
48
+ &__wrapper {
49
+ margin-top: 20px;
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div class="FAQ__wrapper view-transition">
3
+ <faq
4
+ :groups="groups"
5
+ :preopened-group="openedGroup"
6
+ :preopened-entity="openedEntity" />
7
+ </div>
8
+ </template>
9
+
10
+ <script>
11
+ import metaInfo from '@lancom/shared/mixins/meta-info';
12
+ import api from '@lancom/shared/assets/js/api';
13
+ import Faq from '@lancom/shared/components/faq/faq';
14
+ import faqMixin from '@lancom/shared/mixins/faq.mixin';
15
+
16
+ export default {
17
+ name: 'FAQPage',
18
+ mixins: [metaInfo, faqMixin],
19
+ components: {
20
+ Faq
21
+ },
22
+ async asyncData({ store }) {
23
+ const { _id } = store.getters.shop;
24
+ const groups = await api.fetchFAQ(_id);
25
+ return { groups };
26
+ },
27
+ data() {
28
+ return {
29
+ groups: [],
30
+ openedGroup: this.$route.query.group,
31
+ openedEntity: this.$route.query.id
32
+ };
33
+ }
34
+ };
35
+ </script>
36
+
37
+ <style lang="scss">
38
+ .FAQ {
39
+ &__wrapper {
40
+ margin-top: 20px;
41
+ }
42
+ }
43
+ </style>
package/routes/index.js CHANGED
@@ -59,5 +59,15 @@ module.exports = function(routes, resolve) {
59
59
  path: '/checkout/order',
60
60
  component: resolve('@lancom/shared/pages/checkout/order.vue'),
61
61
  chunkName: 'pages/checkout/reset'
62
+ }, {
63
+ name: 'faq',
64
+ path: '/faq',
65
+ component: resolve('@lancom/shared/pages/faq/index.vue'),
66
+ chunkName: 'pages/faq'
67
+ }, {
68
+ name: 'faq-group',
69
+ path: '/faq/:group',
70
+ component: resolve('@lancom/shared/pages/faq/_group/index.vue'),
71
+ chunkName: 'pages/faq/group'
62
72
  }];
63
73
  }