@lancom/shared 0.0.411 → 0.0.413
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.
- package/components/product/product_banners/product-banners.scss +10 -0
- package/components/product/product_banners/product-banners.vue +34 -0
- package/components/product/wizard/wizard.scss +4 -1
- package/components/product/wizard/wizard.vue +6 -1
- package/feeds/google-shopping.js +4 -0
- package/package.json +1 -1
- package/store/product.js +12 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ProductBanners__wrapper">
|
|
3
|
+
<a :href="mainBanner.link" class="ProductBanners__banner">
|
|
4
|
+
<img :src="mainBanner.image.origin" :alt="mainBanner.label" />
|
|
5
|
+
</a>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import { mapGetters } from 'vuex';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'ProductBanners',
|
|
14
|
+
props: {
|
|
15
|
+
product: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
...mapGetters(['shop']),
|
|
22
|
+
...mapGetters('product', ['banners']),
|
|
23
|
+
mainBanner() {
|
|
24
|
+
const bannersItems = this.banners.reduce((items, banner) => ([...items, ...banner.items]), []);
|
|
25
|
+
const productBanner = bannersItems.find(item => item.products?.includes(this.product._id));
|
|
26
|
+
return productBanner || bannersItems[0];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" scoped>
|
|
33
|
+
@import 'product-banners';
|
|
34
|
+
</style>
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
{{ isVisible ? 'CANCEL PRINT' : 'ADD PRINT' }}
|
|
29
29
|
</div>
|
|
30
30
|
</div>
|
|
31
|
+
<div class="Wizard__banners">
|
|
32
|
+
<product-banners :product="product" />
|
|
33
|
+
</div>
|
|
31
34
|
<div
|
|
32
35
|
v-if="isVisible"
|
|
33
36
|
class="Wizard__content"
|
|
@@ -119,6 +122,7 @@ import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
|
119
122
|
import Info from '@lancom/shared/components/common/info-popover';
|
|
120
123
|
import { getPrintAreaSizes } from '@lancom/shared/assets/js/utils/prints';
|
|
121
124
|
import ProgressSteps from '@lancom/shared/components/common/progress_steps/progress-steps';
|
|
125
|
+
import ProductBanners from '@lancom/shared/components/product/product_banners/product-banners';
|
|
122
126
|
import WizardPrintArea from './wizard_print_area/wizard-print-area';
|
|
123
127
|
import WizardPrintSize from './wizard_print_size/wizard-print-size';
|
|
124
128
|
import WizardPrintType from './wizard_print_type/wizard-print-type';
|
|
@@ -143,6 +147,7 @@ export default {
|
|
|
143
147
|
name: 'Editor',
|
|
144
148
|
components: {
|
|
145
149
|
ProgressSteps,
|
|
150
|
+
ProductBanners,
|
|
146
151
|
WizardPrintArea,
|
|
147
152
|
WizardPrintSize,
|
|
148
153
|
WizardPrintType,
|
|
@@ -232,7 +237,7 @@ export default {
|
|
|
232
237
|
},
|
|
233
238
|
editLayer(layer) {
|
|
234
239
|
this.clearWizardData();
|
|
235
|
-
|
|
240
|
+
|
|
236
241
|
this.setEditableLayers([layer]);
|
|
237
242
|
const printArea = this.productPrintAreas.find(pa => pa._id === layer.printArea);
|
|
238
243
|
this.addEditablePrintArea(printArea);
|
package/feeds/google-shopping.js
CHANGED
|
@@ -102,6 +102,10 @@ async function googleShoppingFeed(axios, config, availableStores, country, isEdi
|
|
|
102
102
|
info['g:gtin'] = { _text: sp.gtin || '' };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
if (sp.clearancePrice > 0) {
|
|
106
|
+
info['g:sale_price'] = { _text: `${(sp.clearancePrice)} ${sp.currencyCode || 'AUD'}` };
|
|
107
|
+
}
|
|
108
|
+
|
|
105
109
|
if (sp.storeCode) {
|
|
106
110
|
info['g:store_code'] = { _text: sp.storeCode };
|
|
107
111
|
info['g:link_template'] = { _text: `${link}&store={store_code}` };
|
package/package.json
CHANGED
package/store/product.js
CHANGED
|
@@ -11,6 +11,7 @@ import { sortByName } from '../assets/js/utils/filters';
|
|
|
11
11
|
|
|
12
12
|
export const state = () => ({
|
|
13
13
|
multipack: null,
|
|
14
|
+
banners: [],
|
|
14
15
|
calculatingPrice: false,
|
|
15
16
|
loadingProductDetails: false,
|
|
16
17
|
productDetailsKey: Date.now(),
|
|
@@ -64,6 +65,7 @@ export const getters = {
|
|
|
64
65
|
editorSize: ({ editorSize }) => editorSize,
|
|
65
66
|
template: ({ template }) => template,
|
|
66
67
|
layers: ({ template }) => template.layers || [],
|
|
68
|
+
banners: ({ banners }) => banners || [],
|
|
67
69
|
templateColors: ({ template }) => template.colors || [],
|
|
68
70
|
hasLayers: ({ template }) => (template.layers || []).length > 0,
|
|
69
71
|
visibleSteps: ({ template }) => template.visibleSteps,
|
|
@@ -166,6 +168,13 @@ export const actions = {
|
|
|
166
168
|
const product = await api.fetchProduct(shop, slug, query);
|
|
167
169
|
commit('setProduct', product);
|
|
168
170
|
|
|
171
|
+
const bannersParams = {
|
|
172
|
+
type: 'product view main',
|
|
173
|
+
product: product._id
|
|
174
|
+
};
|
|
175
|
+
const banners = await api.fetchBanners(shop, bannersParams) || [];
|
|
176
|
+
commit('setBanners', banners);
|
|
177
|
+
|
|
169
178
|
const prints = (product.prints || []).filter(({ _id, printTemplate }) => _id === print || (!print && !!printTemplate));
|
|
170
179
|
commit('setPreSetPrints', prints);
|
|
171
180
|
if (prints?.length > 0) {
|
|
@@ -300,6 +309,9 @@ export const mutations = {
|
|
|
300
309
|
setProduct(state, product) {
|
|
301
310
|
state.product = product;
|
|
302
311
|
},
|
|
312
|
+
setBanners(state, banners) {
|
|
313
|
+
state.banners = banners;
|
|
314
|
+
},
|
|
303
315
|
setPriceIncludeGST(state, priceIncludeGST) {
|
|
304
316
|
state.priceIncludeGST = priceIncludeGST;
|
|
305
317
|
},
|