@lancom/shared 0.0.308 → 0.0.309

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.
@@ -10,57 +10,6 @@
10
10
  <img :src="product.brand.logo | staticLink" />
11
11
  </div>
12
12
  <div class="EditorProductDetails__header-info">
13
- <div class="EditorProductDetails__header-row">
14
- <span
15
- v-if="defaultSimpleProductPricing"
16
- class="lc_regular16 lc_grey1">
17
- From {{ currency.isoCode }}
18
- <v-popover
19
- ref="popover"
20
- trigger="hover"
21
- :delay="{ show: 200, hide: 400 }"
22
- popover-class="tooltip popover white"
23
- class="EditorProductDetails__discounts-table">
24
- <price
25
- class="lc_semibold22 lc_black EditorProductDetails__dashed-underline"
26
- :price="defaultSimpleProductPricing[0].price"
27
- :with-gst="inclGST" />
28
- <template slot="popover">
29
- <pricing-discounts-table
30
- :prices="defaultSimpleProductPricing"
31
- :with-gst="inclGST" />
32
- </template>
33
- </v-popover>
34
- </span>
35
- <span class="lc_regular16 lc_grey1 ml-6">
36
- +
37
- <v-popover
38
- ref="popover"
39
- trigger="hover"
40
- :delay="{ show: 200, hide: 400 }"
41
- popover-class="tooltip popover white no-paddings"
42
- class="EditorProductDetails__discounts-table">
43
- <span class="EditorProductDetails__dashed-underline">
44
- Printing
45
- </span>
46
- <template slot="popover">
47
- <pricing-table
48
- :items="printTypePrices"
49
- :bordered="true"
50
- :striped="false"
51
- :with-gst="inclGST"
52
- class="EditorProductDetails__prints-table" />
53
- </template>
54
- </v-popover>
55
- </span>
56
- <span class="ml-10">
57
- <checkbox
58
- v-model="inclGST"
59
- :dark="true">
60
- <div class="ml-5">Inc. {{ taxName }}</div>
61
- </checkbox>
62
- </span>
63
- </div>
64
13
  <div class="EditorProductDetails__header-row">
65
14
  <span class="EditorProductDetails__product-link">
66
15
  SKU:
@@ -81,6 +30,68 @@
81
30
  </div>
82
31
  </div>
83
32
  </div>
33
+ <div class="EditorProductDetails__header-row">
34
+ <span
35
+ v-if="defaultSimpleProductPricing"
36
+ class="lc_regular16 lc_grey1">
37
+ From {{ currency.isoCode }}
38
+ <price
39
+ v-if="printsPrice"
40
+ class="lc_black lc_semibold22"
41
+ :price="printsPrice + defaultSimpleProductPricing[0].price"
42
+ :with-gst="inclGST" />
43
+ <v-popover
44
+ ref="popover"
45
+ trigger="hover"
46
+ :delay="{ show: 200, hide: 400 }"
47
+ popover-class="tooltip popover white"
48
+ class="EditorProductDetails__discounts-table">
49
+ <price
50
+ class="lc_black EditorProductDetails__dashed-underline"
51
+ :class="[printsPrice ? 'lc_semibold16' : 'lc_semibold22']"
52
+ :price="defaultSimpleProductPricing[0].price"
53
+ :with-gst="inclGST" />
54
+ <template slot="popover">
55
+ <pricing-discounts-table
56
+ :prices="defaultSimpleProductPricing"
57
+ :with-gst="inclGST" />
58
+ </template>
59
+ </v-popover>
60
+ </span>
61
+ <span class="lc_regular16 lc_grey1 ml-6">
62
+ +
63
+ <v-popover
64
+ ref="popover"
65
+ trigger="hover"
66
+ :delay="{ show: 200, hide: 400 }"
67
+ popover-class="tooltip popover white no-paddings"
68
+ class="EditorProductDetails__discounts-table">
69
+ <span class="EditorProductDetails__dashed-underline">
70
+ Printing
71
+ </span>
72
+ <price
73
+ v-if="printsPrice"
74
+ class="lc_black lc_semibold16 EditorProductDetails__dashed-underline"
75
+ :price="printsPrice"
76
+ :with-gst="inclGST" />
77
+ <template slot="popover">
78
+ <pricing-table
79
+ :items="printTypePrices"
80
+ :bordered="true"
81
+ :striped="false"
82
+ :with-gst="inclGST"
83
+ class="EditorProductDetails__prints-table" />
84
+ </template>
85
+ </v-popover>
86
+ </span>
87
+ <span class="ml-10">
88
+ <checkbox
89
+ v-model="inclGST"
90
+ :dark="true">
91
+ <div class="ml-5">Inc. {{ taxName }}</div>
92
+ </checkbox>
93
+ </span>
94
+ </div>
84
95
  <!-- <div
