@lancom/shared 0.0.299 → 0.0.301
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/assets/js/utils/gtm.js +16 -30
- package/components/checkout/cart/cart.vue +2 -2
- package/components/checkout/order/order-billing-information/order-billing-information.vue +5 -1
- package/components/checkout/order/order-payment-information/order-payment-information.vue +1 -1
- package/components/editor/editor_product_details/editor-product-details.scss +22 -0
- package/components/editor/editor_product_details/editor-product-details.vue +37 -7
- package/components/modals/payment_modal/payment-modal.vue +1 -1
- package/components/quotes/quote_view/quote-view.mixin.js +1 -1
- package/layouts/products.vue +2 -2
- package/mixins/payment.js +1 -1
- package/mixins/product-view.js +1 -1
- package/package.json +1 -1
- package/store/cart.js +3 -3
package/assets/js/utils/gtm.js
CHANGED
|
@@ -11,11 +11,11 @@ const gtm = {
|
|
|
11
11
|
}
|
|
12
12
|
window.dataLayer.push(data);
|
|
13
13
|
},
|
|
14
|
-
viewItem(product) {
|
|
14
|
+
viewItem(product, currency) {
|
|
15
15
|
this.push({
|
|
16
16
|
event: 'view_item',
|
|
17
17
|
value: product.minPrice,
|
|
18
|
-
currency: 'AUD',
|
|
18
|
+
currency: currency?.isoCode || 'AUD',
|
|
19
19
|
items: [{
|
|
20
20
|
id: product.SKU,
|
|
21
21
|
item_name: product.name,
|
|
@@ -23,11 +23,11 @@ const gtm = {
|
|
|
23
23
|
}]
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
|
-
addToCart(entities, pricing) {
|
|
26
|
+
addToCart(entities, pricing, currency) {
|
|
27
27
|
this.push({
|
|
28
28
|
event: 'add_to_cart',
|
|
29
29
|
value: pricing.totalPriceWithoutTax,
|
|
30
|
-
currency: 'AUD',
|
|
30
|
+
currency: currency?.isoCode || 'AUD',
|
|
31
31
|
items: entities.reduce((products, { product, simpleProducts }) => {
|
|
32
32
|
return [
|
|
33
33
|
...products,
|
|
@@ -41,10 +41,10 @@ const gtm = {
|
|
|
41
41
|
}, [])
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
|
-
viewItemList(products) {
|
|
44
|
+
viewItemList(products, currency) {
|
|
45
45
|
this.push({
|
|
46
46
|
event: 'view_item_list',
|
|
47
|
-
currency: 'AUD',
|
|
47
|
+
currency: currency?.isoCode || 'AUD',
|
|
48
48
|
items: (products || []).map(product => {
|
|
49
49
|
return {
|
|
50
50
|
id: product.SKU,
|
|
@@ -55,32 +55,18 @@ const gtm = {
|
|
|
55
55
|
})
|
|
56
56
|
});
|
|
57
57
|
},
|
|
58
|
-
viewItemList(products) {
|
|
59
|
-
this.push({
|
|
60
|
-
event: 'view_item_list',
|
|
61
|
-
currency: 'AUD',
|
|
62
|
-
items: products.map(product => {
|
|
63
|
-
return {
|
|
64
|
-
id: product.SKU,
|
|
65
|
-
item_name: product.name,
|
|
66
|
-
google_business_vertical: 'retail',
|
|
67
|
-
price: product.minPrice
|
|
68
|
-
};
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
},
|
|
72
58
|
viewSearchResult(search_term) {
|
|
73
59
|
this.push({
|
|
74
60
|
event: 'view_search_results',
|
|
75
61
|
search_term
|
|
76
62
|
});
|
|
77
63
|
},
|
|
78
|
-
viewCart(entities, pricing) {
|
|
64
|
+
viewCart(entities, pricing, currency) {
|
|
79
65
|
if (pricing) {
|
|
80
66
|
this.push({
|
|
81
67
|
event: 'view_item_list',
|
|
82
68
|
value: pricing.totalPriceWithoutTax,
|
|
83
|
-
currency: 'AUD',
|
|
69
|
+
currency: currency?.isoCode || 'AUD',
|
|
84
70
|
coupon: pricing.coupon?.code,
|
|
85
71
|
items: entities.reduce((products, { guid: productGuid, product, simpleProducts }) => {
|
|
86
72
|
return [
|
|
@@ -111,12 +97,12 @@ const gtm = {
|
|
|
111
97
|
// }))
|
|
112
98
|
// });
|
|
113
99
|
},
|
|
114
|
-
purchase(order) {
|
|
100
|
+
purchase(order, currency) {
|
|
115
101
|
const event = {
|
|
116
102
|
event: 'purchase',
|
|
117
103
|
transaction_id: order.code,
|
|
118
104
|
value: order.total,
|
|
119
|
-
currency: 'AUD',
|
|
105
|
+
currency: currency?.isoCode || 'AUD',
|
|
120
106
|
coupon: order.couponCode,
|
|
121
107
|
shipping: order.shippingTotal,
|
|
122
108
|
tax: +(order.totalGST - order.total).toFixed(2),
|
|
@@ -141,7 +127,7 @@ const gtm = {
|
|
|
141
127
|
}
|
|
142
128
|
gtm.push(event);
|
|
143
129
|
},
|
|
144
|
-
shippingInfo(order) {
|
|
130
|
+
shippingInfo(order, currency) {
|
|
145
131
|
const shipping = (order.suppliersWithRates || []).reduce((suppliersRates, supplierRates) => {
|
|
146
132
|
const rate = supplierRates.rates.find(({ selected }) => !!selected);
|
|
147
133
|
return rate ? [...suppliersRates, `${supplierRates.name}. ${rate.name}`] : suppliersRates;
|
|
@@ -150,18 +136,18 @@ const gtm = {
|
|
|
150
136
|
event: 'add_shipping_info',
|
|
151
137
|
value: order.shippingTotal,
|
|
152
138
|
coupon: order.couponCode,
|
|
153
|
-
currency: 'AUD',
|
|
139
|
+
currency: currency?.isoCode || 'AUD',
|
|
154
140
|
shipping_tier: shipping,
|
|
155
141
|
items: getOrderItems(order)
|
|
156
142
|
};
|
|
157
143
|
gtm.push(event);
|
|
158
144
|
},
|
|
159
|
-
paymentInfo(order) {
|
|
145
|
+
paymentInfo(order, currency) {
|
|
160
146
|
const event = {
|
|
161
147
|
event: 'add_payment_info',
|
|
162
148
|
value: order.total,
|
|
163
149
|
coupon: order.couponCode,
|
|
164
|
-
currency: 'AUD',
|
|
150
|
+
currency: currency?.isoCode || 'AUD',
|
|
165
151
|
payment_type: order.paymentMethod,
|
|
166
152
|
items: getOrderItems(order)
|
|
167
153
|
};
|
|
@@ -180,7 +166,7 @@ function getOrderItems(order) {
|
|
|
180
166
|
}, [])
|
|
181
167
|
}
|
|
182
168
|
|
|
183
|
-
function getOrderItem(product, simpleProduct) {
|
|
169
|
+
function getOrderItem(product, simpleProduct, currency) {
|
|
184
170
|
const { SKU, productCost, amount, color, size } = simpleProduct;
|
|
185
171
|
return {
|
|
186
172
|
id: product.SKU,
|
|
@@ -189,7 +175,7 @@ function getOrderItem(product, simpleProduct) {
|
|
|
189
175
|
item_name: product.name.trim(),
|
|
190
176
|
item_brand: product.brand.name,
|
|
191
177
|
price: productCost,
|
|
192
|
-
currency: 'AUD',
|
|
178
|
+
currency: currency?.isoCode || 'AUD',
|
|
193
179
|
quantity: amount,
|
|
194
180
|
google_business_vertical: 'retail'
|
|
195
181
|
};
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
filters: { price },
|
|
93
93
|
mixins: [CartMixin],
|
|
94
94
|
computed: {
|
|
95
|
-
...mapGetters(['MESSAGES', 'SETTINGS']),
|
|
95
|
+
...mapGetters(['MESSAGES', 'SETTINGS', 'currency']),
|
|
96
96
|
...mapGetters('cart', ['isEmpty', 'cartPricingError', 'cartPricing', 'cartPricingCalculating', 'entities']),
|
|
97
97
|
onlyPostcode() {
|
|
98
98
|
return !!this.SETTINGS.CART_ONLY_POSTCODE;
|
|
@@ -118,7 +118,7 @@ export default {
|
|
|
118
118
|
},
|
|
119
119
|
methods: {
|
|
120
120
|
loadedPricing() {
|
|
121
|
-
gtm.viewCart(this.entities, this.cartPricing);
|
|
121
|
+
gtm.viewCart(this.entities, this.cartPricing, this.currency);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
};
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<script>
|
|
28
|
+
import { mapGetters } from 'vuex';
|
|
28
29
|
import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
29
30
|
import { generateOrderData } from '@lancom/shared/assets/js/utils/order';
|
|
30
31
|
import CartQuantityErrors from '@lancom/shared/components/checkout/cart/cart_quantity_errors/cart-quantity-errors';
|
|
@@ -52,6 +53,9 @@ export default {
|
|
|
52
53
|
isSubmit: false
|
|
53
54
|
};
|
|
54
55
|
},
|
|
56
|
+
computed: {
|
|
57
|
+
...mapGetters(['currency'])
|
|
58
|
+
},
|
|
55
59
|
methods: {
|
|
56
60
|
async submit() {
|
|
57
61
|
this.isSubmit = true;
|
|
@@ -62,7 +66,7 @@ export default {
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
const orderInfo = generateOrderData(this.order, this.entities, this.cartPricing);
|
|
65
|
-
gtm.shippingInfo(orderInfo);
|
|
69
|
+
gtm.shippingInfo(orderInfo, this.currency);
|
|
66
70
|
|
|
67
71
|
if (this.copyToShippingAddress) {
|
|
68
72
|
this.order.shippingAddress = { ...this.order.shippingAddress };
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
this.errorMessage = null;
|
|
143
143
|
|
|
144
144
|
const orderInfo = this.orderData || generateOrderData(this.order, this.entities, this.cartPricing);
|
|
145
|
-
gtm.paymentInfo(orderInfo);
|
|
145
|
+
gtm.paymentInfo(orderInfo, this.currency);
|
|
146
146
|
|
|
147
147
|
if (this.isDepositPayment) {
|
|
148
148
|
this.setCard(null);
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
&__wrapper {
|
|
5
5
|
padding-top: 36px;
|
|
6
6
|
}
|
|
7
|
+
&__description {
|
|
8
|
+
margin-top: 15px;
|
|
9
|
+
color: rgb(118, 118, 118);
|
|
10
|
+
}
|
|
7
11
|
&__header {
|
|
8
12
|
display: flex;
|
|
9
13
|
align-items: center;
|
|
@@ -72,6 +76,8 @@
|
|
|
72
76
|
width: 100%;
|
|
73
77
|
text-align: center;
|
|
74
78
|
margin: 15px 0;
|
|
79
|
+
height: 300px;
|
|
80
|
+
position: relative;
|
|
75
81
|
display: none;
|
|
76
82
|
@media (max-width: $bp-extra-small-max) {
|
|
77
83
|
display: block;
|
|
@@ -81,4 +87,20 @@
|
|
|
81
87
|
max-width: 330px;
|
|
82
88
|
}
|
|
83
89
|
}
|
|
90
|
+
&__product-sides-toggle {
|
|
91
|
+
width: 45px;
|
|
92
|
+
height: 45px;
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 50%;
|
|
95
|
+
right: 25px;
|
|
96
|
+
border-radius: 50%;
|
|
97
|
+
display: flex;
|
|
98
|
+
align-items: center;
|
|
99
|
+
justify-content: center;
|
|
100
|
+
background-color: $grey_4;
|
|
101
|
+
font-size: 21px;
|
|
102
|
+
color: $black;
|
|
103
|
+
padding: 10px;
|
|
104
|
+
cursor: pointer;
|
|
105
|
+
}
|
|
84
106
|
}
|
|
@@ -80,9 +80,23 @@
|
|
|
80
80
|
Product Not Available in {{ country.name }}
|
|
81
81
|
</div>
|
|
82
82
|
<div
|
|
83
|
-
v-if="
|
|
84
|
-
class="
|
|
85
|
-
<
|
|
83
|
+
v-if="product.description"
|
|
84
|
+
class="EditorProductDetails__description">
|
|
85
|
+
<rich-text
|
|
86
|
+
:text="product.description"
|
|
87
|
+
class="EditorProductDetails__description-text" />
|
|
88
|
+
</div>
|
|
89
|
+
<div class="EditorProductDetails__product-image">
|
|
90
|
+
<product-side-with-print
|
|
91
|
+
:key="side"
|
|
92
|
+
:product="previewPrintProduct"
|
|
93
|
+
:side="side"
|
|
94
|
+
size="large" />
|
|
95
|
+
<div
|
|
96
|
+
class="EditorProductDetails__product-sides-toggle"
|
|
97
|
+
@click="toggleSide">
|
|
98
|
+
<i class="icon-rotate-tee"></i>
|
|
99
|
+
</div>
|
|
86
100
|
</div>
|
|
87
101
|
<div
|
|
88
102
|
v-if="productDetailsLoaded && productAvailableInCurrentCountry">
|
|
@@ -108,6 +122,8 @@ import { staticLink, priceWithTax } from '@lancom/shared/assets/js/utils/filters
|
|
|
108
122
|
import PricingTable from '@lancom/shared/components/common/pricing_table/pricing-table';
|
|
109
123
|
import { generateProductLink } from '@lancom/shared/assets/js/utils/product';
|
|
110
124
|
import Price from '@lancom/shared/components/common/price';
|
|
125
|
+
import ProductSideWithPrint from '@lancom/shared/components/common/product_side_with_print/product-side-with-print';
|
|
126
|
+
import RichText from '@lancom/shared/components/common/rich-text';
|
|
111
127
|
|
|
112
128
|
export default {
|
|
113
129
|
name: 'EditorProductDetails',
|
|
@@ -116,13 +132,20 @@ export default {
|
|
|
116
132
|
PricingDiscountsTable,
|
|
117
133
|
EditorPricing,
|
|
118
134
|
PricingTable,
|
|
119
|
-
Price
|
|
135
|
+
Price,
|
|
136
|
+
ProductSideWithPrint,
|
|
137
|
+
RichText
|
|
120
138
|
},
|
|
121
139
|
filters: {
|
|
122
140
|
priceWithTax,
|
|
123
141
|
staticLink
|
|
124
142
|
},
|
|
125
143
|
mixins: [modals],
|
|
144
|
+
data() {
|
|
145
|
+
return {
|
|
146
|
+
side: 'front'
|
|
147
|
+
}
|
|
148
|
+
},
|
|
126
149
|
computed: {
|
|
127
150
|
...mapGetters(['taxName']),
|
|
128
151
|
...mapGetters('product', [
|
|
@@ -142,6 +165,13 @@ export default {
|
|
|
142
165
|
'pricingSettings',
|
|
143
166
|
'country'
|
|
144
167
|
]),
|
|
168
|
+
previewPrintProduct() {
|
|
169
|
+
return {
|
|
170
|
+
...this.product,
|
|
171
|
+
color: this.editableColor,
|
|
172
|
+
printsThumbnails: this.layerThumbnails
|
|
173
|
+
};
|
|
174
|
+
},
|
|
145
175
|
inclGST: {
|
|
146
176
|
get() {
|
|
147
177
|
return this.priceIncludeGST;
|
|
@@ -173,13 +203,13 @@ export default {
|
|
|
173
203
|
},
|
|
174
204
|
mainProductImage() {
|
|
175
205
|
return this.images.find(i => i.color === this.editableColor?._id) || this.images[0];
|
|
176
|
-
},
|
|
177
|
-
mainProductImageSrc() {
|
|
178
|
-
return this.mainProductImage && this.mainProductImage.large;
|
|
179
206
|
}
|
|
180
207
|
},
|
|
181
208
|
methods: {
|
|
182
209
|
...mapMutations('product', ['setPriceIncludeGST']),
|
|
210
|
+
toggleSide() {
|
|
211
|
+
this.side = this.side === 'front' ? 'back' : 'front';
|
|
212
|
+
}
|
|
183
213
|
}
|
|
184
214
|
};
|
|
185
215
|
</script>
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
this.processing = true;
|
|
39
39
|
this.order = await this.createOrder({ ...option });
|
|
40
40
|
this.setOrder(this.order);
|
|
41
|
-
gtm.purchase(this.order);
|
|
41
|
+
gtm.purchase(this.order, this.currency);
|
|
42
42
|
gapis.surveyOptin(this.order, this.shop);
|
|
43
43
|
this.clear();
|
|
44
44
|
} catch (e) {
|
package/layouts/products.vue
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
name: product.name,
|
|
206
206
|
highPrice: product.minPrice,
|
|
207
207
|
lowPrice: product.maxPrice,
|
|
208
|
-
priceCurrency: 'AUD',
|
|
208
|
+
priceCurrency: this.currency?.isoCode || 'AUD',
|
|
209
209
|
availability: 'InStock'
|
|
210
210
|
}
|
|
211
211
|
};
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
if (this.$route.query.text) {
|
|
263
263
|
gtm.viewSearchResult(this.$route.query.text);
|
|
264
264
|
}
|
|
265
|
-
gtm.viewItemList(this.products);
|
|
265
|
+
gtm.viewItemList(this.products, this.currency);
|
|
266
266
|
}
|
|
267
267
|
},
|
|
268
268
|
loadProductsWithDebounce: debounce(function () {
|
package/mixins/payment.js
CHANGED
package/mixins/product-view.js
CHANGED
package/package.json
CHANGED
package/store/cart.js
CHANGED
|
@@ -122,7 +122,7 @@ export const actions = {
|
|
|
122
122
|
commit('setEntities', cart.entities);
|
|
123
123
|
}
|
|
124
124
|
if (pricing) {
|
|
125
|
-
gtm.addToCart(addingEntities, pricing);
|
|
125
|
+
gtm.addToCart(addingEntities, pricing, currency);
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
async removeSimpleProductsFromCart({ commit, state }, { simpleProducts, shop, currency }) {
|
|
@@ -139,7 +139,7 @@ export const actions = {
|
|
|
139
139
|
await api.saveCart(payload, shop._id);
|
|
140
140
|
commit('setEntities', entities);
|
|
141
141
|
if (state.cartPricing) {
|
|
142
|
-
gtm.removeFromCart(simpleProducts, state.cartPricing);
|
|
142
|
+
gtm.removeFromCart(simpleProducts, state.cartPricing, currency);
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
async removeSupplier({ commit, state }, { supplier, shop, currency }) {
|
|
@@ -147,7 +147,7 @@ export const actions = {
|
|
|
147
147
|
const entities = state.entities.filter(entity => !brands.includes(entity.product.brand._id));
|
|
148
148
|
if (state.cartPricing) {
|
|
149
149
|
const simpleProducts = entities.reduce((items, entity) => [...items, ...entity.simpleProducts], []);
|
|
150
|
-
gtm.removeFromCart(simpleProducts, state.cartPricing);
|
|
150
|
+
gtm.removeFromCart(simpleProducts, state.cartPricing, currency);
|
|
151
151
|
}
|
|
152
152
|
const payload = { _id: state.id, entities, currency: currency?._id};
|
|
153
153
|
await api.saveCart(payload, shop._id);
|