@lancom/shared 0.0.355 → 0.0.357

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.
@@ -13,7 +13,8 @@
13
13
  Order {{ orderData.code }}
14
14
  </div>
15
15
  <div class="OrderSuccess__card-info">
16
- Thanks for your order! You will receive an order confirmation email shortly.
16
+ Thanks for your order! Your order has been successfully processed using <b>{{ orderData.googleCharge ? 'Google Pay' : orderData.paymentMethod }} {{ cardInfo ? `(${cardInfo})` : '' }}</b>. You will receive an order confirmation email shortly.
17
+ <b></b>
17
18
  </div>
18
19
  <div>
19
20
  <btn
@@ -31,7 +32,11 @@ import { mapGetters } from 'vuex';
31
32
  export default {
32
33
  name: 'OrderSuccess',
33
34
  computed: {
34
- ...mapGetters('order', ['orderData'])
35
+ ...mapGetters('order', ['orderData']),
36
+ cardInfo() {
37
+ const { card } = this.orderData.charge?.payment_method_details || this.orderData.charge || {};
38
+ return card ? `${card.brand || card.scheme} ${card.display_number || `XXXX-XXXX-XXXX-${card.last4 || 'XXXX'}`}` : null;
39
+ }
35
40
  }
36
41
  };
37
42
  </script>
@@ -41,7 +41,7 @@
41
41
  type: 'CARD',
42
42
  parameters: {
43
43
  allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
44
- allowedCardNetworks: ['MASTERCARD', 'VISA'],
44
+ allowedCardNetworks: ['MASTERCARD', 'VISA', 'AMEX'],
45
45
  },
