@lancom/shared 0.0.246 → 0.0.248

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.
@@ -177,7 +177,7 @@ html[dir=rtl] .form-icon-left {
177
177
  height: 50px;
178
178
  border-width: 1px;
179
179
  border-style: solid;
180
- border-color: #EFF1F2;
180
+ border-color: $grey_3;
181
181
  border-radius: 5px;
182
182
  font-style: normal;
183
183
  font-weight: normal;
@@ -424,7 +424,7 @@ html[dir=rtl] .textarea {
424
424
  }
425
425
  &__tags {
426
426
  min-height: 50px;
427
- border: 1px solid #e5e5e5;
427
+ border: 1px solid $grey_3;
428
428
  border-radius: 8px !important;
429
429
  padding: 19px 3px 4px 20px;
430
430
  }
@@ -1,3 +1,5 @@
1
+ @import "@/assets/scss/variables";
2
+
1
3
  .tooltip {
2
4
  display: block !important;
3
5
  z-index: 10000;
@@ -25,7 +27,7 @@
25
27
  &.white &-inner {
26
28
  background: #FFF !important;
27
29
  color: #575872 !important;
28
- border: 1px solid #EFF1F2 !important;
30
+ border: 1px solid $grey_3 !important;
29
31
  }
30
32
  &.white &-arrow {
31
33
  border-color: #FFF !important;
@@ -15,7 +15,7 @@ $white_high_emphasis: #FFFFFF;
15
15
  $white_medium_emphasis: rgba(255, 255, 255, .66);
16
16
  $gray: #575872 !default;
17
17
  $medium_gray: #B0B0BA !default;
18
- $light_gray: #F9F9FC !default;
18
+ $light_gray: #F9F9FC;
19
19
  $link: #5D89A9;
20
20
  $error: #E44868;
21
21
  $secondary_900: #20303C;
@@ -52,8 +52,8 @@ $black: #343750 !default;
52
52
  $gray_main: #616277 !default;
53
53
  $grey_1: #616277 !default;
54
54
  $grey_2: #B0B0BA !default;
55
- $grey_3: #EFF1F2 !default;
56
- $grey_4: #F9F9FC !default;
55
+ $grey_3: #EFF1F2;
56
+ $grey_4: #F9F9FC;
57
57
  $grey_5: #9898A5 !default;
58
58
 
59
59
  $white: #fff;
@@ -191,6 +191,9 @@ export default {
191
191
  this.onOrderSucces();
192
192
  this.$emit('next');
193
193
  }
194
+ } catch (e) {
195
+ const { message } = (e.response && e.response.data) || e;
196
+ this.handleErrors({ messages: [{ message }] });
194
197
  } finally {
195
198
  this.creating = false;
196
199
  }
@@ -86,6 +86,8 @@
86
86
  </template>
87
87
 
88
88
  <script>
89
+ let interval = null;
90
+
89
91
  export default {
90
92
  name: 'Payment',
91
93
  props: {
@@ -108,14 +110,17 @@ export default {
108
110
  fields: null
109
111
  };
110
112
  },
111
- mounted() {
113
+ async mounted() {
112
114
  this.loading = true;
115
+
116
+ await this.preloadPinpayments();
117
+
113
118
  if (window.HostedFields) {
114
- this.initHostedPayment();
119
+ await this.initHostedPayment();
115
120
  } else {
116
- window.addEventListener('load', () => {
121
+ window.addEventListener('load', async () => {
117
122
  if (!this.fields) {
118
- this.initHostedPayment();
123
+ await this.initHostedPayment();
119
124
  }
120
125
  });
121
126
  }
@@ -194,7 +199,31 @@ export default {
194
199
  }
195
200
  );
196
201
  });
197
- }
202
+ },
203
+ async preloadPinpayments() {
204
+ if (!window.HostedFields) {
205
+ clearInterval(interval);
206
+ await this.loadPinpayments();
207
+ await new Promise((resolve, reject) => {
208
+ interval = setInterval(() => {
209
+ if (window.HostedFields) {
210
+ clearInterval(interval);
211
+ resolve()
212
+ }
213
+ }, 100);
214
+ });
215
+ }
216
+ },
217
+ loadPinpayments() {
218
+ return new Promise((resolve) => {
219
+ const script = document.createElement('script');
220
+ script.type = "text/javascript";
221
+ script.src = 'https://cdn.pinpayments.com/pin.hosted_fields.v1.js';
222
+ script.onload = () => resolve();
223
+ const body = document.getElementsByTagName('body')[0];
224
+ body.appendChild(script);
225
+ });
226
+ }
198
227
  }
199
228
  };
200
229
  </script>
@@ -18,7 +18,9 @@
18
18
  </component>
19
19
  </template>
20
20
  </tabs>
21
- <div class="Editor__footer">
21
+ <div
22
+ v-if="productAvailableInCurrentCountry"
23
+ class="Editor__footer">
22
24
  <btn
23
25
  btn-label="Start again"
24
26
  btn-class="white"
@@ -135,8 +137,12 @@ export default {
135
137
  ...mapGetters('layers', [
136
138
  'layerThumbnails'
137
139
  ]),
140
+ productAvailableInCurrentCountry() {
141
+ const { countries } = this.product;
142
+ return !(countries || []).length || countries.includes(this.country._id);
143
+ },
138
144
  addToCartDisabled() {
139
- return !(this.template.layers.length && this.usedSimpleProducts.length);
145
+ return !this.usedSimpleProducts.length || (this.product.printOnly && !this.template.layers.length);
140
146
  }
141
147
  },
142
148
  watch: {
@@ -47,4 +47,10 @@
47
47
  text-align: center;
48
48
  }
49
49
  }
50
+ &__available-warning {
51
+ background-color: $error;
52
+ color: $white;
53
+ padding: 10px;
54
+ margin-top: 10px;
55
+ }
50
56
  }
@@ -61,8 +61,13 @@
61
61
  </div>
62
62
  </div>
63
63
  </div>
64
+ <div
65
+ v-if="!productAvailableInCurrentCountry"
66
+ class="EditorProductDetails__available-warning">
67
+ Product Not Available in {{ country.name }}
68
+ </div>
64
69
  <fragment
65
- v-if="productDetailsLoaded">
70
+ v-if="productDetailsLoaded && productAvailableInCurrentCountry">
66
71
  <div class="EditorProductDetails__section">
67
72
  <product-colors-selector />
68
73
  </div>
@@ -112,8 +117,13 @@ export default {
112
117
  'layerThumbnails'
113
118
  ]),
114
119
  ...mapGetters([
115
- 'pricingSettings'
120
+ 'pricingSettings',
121
+ 'country'
116
122
  ]),
123
+ productAvailableInCurrentCountry() {
124
+ const { countries } = this.product;
125
+ return !(countries || []).length || countries.includes(this.country._id);
126
+ },
117
127
  productLink() {
118
128
  return generateProductLink(this.product);
119
129
  },
