@lancom/shared 0.0.478 → 0.0.479

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.
@@ -110,12 +110,13 @@ function getCategoryPathFromRoute(routeParams) {
110
110
  }
111
111
 
112
112
  export function generateProductsLink($route, data, skipParams = false) {
113
- let { type, category, brand, text, sort, minimumQty, productionTime } = data;
113
+ let { type, category, brand, text, sort, minimumQty, productionTime, clearancePercent } = data;
114
114
  category = (category || category === null) ? generateCategoryPath(category) : getCategoryPathFromRoute($route?.params);
115
115
  type = (type || type === null) ? type : ($route?.params?.type || $route?.query?.type);
116
116
  brand = (brand || brand === null) ? brand : ($route?.params?.brand || $route?.query?.brand);
117
117
  minimumQty = (minimumQty || minimumQty === null) ? minimumQty : ($route?.params?.minimumQty || $route?.query?.minimumQty);
118
118
  productionTime = (productionTime || productionTime === null) ? productionTime : ($route?.params?.productionTime || $route?.query?.productionTime);
119
+ clearancePercent = (clearancePercent || clearancePercent === null) ? clearancePercent : ($route?.query?.clearancePercent || null);
119
120
  text = (text || text === '') ? text : $route?.query?.text;
120
121
  sort = (sort || sort === '') ? sort : $route?.query?.sort;
121
122
 
@@ -133,6 +134,9 @@ export function generateProductsLink($route, data, skipParams = false) {
133
134
  if (productionTime) {
134
135
  params.push(`productionTime=${productionTime}`);
135
136
  }
137
+ if (clearancePercent) {
138
+ params.push(`clearancePercent=${clearancePercent}`);
139
+ }
136
140
 
137
141
  const { page = 1 } = data;
138
142
  if (page > 1) {
@@ -140,7 +144,7 @@ export function generateProductsLink($route, data, skipParams = false) {
140
144
  }
141
145
 
142
146
  Object.keys({ ...(($route && $route.query) || {}), ...data }).forEach(key => {
143
- const rootKeys = ['text', 'sort', 'page', 'category', 'type', 'brand', 'minimumQty', 'productionTime', 'srsltid'];
147
+ const rootKeys = ['text', 'sort', 'page', 'category', 'type', 'brand', 'minimumQty', 'productionTime', 'clearancePercent', 'srsltid'];
144
148
  if (!rootKeys.includes(key)) {
145
149
  let items = ($route && $route.query[key]) ? $route.query[key].split(',') : [];
146
150
  items = (data[key] ? (items.includes(data[key]) ? items.filter(c => c !== data[key]) : [...items, data[key]]) : items).join(',');
@@ -41,8 +41,8 @@
41
41
  flex-direction: column;
42
42
  align-items: flex-end;
43
43
  &--paid {
44
- background-image: url(../../../static/images/paid.svg);
45
- background-repeat: no-repeat;
44
+ background-image: url(../../../static/images/refunded.svg);
45
+ background-repeat: no-repeat;
46
46
  background-position: 0px 0px;
47
47
  background-size: contain;
48
48
  }
@@ -97,6 +97,11 @@
97
97
  <div class="lc_regular16">
98
98
  Total inc {{ taxName }}: <b>{{ refund.totalGST | price(order.currency) }}</b>
99
99
  </div>
100
+ <div
101
+ class="lc_regular16"
102
+ style="background-color: #000; color: #fff; padding: 4px 8px; display: inline-block;">
103
+ {{ isPaid ? 'REFUNDED' : 'Pending Refund' }}: <b>{{ refund.totalGST | price(order.currency) }}</b>
104
+ </div>
100
105
  </div>
101
106
  </div>
102
107
  </div>
@@ -97,6 +97,10 @@ export default {
97
97
  props: {
98
98
  value: {
99
99
  type: Object
100
+ },
101
+ defaultLocation: {
102
+ type: String,
103
+ default: 'London, Greater London'
100
104
  }
101
105
  },
102
106
  data() {
@@ -125,7 +129,7 @@ export default {
125
129
  if (locality && state) {
126
130
  return `${locality}, ${state}`;
127
131
  }
128
- return 'London, Greater London';
132
+ return this.defaultLocation;
129
133
  }
130
134
  },
131
135
  watch: {
@@ -56,6 +56,14 @@
56
56
  :toggleable="toggleable"
57
57
  :display-mode="colorDisplayMode" />
58
58
  </div>
59
+ <div
60
+ v-if="hasClearancePercent"
61
+ class="ProductsAside__item">
62
+ <products-clearance-percent
63
+ :has-selected-icon="hasSelectedIcon"
64
+ :selected-icon-circle="selectedIconCircle"
65
+ :toggleable="toggleable" />
66
+ </div>
59
67
  <div class="ProductsAside__item">
60
68
  <products-attributes
61
69
  :has-selected-icon="hasSelectedIcon"
@@ -84,6 +92,7 @@ import ProductsColorGroups from '@lancom/shared/components/products/products_col
84
92
  import ProductsProductionTime from '@lancom/shared/components/products/products_production_time/products-production-time';
85
93
  import ProductsMinimumQty from '@lancom/shared/components/products/products_minimum_qty/products-minimum-qty';
86
94
  import ProductsSelectedFilters from '@lancom/shared/components/products/products_selected_filters/products-selected-filters';
95
+ import ProductsClearancePercent from '@lancom/shared/components/products/products_clearance_percent/products-clearance-percent';
87
96
  import { generateProductsLink } from '@lancom/shared/assets/js/utils/product';
88
97
 
89
98
  export default {
@@ -97,7 +106,8 @@ export default {
97
106
  ProductsColorGroups,
98
107
  ProductsProductionTime,
99
108
  ProductsMinimumQty,
100
- ProductsSelectedFilters
109
+ ProductsSelectedFilters,
110
+ ProductsClearancePercent
101
111
  },
102
112
  props: {
103
113
  hasSelectedIcon: {
@@ -148,6 +158,10 @@ export default {
148
158
  hasSelectedFilters: {
149
159
  type: Boolean,
150
160
  default: false
161
+ },
162
+ hasClearancePercent: {
163
+ type: Boolean,
164
+ default: false
151
165
  }
152
166
  },
153
167
  data() {
@@ -0,0 +1,19 @@
1
+ @import "@/assets/scss/variables";
2
+
3
+ .ProductsClearancePercent {
4
+ &__item {
5
+ margin: 13px 0;
6
+ font-size: 15px;
7
+ font-weight: 400;
8
+ a {
9
+ color: $grey_1;
10
+ text-decoration: none;
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: space-between;
14
+ }
15
+ &--active a {
16
+ color: $green;
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div
3
+ v-if="clearancePercents.length"
4
+ class="ProductsClearancePercent__wrapper">
5
+ <toggle-content label="Clearance" :toggleable="toggleable">
6
+ <div
7
+ v-for="percent in clearancePercents"
8
+ :key="percent"
9
+ class="ProductsClearancePercent__item"
10
+ :class="{
11
+ 'ProductsClearancePercent__item--active': isSelected(percent)
12
+ }">
13
+ <products-link
14
+ class="ProductsClearancePercent__more"
15
+ :clearance-percent="isSelected(percent) ? null : percent">
16
+ <span>Up to {{ percent }}% off</span>
17
+ <checked-icon
18
+ v-if="hasSelectedIcon"
19
+ :checked="isSelected(percent)"
20
+ :circle="selectedIconCircle" />
21
+ </products-link>
22
+ </div>
23
+ </toggle-content>
24
+ </div>
25
+ </template>
26
+
27
+ <script>
28
+ import { mapGetters } from 'vuex';
29
+ import ToggleContent from '@lancom/shared/components/common/toggle-content';
30
+ import ProductsLink from '@lancom/shared/components/products/products_link/products-link';
31
+ import CheckedIcon from '@lancom/shared/components/common/checked-icon';
32
+
33
+ export default {
34
+ name: 'ProductsClearancePercent',
35
+ components: {
36
+ ToggleContent,
37
+ ProductsLink,
38
+ CheckedIcon
39
+ },
40
+ props: {
41
+ hasSelectedIcon: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ selectedIconCircle: {
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+ toggleable: {
50
+ type: Boolean,
51
+ default: true
52
+ }
53
+ },
54
+ computed: {
55
+ ...mapGetters('products', ['clearancePercents']),
56
+ selectedClearancePercent() {
57
+ return this.$route.query.clearancePercent ? +this.$route.query.clearancePercent : null;
58
+ }
59
+ },
60
+ methods: {
61
+ isSelected(percent) {
62
+ return this.selectedClearancePercent === percent;
63
+ }
64
+ }
65
+ };
66
+ </script>
67
+
68
+ <style lang="scss" scoped>
69
+ @import 'products-clearance-percent';
70
+ </style>
@@ -36,6 +36,9 @@ export default {
36
36
  minimumQty: {
37
37
  type: String
38
38
  },
39
+ clearancePercent: {
40
+ type: Number
41
+ },
39
42
  attributes: {
40
43
  type: Object
41
44
  },
@@ -57,6 +60,7 @@ export default {
57
60
  colorGroups: this.colorGroup,
58
61
  productionTime: this.productionTime,
59
62
  minimumQty: this.minimumQty,
63
+ clearancePercent: this.clearancePercent,
60
64
  option: this.option,
61
65
  text: this.text,
62
66
  sort: this.sort,
@@ -282,7 +282,12 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
282
282
  brandAdditionalProductsRichSnippet = JSON.parse(this.product.brand.additionalProductsRichSnippet);
283
283
  } catch (e) {}
284
284
 
285
- const description = (this.product.gsFeedDescription || this.product.description || '').replace(/<[^>]*>/g, '');
285
+ const rawDescription = (this.product.gsFeedDescription || this.product.description || '').replace(/<[^>]*>/g, '');
286
+ const interpolateDescription = (sp) => rawDescription
287
+ .replace(/\{color\}/g, sp?.color?.name || '')
288
+ .replace(/\{size\}/g, sp?.size?.shortName || '');
289
+ const firstSp = this.productDetails?.simpleProducts?.[0];
290
+ const description = interpolateDescription(firstSp);
286
291
  const productSchema = {
287
292
  '@context': 'https://schema.org',
288
293
  '@type': 'ProductGroup',
@@ -294,6 +299,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
294
299
  const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
295
300
  const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
296
301
  const name = `${this.product.name} | ${sp.size?.shortName || ''} ${sp.color?.name || ''}`;
302
+ const variantDescription = interpolateDescription(sp);
297
303
 
298
304
  const offer = {
299
305
  '@type': 'Offer',
@@ -341,7 +347,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
341
347
  ...galleryImages.map(i => i.extralarge || i.large).filter(i => !!i && i !== image)
342
348
  ],
343
349
  "name": name,
344
- "description": description,
350
+ "description": variantDescription,
345
351
  "color": sp.color?.name,
346
352
  "size": sp.size?.shortName,
347
353
  "offers": offer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.478",
3
+ "version": "0.0.479",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,14 @@
1
+ <svg width="220" height="78" viewBox="0 0 220 78" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect x="5.44" y="18.95" width="205" height="53.32" transform="rotate(-4.06 5.44 18.95)" stroke="#FB3D01" stroke-width="4.19"/>
3
+ <rect x="0.64" y="14.79" width="214" height="62.31" transform="rotate(-4.06 0.64 14.79)" stroke="#FB3D01" stroke-width="1.2"/>
4
+ <text
5
+ x="110"
6
+ y="52"
7
+ fill="#FB3D01"
8
+ font-family="Arial, Helvetica, sans-serif"
9
+ font-size="28"
10
+ font-weight="900"
11
+ letter-spacing="5"
12
+ text-anchor="middle"
13
+ transform="rotate(-4.06 110 39)">REFUNDED</text>
14
+ </svg>
package/store/products.js CHANGED
@@ -16,6 +16,7 @@ export const state = () => ({
16
16
  childrenCategories: [],
17
17
  tags: [],
18
18
  attributes: [],
19
+ clearancePercents: [],
19
20
  loadError: null,
20
21
  placeholder: false
21
22
  });
@@ -34,6 +35,7 @@ export const getters = {
34
35
  childrenCategories: ({ childrenCategories }) => childrenCategories,
35
36
  tags: ({ tags }) => tags || [],
36
37
  attributes: ({ attributes }) => attributes || [],
38
+ clearancePercents: ({ clearancePercents }) => clearancePercents || [],
37
39
  page: ({ page }) => page,
38
40
  count: ({ count }) => count,
39
41
  minPrice: ({ minPrice }) => minPrice,
@@ -57,7 +59,7 @@ export const actions = {
57
59
  commit('setLoadError', null);
58
60
  const {
59
61
  products, count, page, perPage, productTypes, colors, colorGroups, brands, tags, attributes,
60
- categories, minPrice, maxPrice, category
62
+ categories, minPrice, maxPrice, category, clearancePercents
61
63
  } = await api.fetchProducts(shop, params);
62
64
  commit('setCategory', category);
63
65
  commit('setProducts', products);
@@ -73,6 +75,7 @@ export const actions = {
73
75
  commit('setAttributes', attributes);
74
76
  commit('setMinPrice', minPrice);
75
77
  commit('setMaxPrice', maxPrice);
78
+ commit('setClearancePercents', clearancePercents || []);
76
79
 
77
80
  return { products };
78
81
  } catch (e) {
@@ -148,6 +151,9 @@ export const mutations = {
148
151
  setAttributes(state, attributes) {
149
152
  state.attributes = attributes;
150
153
  },
154
+ setClearancePercents(state, clearancePercents) {
155
+ state.clearancePercents = clearancePercents;
156
+ },
151
157
  clearProducts(state) {
152
158
  state.products = [];
153
159
  },