@lancom/shared 0.0.181 → 0.0.183

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,4 +1,5 @@
1
1
  import { mapGetters } from 'vuex';
2
+ import { generateShopHeadScripts } from '@lancom/shared/utils/head';
2
3
 
3
4
  const metaInfo = {
4
5
  data() {
@@ -7,7 +8,8 @@ const metaInfo = {
7
8
  };
8
9
  },
9
10
  computed: {
10
- ...mapGetters('page', ['routeInfo'])
11
+ ...mapGetters('page', ['routeInfo']),
12
+ ...mapGetters(['shop'])
11
13
  },
12
14
  methods: {
13
15
  generateTitleFromRoute() {
@@ -97,7 +99,8 @@ const metaInfo = {
97
99
  hid: 'canonical',
98
100
  rel: 'canonical',
99
101
  href: `https://${process.env.HOST_NAME}${this.$route.path === '/' ? '' : this.$route.path}`
100
- }]
102
+ }],
103
+ ...generateShopHeadScripts(this.shop)
101
104
  };
102
105
  },
103
106
  getRoute() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.181",
3
+ "version": "0.0.183",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,7 @@
1
+ import Vue from 'vue';
2
+
3
+ Vue.component('v-style', {
4
+ render: function (createElement) {
5
+ return createElement('style', this.$slots.default)
6
+ }
7
+ });
package/utils/head.js ADDED
@@ -0,0 +1,18 @@
1
+ export function generateShopHeadScripts(shop) {
2
+ const script = [];
3
+ if (shop.settings?.app?.LOG_ROCKET) {
4
+ script.push({
5
+ hid: 'LogRocket',
6
+ src: 'https://cdn.lr-in-prod.com/LogRocket.min.js',
7
+ crossorigin: 'anonymous'
8
+ }, {
9
+ hid: 'LogRocketInline',
10
+ type: 'text/javascript',
11
+ innerHTML: `window.LogRocket && window.LogRocket.init('${shop.settings?.app?.LOG_ROCKET}');`
12
+ });
13
+ }
14
+ return {
15
+ script,
16
+ __dangerouslyDisableSanitizers: ['script']
17
+ };
18
+ }