@@ -111,7 +111,7 @@ export default {
111
111
  </script>
112
112
 
113
113
  <style lang="scss">
114
- @import "@lancom/shared/assets/scss/variables";
114
+ @import "@/assets/scss/variables";
115
115
  $types: delivery, general, other, printing, garments;
116
116
  .FAQ {
117
117
  &__wrapper {
@@ -218,7 +218,7 @@ $types: delivery, general, other, printing, garments;
218
218
  &-body {
219
219
  padding: 6px 30px 24px 30px;
220
220
  line-height: 27px;
221
- color: $gray;
221
+ color: $grey_1;
222
222
  overflow: hidden;
223
223
  @import "@lancom/shared/assets/scss/normalize";
224
224
  }
@@ -10,20 +10,21 @@
10
10
  right: 0;
11
11
  top: 41px;
12
12
  padding: 10px;
13
- background-color: $black;
14
- color: $white;
13
+ background-color: white;
14
+ border: 1px solid $medium_gray;
15
+ z-index: 999;
15
16
  }
16
17
  &__result-item {
17
18
  padding-bottom: 10px;
18
19
  margin-bottom: 10px;
19
- border-bottom: 1px solid $gray_main;
20
+ border-bottom: 1px solid $medium_gray;
20
21
  &:last-child {
21
22
  border-bottom: none;
22
23
  margin-bottom: 0px;
23
24
  }
24
25
  ::v-deep {
25
26
  a {
26
- color: $white;
27
+ color: $gray_main;
27
28
  font-size: 13px;
28
29
  text-decoration: none;
29
30
  }
@@ -33,24 +34,22 @@
33
34
  padding: 10px;
34
35
  text-align: center;
35
36
  display: block;
36
- background-color: $white;
37
+ background-color: $black;
38
+ color: $white !important;
37
39
  &:hover {
38
- background-color: $black;
39
- color: $white;
40
+ background-color: $white;
41
+ color: $black !important;
40
42
  }
41
43
  }
42
44
  }
43
45
  &__input {
44
46
  input {
45
- background-color: #535353;
46
- border: none;
47
+ border-color: $medium_gray;
47
48
  border-radius: 0px;
48
- color: $white;
49
49
  height: 41px;
50
50
  position: relative;
51
51
  z-index: 1;
52
52
  &::placeholder {
53
- font-weight: 600;
54
53
  font-size: 14px;
55
54
  color: $grey_3;
56
55
  }
@@ -61,7 +60,6 @@
61
60
  right: 10px;
62
61
  font-size: 17px;
63
62
  pointer-events: none;
64
- color: $white;
65
63
  &.icon-search {
66
64
  z-index: 2;
67
65
  pointer-events: all;
@@ -1,3 +1,19 @@
1
+ async function googleLocalShoppingFeed(axios, config, availableStores) {
2
+ const result = await googleShoppingFeed(axios, config, availableStores);
3
+
4
+ const fields = [
5
+ 'g:availability',
6
+ 'g:id',
7
+ 'g:pickup_method',
8
+ 'g:pickup_sla',
9
+ 'g:price',
10
+ 'g:quantity',
11
+ 'g:store_code'
12
+ ];
13
+ result.rss.channel.item = result.rss.channel.item
14
+ .map(i => fields.reduce((item, field) => ({ ...item, [field]: i[field] }), {}));
15
+ return result;
16
+ }
1
17
  async function googleShoppingFeed(axios, config, availableStores) {
2
18
  const { data } = await axios.get(`${config.LOCAL_API_URL}/feed/products?host=${config.HOST_NAME}`);
3
19
  const spliceFirstImage = images => (images || []).splice(0, 1)[0];
@@ -72,6 +88,7 @@ async function googleShoppingFeed(axios, config, availableStores) {
72
88
  }
73
89
  } else {
74
90
  info['g:pickup_method'] = { _text: 'not_supported' };
91
+ info['g:excluded_destination'] = { _text: 'Local_inventory_ads' };
75
92
  }
76
93
  if (product.volume) {
77
94
  if (product.volume.length) {
@@ -104,5 +121,6 @@ async function googleShoppingFeed(axios, config, availableStores) {
104
121
  }
105
122
 
106
123
  module.exports = {
107
- googleShoppingFeed
124
+ googleShoppingFeed,
125
+ googleLocalShoppingFeed
108
126
  };
package/feeds/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const { reviewsFeed } = require('./reviews');
2
- const { googleShoppingFeed } = require('./google-shopping');
2
+ const { googleShoppingFeed, googleLocalShoppingFeed } = require('./google-shopping');
3
3
 
4
4
  module.exports = {
5
5
  reviewsFeed,
6
- googleShoppingFeed
6
+ googleShoppingFeed,
7
+ googleLocalShoppingFeed
7
8
  };
@@ -34,7 +34,10 @@ const metaInfo = {
34
34
  }
35
35
  },
36
36
  head() {
37
- const hasQueryParams = Object.keys(this.$route.query || {}).length > 0;
37
+ const hasQueryParams = Object
38
+ .keys(this.$route.query || {})
39
+ .filter(key => !['color', 'store'].includes(`${key || ''}`.toLowerCase()))
40
+ .length > 0;
38
41
 
39
42
  const { short_text: shortText, image, meta = {} } = this.routeInfo || {};
40
43
  const pageItemMeta = this.pageItem?.meta || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.246",
3
+ "version": "0.0.248",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/product.js CHANGED
@@ -160,6 +160,7 @@ export const actions = {
160
160
  commit('setSelectedPrintArea', { printArea: first._id, size: first.printSize });
161
161
  }
162
162
  } catch (e) {
163
+ console.log(e);
163
164
  const { status, data } = e?.response || {};
164
165
  const statusCode = status || 500;
165
166
  commit('setLoadError', {