85
96
  v-if="!productAvailableInCurrentCountry"
86
97
  class="EditorProductDetails__available-warning">
@@ -126,7 +137,7 @@ import ProductColorsSelector from '@lancom/shared/components/product/product_col
126
137
  import EditorPricing from '@lancom/shared/components/product/editor_pricing/editor-pricing';
127
138
  import PricingDiscountsTable from '@lancom/shared/components/common/pricing_discounts_table/pricing-discounts-table';
128
139
  import modals from '@lancom/shared/mixins/modals';
129
- import { staticLink, priceWithTax } from '@lancom/shared/assets/js/utils/filters';
140
+ import { staticLink, priceWithTax, price, tax } from '@lancom/shared/assets/js/utils/filters';
130
141
  import PricingTable from '@lancom/shared/components/common/pricing_table/pricing-table';
131
142
  import { generateProductLink } from '@lancom/shared/assets/js/utils/product';
132
143
  import Price from '@lancom/shared/components/common/price';
@@ -146,6 +157,7 @@ export default {
146
157
  RichText
147
158
  },
148
159
  filters: {
160
+ price,
149
161
  priceWithTax,
150
162
  staticLink
151
163
  },
@@ -165,12 +177,14 @@ export default {
165
177
  'productDetailsLoaded',
166
178
  'defaultSimpleProduct',
167
179
  'selectedPrintType',
168
- 'isPrintPricing'
180
+ 'isPrintPricing',
181
+ 'printsPrice'
169
182
  ]),
170
183
  ...mapGetters('layers', [
171
184
  'layerThumbnails'
172
185
  ]),
173
186
  ...mapGetters([
187
+ 'gstTax',
174
188
  'pricingSettings',
175
189
  'country'
176
190
  ]),
@@ -72,7 +72,10 @@ export default {
72
72
  return this.print.costType === 'setup only' ? 0 : (this.print.printCost || 0);
73
73
  },
74
74
  setupCost() {
75
- const isFreePricing = this.print.freeSetupOver >= 0 && this.amount > this.print.freeSetupOver;
75
+ let isFreePricing = this.print.freeSetupOver >= 0 && this.amount > this.print.freeSetupOver;
76
+ if ((this.print.products || []).indexOf(this.entity.guid) > 0) {
77
+ isFreePricing = true;
78
+ }
76
79
  return (this.print.costType === 'item cost only' || isFreePricing) ? 0 : (this.print.setupCost || 0);
77
80
  },
78
81
  total() {
@@ -128,7 +128,10 @@ export default {
128
128
  },
129
129
  totalPrice() {
130
130
  const printsTotal = (this.product.prints || []).reduce((total, print) => {
131
- const isFreePricing = print.freeSetupOver >= 0 && this.amount > print.freeSetupOver;
131
+ let isFreePricing = print.freeSetupOver >= 0 && this.amount > print.freeSetupOver;
132
+ if ((print.products || []).indexOf(this.product.guid) > 0) {
133
+ isFreePricing = true;
134
+ }
132
135
  const printCost = print.costType === 'setup only' ? 0 : print.printCost;
133
136
  const setupCost = (print.costType === 'item cost only' || isFreePricing) ? 0 : print.setupCost;
134
137
  return total + this.amount * printCost + setupCost;
@@ -18,23 +18,45 @@
18
18
  <div class="lc_regular14 hidden-md-and-up">
19
19
  {{ product.size.shortName }}
20
20
  </div>
21
- <v-popover
22
- trigger="hover"
23
- :delay="{ show: 200, hide: 400 }"
24
- popover-class="tooltip popover white"
25
- class="ProductSizeSelectorColor__price">
26
- <span>
27
- {{ productPrice | price(currency) }}
28
- </span>
29
- <template slot="popover">
30
- <div>
31
- <pricing-discounts-table
32
- :with-gst="withGst"
33
- :prices="pricing"
34
- :amount="usedSimpleProductsQuantity" />
35
- </div>
36
- </template>
37
- </v-popover>
21
+ <div>
22
+ <div v-if="printsPrice > 0">
23
+ <price
24
+ class="lc_semibold17 ProductSizeSelectorColor__price"
25
+ :price="printsPrice + productPrice"
26
+ :with-gst="withGst" />
27
+ </div>
28
+ <div>
29
+ <v-popover
30
+ trigger="hover"
31
+ :delay="{ show: 200, hide: 400 }"
32
+ popover-class="tooltip popover white"
33
+ class="ProductSizeSelectorColor__price"
34
+ :style="{
35
+ display: productPrice ? 'inline-block' : 'block'
36
+ }">
37
+ <span :class="[printsPrice ? 'lc_regular13' : 'lc_semibold17']">
38
+ {{ productPrice | price(currency) }}
39
+ </span>
40
+ <template slot="popover">
41
+ <div>
42
+ <pricing-discounts-table
43
+ :with-gst="withGst"
44
+ :prices="pricing"
45
+ :amount="usedSimpleProductsQuantity" />
46
+ </div>
47
+ </template>
48
+ </v-popover>
49
+ <span
50
+ v-if="printsPrice > 0"
51
+ class="lc_regular13">
52
+ +
53
+ <price
54
+ :price="printsPrice"
55
+ :with-gst="withGst" />
56
+ </span>
57
+ </div>
58
+
59
+ </div>
38
60
  <div class="hidden-md-and-up">
39
61
  <div
40
62
  v-if="product.quantityStock"
@@ -77,6 +99,7 @@ import PricingDiscountsTable from '@lancom/shared/components/common/pricing_disc
77
99
  import { price } from '@lancom/shared/assets/js/utils/filters';
78
100
  import ProductSizeSelectorColorCell from '@lancom/shared/components/product/product_size_selector/product_size_selector_color/product_size_selector_color_cell/product-size-selector-color-cell';
79
101
  import { tax } from '@lancom/shared/assets/js/utils/filters';
102
+ import Price from '@lancom/shared/components/common/price';
80
103
 
81
104
  export default {
82
105
  name: 'ProductSizeSelectorColor',
@@ -84,6 +107,7 @@ export default {
84
107
  price
85
108
  },
86
109
  components: {
110
+ Price,
87
111
  PricingDiscountsTable,
88
112
  ProductSizeSelectorColorCell
89
113
  },
@@ -102,7 +126,7 @@ export default {
102
126
  }
103
127
  },
104
128
  computed: {
105
- ...mapGetters('product', ['isPrintPricing', 'usedSimpleProductsQuantity']),
129
+ ...mapGetters('product', ['isPrintPricing', 'usedSimpleProductsQuantity', 'printsPrice']),
106
130
  ...mapGetters(['gstTax', 'currency']),
107
131
  currentQuantityStockLabel() {
108
132
  return this.currentQuantityStock > 100 ? '100+' : this.currentQuantityStock;
@@ -82,14 +82,14 @@
82
82
  </a>
83
83
  </div>
84
84
  <div
85
- v-if="product.minPrice === product.maxPrice"
85
+ v-if="minPrice === maxPrice"
86
86
  class="ProductListProduct__info-item lc_h4">
87
- {{ product.minPrice | price(currency) }}
87
+ {{ minPrice | price(currency) }}
88
88
  </div>
89
89
  <div
90
90
  v-else
91
91
  class="ProductListProduct__info-item lc_h4">
92
- {{ product.minPrice | price(currency) }} - {{ product.maxPrice | price(currency) }}
92
+ {{ minPrice | price(currency) }} - {{ maxPrice | price(currency) }}
93
93
  </div>
94
94
  <div class="ProductListProduct__info-item mt-2 lc_caption">
95
95
  {{ product.colors.length }} {{ product.colors.length === 1 ? 'Colour' : 'Colours' }} | Size: {{ product.sizes | sizesRange }}
@@ -194,6 +194,14 @@
194
194
  numberOfItems: this.count,
195
195
  itemListOrder: 'ItemListUnordered',
196
196
  itemListElement: this.products.map(product => {
197
+ const minPrintsPrice = product.minPrintsPrice || 0;
198
+ const minProductPrice = product.isClearance ? product.minPriceWithoutClearance : product.minPrice;
199
+ const minPrice = minProductPrice + minPrintsPrice;
200
+
201
+ const maxPrintsPrice = product.maxPrintsPrice || 0;
202
+ const maxProductPrice = product.isClearance ? product.maxPriceWithoutClearance : product.maxPrice;
203
+ const maxPrice = maxProductPrice + maxPrintsPrice;
204
+
197
205
  const schema = {
198
206
  '@type': 'Product',
199
207
  name: product.name,
@@ -203,8 +211,8 @@
203
211
  '@type': 'AggregateOffer',
204
212
  offerCount: 1,
205
213
  name: product.name,
206
- highPrice: product.minPrice,
207
- lowPrice: product.maxPrice,
214
+ highPrice: maxPrice,
215
+ lowPrice: minPrice,
208
216
  priceCurrency: this.currency?.isoCode || 'AUD',
209
217
  availability: 'InStock'
210
218
  }
@@ -82,10 +82,14 @@ const productPreview = {
82
82
  return this.product?.tags.length > 0;
83
83
  },
84
84
  minPrice() {
85
- return this.product.isClearance ? this.product.minPriceWithoutClearance : this.product.minPrice;
85
+ const printsPrice = this.product.minPrintsPrice || 0;
86
+ const productPrice = this.product.isClearance ? this.product.minPriceWithoutClearance : this.product.minPrice;
87
+ return productPrice + printsPrice;
86
88
  },
87
89
  maxPrice() {
88
- return this.product.isClearance ? this.product.maxPriceWithoutClearance : this.product.maxPrice;
90
+ const printsPrice = this.product.maxPrintsPrice || 0;
91
+ const productPrice = this.product.isClearance ? this.product.maxPriceWithoutClearance : this.product.maxPrice;
92
+ return productPrice + printsPrice;
89
93
  }
90
94
  },
91
95
  mounted() {
@@ -65,7 +65,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
65
65
  },
66
66
  computed: {
67
67
  ...mapGetters(['shop', 'gstTax', 'country', 'currency']),
68
- ...mapGetters('product', ['product', 'simpleProducts', 'productDetails', 'editableColor', 'images', 'preSetPrints', 'preSetPrintsPriceRange', 'editorSize']),
68
+ ...mapGetters('product', ['product', 'simpleProducts', 'productDetails', 'editableColor', 'images', 'preSetPrints', 'editorSize', 'printsPrice']),
69
69
  pageItemImage() {
70
70
  return this.mainProductImageSrc;
71
71
  },
@@ -209,7 +209,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING) => ({
209
209
  name,
210
210
  offers: this.productDetails?.simpleProducts.map(sp => {
211
211
  const spMaxPrice = (sp.pricing || []).reduce((price, pricing) => Math.max(price, pricing.price), 0);
212
- const maxPrice = this.preSetPrints ? spMaxPrice + this.preSetPrintsPriceRange.max : spMaxPrice;
212
+ const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
213
213
  const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
214
214
 
215
215
  const offer = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.308",
3
+ "version": "0.0.309",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/product.js CHANGED
@@ -53,16 +53,6 @@ export const getters = {
53
53
  calculatingPrice: ({ calculatingPrice }) => calculatingPrice,
54
54
  product: ({ product }) => product,
55
55
  preSetPrints: ({ preSetPrints }) => preSetPrints,
56
- preSetPrintsPriceRange: ({ preSetPrints, product }) => {
57
- const [preSetPrint] = preSetPrints || [];
58
- const printType = product.printTypes.find(pt => pt._id === preSetPrint?.printType);
59
- const { printCost = [] } = (printType?.printAreas || [])
60
- .find(({ printSizes }) => (printSizes || []).some(ps => ps?._id === preSetPrint?.printSize)) || {};
61
- return {
62
- min: Math.min(...printCost.map(({ price }) => price)),
63
- max: Math.max(...printCost.map(({ price }) => price))
64
- };
65
- },
66
56
  loadError: ({ loadError }) => loadError,
67
57
  productDetails: ({ productDetails }) => productDetails,
68
58
  productDetailsLoaded: ({ productDetails }) => !!productDetails,
@@ -150,7 +140,13 @@ export const getters = {
150
140
  },
151
141
  editableSide: ({ editableSide }) => editableSide,
152
142
  priceIncludeGST: ({ priceIncludeGST }) => priceIncludeGST,
153
- hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice
143
+ hasUnprintedPrice: ({ product }) => product.minUnprintedPrice || product.maxUnprintedPrice,
144
+ printsPrice: ({ productPricing, product }) => {
145
+ const maxPrintsPrice = +product.maxPrintsPrice || 0;
146
+ const pricing = (productPricing?.products || {})[product._id];
147
+ const price = pricing?.prints?.prints?.reduce((sum , print) => sum + (+print.priceWithoutTax || 0), 0) || maxPrintsPrice;
148
+ return price;
149
+ },
154
150
  };
155
151
 
156
152
  export const actions = {
@@ -160,7 +156,12 @@ export const actions = {
160
156
  const query = { country, currency };
161
157
  const product = await api.fetchProduct(shop, slug, query);
162
158
  commit('setProduct', product);
163
- commit('setPreSetPrints', (product.prints || []).filter(({ _id, printTemplate }) => _id === print || (!print && !!printTemplate)));
159
+
160
+ const prints = (product.prints || []).filter(({ _id, printTemplate }) => _id === print || (!print && !!printTemplate));
161
+ commit('setPreSetPrints', prints);
162
+ if (prints?.length > 0) {
163
+ commit('setIsPrintPricing', true);
164
+ }
164
165
  } catch (e) {
165
166
  console.log(e);
166
167
  const { status, data } = e?.response || {};