46
46
  tokenizationSpecification: {
47
47
  type: 'PAYMENT_GATEWAY',
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="Spinner">
2
+ <div class="Spinner" :class="{ small }">
3
3
  <div class="Spinner__container">
4
4
  <div
5
5
  v-for="petal in 12"
@@ -17,16 +17,23 @@ export default {
17
17
  props: {
18
18
  background: {
19
19
  type: String
20
+ },
21
+ small: {
22
+ type: Boolean,
23
+ default: false
20
24
  }
21
25
  }
22
26
  };
23
27
  </script>
24
28
 
25
29
  <style lang="scss">
26
- $size: 26px;
30
+ $spinnerSize: 26px;
27
31
  $delay_step: 1/12;
28
32
 
29
33
  .Spinner {
34
+ &.small {
35
+ $spinnerSize: 14px !global;
36
+ }
30
37
  @keyframes lds-spinner {
31
38
  0% {
32
39
  opacity: 1;
@@ -45,22 +52,22 @@ $delay_step: 1/12;
45
52
  }
46
53
 
47
54
  &__container {
48
- width: $size;
49
- height: $size;
55
+ width: $spinnerSize;
56
+ height: $spinnerSize;
50
57
  margin: 0 auto;
51
58
  position: relative;
52
- transform: translate(-$size, -$size) scale(1) translate($size, $size);
59
+ transform: translate(-$spinnerSize, -$spinnerSize) scale(1) translate($spinnerSize, $spinnerSize);
53
60
  }
54
61
 
55
62
  &__petal{
56
- left: calc(#{($size / 16) * 7});
63
+ left: calc(#{($spinnerSize / 16) * 7});
57
64
  position: absolute;
58
65
  animation: lds-spinner linear 1s infinite;
59
66
  background: #55A8FF;
60
- width: calc(#{$size} / 8);
61
- height: calc(#{$size} / 4);
67
+ width: calc(#{$spinnerSize} / 8);
68
+ height: calc(#{$spinnerSize} / 4);
62
69
  border-radius: 40%;
63
- transform-origin: calc(#{$size} / 16) calc(#{$size} / 2);
70
+ transform-origin: calc(#{$spinnerSize} / 16) calc(#{$spinnerSize} / 2);
64
71
 
65
72
  @for $i from 1 through 12 {
66
73
  &:nth-child(#{$i}) {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="EditorProductDetails__wrapper">
3
3
  <h3 class="lc_h3 lc_black EditorProductDetails__name">
4
- {{ product.name }}
4
+ {{ fullProductName }}
5
5
  </h3>
6
6
  <div class="EditorProductDetails__header">
7
7
  <div
@@ -208,7 +208,9 @@ export default {
208
208
  'defaultSimpleProduct',
209
209
  'selectedPrintType',
210
210
  'isPrintPricing',
211
- 'printsPrice'
211
+ 'printsPrice',
212
+ 'availableSizes',
213
+ 'availableColors'
212
214
  ]),
213
215
  ...mapGetters('layers', [
214
216
  'layerThumbnails'
@@ -218,6 +220,12 @@ export default {
218
220
  'pricingSettings',
219
221
  'country'
220
222
  ]),
223
+ fullProductName() {
224
+ const name = this.product.name;
225
+ const color = this.availableColors?.find(c => c.alias === this.$route.query?.color);
226
+ const size = this.availableSizes?.find(c => c.shortName === this.$route.query?.size);
227
+ return `${name}${(color || size) ? ` | ${[color?.name, size?.shortName].filter(i => !!i).join(', ') || ''}` : ''}`;
228
+ },
221
229
  hasImages() {
222
230
  return this.modelImages.length > 0;
223
231
  },
@@ -20,6 +20,8 @@
20
20
  font-size: 14px;
21
21
  cursor: pointer;
22
22
  margin-right: 5px;
23
+ display: flex;
24
+ align-items: center;
23
25
  &--active {
24
26
  background: rgb(196, 226, 236);
25
27
  }
@@ -28,7 +28,11 @@
28
28
  'EditorWorkspaceSide__toggle-wireframe--active': visibleOnpress
29
29
  }"
30
30
  @mousedown.stop.prevent="toggleOnpressImage(true)">
31
- {{ visibleOnpress ? 'Hide On Press' : 'Show On Press' }}
31
+ <spinner
32
+ v-if="visibleOnpress && !backgroundImageLoaded"
33
+ :small="true"
34
+ style="margin-right: 10px;" />
35
+ {{ visibleOnpress ? 'Real product photo' : 'Press for real product photo' }}
32
36
  </div>
33
37
  </div>
34
38
  <div
@@ -59,6 +59,7 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
59
59
  .replace(/&middot;/, '·');
60
60
 
61
61
  let link = `https://${config.HOST_NAME}${generateProductLink(product, sp.color, isEditor)}`;
62
+ link = link.includes('?') ? `${link}&size=${sp.size?.shortName}` : `${link}?size=${sp.size?.shortName}`
62
63
  link = link.includes('?') ? `${link}&price=IT` : `${link}?price=IT`
63
64
  if (sp.multipackQty) {
64
65
  link = link.includes('?') ? `${link}&multipack=${sp.SKU}` : `${link}?multipack=${sp.SKU}`;
@@ -285,7 +285,7 @@
285
285
  ]
286
286
  };
287
287
 
288
- return [productsSchema, breadcrumbSchema];
288
+ return [productsSchema, breadcrumbSchema, this.$store.state.shop?.schema].filter(s => !!s);
289
289
  },
290
290
  methods: {
291
291
  ...mapActions([
@@ -4,7 +4,7 @@ import { fitLayerToEditorSize } from '@lancom/shared/assets/js/utils/layers';
4
4
  import { getPrintAreaByName } from '@lancom/shared/assets/js/models/print-area';
5
5
  import { getLayerModel } from '@lancom/shared/assets/js/models/product-layers';
6
6
  import { tax, staticLink, inRange } from '@lancom/shared/assets/js/utils/filters';
7
- import { getProductLargeCover } from '@lancom/shared/assets/js/utils/colors';
7
+ import { getProductLargeCover, isValidImageTypes } from '@lancom/shared/assets/js/utils/colors';
8
8
  import metaInfo from '@lancom/shared/mixins/meta-info';
9
9
  import { STORE_CODES } from '@/constants/store';
10
10
  import { generateProductLink, generateProductsLink } from '@lancom/shared/assets/js/utils/product';
@@ -255,19 +255,20 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
255
255
  brandAdditionalProductsRichSnippet = JSON.parse(this.product.brand.additionalProductsRichSnippet);
256
256
  } catch (e) {}
257
257
 
258
+ const description = (this.product.gsFeedDescription || this.product.description || '').replace(/<[^>]*>/g, '');
258
259
  const productSchema = {
259
260
  '@context': 'https://schema.org',
260
- '@type': 'Product',
261
- description: (this.product.gsFeedDescription || this.product.description || '').replace(/<[^>]*>/g, ''),
261
+ '@type': 'ProductGroup',
262
+ description: description,
262
263
  name,
263
- offers: this.productDetails?.simpleProducts.map(sp => {
264
+ hasVariant: this.productDetails?.simpleProducts.map(sp => {
264
265
  const spMaxPrice = (sp.pricing || []).reduce((price, pricing) => Math.max(price, pricing.price), 0);
265
266
  const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
266
267
  const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
267
268
 
268
269
  const offer = {
269
270
  '@type': 'Offer',
270
- name: `${sp.size?.name || ''} / ${sp.color?.name || ''}`,
271
+ name: `${sp.size?.shortName || ''} / ${sp.color?.name || ''}`,
271
272
  url,
272
273
  availability: `https://schema.org/${availability}`,
273
274
  price: +tax(maxPrice, this.gstTax).toFixed(2),
@@ -295,7 +296,24 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
295
296
  };
296
297
  }
297
298
 
298
- return offer;
299
+ const galleryImages = this.product.images?.filter(i => !(i.types || []).includes('designer') && i.color === sp.color?._id) || [];
300
+ const image = getProductLargeCover(this.product, 'front', sp.color);
301
+ return {
302
+ "@type": "Product",
303
+ "sku": sp.SKU,
304
+ "gtin13": sp.gtin,
305
+ "image": [
306
+ image,
307
+ ...galleryImages.map(i => i.large).filter(i => !!i && i !== image)
308
+ ],
309
+ "name": `${this.product.name} | ${sp.size?.shortName || ''} ${sp.color?.name || ''}`,
310
+ "description": description,
311
+ "color": sp.color?.name,
312
+ "size": sp.size?.shortName,
313
+ "offers": offer,
314
+ "shippingDetails": { "@id": "#shipping_policy" },
315
+ "hasMerchantReturnPolicy": { "@id": "#return_policy" }
316
+ };
299
317
  })
300
318
  };
301
319
 
@@ -308,7 +326,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
308
326
  }
309
327
 
310
328
  if (SKU) {
311
- productSchema.sku = SKU;
329
+ productSchema.productGroupID = SKU;
312
330
  // schema.gtin = SKU;
313
331
  }
314
332
 
@@ -384,7 +402,9 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
384
402
  return [
385
403
  productSchema,
386
404
  breadcrumbSchema,
387
- mainEntity.length > 0 ? faqSchema : null
405
+ mainEntity.length > 0 ? faqSchema : null,
406
+ this.$store.state.shop?.shippingPolicySchema,
407
+ this.$store.state.shop?.returnPolicySchema
388
408
  ].filter(s => !!s);
389
409
  }
390
410
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.355",
3
+ "version": "0.0.357",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {